Date:2012-01-31 14:21:01 (8 years 7 months ago)
Author:Paul Cercueil
Commit:c0b8b4de40abac36cea0dd2b376f2713f49b859e
Message:MIPS: JZ4740: code re-ordering.

The init/exit functions of each SLCD panel has been moved, so
that in the future they can call enable/disable or other static
functions more easily.
Files: drivers/video/jz4740_slcd_panels.c (4 diffs)

Change Details

drivers/video/jz4740_slcd_panels.c
9191#define ILI9325_GPIO_CS_N JZ_GPIO_PORTB(17) /* Chip select */
9292#define ILI9325_GPIO_RESET_N JZ_GPIO_PORTB(18) /* LCD reset */
9393
94static int ili9325_init(struct jzfb *jzfb)
95{
96    struct device *dev = &jzfb->pdev->dev;
97    int ret;
98
99    ret = gpio_request(ILI9325_GPIO_CS_N, dev_name(dev));
100    if (ret)
101        goto err_cs;
102    gpio_direction_output(ILI9325_GPIO_CS_N, 1);
103
104    ret = gpio_request(ILI9325_GPIO_RESET_N, dev_name(dev));
105    if (ret)
106        goto err_reset;
107    gpio_direction_output(ILI9325_GPIO_RESET_N, 0);
108
109    mdelay(100);
110    return 0;
111
112err_reset:
113    gpio_free(ILI9325_GPIO_CS_N);
114err_cs:
115    dev_err(dev, "Could not reserve GPIO pins for ILI9325 panel driver\n");
116    return ret;
117}
118
119static void ili9325_exit(struct jzfb *jzfb)
120{
121    gpio_free(ILI9325_GPIO_CS_N);
122    gpio_free(ILI9325_GPIO_RESET_N);
123}
124
12594static void ili9325_enable(struct jzfb *jzfb)
12695{
12796    /* RESET pulse */
...... 
203172    gpio_set_value(ILI9325_GPIO_RESET_N, 0);
204173}
205174
206#endif
207
208#ifdef CONFIG_JZ_SLCD_ILI9331
209
210#define ILI9331_GPIO_CS_N JZ_GPIO_PORTB(17) /* Chip select */
211#define ILI9331_GPIO_RESET_N JZ_GPIO_PORTB(18) /* LCD reset */
212
213static int ili9331_init(struct jzfb *jzfb)
175static int ili9325_init(struct jzfb *jzfb)
214176{
215177    struct device *dev = &jzfb->pdev->dev;
216178    int ret;
217179
218    ret = gpio_request(ILI9331_GPIO_CS_N, dev_name(dev));
180    ret = gpio_request(ILI9325_GPIO_CS_N, dev_name(dev));
219181    if (ret)
220182        goto err_cs;
221    gpio_direction_output(ILI9331_GPIO_CS_N, 1);
183    gpio_direction_output(ILI9325_GPIO_CS_N, 1);
222184
223    ret = gpio_request(ILI9331_GPIO_RESET_N, dev_name(dev));
185    ret = gpio_request(ILI9325_GPIO_RESET_N, dev_name(dev));
224186    if (ret)
225187        goto err_reset;
226    gpio_direction_output(ILI9331_GPIO_RESET_N, 0);
188    gpio_direction_output(ILI9325_GPIO_RESET_N, 0);
227189
228190    mdelay(100);
229191    return 0;
230192
231193err_reset:
232    gpio_free(ILI9331_GPIO_CS_N);
194    gpio_free(ILI9325_GPIO_CS_N);
233195err_cs:
234    dev_err(dev, "Could not reserve GPIO pins for ILI9331 panel driver\n");
196    dev_err(dev, "Could not reserve GPIO pins for ILI9325 panel driver\n");
235197    return ret;
236198}
237199
238static void ili9331_exit(struct jzfb *jzfb)
200static void ili9325_exit(struct jzfb *jzfb)
239201{
240    gpio_free(ILI9331_GPIO_CS_N);
241    gpio_free(ILI9331_GPIO_RESET_N);
202    gpio_free(ILI9325_GPIO_CS_N);
203    gpio_free(ILI9325_GPIO_RESET_N);
242204}
243205
206#endif
207
208#ifdef CONFIG_JZ_SLCD_ILI9331
209
210#define ILI9331_GPIO_CS_N JZ_GPIO_PORTB(17) /* Chip select */
211#define ILI9331_GPIO_RESET_N JZ_GPIO_PORTB(18) /* LCD reset */
212
244213static void ili9331_enable(struct jzfb *jzfb)
245214{
246215    /* RESET pulse */
...... 
319288    gpio_set_value(ILI9331_GPIO_RESET_N, 0);
320289}
321290
322#endif
323
324#ifdef CONFIG_JZ_SLCD_ILI9338
325
326#define ILI9338_GPIO_CS_N JZ_GPIO_PORTB(17) /* Chip select */
327#define ILI9338_GPIO_RESET_N JZ_GPIO_PORTB(18) /* LCD reset */
328
329static int ili9338_init(struct jzfb *jzfb)
291static int ili9331_init(struct jzfb *jzfb)
330292{
331293    struct device *dev = &jzfb->pdev->dev;
332294    int ret;
333295
334    ret = gpio_request(ILI9338_GPIO_CS_N, dev_name(dev));
296    ret = gpio_request(ILI9331_GPIO_CS_N, dev_name(dev));
335297    if (ret)
336298        goto err_cs;
337    gpio_direction_output(ILI9338_GPIO_CS_N, 1);
299    gpio_direction_output(ILI9331_GPIO_CS_N, 1);
338300
339    ret = gpio_request(ILI9338_GPIO_RESET_N, dev_name(dev));
301    ret = gpio_request(ILI9331_GPIO_RESET_N, dev_name(dev));
340302    if (ret)
341303        goto err_reset;
342    gpio_direction_output(ILI9338_GPIO_RESET_N, 0);
304    gpio_direction_output(ILI9331_GPIO_RESET_N, 0);
343305
344306    mdelay(100);
345307    return 0;
346308
347309err_reset:
348    gpio_free(ILI9338_GPIO_CS_N);
310    gpio_free(ILI9331_GPIO_CS_N);
349311err_cs:
350    dev_err(dev, "Could not reserve GPIO pins for ILI9338 panel driver\n");
312    dev_err(dev, "Could not reserve GPIO pins for ILI9331 panel driver\n");
351313    return ret;
352314}
353315
354static void ili9338_exit(struct jzfb *jzfb)
316static void ili9331_exit(struct jzfb *jzfb)
355317{
356    gpio_free(ILI9338_GPIO_CS_N);
357    gpio_free(ILI9338_GPIO_RESET_N);
318    gpio_free(ILI9331_GPIO_CS_N);
319    gpio_free(ILI9331_GPIO_RESET_N);
358320}
359321
322#endif
323
324#ifdef CONFIG_JZ_SLCD_ILI9338
325
326#define ILI9338_GPIO_CS_N JZ_GPIO_PORTB(17) /* Chip select */
327#define ILI9338_GPIO_RESET_N JZ_GPIO_PORTB(18) /* LCD reset */
328
360329static void ili9338_enable(struct jzfb *jzfb)
361330{
362331    /* RESET pulse */
...... 
450419    /* Keep RESET active */
451420    gpio_set_value(ILI9338_GPIO_RESET_N, 0);
452421}
422
423static int ili9338_init(struct jzfb *jzfb)
424{
425    struct device *dev = &jzfb->pdev->dev;
426    int ret;
427
428    ret = gpio_request(ILI9338_GPIO_CS_N, dev_name(dev));
429    if (ret)
430        goto err_cs;
431    gpio_direction_output(ILI9338_GPIO_CS_N, 1);
432
433    ret = gpio_request(ILI9338_GPIO_RESET_N, dev_name(dev));
434    if (ret)
435        goto err_reset;
436    gpio_direction_output(ILI9338_GPIO_RESET_N, 0);
437
438    mdelay(100);
439    return 0;
440
441err_reset:
442    gpio_free(ILI9338_GPIO_CS_N);
443err_cs:
444    dev_err(dev, "Could not reserve GPIO pins for ILI9338 panel driver\n");
445    return ret;
446}
447
448static void ili9338_exit(struct jzfb *jzfb)
449{
450    gpio_free(ILI9338_GPIO_CS_N);
451    gpio_free(ILI9338_GPIO_RESET_N);
452}
453
453454#endif
454455
455456static const struct jz_slcd_panel jz_slcd_panels[] = {

Archive Download the corresponding diff file



interactive