From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964818AbcDLMEa (ORCPT ); Tue, 12 Apr 2016 08:04:30 -0400 Received: from down.free-electrons.com ([37.187.137.238]:34506 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756095AbcDLME1 (ORCPT ); Tue, 12 Apr 2016 08:04:27 -0400 Date: Tue, 12 Apr 2016 14:04:12 +0200 From: Boris Brezillon To: Thierry Reding Cc: linux-pwm@vger.kernel.org, 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, David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Hartley Sweeten , Ryan Mallon , Alexander Shiyan , Milo Kim Subject: Re: [PATCH v5 05/46] pwm: introduce the pwm_args concept Message-ID: <20160412140412.42704302@bbrezillon> In-Reply-To: <20160412113912.GK18882@ulmo.ba.sec> References: <1459368249-13241-1-git-send-email-boris.brezillon@free-electrons.com> <1459368249-13241-6-git-send-email-boris.brezillon@free-electrons.com> <20160412113912.GK18882@ulmo.ba.sec> X-Mailer: Claws Mail 3.12.0 (GTK+ 2.24.28; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 12 Apr 2016 13:39:12 +0200 Thierry Reding wrote: > On Wed, Mar 30, 2016 at 10:03:28PM +0200, Boris Brezillon wrote: > > Currently the PWM core mixes the current PWM state with the per-platform > > reference config (specified through the PWM lookup table, DT definition or > > directly hardcoded in PWM drivers). > > > > Create a pwm_args struct to store this reference config, so that PWM users > > can differentiate the current config from the reference one. > > > > Patch all places where pwm->args should be initialized. We keep the > > pwm_set_polarity/period() calls until all PWM users are patched to > > use pwm_args instead of pwm_get_period/polarity(). > > Perhaps a helper would be useful? Something like: > > static inline void > pwm_apply_args(struct pwm_device *pwm, const struct pwm_args *args) > { > pwm_set_duty_cycle(pwm, args->duty_cycle); > pwm_set_period(pwm, args->period); > } > > ? That would make it slightly easier to get rid of it again after all > clients have been converted. Sure. I'll add this helper. > > With the exception of pwm-clps711x all of these args are set at of_xlate > time (for DT) or from the lookup table in pwm_get() (for non-DT), so it > might even be possible to move this call to the core, so that removal of > it will be a one-liner. Not sure I get that one. Some drivers are implementing their own ->of_xlate() method, how would you get rid of this pwm_apply_args() in those custom implementations? -- Boris Brezillon, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com