aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2013-07-04 15:13:30 -0400
committerSimon Horman <horms+renesas@verge.net.au>2013-07-16 21:06:18 -0400
commit0fb19cdabfc3f8884bac53fd81b02bf61c7904af (patch)
tree271e71f83890ac9789d75902a1761a47a82f57b7
parent3f3bee2e31f6fbf8ac09b58b8e87374d24387cef (diff)
ARM: mach-shmobile: ag5evm: Use bd6107 backlight driver
Replace the backlight callback with a bd6107 backlight platform device. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-rw-r--r--arch/arm/mach-shmobile/board-ag5evm.c65
1 files changed, 16 insertions, 49 deletions
diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c
index c7540710906f..f6d64495c405 100644
--- a/arch/arm/mach-shmobile/board-ag5evm.c
+++ b/arch/arm/mach-shmobile/board-ag5evm.c
@@ -41,6 +41,7 @@
41#include <linux/mmc/sh_mmcif.h> 41#include <linux/mmc/sh_mmcif.h>
42#include <linux/mmc/sh_mobile_sdhi.h> 42#include <linux/mmc/sh_mobile_sdhi.h>
43#include <linux/mfd/tmio.h> 43#include <linux/mfd/tmio.h>
44#include <linux/platform_data/bd6107.h>
44#include <linux/sh_clk.h> 45#include <linux/sh_clk.h>
45#include <linux/irqchip/arm-gic.h> 46#include <linux/irqchip/arm-gic.h>
46#include <video/sh_mobile_lcdc.h> 47#include <video/sh_mobile_lcdc.h>
@@ -291,47 +292,7 @@ static struct platform_device mipidsi0_device = {
291 }, 292 },
292}; 293};
293 294
294static unsigned char lcd_backlight_seq[3][2] = { 295/* LCDC0 and backlight */
295 { 0x04, 0x07 },
296 { 0x23, 0x80 },
297 { 0x03, 0x01 },
298};
299
300static int lcd_backlight_set_brightness(int brightness)
301{
302 struct i2c_adapter *adap;
303 struct i2c_msg msg;
304 unsigned int i;
305 int ret;
306
307 if (brightness == 0) {
308 /* Reset the chip */
309 gpio_set_value(235, 0);
310 mdelay(24);
311 gpio_set_value(235, 1);
312 return 0;
313 }
314
315 adap = i2c_get_adapter(1);
316 if (adap == NULL)
317 return -ENODEV;
318
319 for (i = 0; i < ARRAY_SIZE(lcd_backlight_seq); i++) {
320 msg.addr = 0x6d;
321 msg.buf = &lcd_backlight_seq[i][0];
322 msg.len = 2;
323 msg.flags = 0;
324
325 ret = i2c_transfer(adap, &msg, 1);
326 if (ret < 0)
327 break;
328 }
329
330 i2c_put_adapter(adap);
331 return ret < 0 ? ret : 0;
332}
333
334/* LCDC0 */
335static const struct fb_videomode lcdc0_modes[] = { 296static const struct fb_videomode lcdc0_modes[] = {
336 { 297 {
337 .name = "R63302(QHD)", 298 .name = "R63302(QHD)",
@@ -361,11 +322,6 @@ static struct sh_mobile_lcdc_info lcdc0_info = {
361 .width = 44, 322 .width = 44,
362 .height = 79, 323 .height = 79,
363 }, 324 },
364 .bl_info = {
365 .name = "sh_mobile_lcdc_bl",
366 .max_brightness = 1,
367 .set_brightness = lcd_backlight_set_brightness,
368 },
369 .tx_dev = &mipidsi0_device, 325 .tx_dev = &mipidsi0_device,
370 } 326 }
371}; 327};
@@ -394,6 +350,17 @@ static struct platform_device lcdc0_device = {
394 }, 350 },
395}; 351};
396 352
353static struct bd6107_platform_data backlight_data = {
354 .fbdev = &lcdc0_device.dev,
355 .reset = 235,
356 .def_value = 0,
357};
358
359static struct i2c_board_info backlight_board_info = {
360 I2C_BOARD_INFO("bd6107", 0x6d),
361 .platform_data = &backlight_data,
362};
363
397/* Fixed 2.8V regulators to be used by SDHI0 */ 364/* Fixed 2.8V regulators to be used by SDHI0 */
398static struct regulator_consumer_supply fixed2v8_power_consumers[] = 365static struct regulator_consumer_supply fixed2v8_power_consumers[] =
399{ 366{
@@ -648,15 +615,15 @@ static void __init ag5evm_init(void)
648 gpio_set_value(217, 1); 615 gpio_set_value(217, 1);
649 mdelay(100); 616 mdelay(100);
650 617
651 /* LCD backlight controller */
652 gpio_request_one(235, GPIOF_OUT_INIT_LOW, NULL); /* RESET */
653 lcd_backlight_set_brightness(0);
654 618
655#ifdef CONFIG_CACHE_L2X0 619#ifdef CONFIG_CACHE_L2X0
656 /* Shared attribute override enable, 64K*8way */ 620 /* Shared attribute override enable, 64K*8way */
657 l2x0_init(IOMEM(0xf0100000), 0x00460000, 0xc2000fff); 621 l2x0_init(IOMEM(0xf0100000), 0x00460000, 0xc2000fff);
658#endif 622#endif
659 sh73a0_add_standard_devices(); 623 sh73a0_add_standard_devices();
624
625 i2c_register_board_info(1, &backlight_board_info, 1);
626
660 platform_add_devices(ag5evm_devices, ARRAY_SIZE(ag5evm_devices)); 627 platform_add_devices(ag5evm_devices, ARRAY_SIZE(ag5evm_devices));
661} 628}
662 629