From: peter.ujfalusi@ti.com (Peter Ujfalusi)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 8/8] ARM: OMAP: omap3beagle: Use the pwm_leds driver to control the PMU_STAT led
Date: Fri, 18 Jan 2013 15:31:56 +0100 [thread overview]
Message-ID: <1358519516-13165-9-git-send-email-peter.ujfalusi@ti.com> (raw)
In-Reply-To: <1358519516-13165-1-git-send-email-peter.ujfalusi@ti.com>
With the PWM backed driver the PMU_STAT led's brighness can be controlled.
This needs the new drivers for the TWL PWM/LED to work.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
arch/arm/mach-omap2/board-omap3beagle.c | 39 ++++++++++++++++++++++++++-------
1 file changed, 31 insertions(+), 8 deletions(-)
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 909e7fa..2a6e8ad 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -20,6 +20,8 @@
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/leds.h>
+#include <linux/pwm.h>
+#include <linux/leds_pwm.h>
#include <linux/gpio.h>
#include <linux/input.h>
#include <linux/gpio_keys.h>
@@ -55,6 +57,32 @@
#define NAND_CS 0
+static struct pwm_lookup pwm_lookup[] = {
+ /* LEDB -> PMU_STAT */
+ PWM_LOOKUP("twl-pwmled", 1, "leds_pwm", "beagleboard::pmu_stat"),
+};
+
+static struct led_pwm pwm_leds[] = {
+ {
+ .name = "beagleboard::pmu_stat",
+ .max_brightness = 127,
+ .pwm_period_ns = 7812500,
+ },
+};
+
+static struct led_pwm_platform_data pwm_data = {
+ .num_leds = ARRAY_SIZE(pwm_leds),
+ .leds = pwm_leds,
+};
+
+static struct platform_device leds_pwm = {
+ .name = "leds_pwm",
+ .id = -1,
+ .dev = {
+ .platform_data = &pwm_data,
+ },
+};
+
/*
* OMAP3 Beagle revision
* Run time detection of Beagle revision is done by reading GPIO.
@@ -292,9 +320,6 @@ static int beagle_twl_gpio_setup(struct device *dev,
gpio_request_one(gpio + TWL4030_GPIO_MAX, beagle_config.usb_pwr_level,
"nEN_USB_PWR");
- /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */
- gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
-
return 0;
}
@@ -376,11 +401,6 @@ static struct gpio_led gpio_leds[] = {
.default_trigger = "mmc0",
.gpio = 149,
},
- {
- .name = "beagleboard::pmu_stat",
- .gpio = -EINVAL, /* gets replaced */
- .active_low = true,
- },
};
static struct gpio_led_platform_data gpio_led_info = {
@@ -428,6 +448,7 @@ static struct platform_device *omap3_beagle_devices[] __initdata = {
&leds_gpio,
&keys_gpio,
&madc_hwmon,
+ &leds_pwm,
};
static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
@@ -532,6 +553,8 @@ static void __init omap3_beagle_init(void)
/* Ensure SDRC pins are mux'd for self-refresh */
omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
+
+ pwm_add_table(pwm_lookup, ARRAY_SIZE(pwm_lookup));
}
MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board")
--
1.8.1
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 ` [PATCH v2 7/8] ARM: OMAP: board-4430sdp: Proper support for TWL6030 PWM LED/Backlight Peter Ujfalusi
2013-01-18 14:31 ` Peter Ujfalusi [this message]
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-9-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