From: peter.ujfalusi@ti.com (Peter Ujfalusi)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 7/8] ARM: OMAP: board-4430sdp: Proper support for TWL6030 PWM LED/Backlight
Date: Fri, 18 Jan 2013 15:31:55 +0100 [thread overview]
Message-ID: <1358519516-13165-8-git-send-email-peter.ujfalusi@ti.com> (raw)
In-Reply-To: <1358519516-13165-1-git-send-email-peter.ujfalusi@ti.com>
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>
---
arch/arm/mach-omap2/board-4430sdp.c | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 1cc6696..918b73b 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -24,8 +24,10 @@
#include <linux/gpio_keys.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/fixed.h>
+#include <linux/pwm.h>
#include <linux/leds.h>
#include <linux/leds_pwm.h>
+#include <linux/pwm_backlight.h>
#include <linux/platform_data/omap4-keypad.h>
#include <linux/usb/musb.h>
@@ -256,10 +258,20 @@ static struct gpio_led_platform_data sdp4430_led_data = {
.num_leds = ARRAY_SIZE(sdp4430_gpio_leds),
};
+static struct pwm_lookup sdp4430_pwm_lookup[] = {
+ PWM_LOOKUP("twl-pwm", 0, "leds_pwm", "omap4::keypad"),
+ PWM_LOOKUP("twl-pwm", 1, "pwm-backlight", NULL),
+ PWM_LOOKUP("twl-pwmled", 0, "leds_pwm", "omap4:green:chrg"),
+};
+
static struct led_pwm sdp4430_pwm_leds[] = {
{
+ .name = "omap4::keypad",
+ .max_brightness = 127,
+ .pwm_period_ns = 7812500,
+ },
+ {
.name = "omap4:green:chrg",
- .pwm_id = 1,
.max_brightness = 255,
.pwm_period_ns = 7812500,
},
@@ -278,6 +290,20 @@ static struct platform_device sdp4430_leds_pwm = {
},
};
+static struct platform_pwm_backlight_data sdp4430_backlight_data = {
+ .max_brightness = 127,
+ .dft_brightness = 127,
+ .pwm_period_ns = 7812500,
+};
+
+static struct platform_device sdp4430_backlight_pwm = {
+ .name = "pwm-backlight",
+ .id = -1,
+ .dev = {
+ .platform_data = &sdp4430_backlight_data,
+ },
+};
+
static int omap_prox_activate(struct device *dev)
{
gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 1);
@@ -412,6 +438,7 @@ static struct platform_device *sdp4430_devices[] __initdata = {
&sdp4430_gpio_keys_device,
&sdp4430_leds_gpio,
&sdp4430_leds_pwm,
+ &sdp4430_backlight_pwm,
&sdp4430_vbat,
&sdp4430_dmic_codec,
&sdp4430_abe_audio,
@@ -707,6 +734,7 @@ static void __init omap_4430sdp_init(void)
ARRAY_SIZE(sdp4430_spi_board_info));
}
+ pwm_add_table(sdp4430_pwm_lookup, ARRAY_SIZE(sdp4430_pwm_lookup));
status = omap4_keyboard_init(&sdp4430_keypad_data, &keypad_data);
if (status)
pr_err("Keypad initialization failed: %d\n", status);
--
1.8.1
next prev parent reply other threads:[~2013-01-18 14:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-18 14:31 [PATCH v2 0/8] ARM: OMAP: Audio support via omap-twl4030 and pwm support Peter Ujfalusi
2013-01-18 14:31 ` [PATCH v2 1/8] ARM: OMAP: 3430sdp: Enable extmute functionality for audio Peter Ujfalusi
2013-01-18 14:31 ` [PATCH v2 2/8] ARM: OMAP: zoom: Zoom2 does not have extmute functionality Peter Ujfalusi
2013-01-18 14:31 ` [PATCH v2 3/8] ARM: OMAP2+: twl-common: Add default twl4030 audio configuration Peter Ujfalusi
2013-01-18 14:31 ` [PATCH v2 4/8] ARM: OMAP2+: twl-common: Allow boards to customize the twl4030 audio setup Peter Ujfalusi
2013-01-18 14:31 ` [PATCH v2 5/8] ARM: OMAP: zoom: Audio support via the common omap-twl4030 machine driver Peter Ujfalusi
2013-01-18 14:31 ` [PATCH v2 6/8] ARM: OMAP: sdp3430: " Peter Ujfalusi
2013-01-18 14:31 ` Peter Ujfalusi [this message]
2013-01-18 14:31 ` [PATCH v2 8/8] ARM: OMAP: omap3beagle: Use the pwm_leds driver to control the PMU_STAT led Peter Ujfalusi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1358519516-13165-8-git-send-email-peter.ujfalusi@ti.com \
--to=peter.ujfalusi@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox