From patchwork Fri Jan 18 14:31:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 2003171 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 328903FED4 for ; Fri, 18 Jan 2013 14:36:53 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TwD1K-0005nC-7m; Fri, 18 Jan 2013 14:34:14 +0000 Received: from comal.ext.ti.com ([198.47.26.152]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TwCzI-0004mm-PF for linux-arm-kernel@lists.infradead.org; Fri, 18 Jan 2013 14:32:12 +0000 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id r0IEW7Mu005745; Fri, 18 Jan 2013 08:32:07 -0600 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id r0IEW7GD000697; Fri, 18 Jan 2013 08:32:07 -0600 Received: from dlelxv22.itg.ti.com (172.17.1.197) by dfle72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.1.323.3; Fri, 18 Jan 2013 08:32:07 -0600 Received: from barack.emea.dhcp.ti.com (barack.emea.dhcp.ti.com [137.167.125.64]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id r0IEVvfM027919; Fri, 18 Jan 2013 08:32:06 -0600 From: Peter Ujfalusi To: Tony Lindgren 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 Message-ID: <1358519516-13165-9-git-send-email-peter.ujfalusi@ti.com> X-Mailer: git-send-email 1.8.1 In-Reply-To: <1358519516-13165-1-git-send-email-peter.ujfalusi@ti.com> References: <1358519516-13165-1-git-send-email-peter.ujfalusi@ti.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130118_093208_965837_5541CAE7 X-CRM114-Status: GOOD ( 17.09 ) X-Spam-Score: -7.6 (-------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-7.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [198.47.26.152 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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 --- 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 #include #include +#include +#include #include #include #include @@ -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")