ARM: mach-shmobile: mackerel: Use gpio-backlight
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Thu, 4 Jul 2013 19:13:27 +0000 (21:13 +0200)
committerSimon Horman <horms+renesas@verge.net.au>
Wed, 17 Jul 2013 01:06:14 +0000 (10:06 +0900)
Replace the backlight callback with a gpio-backlight platform device.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
arch/arm/mach-shmobile/board-mackerel.c

index 85f51a849a5043a7f122c6a25c7c63dd97877ec1..af06753eb8092500de41707ac68216bd3ed244a0 100644 (file)
@@ -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 */