From patchwork Fri Jan 18 14:31:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 2003111 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 61BDF3FED4 for ; Fri, 18 Jan 2013 14:36:25 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TwD14-0005YB-Fq; Fri, 18 Jan 2013 14:33:58 +0000 Received: from devils.ext.ti.com ([198.47.26.153]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TwCzH-0004mE-Iw for linux-arm-kernel@lists.infradead.org; Fri, 18 Jan 2013 14:32:11 +0000 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id r0IEW6lU011979; Fri, 18 Jan 2013 08:32:06 -0600 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id r0IEW6GR000678; Fri, 18 Jan 2013 08:32:06 -0600 Received: from dlelxv22.itg.ti.com (172.17.1.197) by dfle73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.1.323.3; Fri, 18 Jan 2013 08:32:06 -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 r0IEVvfL027919; Fri, 18 Jan 2013 08:32:05 -0600 From: Peter Ujfalusi To: Tony Lindgren 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 Message-ID: <1358519516-13165-8-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_093207_767528_3ABFF3C2 X-CRM114-Status: GOOD ( 15.73 ) 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.153 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 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 --- 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 #include #include +#include #include #include +#include #include #include @@ -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);