@@ -10,11 +10,13 @@
#include <linux/device.h>
#include <linux/export.h>
#include <linux/platform_device.h>
+#include <linux/property.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <linux/mtd/physmap.h>
#include <linux/spi/spi.h>
#include <linux/spi/flash.h>
+#include <linux/gpio/machine.h>
#include <linux/i2c.h>
#include <linux/irq.h>
#include <linux/interrupt.h>
@@ -28,14 +30,6 @@
#include <asm/portmux.h>
#include <asm/dpmc.h>
-#if IS_ENABLED(CONFIG_TOUCHSCREEN_AD7879)
-#include <linux/platform_data/ad7879.h>
-#define LCD_BACKLIGHT_GPIO 0x40
-/* TLL6527M uses TLL7UIQ35 / ADI LCD EZ Extender. AD7879 AUX GPIO is used for
- * LCD Backlight Enable
- */
-#endif
-
/*
* Name the Board for the /proc/cpuinfo
*/
@@ -109,8 +103,6 @@ static struct platform_device musb_device = {
static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data = {
.mode = LQ035_NORM | LQ035_RGB | LQ035_RL | LQ035_TB,
.ppi_mode = USE_RGB565_16_BIT_PPI,
- .use_bl = 1,
- .gpio_bl = LCD_BACKLIGHT_GPIO,
};
static struct resource bfin_lq035q1_resources[] = {
@@ -132,6 +124,23 @@ static struct platform_device bfin_lq035q1_device = {
};
#endif
+#if IS_ENABLED(CONFIG_BACKLIGHT_GPIO)
+/* TLL6527M uses TLL7UIQ35 / ADI LCD EZ Extender. AD7879 AUX GPIO is used for
+ * LCD Backlight Enable
+ */
+static struct gpiod_lookup_table bfin_gpio_backlight_gpios_table = {
+ .dev_id = "gpio-backlight.0",
+ .table = {
+ GPIO_LOOKUP("AD7879-GPIO", 0, NULL, GPIO_ACTIVE_HIGH),
+ { }
+ },
+};
+
+static struct platform_device bfin_gpio_backlight_device = {
+ .name = "gpio-backlight",
+};
+#endif
+
#if IS_ENABLED(CONFIG_MTD_GPIO_ADDR)
static struct mtd_partition tll6527m_partitions[] = {
{
@@ -323,6 +332,7 @@ static struct bfin5xx_spi_chip mmc_spi_chip_info = {
#endif
#if IS_ENABLED(CONFIG_TOUCHSCREEN_AD7879)
+#include <linux/platform_data/ad7879.h>
static const struct ad7879_platform_data bfin_ad7879_ts_info = {
.model = 7879, /* Model = AD7879 */
.x_plate_ohms = 620, /* 620 Ohm from the touch datasheet */
@@ -336,7 +346,7 @@ static const struct ad7879_platform_data bfin_ad7879_ts_info = {
/* take the average of 4 middle samples */
.pen_down_acc_interval = 255, /* 9.4 ms */
.gpio_export = 1, /* configure AUX as GPIO output*/
- .gpio_base = LCD_BACKLIGHT_GPIO,
+ .gpio_base = -1,
};
#endif
@@ -836,6 +846,10 @@ static struct platform_device *tll6527m_devices[] __initdata = {
&bfin_lq035q1_device,
#endif
+#if IS_ENABLED(CONFIG_BACKLIGHT_GPIO)
+ &bfin_gpio_backlight_device,
+#endif
+
#if IS_ENABLED(CONFIG_SERIAL_BFIN)
#ifdef CONFIG_SERIAL_BFIN_UART0
&bfin_uart0_device,
@@ -880,9 +894,17 @@ static struct platform_device *tll6527m_devices[] __initdata = {
#endif
};
+static struct gpiod_lookup_table *tll6527m_gpio_tables[] = {
+#if IS_ENABLED(CONFIG_BACKLIGHT_GPIO)
+ &bfin_gpio_backlight_gpios_table,
+#endif
+};
+
static int __init tll6527m_init(void)
{
printk(KERN_INFO "%s(): registering device resources\n", __func__);
+ gpiod_add_lookup_tables(tll6527m_gpio_tables,
+ AERRAY_SIZE(tll6527m_gpio_tables));
i2c_register_board_info(0, bfin_i2c_board_info,
ARRAY_SIZE(bfin_i2c_board_info));
platform_add_devices(tll6527m_devices, ARRAY_SIZE(tll6527m_devices));
@@ -372,7 +372,7 @@ static struct platform_device lcdc_device = {
static struct gpiod_lookup_table gpio_backlight_gpios_table = {
.dev_id = "gpio-backlight.0",
.table = {
- GPIO_LOOKUP_IDX("sh7724_pfc", GPIO_PTR1, NULL, 0, GPIO_ACTIVE_HIGH);
+ GPIO_LOOKUP("sh7724_pfc", GPIO_PTR1, NULL, GPIO_ACTIVE_HIGH),
{ }
},
};