From patchwork Thu Apr 14 19:17:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris BREZILLON X-Patchwork-Id: 8841911 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7E6859F54F for ; Thu, 14 Apr 2016 19:22:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 98D8B20373 for ; Thu, 14 Apr 2016 19:22:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 41AAB20279 for ; Thu, 14 Apr 2016 19:22:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753344AbcDNTWD (ORCPT ); Thu, 14 Apr 2016 15:22:03 -0400 Received: from down.free-electrons.com ([37.187.137.238]:33944 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752396AbcDNTSr (ORCPT ); Thu, 14 Apr 2016 15:18:47 -0400 Received: by mail.free-electrons.com (Postfix, from userid 110) id B71C51B08; Thu, 14 Apr 2016 21:18:43 +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.9 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 (LFbn-1-2159-240.w90-76.abo.wanadoo.fr [90.76.216.240]) by mail.free-electrons.com (Postfix) with ESMTPSA id 0B97B241; Thu, 14 Apr 2016 21:18:27 +0200 (CEST) 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 , Kukjin Kim , Krzysztof Kozlowski , linux-samsung-soc@vger.kernel.org, intel-gfx@lists.freedesktop.org, Daniel Vetter , Jani Nikula , Jonathan Corbet , linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Hartley Sweeten , Ryan Mallon , Alexander Shiyan , Milo Kim , Doug Anderson , Caesar Wang , Stephen Barber , Boris Brezillon Subject: [PATCH v5 17/24] pwm: keep PWM state in sync with hardware state Date: Thu, 14 Apr 2016 21:17:37 +0200 Message-Id: <1460661464-11216-18-git-send-email-boris.brezillon@free-electrons.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1460661464-11216-1-git-send-email-boris.brezillon@free-electrons.com> References: <1460661464-11216-1-git-send-email-boris.brezillon@free-electrons.com> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Before the introduction of pwm_args, the core was resetting the PWM period and polarity states to the reference values (those provided through the DT, a PWM lookup table or hardcoded in the driver). Now that all PWM users are correctly using pwm_args to configure their PWM device, we can safely remove the pwm_apply_args() call in pwm_device_request(). We can also get rid of the pwm_set_period() call done in pwm_apply_args(), because PWM users are now directly using pargs->period instead of pwm_get_period(). By doing that we avoid messing with the current PWM period. The only remaining bit in pwm_apply_args() is the initial polarity setting, and it should go away when all PWM users have been patched to use the atomic API (with this API the polarity will be set along with other PWM arguments when configuring the PWM). Signed-off-by: Boris Brezillon --- drivers/pwm/core.c | 8 -------- include/linux/pwm.h | 1 - 2 files changed, 9 deletions(-) diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index ac89529..26c3cf5 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c @@ -128,14 +128,6 @@ static int pwm_device_request(struct pwm_device *pwm, const char *label) set_bit(PWMF_REQUESTED, &pwm->flags); pwm->label = label; - /* - * FIXME: this should be removed as soon as all PWM users are - * properly making use of pwm_args to initialize the PWM device. - * If we don't get rid of it, then PWM state and hardware can be - * desynchronized. - */ - pwm_apply_args(pwm); - return 0; } diff --git a/include/linux/pwm.h b/include/linux/pwm.h index c8859b7..2f500a5 100644 --- a/include/linux/pwm.h +++ b/include/linux/pwm.h @@ -170,7 +170,6 @@ static inline void pwm_get_args(const struct pwm_device *pwm, static inline void pwm_apply_args(struct pwm_device *pwm) { - pwm_set_period(pwm, pwm->args.period); pwm_set_polarity(pwm, pwm->args.polarity); }