Commit db01120c5f6cb1d8c6533a49b009f08a73852498

Authored by Thierry Reding
Committed by Thierry Reding
1 parent d46055af1c

ARM: pxa: Initialize PWM backlight enable_gpio field

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>

Showing 17 changed files with 19 additions and 34 deletions Side-by-side Diff

arch/arm/mach-pxa/cm-x300.c
... ... @@ -310,6 +310,7 @@
310 310 .max_brightness = 100,
311 311 .dft_brightness = 100,
312 312 .pwm_period_ns = 10000,
  313 + .enable_gpio = -1,
313 314 };
314 315  
315 316 static struct platform_device cm_x300_backlight_device = {
arch/arm/mach-pxa/colibri-pxa270-income.c
... ... @@ -189,6 +189,7 @@
189 189 .max_brightness = 0x3ff,
190 190 .dft_brightness = 0x1ff,
191 191 .pwm_period_ns = 1000000,
  192 + .enable_gpio = -1,
192 193 };
193 194  
194 195 static struct platform_device income_backlight = {
arch/arm/mach-pxa/ezx.c
... ... @@ -54,6 +54,7 @@
54 54 .max_brightness = 1023,
55 55 .dft_brightness = 1023,
56 56 .pwm_period_ns = 78770,
  57 + .enable_gpio = -1,
57 58 };
58 59  
59 60 static struct platform_device ezx_backlight_device = {
arch/arm/mach-pxa/hx4700.c
... ... @@ -561,6 +561,7 @@
561 561 .max_brightness = 200,
562 562 .dft_brightness = 100,
563 563 .pwm_period_ns = 30923,
  564 + .enable_gpio = -1,
564 565 };
565 566  
566 567 static struct platform_device backlight = {
arch/arm/mach-pxa/lpd270.c
... ... @@ -269,6 +269,7 @@
269 269 .max_brightness = 1,
270 270 .dft_brightness = 1,
271 271 .pwm_period_ns = 78770,
  272 + .enable_gpio = -1,
272 273 };
273 274  
274 275 static struct platform_device lpd270_backlight_device = {
arch/arm/mach-pxa/magician.c
... ... @@ -378,6 +378,7 @@
378 378 .max_brightness = 272,
379 379 .dft_brightness = 100,
380 380 .pwm_period_ns = 30923,
  381 + .enable_gpio = -1,
381 382 .init = magician_backlight_init,
382 383 .notify = magician_backlight_notify,
383 384 .exit = magician_backlight_exit,
arch/arm/mach-pxa/mainstone.c
... ... @@ -338,6 +338,7 @@
338 338 .max_brightness = 1023,
339 339 .dft_brightness = 1023,
340 340 .pwm_period_ns = 78770,
  341 + .enable_gpio = -1,
341 342 };
342 343  
343 344 static struct platform_device mainstone_backlight_device = {
arch/arm/mach-pxa/mioa701.c
... ... @@ -186,6 +186,7 @@
186 186 .max_brightness = 100,
187 187 .dft_brightness = 50,
188 188 .pwm_period_ns = 4000 * 1024, /* Fl = 250kHz */
  189 + .enable_gpio = -1,
189 190 };
190 191  
191 192 /*
arch/arm/mach-pxa/palm27x.c
... ... @@ -322,6 +322,7 @@
322 322 .max_brightness = 0xfe,
323 323 .dft_brightness = 0x7e,
324 324 .pwm_period_ns = 3500 * 1024,
  325 + .enable_gpio = -1,
325 326 .init = palm27x_backlight_init,
326 327 .notify = palm27x_backlight_notify,
327 328 .exit = palm27x_backlight_exit,
arch/arm/mach-pxa/palmtc.c
... ... @@ -166,45 +166,12 @@
166 166 * Backlight
167 167 ******************************************************************************/
168 168 #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE)
169   -static int palmtc_backlight_init(struct device *dev)
170   -{
171   - int ret;
172   -
173   - ret = gpio_request(GPIO_NR_PALMTC_BL_POWER, "BL POWER");
174   - if (ret)
175   - goto err;
176   - ret = gpio_direction_output(GPIO_NR_PALMTC_BL_POWER, 1);
177   - if (ret)
178   - goto err2;
179   -
180   - return 0;
181   -
182   -err2:
183   - gpio_free(GPIO_NR_PALMTC_BL_POWER);
184   -err:
185   - return ret;
186   -}
187   -
188   -static int palmtc_backlight_notify(struct device *dev, int brightness)
189   -{
190   - /* backlight is on when GPIO16 AF0 is high */
191   - gpio_set_value(GPIO_NR_PALMTC_BL_POWER, brightness);
192   - return brightness;
193   -}
194   -
195   -static void palmtc_backlight_exit(struct device *dev)
196   -{
197   - gpio_free(GPIO_NR_PALMTC_BL_POWER);
198   -}
199   -
200 169 static struct platform_pwm_backlight_data palmtc_backlight_data = {
201 170 .pwm_id = 1,
202 171 .max_brightness = PALMTC_MAX_INTENSITY,
203 172 .dft_brightness = PALMTC_MAX_INTENSITY,
204 173 .pwm_period_ns = PALMTC_PERIOD_NS,
205   - .init = palmtc_backlight_init,
206   - .notify = palmtc_backlight_notify,
207   - .exit = palmtc_backlight_exit,
  174 + .enable_gpio = GPIO_NR_PALMTC_BL_POWER,
208 175 };
209 176  
210 177 static struct platform_device palmtc_backlight = {
arch/arm/mach-pxa/palmte2.c
... ... @@ -165,6 +165,7 @@
165 165 .max_brightness = PALMTE2_MAX_INTENSITY,
166 166 .dft_brightness = PALMTE2_MAX_INTENSITY,
167 167 .pwm_period_ns = PALMTE2_PERIOD_NS,
  168 + .enable_gpio = -1,
168 169 .init = palmte2_backlight_init,
169 170 .notify = palmte2_backlight_notify,
170 171 .exit = palmte2_backlight_exit,
arch/arm/mach-pxa/pcm990-baseboard.c
... ... @@ -153,6 +153,7 @@
153 153 .max_brightness = 1023,
154 154 .dft_brightness = 1023,
155 155 .pwm_period_ns = 78770,
  156 + .enable_gpio = -1,
156 157 };
157 158  
158 159 static struct platform_device pcm990_backlight_device = {
arch/arm/mach-pxa/raumfeld.c
... ... @@ -539,6 +539,7 @@
539 539 .dft_brightness = 100,
540 540 /* 10000 ns = 10 ms ^= 100 kHz */
541 541 .pwm_period_ns = 10000,
  542 + .enable_gpio = -1,
542 543 };
543 544  
544 545 static struct platform_device raumfeld_pwm_backlight_device = {
arch/arm/mach-pxa/tavorevb.c
... ... @@ -175,6 +175,7 @@
175 175 .max_brightness = 100,
176 176 .dft_brightness = 100,
177 177 .pwm_period_ns = 100000,
  178 + .enable_gpio = -1,
178 179 },
179 180 [1] = {
180 181 /* secondary backlight */
... ... @@ -182,6 +183,7 @@
182 183 .max_brightness = 100,
183 184 .dft_brightness = 100,
184 185 .pwm_period_ns = 100000,
  186 + .enable_gpio = -1,
185 187 },
186 188 };
187 189  
arch/arm/mach-pxa/viper.c
... ... @@ -401,6 +401,7 @@
401 401 .max_brightness = 100,
402 402 .dft_brightness = 100,
403 403 .pwm_period_ns = 1000000,
  404 + .enable_gpio = -1,
404 405 .init = viper_backlight_init,
405 406 .notify = viper_backlight_notify,
406 407 .exit = viper_backlight_exit,
arch/arm/mach-pxa/z2.c
... ... @@ -206,6 +206,7 @@
206 206 .max_brightness = 1023,
207 207 .dft_brightness = 0,
208 208 .pwm_period_ns = 1260320,
  209 + .enable_gpio = -1,
209 210 },
210 211 [1] = {
211 212 /* LCD Backlight */
... ... @@ -213,6 +214,7 @@
213 214 .max_brightness = 1023,
214 215 .dft_brightness = 512,
215 216 .pwm_period_ns = 1260320,
  217 + .enable_gpio = -1,
216 218 },
217 219 };
218 220  
arch/arm/mach-pxa/zylonite.c
... ... @@ -125,6 +125,7 @@
125 125 .max_brightness = 100,
126 126 .dft_brightness = 100,
127 127 .pwm_period_ns = 10000,
  128 + .enable_gpio = -1,
128 129 };
129 130  
130 131 static struct platform_device zylonite_backlight_device = {