Browse Source

ARM: pxa: lpd270: Use PWM lookup table

Use a PWM lookup table to provide the PWM to the pwm-backlight device.
The driver has a legacy code path that is required only because boards
still use the legacy method of requesting PWMs by global ID. Replacing
these usages allows that legacy fallback to be removed.

Cc: Daniel Mack <daniel@zonque.org>
Cc: Haojian Zhuang <haojian.zhuang@gmail.com>
Cc: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Thierry Reding 9 years ago
parent
commit
2dc9975a51
1 changed files with 7 additions and 2 deletions
  1. 7 2
      arch/arm/mach-pxa/lpd270.c

+ 7 - 2
arch/arm/mach-pxa/lpd270.c

@@ -23,6 +23,7 @@
 #include <linux/ioport.h>
 #include <linux/ioport.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/partitions.h>
+#include <linux/pwm.h>
 #include <linux/pwm_backlight.h>
 #include <linux/pwm_backlight.h>
 #include <linux/smc91x.h>
 #include <linux/smc91x.h>
 
 
@@ -271,11 +272,14 @@ static struct platform_device lpd270_flash_device[2] = {
 	},
 	},
 };
 };
 
 
+static struct pwm_lookup lpd270_pwm_lookup[] = {
+	PWM_LOOKUP("pxa27x-pwm.0", 0, "pwm-backlight.0", NULL, 78770,
+		   PWM_POLARITY_NORMAL),
+};
+
 static struct platform_pwm_backlight_data lpd270_backlight_data = {
 static struct platform_pwm_backlight_data lpd270_backlight_data = {
-	.pwm_id		= 0,
 	.max_brightness	= 1,
 	.max_brightness	= 1,
 	.dft_brightness	= 1,
 	.dft_brightness	= 1,
-	.pwm_period_ns	= 78770,
 	.enable_gpio	= -1,
 	.enable_gpio	= -1,
 };
 };
 
 
@@ -474,6 +478,7 @@ static void __init lpd270_init(void)
 	 */
 	 */
 	ARB_CNTRL = ARB_CORE_PARK | 0x234;
 	ARB_CNTRL = ARB_CORE_PARK | 0x234;
 
 
+	pwm_add_table(lpd270_pwm_lookup, ARRAY_SIZE(lpd270_pwm_lookup));
 	platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
 	platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
 
 
 	pxa_set_ac97_info(NULL);
 	pxa_set_ac97_info(NULL);