Skip to contentSkip to conversation

Renesas ARM and SH based SoC backlight drivers for v3.12

PATCH New Simon Horman 2 participants 9 messages Jul 19, 2013 – Aug 4, 2013

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

cover Renesas ARM and SH based SoC backlight drivers for v3.12

Hi Olof, Hi Arnd,

please consider the following backlight drivers for v3.12.

The following changes since commit ad81f0545ef01ea651886dddac4bef6cec930092:

Linux 3.11-rc1 (2013-07-14 15:18:27 -0700)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git tags/renesas-backlight-for-v3.12

for you to fetch changes up to 0fb19cdabfc3f8884bac53fd81b02bf61c7904af:

ARM: mach-shmobile: ag5evm: Use bd6107 backlight driver (2013-07-17 10:06:18 +0900)

----------------------------------------------------------------
Renesas ARM and SH based SoC backlight drivers for v3.12

Backlight drivers used by SH and ARM SH-Mobile boards.

----------------------------------------------------------------
Laurent Pinchart (7):
backlight: Add GPIO-based backlight driver
backlight: Add Sanyo LV5207LP backlight driver
backlight: Add ROHM BD6107 backlight driver
ARM: mach-shmobile: mackerel: Use gpio-backlight
sh: ecovec24: Use gpio-backlight
sh: kfr2r09: Use lv5207lp backlight
ARM: mach-shmobile: ag5evm: Use bd6107 backlight driver

 arch/arm/mach-shmobile/board-ag5evm.c        |   65 ++------
 arch/arm/mach-shmobile/board-mackerel.c      |   34 ++--
 arch/sh/boards/mach-ecovec24/setup.c         |   37 +++--
 arch/sh/boards/mach-kfr2r09/lcd_wqvga.c      |   48 ------
 arch/sh/boards/mach-kfr2r09/setup.c          |   19 ++-
 arch/sh/include/mach-kfr2r09/mach/kfr2r09.h  |    2 -
 drivers/video/backlight/Kconfig              |   19 +++
 drivers/video/backlight/Makefile             |    3 +
 drivers/video/backlight/bd6107.c             |  213 ++++++++++++++++++++++++++
 drivers/video/backlight/gpio_backlight.c     |  133 ++++++++++++++++
 drivers/video/backlight/lv5207lp.c           |  171 +++++++++++++++++++++
 include/linux/platform_data/bd6107.h         |   19 +++
 include/linux/platform_data/gpio_backlight.h |   21 +++
 include/linux/platform_data/lv5207lp.h       |   19 +++
 14 files changed, 665 insertions(+), 138 deletions(-)
 create mode 100644 drivers/video/backlight/bd6107.c
 create mode 100644 drivers/video/backlight/gpio_backlight.c
 create mode 100644 drivers/video/backlight/lv5207lp.c
 create mode 100644 include/linux/platform_data/bd6107.h
 create mode 100644 include/linux/platform_data/gpio_backlight.h
 create mode 100644 include/linux/platform_data/lv5207lp.h
#1 lore raw

PATCH 1/7 backlight: Add GPIO-based backlight driver

From: Laurent Pinchart <[email protected]>

The GPIO backlight driver controls the backlight in on/off mode through a single GPIO.

---
 drivers/video/backlight/Kconfig              |    7 ++
 drivers/video/backlight/Makefile             |    1 +
 drivers/video/backlight/gpio_backlight.c     |  133 ++++++++++++++++++++++++++
 include/linux/platform_data/gpio_backlight.h |   21 ++++
 4 files changed, 162 insertions(+)
 create mode 100644 drivers/video/backlight/gpio_backlight.c
 create mode 100644 include/linux/platform_data/gpio_backlight.h
drivers/video/backlight/Kconfig +7 -0
index d5ab658..5ab6423 100644
@@ -425,6 +425,13 @@ config BACKLIGHT_AS3711
 	  If you have an Austrian Microsystems AS3711 say Y to enable the
 	  backlight driver.
 
+config BACKLIGHT_GPIO
+	tristate "Generic GPIO based Backlight Driver"
+	depends on GPIOLIB
+	help
+	  If you have a LCD backlight adjustable by GPIO, say Y to enable
+	  this driver.
+
 endif # BACKLIGHT_CLASS_DEVICE
 
 endif # BACKLIGHT_LCD_SUPPORT
drivers/video/backlight/Makefile +1 -0
index 92711fe..65698a8 100644
@@ -32,6 +32,7 @@ obj-$(CONFIG_BACKLIGHT_DA903X)		+= da903x_bl.o
 obj-$(CONFIG_BACKLIGHT_DA9052)		+= da9052_bl.o
 obj-$(CONFIG_BACKLIGHT_EP93XX)		+= ep93xx_bl.o
 obj-$(CONFIG_BACKLIGHT_GENERIC)		+= generic_bl.o
+obj-$(CONFIG_BACKLIGHT_GPIO)		+= gpio_backlight.o
 obj-$(CONFIG_BACKLIGHT_HP680)		+= hp680_bl.o
 obj-$(CONFIG_BACKLIGHT_HP700)		+= jornada720_bl.o
 obj-$(CONFIG_BACKLIGHT_LM3533)		+= lm3533_bl.o
drivers/video/backlight/gpio_backlight.c new file +133 -0

133 lines not on this page · raw message

include/linux/platform_data/gpio_backlight.h new file +21 -0
new file mode 100644
index 0000000..5ae0d9c
@@ -0,0 +1,21 @@
+/*
+ * gpio_backlight.h - Simple GPIO-controlled backlight
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef __GPIO_BACKLIGHT_H__
+#define __GPIO_BACKLIGHT_H__
+
+struct device;
+
+struct gpio_backlight_platform_data {
+	struct device *fbdev;
+	int gpio;
+	int def_value;
+	bool active_low;
+	const char *name;
+};
+
+#endif
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 2/7 backlight: Add Sanyo LV5207LP backlight driver

In reply to Simon Horman

From: Laurent Pinchart <[email protected]>

The LV5207LP is a multi-purpose 7 LEDs driver for the mobile market. Only the main LED is supported by this driver.

---
 drivers/video/backlight/Kconfig        |    6 ++
 drivers/video/backlight/Makefile       |    1 +
 drivers/video/backlight/lv5207lp.c     |  171 ++++++++++++++++++++++++++++++++
 include/linux/platform_data/lv5207lp.h |   19 ++++
 4 files changed, 197 insertions(+)
 create mode 100644 drivers/video/backlight/lv5207lp.c
 create mode 100644 include/linux/platform_data/lv5207lp.h
drivers/video/backlight/Kconfig +6 -0
index 5ab6423..b304e07 100644
@@ -432,6 +432,12 @@ config BACKLIGHT_GPIO
 	  If you have a LCD backlight adjustable by GPIO, say Y to enable
 	  this driver.
 
+config BACKLIGHT_LV5207LP
+	tristate "Sanyo LV5207LP Backlight"
+	depends on I2C
+	help
+	  If you have a Sanyo LV5207LP say Y to enable the backlight driver.
+
 endif # BACKLIGHT_CLASS_DEVICE
 
 endif # BACKLIGHT_LCD_SUPPORT
drivers/video/backlight/Makefile +1 -0
index 65698a8..4e5e811 100644
@@ -41,6 +41,7 @@ obj-$(CONFIG_BACKLIGHT_LM3639)		+= lm3639_bl.o
 obj-$(CONFIG_BACKLIGHT_LOCOMO)		+= locomolcd.o
 obj-$(CONFIG_BACKLIGHT_LP855X)		+= lp855x_bl.o
 obj-$(CONFIG_BACKLIGHT_LP8788)		+= lp8788_bl.o
+obj-$(CONFIG_BACKLIGHT_LV5207LP)	+= lv5207lp.o
 obj-$(CONFIG_BACKLIGHT_MAX8925)		+= max8925_bl.o
 obj-$(CONFIG_BACKLIGHT_OMAP1)		+= omap1_bl.o
 obj-$(CONFIG_BACKLIGHT_OT200)		+= ot200_bl.o
drivers/video/backlight/lv5207lp.c new file +171 -0

171 lines not on this page · raw message

include/linux/platform_data/lv5207lp.h new file +19 -0
new file mode 100644
index 0000000..7dc4d9a
@@ -0,0 +1,19 @@
+/*
+ * lv5207lp.h - Sanyo LV5207LP LEDs Driver
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef __LV5207LP_H__
+#define __LV5207LP_H__
+
+struct device;
+
+struct lv5207lp_platform_data {
+	struct device *fbdev;
+	unsigned int max_value;
+	unsigned int def_value;
+};
+
+#endif
Signature · 1 line
1.7.10.4
#3 lore raw

PATCH 3/7 backlight: Add ROHM BD6107 backlight driver

In reply to Simon Horman

From: Laurent Pinchart <[email protected]>

The BD6107 is a multi-purpose 10 channels LED driver for the mobile market. Only the main channel is supported by this driver.

---
 drivers/video/backlight/Kconfig      |    6 +
 drivers/video/backlight/Makefile     |    1 +
 drivers/video/backlight/bd6107.c     |  213 ++++++++++++++++++++++++++++++++++
 include/linux/platform_data/bd6107.h |   19 +++
 4 files changed, 239 insertions(+)
 create mode 100644 drivers/video/backlight/bd6107.c
 create mode 100644 include/linux/platform_data/bd6107.h
drivers/video/backlight/Kconfig +6 -0
index b304e07..d4a7a35 100644
@@ -438,6 +438,12 @@ config BACKLIGHT_LV5207LP
 	help
 	  If you have a Sanyo LV5207LP say Y to enable the backlight driver.
 
+config BACKLIGHT_BD6107
+	tristate "Rohm BD6107 Backlight"
+	depends on I2C
+	help
+	  If you have a Rohm BD6107 say Y to enable the backlight driver.
+
 endif # BACKLIGHT_CLASS_DEVICE
 
 endif # BACKLIGHT_LCD_SUPPORT
drivers/video/backlight/Makefile +1 -0
index 4e5e811..38e1bab 100644
@@ -26,6 +26,7 @@ obj-$(CONFIG_BACKLIGHT_ADP8870)		+= adp8870_bl.o
 obj-$(CONFIG_BACKLIGHT_APPLE)		+= apple_bl.o
 obj-$(CONFIG_BACKLIGHT_AS3711)		+= as3711_bl.o
 obj-$(CONFIG_BACKLIGHT_ATMEL_PWM)	+= atmel-pwm-bl.o
+obj-$(CONFIG_BACKLIGHT_BD6107)		+= bd6107.o
 obj-$(CONFIG_BACKLIGHT_CARILLO_RANCH)	+= cr_bllcd.o
 obj-$(CONFIG_BACKLIGHT_CLASS_DEVICE)	+= backlight.o
 obj-$(CONFIG_BACKLIGHT_DA903X)		+= da903x_bl.o
drivers/video/backlight/bd6107.c new file +213 -0

213 lines not on this page · raw message

include/linux/platform_data/bd6107.h new file +19 -0
new file mode 100644
index 0000000..671d650
@@ -0,0 +1,19 @@
+/*
+ * bd6107.h - Rohm BD6107 LEDs Driver
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef __BD6107_H__
+#define __BD6107_H__
+
+struct device;
+
+struct bd6107_platform_data {
+	struct device *fbdev;
+	int reset;			/* Reset GPIO */
+	unsigned int def_value;
+};
+
+#endif
Signature · 1 line
1.7.10.4
#4 lore raw

PATCH 4/7 ARM: mach-shmobile: mackerel: Use gpio-backlight

In reply to Simon Horman

From: Laurent Pinchart <[email protected]>

Replace the backlight callback with a gpio-backlight platform device.

---
 arch/arm/mach-shmobile/board-mackerel.c |   34 +++++++++++++++----------------
 1 file changed, 17 insertions(+), 17 deletions(-)
arch/arm/mach-shmobile/board-mackerel.c +17 -17
index 85f51a8..af06753 100644
@@ -41,6 +41,7 @@
 #include <linux/mtd/physmap.h>
 #include <linux/mtd/sh_flctl.h>
 #include <linux/pinctrl/machine.h>
+#include <linux/platform_data/gpio_backlight.h>
 #include <linux/pm_clock.h>
 #include <linux/regulator/fixed.h>
 #include <linux/regulator/machine.h>
@@ -49,7 +50,6 @@
 #include <linux/tca6416_keypad.h>
 #include <linux/usb/renesas_usbhs.h>
 #include <linux/dma-mapping.h>
-
 #include <video/sh_mobile_hdmi.h>
 #include <video/sh_mobile_lcdc.h>
 #include <media/sh_mobile_ceu.h>
@@ -346,7 +346,7 @@ static struct platform_device meram_device = {
 	},
 };
 
-/* LCDC */
+/* LCDC and backlight */
 static struct fb_videomode mackerel_lcdc_modes[] = {
 	{
 		.name		= "WVGA Panel",
@@ -362,13 +362,6 @@ static struct fb_videomode mackerel_lcdc_modes[] = {
 	},
 };
 
-static int mackerel_set_brightness(int brightness)
-{
-	gpio_set_value(31, brightness);
-
-	return 0;
-}
-
 static const struct sh_mobile_meram_cfg lcd_meram_cfg = {
 	.icb[0] = {
 		.meram_size     = 0x40,
@@ -393,11 +386,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 = mackerel_set_brightness,
-		},
 		.meram_cfg = &lcd_meram_cfg,
 	}
 };
@@ -425,6 +413,20 @@ static struct platform_device lcdc_device = {
 	},
 };
 
+static struct gpio_backlight_platform_data gpio_backlight_data = {
+	.fbdev = &lcdc_device.dev,
+	.gpio = 31,
+	.def_value = 1,
+	.name = "backlight",
+};
+
+static struct platform_device gpio_backlight_device = {
+	.name = "gpio-backlight",
+	.dev = {
+		.platform_data = &gpio_backlight_data,
+	},
+};
+
 /* HDMI */
 static struct sh_mobile_hdmi_info hdmi_info = {
 	.flags		= HDMI_SND_SRC_SPDIF,
@@ -1231,6 +1233,7 @@ static struct platform_device *mackerel_devices[] __initdata = {
 	&nor_flash_device,
 	&smc911x_device,
 	&lcdc_device,
+	&gpio_backlight_device,
 	&usbhs0_device,
 	&usbhs1_device,
 	&leds_device,
@@ -1441,9 +1444,6 @@ static void __init mackerel_init(void)
 				  ARRAY_SIZE(mackerel_pinctrl_map));
 	sh7372_pinmux_init();
 
-	/* backlight, off by default */
-	gpio_request_one(31, GPIOF_OUT_INIT_LOW, NULL);
-
 	gpio_request_one(151, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */
 
 	/* USBHS0 */
Signature · 1 line
1.7.10.4
#5 lore raw

PATCH 5/7 sh: ecovec24: Use gpio-backlight

In reply to Simon Horman

From: Laurent Pinchart <[email protected]>

Replace the backlight callback with a gpio-backlight platform device.

---
 arch/sh/boards/mach-ecovec24/setup.c |   37 ++++++++++++++++++----------------
 1 file changed, 20 insertions(+), 17 deletions(-)
arch/sh/boards/mach-ecovec24/setup.c +20 -17
index 61fade0..bcbb86b 100644
@@ -30,6 +30,7 @@
 #include <linux/spi/mmc_spi.h>
 #include <linux/input.h>
 #include <linux/input/sh_keysc.h>
+#include <linux/platform_data/gpio_backlight.h>
 #include <linux/sh_eth.h>
 #include <linux/sh_intc.h>
 #include <linux/videodev2.h>
@@ -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,
Signature · 1 line
1.7.10.4
#6 lore raw

PATCH 6/7 sh: kfr2r09: Use lv5207lp backlight

In reply to Simon Horman

From: Laurent Pinchart <[email protected]>

Replace the backlight callback with a lv5207lp backlight platform device.

---
 arch/sh/boards/mach-kfr2r09/lcd_wqvga.c     |   48 ---------------------------
 arch/sh/boards/mach-kfr2r09/setup.c         |   19 ++++++++---
 arch/sh/include/mach-kfr2r09/mach/kfr2r09.h |    2 --
 3 files changed, 14 insertions(+), 55 deletions(-)
arch/sh/boards/mach-kfr2r09/lcd_wqvga.c +0 -48
index c620503..355a78a 100644
@@ -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;
-}
arch/sh/boards/mach-kfr2r09/setup.c +14 -5
index ab502f12..1df4398 100644
@@ -21,6 +21,7 @@
 #include <linux/input.h>
 #include <linux/input/sh_keysc.h>
 #include <linux/i2c.h>
+#include <linux/platform_data/lv5207lp.h>
 #include <linux/regulator/fixed.h>
 #include <linux/regulator/machine.h>
 #include <linux/usb/r8a66597.h>
@@ -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));
 }
arch/sh/include/mach-kfr2r09/mach/kfr2r09.h +0 -2
index c20c9e5..79f154e 100644
@@ -4,13 +4,11 @@
 #include <video/sh_mobile_lcdc.h>
 
 #if defined(CONFIG_FB_SH_MOBILE_LCDC) || defined(CONFIG_FB_SH_MOBILE_LCDC_MODULE)
-int kfr2r09_lcd_set_brightness(int brightness);
 int kfr2r09_lcd_setup(void *sys_ops_handle,
 		      struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
 void kfr2r09_lcd_start(void *sys_ops_handle,
 		       struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
 #else
-static int kfr2r09_lcd_set_brightness(int brightness) {}
 static int kfr2r09_lcd_setup(void *sys_ops_handle,
 				struct sh_mobile_lcdc_sys_bus_ops *sys_ops)
 {
Signature · 1 line
1.7.10.4
#7 lore raw

PATCH 7/7 ARM: mach-shmobile: ag5evm: Use bd6107 backlight driver

In reply to Simon Horman

From: Laurent Pinchart <[email protected]>

Replace the backlight callback with a bd6107 backlight platform device.

---
 arch/arm/mach-shmobile/board-ag5evm.c |   65 ++++++++-------------------------
 1 file changed, 16 insertions(+), 49 deletions(-)
arch/arm/mach-shmobile/board-ag5evm.c +16 -49
index c754071..f6d6449 100644
@@ -41,6 +41,7 @@
 #include <linux/mmc/sh_mmcif.h>
 #include <linux/mmc/sh_mobile_sdhi.h>
 #include <linux/mfd/tmio.h>
+#include <linux/platform_data/bd6107.h>
 #include <linux/sh_clk.h>
 #include <linux/irqchip/arm-gic.h>
 #include <video/sh_mobile_lcdc.h>
@@ -291,47 +292,7 @@ static struct platform_device mipidsi0_device = {
 	},
 };
 
-static unsigned char lcd_backlight_seq[3][2] = {
-	{ 0x04, 0x07 },
-	{ 0x23, 0x80 },
-	{ 0x03, 0x01 },
-};
-
-static int lcd_backlight_set_brightness(int brightness)
-{
-	struct i2c_adapter *adap;
-	struct i2c_msg msg;
-	unsigned int i;
-	int ret;
-
-	if (brightness == 0) {
-		/* Reset the chip */
-		gpio_set_value(235, 0);
-		mdelay(24);
-		gpio_set_value(235, 1);
-		return 0;
-	}
-
-	adap = i2c_get_adapter(1);
-	if (adap == NULL)
-		return -ENODEV;
-
-	for (i = 0; i < ARRAY_SIZE(lcd_backlight_seq); i++) {
-		msg.addr = 0x6d;
-		msg.buf = &lcd_backlight_seq[i][0];
-		msg.len = 2;
-		msg.flags = 0;
-
-		ret = i2c_transfer(adap, &msg, 1);
-		if (ret < 0)
-			break;
-	}
-
-	i2c_put_adapter(adap);
-	return ret < 0 ? ret : 0;
-}
-
-/* LCDC0 */
+/* LCDC0 and backlight */
 static const struct fb_videomode lcdc0_modes[] = {
 	{
 		.name		= "R63302(QHD)",
@@ -361,11 +322,6 @@ static struct sh_mobile_lcdc_info lcdc0_info = {
 			.width = 44,
 			.height = 79,
 		},
-		.bl_info = {
-			.name = "sh_mobile_lcdc_bl",
-			.max_brightness = 1,
-			.set_brightness = lcd_backlight_set_brightness,
-		},
 		.tx_dev = &mipidsi0_device,
 	}
 };
@@ -394,6 +350,17 @@ static struct platform_device lcdc0_device = {
 	},
 };
 
+static struct bd6107_platform_data backlight_data = {
+	.fbdev = &lcdc0_device.dev,
+	.reset = 235,
+	.def_value = 0,
+};
+
+static struct i2c_board_info backlight_board_info = {
+	I2C_BOARD_INFO("bd6107", 0x6d),
+	.platform_data = &backlight_data,
+};
+
 /* Fixed 2.8V regulators to be used by SDHI0 */
 static struct regulator_consumer_supply fixed2v8_power_consumers[] =
 {
@@ -648,15 +615,15 @@ static void __init ag5evm_init(void)
 	gpio_set_value(217, 1);
 	mdelay(100);
 
-	/* LCD backlight controller */
-	gpio_request_one(235, GPIOF_OUT_INIT_LOW, NULL); /* RESET */
-	lcd_backlight_set_brightness(0);
 
 #ifdef CONFIG_CACHE_L2X0
 	/* Shared attribute override enable, 64K*8way */
 	l2x0_init(IOMEM(0xf0100000), 0x00460000, 0xc2000fff);
 #endif
 	sh73a0_add_standard_devices();
+
+	i2c_register_board_info(1, &backlight_board_info, 1);
+
 	platform_add_devices(ag5evm_devices, ARRAY_SIZE(ag5evm_devices));
 }
 
Signature · 1 line
1.7.10.4
#8 lore raw

cover Renesas ARM and SH based SoC backlight drivers for v3.12

In reply to Simon Horman

Hi,

Quoted 11 lines · Simon Horman

Hi Olof, Hi Arnd,

please consider the following backlight drivers for v3.12.

The following changes since commit ad81f0545ef01ea651886dddac4bef6cec930092:

Linux 3.11-rc1 (2013-07-14 15:18:27 -0700)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git tags/renesas-backlight-for-v3.12

Pulled. In the future a branch like this could be split into the driver updates for the backlight stuff, then board patches to plumb in the new drivers. But I've pulled it all into the next/boards branch for now.

-Olof