diff options
author | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2012-08-15 12:25:27 -0400 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2012-11-21 09:50:02 -0500 |
commit | 37f4dd13505bab9f2bbd2f66a2c9375e959452eb (patch) | |
tree | d592960f843688ea1095c36fc9556a53a68c6e13 | |
parent | f70f4711df527b914486bf5381ec9a4911915c7d (diff) |
ARM: mach-shmobile: ag5evm: 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: Simon Horman <horms@verge.net.au>
-rw-r--r-- | arch/arm/mach-shmobile/board-ag5evm.c | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c index d787979a5310..032d10817e79 100644 --- a/arch/arm/mach-shmobile/board-ag5evm.c +++ b/arch/arm/mach-shmobile/board-ag5evm.c | |||
@@ -295,28 +295,38 @@ static unsigned char lcd_backlight_seq[3][2] = { | |||
295 | { 0x03, 0x01 }, | 295 | { 0x03, 0x01 }, |
296 | }; | 296 | }; |
297 | 297 | ||
298 | static void lcd_backlight_on(void) | 298 | static int lcd_backlight_set_brightness(int brightness) |
299 | { | 299 | { |
300 | struct i2c_adapter *a; | 300 | struct i2c_adapter *adap; |
301 | struct i2c_msg msg; | 301 | struct i2c_msg msg; |
302 | int k; | 302 | unsigned int i; |
303 | int ret; | ||
304 | |||
305 | if (brightness == 0) { | ||
306 | /* Reset the chip */ | ||
307 | gpio_set_value(GPIO_PORT235, 0); | ||
308 | mdelay(24); | ||
309 | gpio_set_value(GPIO_PORT235, 1); | ||
310 | return 0; | ||
311 | } | ||
312 | |||
313 | adap = i2c_get_adapter(1); | ||
314 | if (adap == NULL) | ||
315 | return -ENODEV; | ||
303 | 316 | ||
304 | a = i2c_get_adapter(1); | 317 | for (i = 0; i < ARRAY_SIZE(lcd_backlight_seq); i++) { |
305 | for (k = 0; a && k < 3; k++) { | ||
306 | msg.addr = 0x6d; | 318 | msg.addr = 0x6d; |
307 | msg.buf = &lcd_backlight_seq[k][0]; | 319 | msg.buf = &lcd_backlight_seq[i][0]; |
308 | msg.len = 2; | 320 | msg.len = 2; |
309 | msg.flags = 0; | 321 | msg.flags = 0; |
310 | if (i2c_transfer(a, &msg, 1) != 1) | 322 | |
323 | ret = i2c_transfer(adap, &msg, 1); | ||
324 | if (ret < 0) | ||
311 | break; | 325 | break; |
312 | } | 326 | } |
313 | } | ||
314 | 327 | ||
315 | static void lcd_backlight_reset(void) | 328 | i2c_put_adapter(adap); |
316 | { | 329 | return ret < 0 ? ret : 0; |
317 | gpio_set_value(GPIO_PORT235, 0); | ||
318 | mdelay(24); | ||
319 | gpio_set_value(GPIO_PORT235, 1); | ||
320 | } | 330 | } |
321 | 331 | ||
322 | /* LCDC0 */ | 332 | /* LCDC0 */ |
@@ -348,8 +358,11 @@ static struct sh_mobile_lcdc_info lcdc0_info = { | |||
348 | .panel_cfg = { | 358 | .panel_cfg = { |
349 | .width = 44, | 359 | .width = 44, |
350 | .height = 79, | 360 | .height = 79, |
351 | .display_on = lcd_backlight_on, | 361 | }, |
352 | .display_off = lcd_backlight_reset, | 362 | .bl_info = { |
363 | .name = "sh_mobile_lcdc_bl", | ||
364 | .max_brightness = 1, | ||
365 | .set_brightness = lcd_backlight_set_brightness, | ||
353 | }, | 366 | }, |
354 | .tx_dev = &mipidsi0_device, | 367 | .tx_dev = &mipidsi0_device, |
355 | } | 368 | } |
@@ -622,7 +635,7 @@ static void __init ag5evm_init(void) | |||
622 | /* LCD backlight controller */ | 635 | /* LCD backlight controller */ |
623 | gpio_request(GPIO_PORT235, NULL); /* RESET */ | 636 | gpio_request(GPIO_PORT235, NULL); /* RESET */ |
624 | gpio_direction_output(GPIO_PORT235, 0); | 637 | gpio_direction_output(GPIO_PORT235, 0); |
625 | lcd_backlight_reset(); | 638 | lcd_backlight_set_brightness(0); |
626 | 639 | ||
627 | /* enable SDHI0 on CN15 [SD I/F] */ | 640 | /* enable SDHI0 on CN15 [SD I/F] */ |
628 | gpio_request(GPIO_FN_SDHIWP0, NULL); | 641 | gpio_request(GPIO_FN_SDHIWP0, NULL); |