Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sh: kfr2r09: Use lv5207lp backlight

Replace the backlight callback with a lv5207lp backlight platform
device.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>

authored by

Laurent Pinchart and committed by
Simon Horman
3f3bee2e fe79f919

+14 -55
-48
arch/sh/boards/mach-kfr2r09/lcd_wqvga.c
··· 276 276 { 277 277 write_memory_start(sohandle, so); 278 278 } 279 - 280 - #define CTRL_CKSW 0x10 281 - #define CTRL_C10 0x20 282 - #define CTRL_CPSW 0x80 283 - #define MAIN_MLED4 0x40 284 - #define MAIN_MSW 0x80 285 - 286 - int kfr2r09_lcd_set_brightness(int brightness) 287 - { 288 - struct i2c_adapter *a; 289 - struct i2c_msg msg; 290 - unsigned char buf[2]; 291 - int ret; 292 - 293 - a = i2c_get_adapter(0); 294 - if (!a) 295 - return -ENODEV; 296 - 297 - buf[0] = 0x00; 298 - if (brightness) 299 - buf[1] = CTRL_CPSW | CTRL_C10 | CTRL_CKSW; 300 - else 301 - buf[1] = 0; 302 - 303 - msg.addr = 0x75; 304 - msg.buf = buf; 305 - msg.len = 2; 306 - msg.flags = 0; 307 - ret = i2c_transfer(a, &msg, 1); 308 - if (ret != 1) 309 - return -ENODEV; 310 - 311 - buf[0] = 0x01; 312 - if (brightness) 313 - buf[1] = MAIN_MSW | MAIN_MLED4 | 0x0c; 314 - else 315 - buf[1] = 0; 316 - 317 - msg.addr = 0x75; 318 - msg.buf = buf; 319 - msg.len = 2; 320 - msg.flags = 0; 321 - ret = i2c_transfer(a, &msg, 1); 322 - if (ret != 1) 323 - return -ENODEV; 324 - 325 - return 0; 326 - }
+14 -5
arch/sh/boards/mach-kfr2r09/setup.c
··· 21 21 #include <linux/input.h> 22 22 #include <linux/input/sh_keysc.h> 23 23 #include <linux/i2c.h> 24 + #include <linux/platform_data/lv5207lp.h> 24 25 #include <linux/regulator/fixed.h> 25 26 #include <linux/regulator/machine.h> 26 27 #include <linux/usb/r8a66597.h> ··· 160 159 .setup_sys = kfr2r09_lcd_setup, 161 160 .start_transfer = kfr2r09_lcd_start, 162 161 }, 163 - .bl_info = { 164 - .name = "sh_mobile_lcdc_bl", 165 - .max_brightness = 1, 166 - .set_brightness = kfr2r09_lcd_set_brightness, 167 - }, 168 162 .sys_bus_cfg = { 169 163 .ldmt2r = 0x07010904, 170 164 .ldmt3r = 0x14012914, ··· 189 193 .dev = { 190 194 .platform_data = &kfr2r09_sh_lcdc_info, 191 195 }, 196 + }; 197 + 198 + static struct lv5207lp_platform_data kfr2r09_backlight_data = { 199 + .fbdev = &kfr2r09_sh_lcdc_device.dev, 200 + .def_value = 13, 201 + .max_value = 13, 202 + }; 203 + 204 + static struct i2c_board_info kfr2r09_backlight_board_info = { 205 + I2C_BOARD_INFO("lv5207lp", 0x75), 206 + .platform_data = &kfr2r09_backlight_data, 192 207 }; 193 208 194 209 static struct r8a66597_platdata kfr2r09_usb0_gadget_data = { ··· 633 626 gpio_request(GPIO_FN_SDHI0D0, NULL); 634 627 gpio_request(GPIO_FN_SDHI0CMD, NULL); 635 628 gpio_request(GPIO_FN_SDHI0CLK, NULL); 629 + 630 + i2c_register_board_info(0, &kfr2r09_backlight_board_info, 1); 636 631 637 632 return platform_add_devices(kfr2r09_devices, 638 633 ARRAY_SIZE(kfr2r09_devices));
-2
arch/sh/include/mach-kfr2r09/mach/kfr2r09.h
··· 4 4 #include <video/sh_mobile_lcdc.h> 5 5 6 6 #if defined(CONFIG_FB_SH_MOBILE_LCDC) || defined(CONFIG_FB_SH_MOBILE_LCDC_MODULE) 7 - int kfr2r09_lcd_set_brightness(int brightness); 8 7 int kfr2r09_lcd_setup(void *sys_ops_handle, 9 8 struct sh_mobile_lcdc_sys_bus_ops *sys_ops); 10 9 void kfr2r09_lcd_start(void *sys_ops_handle, 11 10 struct sh_mobile_lcdc_sys_bus_ops *sys_ops); 12 11 #else 13 - static int kfr2r09_lcd_set_brightness(int brightness) {} 14 12 static int kfr2r09_lcd_setup(void *sys_ops_handle, 15 13 struct sh_mobile_lcdc_sys_bus_ops *sys_ops) 16 14 {