aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2012-11-07 05:40:18 -0500
committerPeter Ujfalusi <peter.ujfalusi@ti.com>2013-01-22 04:35:04 -0500
commit42997c4b2ec3c5dcf97c739cd64128d3e55d8f31 (patch)
tree74cfeb1d7f3d30094b4c1e1c4949e77a2c7eb865 /arch
parent77f86144984e4cd375c9dcda83b79f32670f85fe (diff)
ARM: OMAP: board-4430sdp: Proper support for TWL6030 PWM LED/Backlight
New PWM drivers are being prepared for twl series which will enable the use of all PWMs (PWMs and LEDs). They are implemented as generic PWM drivers to be able to use them for different purposes. The current platform code was broken: the leds_pwm driver was not able to pick up the PWM since the pwm_id was incorrect. With the other patches we will be able to control the followings: LCD backlight via pwm-backlight driver Keypad leds via leds_pwm driver as normal LED Charging indicator via leds_pwm driver as normal LED Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-omap2/board-4430sdp.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 1cc6696594fd..918b73bd0215 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -24,8 +24,10 @@
24#include <linux/gpio_keys.h> 24#include <linux/gpio_keys.h>
25#include <linux/regulator/machine.h> 25#include <linux/regulator/machine.h>
26#include <linux/regulator/fixed.h> 26#include <linux/regulator/fixed.h>
27#include <linux/pwm.h>
27#include <linux/leds.h> 28#include <linux/leds.h>
28#include <linux/leds_pwm.h> 29#include <linux/leds_pwm.h>
30#include <linux/pwm_backlight.h>
29#include <linux/platform_data/omap4-keypad.h> 31#include <linux/platform_data/omap4-keypad.h>
30#include <linux/usb/musb.h> 32#include <linux/usb/musb.h>
31 33
@@ -256,10 +258,20 @@ static struct gpio_led_platform_data sdp4430_led_data = {
256 .num_leds = ARRAY_SIZE(sdp4430_gpio_leds), 258 .num_leds = ARRAY_SIZE(sdp4430_gpio_leds),
257}; 259};
258 260
261static struct pwm_lookup sdp4430_pwm_lookup[] = {
262 PWM_LOOKUP("twl-pwm", 0, "leds_pwm", "omap4::keypad"),
263 PWM_LOOKUP("twl-pwm", 1, "pwm-backlight", NULL),
264 PWM_LOOKUP("twl-pwmled", 0, "leds_pwm", "omap4:green:chrg"),
265};
266
259static struct led_pwm sdp4430_pwm_leds[] = { 267static struct led_pwm sdp4430_pwm_leds[] = {
260 { 268 {
269 .name = "omap4::keypad",
270 .max_brightness = 127,
271 .pwm_period_ns = 7812500,
272 },
273 {
261 .name = "omap4:green:chrg", 274 .name = "omap4:green:chrg",
262 .pwm_id = 1,
263 .max_brightness = 255, 275 .max_brightness = 255,
264 .pwm_period_ns = 7812500, 276 .pwm_period_ns = 7812500,
265 }, 277 },
@@ -278,6 +290,20 @@ static struct platform_device sdp4430_leds_pwm = {
278 }, 290 },
279}; 291};
280 292
293static struct platform_pwm_backlight_data sdp4430_backlight_data = {
294 .max_brightness = 127,
295 .dft_brightness = 127,
296 .pwm_period_ns = 7812500,
297};
298
299static struct platform_device sdp4430_backlight_pwm = {
300 .name = "pwm-backlight",
301 .id = -1,
302 .dev = {
303 .platform_data = &sdp4430_backlight_data,
304 },
305};
306
281static int omap_prox_activate(struct device *dev) 307static int omap_prox_activate(struct device *dev)
282{ 308{
283 gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 1); 309 gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 1);
@@ -412,6 +438,7 @@ static struct platform_device *sdp4430_devices[] __initdata = {
412 &sdp4430_gpio_keys_device, 438 &sdp4430_gpio_keys_device,
413 &sdp4430_leds_gpio, 439 &sdp4430_leds_gpio,
414 &sdp4430_leds_pwm, 440 &sdp4430_leds_pwm,
441 &sdp4430_backlight_pwm,
415 &sdp4430_vbat, 442 &sdp4430_vbat,
416 &sdp4430_dmic_codec, 443 &sdp4430_dmic_codec,
417 &sdp4430_abe_audio, 444 &sdp4430_abe_audio,
@@ -707,6 +734,7 @@ static void __init omap_4430sdp_init(void)
707 ARRAY_SIZE(sdp4430_spi_board_info)); 734 ARRAY_SIZE(sdp4430_spi_board_info));
708 } 735 }
709 736
737 pwm_add_table(sdp4430_pwm_lookup, ARRAY_SIZE(sdp4430_pwm_lookup));
710 status = omap4_keyboard_init(&sdp4430_keypad_data, &keypad_data); 738 status = omap4_keyboard_init(&sdp4430_keypad_data, &keypad_data);
711 if (status) 739 if (status)
712 pr_err("Keypad initialization failed: %d\n", status); 740 pr_err("Keypad initialization failed: %d\n", status);