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

sh: kfr2r09: Use the backlight API for brightness control

Don't hook up brightness control in the display on/off operations, use
the backlight API instead.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Paul Mundt <lethal@linux-sh.org>

+10 -19
+3 -13
arch/sh/boards/mach-kfr2r09/lcd_wqvga.c
··· 283 283 #define MAIN_MLED4 0x40 284 284 #define MAIN_MSW 0x80 285 285 286 - static int kfr2r09_lcd_backlight(int on) 286 + int kfr2r09_lcd_set_brightness(int brightness) 287 287 { 288 288 struct i2c_adapter *a; 289 289 struct i2c_msg msg; ··· 295 295 return -ENODEV; 296 296 297 297 buf[0] = 0x00; 298 - if (on) 298 + if (brightness) 299 299 buf[1] = CTRL_CPSW | CTRL_C10 | CTRL_CKSW; 300 300 else 301 301 buf[1] = 0; ··· 309 309 return -ENODEV; 310 310 311 311 buf[0] = 0x01; 312 - if (on) 312 + if (brightness) 313 313 buf[1] = MAIN_MSW | MAIN_MLED4 | 0x0c; 314 314 else 315 315 buf[1] = 0; ··· 323 323 return -ENODEV; 324 324 325 325 return 0; 326 - } 327 - 328 - void kfr2r09_lcd_on(void) 329 - { 330 - kfr2r09_lcd_backlight(1); 331 - } 332 - 333 - void kfr2r09_lcd_off(void) 334 - { 335 - kfr2r09_lcd_backlight(0); 336 326 }
+5 -2
arch/sh/boards/mach-kfr2r09/setup.c
··· 158 158 .height = 58, 159 159 .setup_sys = kfr2r09_lcd_setup, 160 160 .start_transfer = kfr2r09_lcd_start, 161 - .display_on = kfr2r09_lcd_on, 162 - .display_off = kfr2r09_lcd_off, 161 + }, 162 + .bl_info = { 163 + .name = "sh_mobile_lcdc_bl", 164 + .max_brightness = 1, 165 + .set_brightness = kfr2r09_lcd_set_brightness, 163 166 }, 164 167 .sys_bus_cfg = { 165 168 .ldmt2r = 0x07010904,
+2 -4
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 - void kfr2r09_lcd_on(void); 8 - void kfr2r09_lcd_off(void); 7 + int kfr2r09_lcd_set_brightness(int brightness); 9 8 int kfr2r09_lcd_setup(void *sys_ops_handle, 10 9 struct sh_mobile_lcdc_sys_bus_ops *sys_ops); 11 10 void kfr2r09_lcd_start(void *sys_ops_handle, 12 11 struct sh_mobile_lcdc_sys_bus_ops *sys_ops); 13 12 #else 14 - static void kfr2r09_lcd_on(void) {} 15 - static void kfr2r09_lcd_off(void) {} 13 + static int kfr2r09_lcd_set_brightness(int brightness) {} 16 14 static int kfr2r09_lcd_setup(void *sys_ops_handle, 17 15 struct sh_mobile_lcdc_sys_bus_ops *sys_ops) 18 16 {