From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thierry Reding Subject: Re: [PATCH v5 05/46] pwm: introduce the pwm_args concept Date: Tue, 12 Apr 2016 13:39:12 +0200 Message-ID: <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> Reply-To: thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Ah40dssYA/cDqAW1" Return-path: Sender: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Content-Disposition: inline In-Reply-To: <1459368249-13241-6-git-send-email-boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , To: Boris Brezillon Cc: linux-pwm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Mike Turquette , Stephen Boyd , linux-clk-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Mark Brown , Liam Girdwood , Kamil Debski , lm-sensors-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org, Jean Delvare , Guenter Roeck , Dmitry Torokhov , linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Bryan Wu , Richard Purdie , Jacek Anaszewski , linux-leds-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Maxime Ripard , Chen-Yu Tsai , linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org, Joachim Eastwood , Thomas Petazzoni , Heiko Stuebner , linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, Jingoo Han , Lee Jones List-Id: linux-input@vger.kernel.org --Ah40dssYA/cDqAW1 Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline 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. 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. Thierry --Ah40dssYA/cDqAW1--