From patchwork Mon May 19 20:42:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 4205881 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 75512BEEAB for ; Mon, 19 May 2014 20:44:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9DC89202DD for ; Mon, 19 May 2014 20:44:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AC25920279 for ; Mon, 19 May 2014 20:44:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752183AbaESUn5 (ORCPT ); Mon, 19 May 2014 16:43:57 -0400 Received: from top.free-electrons.com ([176.31.233.9]:55044 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751758AbaESUnx (ORCPT ); Mon, 19 May 2014 16:43:53 -0400 Received: by mail.free-electrons.com (Postfix, from userid 106) id 8DA448B8; Mon, 19 May 2014 22:43:56 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from localhost (128-79-216-6.hfc.dyn.abo.bbox.fr [128.79.216.6]) by mail.free-electrons.com (Postfix) with ESMTPSA id A6A4AA8F; Mon, 19 May 2014 22:43:02 +0200 (CEST) From: Alexandre Belloni To: Thierry Reding Cc: Tony Lindgren , Philipp Zabel , Paul Parsons , Simon Horman , Magnus Damm , Eric Miao , Haojian Zhuang , Bryan Wu , Jingoo Han , Lee Jones , linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, linux-sh@vger.kernel.org, linux-leds@vger.kernel.org, linux-fbdev@vger.kernel.org, Alexandre Belloni Subject: [PATCHv2 resend 10/11] leds: leds-pwm: retrieve configured pwm period Date: Mon, 19 May 2014 22:42:41 +0200 Message-Id: <1400532162-29483-11-git-send-email-alexandre.belloni@free-electrons.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1400532162-29483-1-git-send-email-alexandre.belloni@free-electrons.com> References: <1400532162-29483-1-git-send-email-alexandre.belloni@free-electrons.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The PWM core is now able to initialize the PWM period. Use it and if it is not configured, use the supplied pwm_period_ns. Signed-off-by: Alexandre Belloni --- drivers/leds/leds-pwm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c index 7d0aaed1e23a..aa770ec1e892 100644 --- a/drivers/leds/leds-pwm.c +++ b/drivers/leds/leds-pwm.c @@ -181,7 +181,6 @@ static int led_pwm_probe(struct platform_device *pdev) led_dat->cdev.name = cur_led->name; led_dat->cdev.default_trigger = cur_led->default_trigger; led_dat->active_low = cur_led->active_low; - led_dat->period = cur_led->pwm_period_ns; led_dat->cdev.brightness_set = led_pwm_set; led_dat->cdev.brightness = LED_OFF; led_dat->cdev.max_brightness = cur_led->max_brightness; @@ -191,6 +190,10 @@ static int led_pwm_probe(struct platform_device *pdev) if (led_dat->can_sleep) INIT_WORK(&led_dat->work, led_pwm_work); + led_dat->period = pwm_get_period(led_dat->pwm); + if (!led_dat->period && (cur_led->pwm_period_ns > 0)) + led_dat->period = cur_led->pwm_period_ns; + ret = led_classdev_register(&pdev->dev, &led_dat->cdev); if (ret < 0) goto err;