Skip to content

Commit

Permalink
sh: ecovec24: add additional properties to the backlight device
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Bartosz Golaszewski authored and Lee Jones committed Nov 11, 2019
1 parent 706dc68 commit d9e2b6e
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions arch/sh/boards/mach-ecovec24/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,20 +371,35 @@ 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,
.def_value = 1,
.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,
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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));
}
Expand Down

0 comments on commit d9e2b6e

Please sign in to comment.