ARM: pxa: Initialize PWM backlight enable_gpio field
authorThierry Reding <treding@nvidia.com>
Fri, 30 Aug 2013 10:15:24 +0000 (12:15 +0200)
committerThierry Reding <thierry.reding@gmail.com>
Wed, 16 Oct 2013 07:05:57 +0000 (09:05 +0200)
The GPIO API defines 0 as being a valid GPIO number, so this field needs
to be initialized explicitly.

A special case is the Palm Tungsten|C board. Since it doesn't use any
quirks that would require the existing .init() or .exit() hooks it can
simply use the new enable_gpio field.

Signed-off-by: Thierry Reding <treding@nvidia.com>
17 files changed:
arch/arm/mach-pxa/cm-x300.c
arch/arm/mach-pxa/colibri-pxa270-income.c
arch/arm/mach-pxa/ezx.c
arch/arm/mach-pxa/hx4700.c
arch/arm/mach-pxa/lpd270.c
arch/arm/mach-pxa/magician.c
arch/arm/mach-pxa/mainstone.c
arch/arm/mach-pxa/mioa701.c
arch/arm/mach-pxa/palm27x.c
arch/arm/mach-pxa/palmtc.c
arch/arm/mach-pxa/palmte2.c
arch/arm/mach-pxa/pcm990-baseboard.c
arch/arm/mach-pxa/raumfeld.c
arch/arm/mach-pxa/tavorevb.c
arch/arm/mach-pxa/viper.c
arch/arm/mach-pxa/z2.c
arch/arm/mach-pxa/zylonite.c

index f942349..584439b 100644 (file)
@@ -310,6 +310,7 @@ static struct platform_pwm_backlight_data cm_x300_backlight_data = {
        .max_brightness = 100,
        .dft_brightness = 100,
        .pwm_period_ns  = 10000,
+       .enable_gpio    = -1,
 };
 
 static struct platform_device cm_x300_backlight_device = {
index 2d4a7b4..3aa2646 100644 (file)
@@ -189,6 +189,7 @@ static struct platform_pwm_backlight_data income_backlight_data = {
        .max_brightness = 0x3ff,
        .dft_brightness = 0x1ff,
        .pwm_period_ns  = 1000000,
+       .enable_gpio    = -1,
 };
 
 static struct platform_device income_backlight = {
index fe2eb83..ab93441 100644 (file)
@@ -54,6 +54,7 @@ static struct platform_pwm_backlight_data ezx_backlight_data = {
        .max_brightness = 1023,
        .dft_brightness = 1023,
        .pwm_period_ns  = 78770,
+       .enable_gpio    = -1,
 };
 
 static struct platform_device ezx_backlight_device = {
index 133109e..a7c30eb 100644 (file)
@@ -561,6 +561,7 @@ static struct platform_pwm_backlight_data backlight_data = {
        .max_brightness = 200,
        .dft_brightness = 100,
        .pwm_period_ns  = 30923,
+       .enable_gpio    = -1,
 };
 
 static struct platform_device backlight = {
index 1255ee0..9f6ec16 100644 (file)
@@ -269,6 +269,7 @@ static struct platform_pwm_backlight_data lpd270_backlight_data = {
        .max_brightness = 1,
        .dft_brightness = 1,
        .pwm_period_ns  = 78770,
+       .enable_gpio    = -1,
 };
 
 static struct platform_device lpd270_backlight_device = {
index f44532f..fab30d6 100644 (file)
@@ -378,6 +378,7 @@ static struct platform_pwm_backlight_data backlight_data = {
        .max_brightness = 272,
        .dft_brightness = 100,
        .pwm_period_ns  = 30923,
+       .enable_gpio    = -1,
        .init           = magician_backlight_init,
        .notify         = magician_backlight_notify,
        .exit           = magician_backlight_exit,
index dd70343..08ccc07 100644 (file)
@@ -338,6 +338,7 @@ static struct platform_pwm_backlight_data mainstone_backlight_data = {
        .max_brightness = 1023,
        .dft_brightness = 1023,
        .pwm_period_ns  = 78770,
+       .enable_gpio    = -1,
 };
 
 static struct platform_device mainstone_backlight_device = {
index acc9d3c..f70583f 100644 (file)
@@ -186,6 +186,7 @@ static struct platform_pwm_backlight_data mioa701_backlight_data = {
        .max_brightness = 100,
        .dft_brightness = 50,
        .pwm_period_ns  = 4000 * 1024,  /* Fl = 250kHz */
+       .enable_gpio    = -1,
 };
 
 /*
index 17d4c53..e54a296 100644 (file)
@@ -322,6 +322,7 @@ static struct platform_pwm_backlight_data palm27x_backlight_data = {
        .max_brightness = 0xfe,
        .dft_brightness = 0x7e,
        .pwm_period_ns  = 3500 * 1024,
+       .enable_gpio    = -1,
        .init           = palm27x_backlight_init,
        .notify         = palm27x_backlight_notify,
        .exit           = palm27x_backlight_exit,
index 100b176..7691c97 100644 (file)
@@ -166,45 +166,12 @@ static inline void palmtc_keys_init(void) {}
  * Backlight
  ******************************************************************************/
 #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE)
-static int palmtc_backlight_init(struct device *dev)
-{
-       int ret;
-
-       ret = gpio_request(GPIO_NR_PALMTC_BL_POWER, "BL POWER");
-       if (ret)
-               goto err;
-       ret = gpio_direction_output(GPIO_NR_PALMTC_BL_POWER, 1);
-       if (ret)
-               goto err2;
-
-       return 0;
-
-err2:
-       gpio_free(GPIO_NR_PALMTC_BL_POWER);
-err:
-       return ret;
-}
-
-static int palmtc_backlight_notify(struct device *dev, int brightness)
-{
-       /* backlight is on when GPIO16 AF0 is high */
-       gpio_set_value(GPIO_NR_PALMTC_BL_POWER, brightness);
-       return brightness;
-}
-
-static void palmtc_backlight_exit(struct device *dev)
-{
-       gpio_free(GPIO_NR_PALMTC_BL_POWER);
-}
-
 static struct platform_pwm_backlight_data palmtc_backlight_data = {
        .pwm_id         = 1,
        .max_brightness = PALMTC_MAX_INTENSITY,
        .dft_brightness = PALMTC_MAX_INTENSITY,
        .pwm_period_ns  = PALMTC_PERIOD_NS,
-       .init           = palmtc_backlight_init,
-       .notify         = palmtc_backlight_notify,
-       .exit           = palmtc_backlight_exit,
+       .enable_gpio    = GPIO_NR_PALMTC_BL_POWER,
 };
 
 static struct platform_device palmtc_backlight = {
index 0742721..956fd24 100644 (file)
@@ -165,6 +165,7 @@ static struct platform_pwm_backlight_data palmte2_backlight_data = {
        .max_brightness = PALMTE2_MAX_INTENSITY,
        .dft_brightness = PALMTE2_MAX_INTENSITY,
        .pwm_period_ns  = PALMTE2_PERIOD_NS,
+       .enable_gpio    = -1,
        .init           = palmte2_backlight_init,
        .notify         = palmte2_backlight_notify,
        .exit           = palmte2_backlight_exit,
index 3133ba8..9a4e470 100644 (file)
@@ -153,6 +153,7 @@ static struct platform_pwm_backlight_data pcm990_backlight_data = {
        .max_brightness = 1023,
        .dft_brightness = 1023,
        .pwm_period_ns  = 78770,
+       .enable_gpio    = -1,
 };
 
 static struct platform_device pcm990_backlight_device = {
index 969b0ba..8386dc3 100644 (file)
@@ -539,6 +539,7 @@ static struct platform_pwm_backlight_data raumfeld_pwm_backlight_data = {
        .dft_brightness = 100,
        /* 10000 ns = 10 ms ^= 100 kHz */
        .pwm_period_ns  = 10000,
+       .enable_gpio    = -1,
 };
 
 static struct platform_device raumfeld_pwm_backlight_device = {
index 4680efe..a71da84 100644 (file)
@@ -175,6 +175,7 @@ static struct platform_pwm_backlight_data tavorevb_backlight_data[] = {
                .max_brightness = 100,
                .dft_brightness = 100,
                .pwm_period_ns  = 100000,
+               .enable_gpio    = -1,
        },
        [1] = {
                /* secondary backlight */
@@ -182,6 +183,7 @@ static struct platform_pwm_backlight_data tavorevb_backlight_data[] = {
                .max_brightness = 100,
                .dft_brightness = 100,
                .pwm_period_ns  = 100000,
+               .enable_gpio    = -1,
        },
 };
 
index 9c363c0..29905b1 100644 (file)
@@ -401,6 +401,7 @@ static struct platform_pwm_backlight_data viper_backlight_data = {
        .max_brightness = 100,
        .dft_brightness = 100,
        .pwm_period_ns  = 1000000,
+       .enable_gpio    = -1,
        .init           = viper_backlight_init,
        .notify         = viper_backlight_notify,
        .exit           = viper_backlight_exit,
index 2513d8f..e1a121b 100644 (file)
@@ -206,6 +206,7 @@ static struct platform_pwm_backlight_data z2_backlight_data[] = {
                .max_brightness = 1023,
                .dft_brightness = 0,
                .pwm_period_ns  = 1260320,
+               .enable_gpio    = -1,
        },
        [1] = {
                /* LCD Backlight */
@@ -213,6 +214,7 @@ static struct platform_pwm_backlight_data z2_backlight_data[] = {
                .max_brightness = 1023,
                .dft_brightness = 512,
                .pwm_period_ns  = 1260320,
+               .enable_gpio    = -1,
        },
 };
 
index 36cf7cf..77daea4 100644 (file)
@@ -125,6 +125,7 @@ static struct platform_pwm_backlight_data zylonite_backlight_data = {
        .max_brightness = 100,
        .dft_brightness = 100,
        .pwm_period_ns  = 10000,
+       .enable_gpio    = -1,
 };
 
 static struct platform_device zylonite_backlight_device = {