Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933739AbcDLNPN (ORCPT ); Tue, 12 Apr 2016 09:15:13 -0400 Received: from mail-wm0-f46.google.com ([74.125.82.46]:37927 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932523AbcDLNPJ (ORCPT ); Tue, 12 Apr 2016 09:15:09 -0400 Date: Tue, 12 Apr 2016 15:15:03 +0200 From: Thierry Reding To: Boris Brezillon 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: <20160412131503.GR18882@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> <20160412150627.7084665d@bbrezillon> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="TDVcAd+kFgbLxwBe" Content-Disposition: inline In-Reply-To: <20160412150627.7084665d@bbrezillon> User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3690 Lines: 89 --TDVcAd+kFgbLxwBe Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 12, 2016 at 03:06:27PM +0200, Boris Brezillon wrote: > On Tue, 12 Apr 2016 13:39:12 +0200 > Thierry Reding wrote: >=20 > > 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-platf= orm > > > reference config (specified through the PWM lookup table, DT definiti= on or > > > directly hardcoded in PWM drivers). > > >=20 > > > Create a pwm_args struct to store this reference config, so that PWM = users > > > can differentiate the current config from the reference one. > > >=20 > > > 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(). > >=20 > > Perhaps a helper would be useful? Something like: > >=20 > > 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); > > } > >=20 > > ? That would make it slightly easier to get rid of it again after all > > clients have been converted. > >=20 > > 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. >=20 > Okay, I think I misunderstood your suggestion. I thought you wanted > this helper to set the reference config, but you actually want to apply > a new state based on the PWM reference values. >=20 > Except that pwm_args does not contain all the required information to > apply a full config (args->duty_cycle and args->enable do not exist). >=20 > This being said, in my v6 I moved the content of > pwm_regulator_adjust_pwm_config() (patch 27) into a generic helper > (pwm_adjust_config()). This helper is doing pretty much what you're > suggesting here (but again, I'm not sure I correctly understood your > suggestion :-/). I'm not suggesting that pwm_apply_args() apply any state. I think we both agreed earlier that the initial state (represented by pwm_args) was never to be automatically applied. What I was suggesting is that we move all the calls to pwm_set_period() and pwm_set_duty_cycle() into a central location to make it easier to remove them later in the series. This is really only temporary, so I don't mind if we leave the calls sprinkled all over the place. At least that way I hope we'll avoid confusion about what we're talking about =3D) Thierry --TDVcAd+kFgbLxwBe Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAABCAAGBQJXDPTXAAoJEN0jrNd/PrOh43wP/RW8nWeST0v0826zi4V45N1E +TYv38nqsVYDmlhydRpEmUUzDp+i8P+jXS+FD48OsEByyvLzF6NOdtbD7H2no8zb 7o4G2twqZSwmNTKGcVVnDnvxqsTLRbB/zsSGqPO9NJ3Zu0wBS+0Xg5Vjqk6PmIRR LSmzUQc5Cd6Mvb9aQqois5iJ0ivNQlB2YlJ8DYUXfPakj0cc5DpQg1D71c+jCsVL REicaT6lu64/oaO2Jkth+9sGtJ3Z4mCoKCRtiAUKSLFojHnhX+ZbPS1U+vgip5UD 5h3NPaZytj2T/8TdmNceNF2uzpSq5+pc8N37CFpIxcmvhgb3DU24dVsOJyEW5PAk QzYA5LDTmAQMsWDSDcoU1pUbxdfIRrIJ6q9kUgIX+aPIcKY8FIJ08XnX5k05Eyve 4qr29sV/0csHazKsdL94LhfxpmP87DNaLZP3CBXQt8R5PkYFpFY4tAVsYyiRdV0M mo9yGfddFafGvqJbLSi19GhXW7tGoFsItMJB843opLZ77mE3VgpLHMCCr6MRGgjK ZWWETRUpY2iF72dZc5eJH2cTacw4eAhkkwmi8xHy2aS2tvvzwUnMSagOF1S0NdSP lAKl9Y1DcwSrlYNuDkeKIcMULMqC74RB+qM8kdpLiiH08xsBGEKftUt7NGeRg/nx DCr+t7SdbH+cClDjpBxu =AuFt -----END PGP SIGNATURE----- --TDVcAd+kFgbLxwBe--