From fe79f919f47eabf6eae08414dcc078b0d89dfd8e Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 4 Jul 2013 21:13:28 +0200 Subject: sh: ecovec24: Use gpio-backlight Replace the backlight callback with a gpio-backlight platform device. Signed-off-by: Laurent Pinchart Signed-off-by: Simon Horman --- arch/sh/boards/mach-ecovec24/setup.c | 37 +++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'arch/sh/boards') diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c index 61fade0f..bcbb86b 100644 --- a/arch/sh/boards/mach-ecovec24/setup.c +++ b/arch/sh/boards/mach-ecovec24/setup.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -303,7 +304,7 @@ static struct platform_device usbhs_device = { .resource = usbhs_resources, }; -/* LCDC */ +/* LCDC and backlight */ static const struct fb_videomode ecovec_lcd_modes[] = { { .name = "Panel", @@ -334,13 +335,6 @@ static const struct fb_videomode ecovec_dvi_modes[] = { }, }; -static int ecovec24_set_brightness(int brightness) -{ - gpio_set_value(GPIO_PTR1, brightness); - - return 0; -} - static struct sh_mobile_lcdc_info lcdc_info = { .ch[0] = { .interface_type = RGB18, @@ -350,11 +344,6 @@ static struct sh_mobile_lcdc_info lcdc_info = { .width = 152, .height = 91, }, - .bl_info = { - .name = "sh_mobile_lcdc_bl", - .max_brightness = 1, - .set_brightness = ecovec24_set_brightness, - }, } }; @@ -380,6 +369,20 @@ static struct platform_device lcdc_device = { }, }; +static struct gpio_backlight_platform_data gpio_backlight_data = { + .fbdev = &lcdc_device.dev, + .gpio = GPIO_PTR1, + .def_value = 1, + .name = "backlight", +}; + +static struct platform_device gpio_backlight_device = { + .name = "gpio-backlight", + .dev = { + .platform_data = &gpio_backlight_data, + }, +}; + /* CEU0 */ static struct sh_mobile_ceu_info sh_mobile_ceu0_info = { .flags = SH_CEU_FLAG_USE_8BIT_BUS, @@ -1049,6 +1052,7 @@ static struct platform_device *ecovec_devices[] __initdata = { &usb1_common_device, &usbhs_device, &lcdc_device, + &gpio_backlight_device, &ceu0_device, &ceu1_device, &keysc_device, @@ -1239,11 +1243,9 @@ static int __init arch_setup(void) gpio_request(GPIO_PTE6, NULL); gpio_request(GPIO_PTU1, NULL); - gpio_request(GPIO_PTR1, NULL); gpio_request(GPIO_PTA2, NULL); gpio_direction_input(GPIO_PTE6); gpio_direction_output(GPIO_PTU1, 0); - gpio_direction_output(GPIO_PTR1, 0); gpio_direction_output(GPIO_PTA2, 0); /* I/O buffer drive ability is high */ @@ -1256,6 +1258,9 @@ static int __init arch_setup(void) lcdc_info.ch[0].lcd_modes = ecovec_dvi_modes; lcdc_info.ch[0].num_modes = ARRAY_SIZE(ecovec_dvi_modes); + /* No backlight */ + gpio_backlight_data.fbdev = NULL; + gpio_set_value(GPIO_PTA2, 1); gpio_set_value(GPIO_PTU1, 1); } else { @@ -1265,8 +1270,6 @@ static int __init arch_setup(void) lcdc_info.ch[0].lcd_modes = ecovec_lcd_modes; lcdc_info.ch[0].num_modes = ARRAY_SIZE(ecovec_lcd_modes); - gpio_set_value(GPIO_PTR1, 1); - /* FIXME * * LCDDON control is needed for Panel, -- cgit v1.1 From 3f3bee2e31f6fbf8ac09b58b8e87374d24387cef Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 4 Jul 2013 21:13:29 +0200 Subject: sh: kfr2r09: Use lv5207lp backlight Replace the backlight callback with a lv5207lp backlight platform device. Signed-off-by: Laurent Pinchart Signed-off-by: Simon Horman --- arch/sh/boards/mach-kfr2r09/lcd_wqvga.c | 48 --------------------------------- arch/sh/boards/mach-kfr2r09/setup.c | 19 +++++++++---- 2 files changed, 14 insertions(+), 53 deletions(-) (limited to 'arch/sh/boards') diff --git a/arch/sh/boards/mach-kfr2r09/lcd_wqvga.c b/arch/sh/boards/mach-kfr2r09/lcd_wqvga.c index c620503..355a78a 100644 --- a/arch/sh/boards/mach-kfr2r09/lcd_wqvga.c +++ b/arch/sh/boards/mach-kfr2r09/lcd_wqvga.c @@ -276,51 +276,3 @@ void kfr2r09_lcd_start(void *sohandle, struct sh_mobile_lcdc_sys_bus_ops *so) { write_memory_start(sohandle, so); } - -#define CTRL_CKSW 0x10 -#define CTRL_C10 0x20 -#define CTRL_CPSW 0x80 -#define MAIN_MLED4 0x40 -#define MAIN_MSW 0x80 - -int kfr2r09_lcd_set_brightness(int brightness) -{ - struct i2c_adapter *a; - struct i2c_msg msg; - unsigned char buf[2]; - int ret; - - a = i2c_get_adapter(0); - if (!a) - return -ENODEV; - - buf[0] = 0x00; - if (brightness) - buf[1] = CTRL_CPSW | CTRL_C10 | CTRL_CKSW; - else - buf[1] = 0; - - msg.addr = 0x75; - msg.buf = buf; - msg.len = 2; - msg.flags = 0; - ret = i2c_transfer(a, &msg, 1); - if (ret != 1) - return -ENODEV; - - buf[0] = 0x01; - if (brightness) - buf[1] = MAIN_MSW | MAIN_MLED4 | 0x0c; - else - buf[1] = 0; - - msg.addr = 0x75; - msg.buf = buf; - msg.len = 2; - msg.flags = 0; - ret = i2c_transfer(a, &msg, 1); - if (ret != 1) - return -ENODEV; - - return 0; -} diff --git a/arch/sh/boards/mach-kfr2r09/setup.c b/arch/sh/boards/mach-kfr2r09/setup.c index ab502f12..1df4398 100644 --- a/arch/sh/boards/mach-kfr2r09/setup.c +++ b/arch/sh/boards/mach-kfr2r09/setup.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -159,11 +160,6 @@ static struct sh_mobile_lcdc_info kfr2r09_sh_lcdc_info = { .setup_sys = kfr2r09_lcd_setup, .start_transfer = kfr2r09_lcd_start, }, - .bl_info = { - .name = "sh_mobile_lcdc_bl", - .max_brightness = 1, - .set_brightness = kfr2r09_lcd_set_brightness, - }, .sys_bus_cfg = { .ldmt2r = 0x07010904, .ldmt3r = 0x14012914, @@ -195,6 +191,17 @@ static struct platform_device kfr2r09_sh_lcdc_device = { }, }; +static struct lv5207lp_platform_data kfr2r09_backlight_data = { + .fbdev = &kfr2r09_sh_lcdc_device.dev, + .def_value = 13, + .max_value = 13, +}; + +static struct i2c_board_info kfr2r09_backlight_board_info = { + I2C_BOARD_INFO("lv5207lp", 0x75), + .platform_data = &kfr2r09_backlight_data, +}; + static struct r8a66597_platdata kfr2r09_usb0_gadget_data = { .on_chip = 1, }; @@ -627,6 +634,8 @@ static int __init kfr2r09_devices_setup(void) gpio_request(GPIO_FN_SDHI0CMD, NULL); gpio_request(GPIO_FN_SDHI0CLK, NULL); + i2c_register_board_info(0, &kfr2r09_backlight_board_info, 1); + return platform_add_devices(kfr2r09_devices, ARRAY_SIZE(kfr2r09_devices)); } -- cgit v1.1