sh: ecovec24: add additional properties to the backlight device
authorBartosz Golaszewski <bgolaszewski@baylibre.com>
Tue, 22 Oct 2019 08:36:25 +0000 (10:36 +0200)
committerLee Jones <lee.jones@linaro.org>
Mon, 11 Nov 2019 11:34:01 +0000 (11:34 +0000)
Add a GPIO lookup entry and a device property for GPIO backlight to the
board file. Tie them to the platform device which is now registered using
platform_device_register_full() because of the properties. These changes
are inactive now but will be used once the gpio backlight driver is
modified.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Tested-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
arch/sh/boards/mach-ecovec24/setup.c

index acaa974..aaa8ea6 100644 (file)
@@ -371,6 +371,19 @@ static struct platform_device lcdc_device = {
        },
 };
 
+static struct gpiod_lookup_table gpio_backlight_lookup = {
+       .dev_id         = "gpio-backlight.0",
+       .table = {
+               GPIO_LOOKUP("sh7724_pfc", GPIO_PTR1, NULL, GPIO_ACTIVE_HIGH),
+               { }
+       },
+};
+
+static struct property_entry gpio_backlight_props[] = {
+       PROPERTY_ENTRY_BOOL("default-on"),
+       { }
+};
+
 static struct gpio_backlight_platform_data gpio_backlight_data = {
        .fbdev = &lcdc_device.dev,
        .gpio = GPIO_PTR1,
@@ -378,13 +391,15 @@ static struct gpio_backlight_platform_data gpio_backlight_data = {
        .name = "backlight",
 };
 
-static struct platform_device gpio_backlight_device = {
+static const struct platform_device_info gpio_backlight_device_info = {
        .name = "gpio-backlight",
-       .dev = {
-               .platform_data = &gpio_backlight_data,
-       },
+       .data = &gpio_backlight_data,
+       .size_data = sizeof(gpio_backlight_data),
+       .properties = gpio_backlight_props,
 };
 
+static struct platform_device *gpio_backlight_device;
+
 /* CEU0 */
 static struct ceu_platform_data ceu0_pdata = {
        .num_subdevs                    = 2,
@@ -1006,7 +1021,6 @@ static struct platform_device *ecovec_devices[] __initdata = {
        &usb1_common_device,
        &usbhs_device,
        &lcdc_device,
-       &gpio_backlight_device,
        &keysc_device,
        &cn12_power,
 #if defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE)
@@ -1462,6 +1476,12 @@ static int __init arch_setup(void)
 #endif
 #endif
 
+       gpiod_add_lookup_table(&gpio_backlight_lookup);
+       gpio_backlight_device = platform_device_register_full(
+                                       &gpio_backlight_device_info);
+       if (IS_ERR(gpio_backlight_device))
+               return PTR_ERR(gpio_backlight_device);
+
        return platform_add_devices(ecovec_devices,
                                    ARRAY_SIZE(ecovec_devices));
 }