From patchwork Mon Nov 16 08:56:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris BREZILLON X-Patchwork-Id: 7622831 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 47756BF90C for ; Mon, 16 Nov 2015 09:05:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5350D2034A for ; Mon, 16 Nov 2015 09:05:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 510DC20376 for ; Mon, 16 Nov 2015 09:05:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752651AbbKPJFR (ORCPT ); Mon, 16 Nov 2015 04:05:17 -0500 Received: from down.free-electrons.com ([37.187.137.238]:34631 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752251AbbKPI5D (ORCPT ); Mon, 16 Nov 2015 03:57:03 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id E43C4417; Mon, 16 Nov 2015 09:57:00 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from localhost.localdomain (AToulouse-657-1-1082-82.w92-146.abo.wanadoo.fr [92.146.160.82]) by mail.free-electrons.com (Postfix) with ESMTPSA id E1D0A420; Mon, 16 Nov 2015 09:56:57 +0100 (CET) From: Boris Brezillon To: Thierry Reding , linux-pwm@vger.kernel.org Cc: Mike Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Mark Brown , Liam Girdwood , Kamil Debski , lm-sensors@lm-sensors.org, Jean Delvare , Guenter Roeck , Dmitry Torokhov , linux-input@vger.kernel.org, Bryan Wu , Richard Purdie , Jacek Anaszewski , linux-leds@vger.kernel.org, Maxime Ripard , Chen-Yu Tsai , linux-sunxi@googlegroups.com, Joachim Eastwood , Thomas Petazzoni , Heiko Stuebner , linux-rockchip@lists.infradead.org, Jingoo Han , Lee Jones , linux-fbdev@vger.kernel.org, Jean-Christophe Plagniol-Villard , Tomi Valkeinen , Robert Jarzmik , Alexandre Belloni , Julia Lawall , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Boris Brezillon Subject: [PATCH v4 07/24] pwm: use pwm_get/set_default_xxx() helpers where appropriate Date: Mon, 16 Nov 2015 09:56:30 +0100 Message-Id: <1447664207-24370-8-git-send-email-boris.brezillon@free-electrons.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1447664207-24370-1-git-send-email-boris.brezillon@free-electrons.com> References: <1447664207-24370-1-git-send-email-boris.brezillon@free-electrons.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP pwm_set/get_default_xxx() helpers have been introduced to differentiate the default PWM states (those retrieved through DT, PWM lookup table or statically assigned by the driver) and the current PWM ones. Make use of those helpers where appropriate. Signed-off-by: Boris Brezillon Tested-by: Heiko Stuebner Reviewed-by: Alexandre Belloni Acked-by: Robert Jarzmik --- drivers/pwm/core.c | 14 +++++++------- drivers/pwm/pwm-pxa.c | 2 +- drivers/pwm/pwm-sun4i.c | 3 ++- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index d24ca5f..59073a1 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c @@ -146,12 +146,12 @@ of_pwm_xlate_with_flags(struct pwm_chip *pc, const struct of_phandle_args *args) if (IS_ERR(pwm)) return pwm; - pwm_set_period(pwm, args->args[1]); + pwm_set_default_period(pwm, args->args[1]); if (args->args[2] & PWM_POLARITY_INVERTED) - pwm_set_polarity(pwm, PWM_POLARITY_INVERSED); + pwm_set_default_polarity(pwm, PWM_POLARITY_INVERSED); else - pwm_set_polarity(pwm, PWM_POLARITY_NORMAL); + pwm_set_default_polarity(pwm, PWM_POLARITY_NORMAL); return pwm; } @@ -172,7 +172,7 @@ of_pwm_simple_xlate(struct pwm_chip *pc, const struct of_phandle_args *args) if (IS_ERR(pwm)) return pwm; - pwm_set_period(pwm, args->args[1]); + pwm_set_default_period(pwm, args->args[1]); return pwm; } @@ -268,7 +268,7 @@ int pwmchip_add_with_polarity(struct pwm_chip *chip, pwm->chip = chip; pwm->pwm = chip->base + i; pwm->hwpwm = i; - pwm->polarity = polarity; + pwm_set_default_polarity(pwm, polarity); mutex_init(&pwm->lock); radix_tree_insert(&pwm_tree, pwm->pwm, pwm); @@ -751,8 +751,8 @@ struct pwm_device *pwm_get(struct device *dev, const char *con_id) if (IS_ERR(pwm)) goto out; - pwm_set_period(pwm, chosen->period); - pwm_set_polarity(pwm, chosen->polarity); + pwm_set_default_period(pwm, chosen->period); + pwm_set_default_polarity(pwm, chosen->polarity); out: mutex_unlock(&pwm_lookup_lock); diff --git a/drivers/pwm/pwm-pxa.c b/drivers/pwm/pwm-pxa.c index cb2f702..65b80aa 100644 --- a/drivers/pwm/pwm-pxa.c +++ b/drivers/pwm/pwm-pxa.c @@ -160,7 +160,7 @@ pxa_pwm_of_xlate(struct pwm_chip *pc, const struct of_phandle_args *args) if (IS_ERR(pwm)) return pwm; - pwm_set_period(pwm, args->args[0]); + pwm_set_default_period(pwm, args->args[0]); return pwm; } diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c index 67af9f6..f6a7451 100644 --- a/drivers/pwm/pwm-sun4i.c +++ b/drivers/pwm/pwm-sun4i.c @@ -354,7 +354,8 @@ static int sun4i_pwm_probe(struct platform_device *pdev) val = sun4i_pwm_readl(pwm, PWM_CTRL_REG); for (i = 0; i < pwm->chip.npwm; i++) if (!(val & BIT_CH(PWM_ACT_STATE, i))) - pwm->chip.pwms[i].polarity = PWM_POLARITY_INVERSED; + pwm_set_default_polarity(&pwm->chip.pwms[i], + PWM_POLARITY_INVERSED); clk_disable_unprepare(pwm->clk); return 0;