From patchwork Mon May 19 20:42:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 4206291 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B784B9F1CD for ; Mon, 19 May 2014 20:50:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 06415202F0 for ; Mon, 19 May 2014 20:50:42 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3382A20266 for ; Mon, 19 May 2014 20:50:41 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WmUQm-0001AJ-UO; Mon, 19 May 2014 20:45:08 +0000 Received: from top.free-electrons.com ([176.31.233.9] helo=mail.free-electrons.com) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WmUPn-00086v-PK for linux-arm-kernel@lists.infradead.org; Mon, 19 May 2014 20:44:08 +0000 Received: by mail.free-electrons.com (Postfix, from userid 106) id C4856964; 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=-2.5 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 61813B3E; Mon, 19 May 2014 22:43:03 +0200 (CEST) From: Alexandre Belloni To: Thierry Reding Subject: [PATCHv2 resend 11/11] backlight: pwm_bl: retrieve configured pwm period Date: Mon, 19 May 2014 22:42:42 +0200 Message-Id: <1400532162-29483-12-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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140519_134407_982704_D6523C4F X-CRM114-Status: GOOD ( 13.43 ) X-Spam-Score: 0.3 (/) Cc: linux-pwm@vger.kernel.org, linux-fbdev@vger.kernel.org, Jingoo Han , Eric Miao , linux-sh@vger.kernel.org, Tony Lindgren , Bryan Wu , Magnus Damm , linux-kernel@vger.kernel.org, Haojian Zhuang , Simon Horman , Alexandre Belloni , linux-leds@vger.kernel.org, Philipp Zabel , Paul Parsons , linux-omap@vger.kernel.org, Lee Jones , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The PWM core is now able to initialize the PWM period from platform_data. Use it and if it is not configured, use the supplied pwm_period_ns. Signed-off-by: Alexandre Belloni --- drivers/video/backlight/pwm_bl.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index b75201ff46f6..1bb8a69062c5 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -304,12 +304,14 @@ static int pwm_backlight_probe(struct platform_device *pdev) /* * The DT case will set the pwm_period_ns field to 0 and store the * period, parsed from the DT, in the PWM device. For the non-DT case, - * set the period from platform data. + * set the period from platform data if it is not already set. */ - if (data->pwm_period_ns > 0) + pb->period = pwm_get_period(pb->pwm); + if (!pb->period && (data->pwm_period_ns > 0)) { + pb->period = data->pwm_period_ns; pwm_set_period(pb->pwm, data->pwm_period_ns); + } - pb->period = pwm_get_period(pb->pwm); pb->lth_brightness = data->lth_brightness * (pb->period / pb->scale); memset(&props, 0, sizeof(struct backlight_properties));