Skip to content

Commit fe79f91

Browse files
Laurent Pincharthorms
authored andcommitted
sh: ecovec24: Use gpio-backlight
Replace the backlight callback with a gpio-backlight platform device. Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Simon Horman <[email protected]>
1 parent 14bd03e commit fe79f91

File tree

1 file changed

+20
-17
lines changed
  • arch/sh/boards/mach-ecovec24

1 file changed

+20
-17
lines changed

arch/sh/boards/mach-ecovec24/setup.c

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <linux/spi/mmc_spi.h>
3131
#include <linux/input.h>
3232
#include <linux/input/sh_keysc.h>
33+
#include <linux/platform_data/gpio_backlight.h>
3334
#include <linux/sh_eth.h>
3435
#include <linux/sh_intc.h>
3536
#include <linux/videodev2.h>
@@ -303,7 +304,7 @@ static struct platform_device usbhs_device = {
303304
.resource = usbhs_resources,
304305
};
305306

306-
/* LCDC */
307+
/* LCDC and backlight */
307308
static const struct fb_videomode ecovec_lcd_modes[] = {
308309
{
309310
.name = "Panel",
@@ -334,13 +335,6 @@ static const struct fb_videomode ecovec_dvi_modes[] = {
334335
},
335336
};
336337

337-
static int ecovec24_set_brightness(int brightness)
338-
{
339-
gpio_set_value(GPIO_PTR1, brightness);
340-
341-
return 0;
342-
}
343-
344338
static struct sh_mobile_lcdc_info lcdc_info = {
345339
.ch[0] = {
346340
.interface_type = RGB18,
@@ -350,11 +344,6 @@ static struct sh_mobile_lcdc_info lcdc_info = {
350344
.width = 152,
351345
.height = 91,
352346
},
353-
.bl_info = {
354-
.name = "sh_mobile_lcdc_bl",
355-
.max_brightness = 1,
356-
.set_brightness = ecovec24_set_brightness,
357-
},
358347
}
359348
};
360349

@@ -380,6 +369,20 @@ static struct platform_device lcdc_device = {
380369
},
381370
};
382371

372+
static struct gpio_backlight_platform_data gpio_backlight_data = {
373+
.fbdev = &lcdc_device.dev,
374+
.gpio = GPIO_PTR1,
375+
.def_value = 1,
376+
.name = "backlight",
377+
};
378+
379+
static struct platform_device gpio_backlight_device = {
380+
.name = "gpio-backlight",
381+
.dev = {
382+
.platform_data = &gpio_backlight_data,
383+
},
384+
};
385+
383386
/* CEU0 */
384387
static struct sh_mobile_ceu_info sh_mobile_ceu0_info = {
385388
.flags = SH_CEU_FLAG_USE_8BIT_BUS,
@@ -1049,6 +1052,7 @@ static struct platform_device *ecovec_devices[] __initdata = {
10491052
&usb1_common_device,
10501053
&usbhs_device,
10511054
&lcdc_device,
1055+
&gpio_backlight_device,
10521056
&ceu0_device,
10531057
&ceu1_device,
10541058
&keysc_device,
@@ -1239,11 +1243,9 @@ static int __init arch_setup(void)
12391243

12401244
gpio_request(GPIO_PTE6, NULL);
12411245
gpio_request(GPIO_PTU1, NULL);
1242-
gpio_request(GPIO_PTR1, NULL);
12431246
gpio_request(GPIO_PTA2, NULL);
12441247
gpio_direction_input(GPIO_PTE6);
12451248
gpio_direction_output(GPIO_PTU1, 0);
1246-
gpio_direction_output(GPIO_PTR1, 0);
12471249
gpio_direction_output(GPIO_PTA2, 0);
12481250

12491251
/* I/O buffer drive ability is high */
@@ -1256,6 +1258,9 @@ static int __init arch_setup(void)
12561258
lcdc_info.ch[0].lcd_modes = ecovec_dvi_modes;
12571259
lcdc_info.ch[0].num_modes = ARRAY_SIZE(ecovec_dvi_modes);
12581260

1261+
/* No backlight */
1262+
gpio_backlight_data.fbdev = NULL;
1263+
12591264
gpio_set_value(GPIO_PTA2, 1);
12601265
gpio_set_value(GPIO_PTU1, 1);
12611266
} else {
@@ -1265,8 +1270,6 @@ static int __init arch_setup(void)
12651270
lcdc_info.ch[0].lcd_modes = ecovec_lcd_modes;
12661271
lcdc_info.ch[0].num_modes = ARRAY_SIZE(ecovec_lcd_modes);
12671272

1268-
gpio_set_value(GPIO_PTR1, 1);
1269-
12701273
/* FIXME
12711274
*
12721275
* LCDDON control is needed for Panel,

0 commit comments

Comments
 (0)