From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thierry Reding Subject: Re: [PATCH v5 15/46] pwm: introduce the pwm_state concept Date: Tue, 12 Apr 2016 14:21:41 +0200 Message-ID: <20160412122141.GP18882@ulmo.ba.sec> References: <1459368249-13241-1-git-send-email-boris.brezillon@free-electrons.com> <1459368249-13241-16-git-send-email-boris.brezillon@free-electrons.com> <20160412114904.GM18882@ulmo.ba.sec> <20160412141718.5fe4cf24@bbrezillon> Reply-To: thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="6sj9mcRtP+pTWLOo" Return-path: Sender: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Content-Disposition: inline In-Reply-To: <20160412141718.5fe4cf24@bbrezillon> 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-leds@vger.kernel.org --6sj9mcRtP+pTWLOo Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline On Tue, Apr 12, 2016 at 02:17:18PM +0200, Boris Brezillon wrote: > On Tue, 12 Apr 2016 13:49:04 +0200 > Thierry Reding wrote: > > > On Wed, Mar 30, 2016 at 10:03:38PM +0200, Boris Brezillon wrote: > > > The PWM state, represented by its period, duty_cycle and polarity, > > > is currently directly stored in the PWM device. > > > Declare a pwm_state structure embedding those field so that we can later > > > use this struct to atomically update all the PWM parameters at once. > > > > > > All pwm_get_xxx() helpers are now implemented as wrappers around > > > pwm_get_state(). > > > > > > Signed-off-by: Boris Brezillon > > > --- > > > drivers/pwm/core.c | 8 ++++---- > > > include/linux/pwm.h | 54 +++++++++++++++++++++++++++++++++++++++++------------ > > > 2 files changed, 46 insertions(+), 16 deletions(-) > > > > > > diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c > > > index 6433059..f3f91e7 100644 > > > --- a/drivers/pwm/core.c > > > +++ b/drivers/pwm/core.c > > > @@ -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->state.polarity = polarity; > > > > Would this not more correctly be assigned to pwm->args.polarity? After > > all this is setting up the "initial" state, much like DT or the lookup > > tables would for duty cycle and period. > > Yes, I wasn't sure about the pwm_add_with_polarity() meaning. To me, > all the reference info should be extracted from DT, PWM lookup table or > driver specific ->request() implementation, but I can definitely > initialize the args.polarity here too. > > Should I keep the pwm->state.polarity assignment (to set the initial > polarity when the driver does not support hardware readout)? Wouldn't this work automatically as part of the pwm_apply_args() helper if we extended it with this setting? Thierry --6sj9mcRtP+pTWLOo-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756303AbcDLMVt (ORCPT ); Tue, 12 Apr 2016 08:21:49 -0400 Received: from mail-wm0-f41.google.com ([74.125.82.41]:36717 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755997AbcDLMVp (ORCPT ); Tue, 12 Apr 2016 08:21:45 -0400 Date: Tue, 12 Apr 2016 14:21:41 +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 15/46] pwm: introduce the pwm_state concept Message-ID: <20160412122141.GP18882@ulmo.ba.sec> References: <1459368249-13241-1-git-send-email-boris.brezillon@free-electrons.com> <1459368249-13241-16-git-send-email-boris.brezillon@free-electrons.com> <20160412114904.GM18882@ulmo.ba.sec> <20160412141718.5fe4cf24@bbrezillon> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="6sj9mcRtP+pTWLOo" Content-Disposition: inline In-Reply-To: <20160412141718.5fe4cf24@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 --6sj9mcRtP+pTWLOo Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 12, 2016 at 02:17:18PM +0200, Boris Brezillon wrote: > On Tue, 12 Apr 2016 13:49:04 +0200 > Thierry Reding wrote: >=20 > > On Wed, Mar 30, 2016 at 10:03:38PM +0200, Boris Brezillon wrote: > > > The PWM state, represented by its period, duty_cycle and polarity, > > > is currently directly stored in the PWM device. > > > Declare a pwm_state structure embedding those field so that we can la= ter > > > use this struct to atomically update all the PWM parameters at once. > > >=20 > > > All pwm_get_xxx() helpers are now implemented as wrappers around > > > pwm_get_state(). > > >=20 > > > Signed-off-by: Boris Brezillon > > > --- > > > drivers/pwm/core.c | 8 ++++---- > > > include/linux/pwm.h | 54 +++++++++++++++++++++++++++++++++++++++++--= ---------- > > > 2 files changed, 46 insertions(+), 16 deletions(-) > > >=20 > > > diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c > > > index 6433059..f3f91e7 100644 > > > --- a/drivers/pwm/core.c > > > +++ b/drivers/pwm/core.c > > > @@ -268,7 +268,7 @@ int pwmchip_add_with_polarity(struct pwm_chip *ch= ip, > > > pwm->chip =3D chip; > > > pwm->pwm =3D chip->base + i; > > > pwm->hwpwm =3D i; > > > - pwm->polarity =3D polarity; > > > + pwm->state.polarity =3D polarity; > >=20 > > Would this not more correctly be assigned to pwm->args.polarity? After > > all this is setting up the "initial" state, much like DT or the lookup > > tables would for duty cycle and period. >=20 > Yes, I wasn't sure about the pwm_add_with_polarity() meaning. To me, > all the reference info should be extracted from DT, PWM lookup table or > driver specific ->request() implementation, but I can definitely > initialize the args.polarity here too. >=20 > Should I keep the pwm->state.polarity assignment (to set the initial > polarity when the driver does not support hardware readout)? Wouldn't this work automatically as part of the pwm_apply_args() helper if we extended it with this setting? Thierry --6sj9mcRtP+pTWLOo Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAABCAAGBQJXDOhVAAoJEN0jrNd/PrOhhwkQAJV2017vhS1DAf1uCVQWtngM JY9NrWrvCeS1qLmCzic1jLPGRxoGl6Nh2TaVItVM8Ovr4/rPTOFpWSyrYNy/2mHv FYQ/nEDzm9bjKLv5fbROW74egNBVvvBd1mxan7RVMuwR7aLjZa3mQv85cLTtNjIU +bo4YMRkt4yW27zssHFcWg4TDBgRfbeOOKhgH6h8FujmeUiC7Vlom/hZVLpCx45H r90GeIp3xv8vHIqUpT4/bf+8UvTVVJsczUPIZ+9QnLPRMNAbyZZUrlJLXCJnVEDB 1xcxM9LGD3Kzr9BgxlA1POS0O3Jya46fhnMoSJOc04DSlYPnMPEHY5Qu6EpMhn58 wZPYdEcUZQwXqzV8x8Hn7HMdK21B78nF22D0u7/dcdpKNMWIaBfrNrNUNYgvnK3n HggfcpID6gTiuELb+aog3SxjN9ODf7WCxIWKHyJMRW9KYBn1WKpfH7PLKtw+ZTG+ u7/mx38Y4K6Az2XsZtgAN/x798xF45xcZfhEGhm4Y1DGkHItHcEsbrijfUOzxMFv rQmKT7H8x72UOwxEC4B+gWG+omzSxrzX9MDDIfsLvLxVALlOiAjFY8rrDkvSrcP0 Xh44M11vHHNQUQh9zvj2KXvZicjziq79CjvcUc3WmbbDgZU29eU+EU0sQa2xmPfj rBYFeFrNy3eyoIu2jFyI =J8+t -----END PGP SIGNATURE----- --6sj9mcRtP+pTWLOo-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thierry Reding Date: Tue, 12 Apr 2016 12:21:41 +0000 Subject: Re: [PATCH v5 15/46] pwm: introduce the pwm_state concept Message-Id: <20160412122141.GP18882@ulmo.ba.sec> MIME-Version: 1 Content-Type: multipart/mixed; boundary="6sj9mcRtP+pTWLOo" List-Id: References: <1459368249-13241-1-git-send-email-boris.brezillon@free-electrons.com> <1459368249-13241-16-git-send-email-boris.brezillon@free-electrons.com> <20160412114904.GM18882@ulmo.ba.sec> <20160412141718.5fe4cf24@bbrezillon> In-Reply-To: <20160412141718.5fe4cf24@bbrezillon> 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 --6sj9mcRtP+pTWLOo Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 12, 2016 at 02:17:18PM +0200, Boris Brezillon wrote: > On Tue, 12 Apr 2016 13:49:04 +0200 > Thierry Reding wrote: >=20 > > On Wed, Mar 30, 2016 at 10:03:38PM +0200, Boris Brezillon wrote: > > > The PWM state, represented by its period, duty_cycle and polarity, > > > is currently directly stored in the PWM device. > > > Declare a pwm_state structure embedding those field so that we can la= ter > > > use this struct to atomically update all the PWM parameters at once. > > >=20 > > > All pwm_get_xxx() helpers are now implemented as wrappers around > > > pwm_get_state(). > > >=20 > > > Signed-off-by: Boris Brezillon > > > --- > > > drivers/pwm/core.c | 8 ++++---- > > > include/linux/pwm.h | 54 +++++++++++++++++++++++++++++++++++++++++--= ---------- > > > 2 files changed, 46 insertions(+), 16 deletions(-) > > >=20 > > > diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c > > > index 6433059..f3f91e7 100644 > > > --- a/drivers/pwm/core.c > > > +++ b/drivers/pwm/core.c > > > @@ -268,7 +268,7 @@ int pwmchip_add_with_polarity(struct pwm_chip *ch= ip, > > > pwm->chip =3D chip; > > > pwm->pwm =3D chip->base + i; > > > pwm->hwpwm =3D i; > > > - pwm->polarity =3D polarity; > > > + pwm->state.polarity =3D polarity; > >=20 > > Would this not more correctly be assigned to pwm->args.polarity? After > > all this is setting up the "initial" state, much like DT or the lookup > > tables would for duty cycle and period. >=20 > Yes, I wasn't sure about the pwm_add_with_polarity() meaning. To me, > all the reference info should be extracted from DT, PWM lookup table or > driver specific ->request() implementation, but I can definitely > initialize the args.polarity here too. >=20 > Should I keep the pwm->state.polarity assignment (to set the initial > polarity when the driver does not support hardware readout)? Wouldn't this work automatically as part of the pwm_apply_args() helper if we extended it with this setting? Thierry --6sj9mcRtP+pTWLOo Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAABCAAGBQJXDOhVAAoJEN0jrNd/PrOhhwkQAJV2017vhS1DAf1uCVQWtngM JY9NrWrvCeS1qLmCzic1jLPGRxoGl6Nh2TaVItVM8Ovr4/rPTOFpWSyrYNy/2mHv FYQ/nEDzm9bjKLv5fbROW74egNBVvvBd1mxan7RVMuwR7aLjZa3mQv85cLTtNjIU +bo4YMRkt4yW27zssHFcWg4TDBgRfbeOOKhgH6h8FujmeUiC7Vlom/hZVLpCx45H r90GeIp3xv8vHIqUpT4/bf+8UvTVVJsczUPIZ+9QnLPRMNAbyZZUrlJLXCJnVEDB 1xcxM9LGD3Kzr9BgxlA1POS0O3Jya46fhnMoSJOc04DSlYPnMPEHY5Qu6EpMhn58 wZPYdEcUZQwXqzV8x8Hn7HMdK21B78nF22D0u7/dcdpKNMWIaBfrNrNUNYgvnK3n HggfcpID6gTiuELb+aog3SxjN9ODf7WCxIWKHyJMRW9KYBn1WKpfH7PLKtw+ZTG+ u7/mx38Y4K6Az2XsZtgAN/x798xF45xcZfhEGhm4Y1DGkHItHcEsbrijfUOzxMFv rQmKT7H8x72UOwxEC4B+gWG+omzSxrzX9MDDIfsLvLxVALlOiAjFY8rrDkvSrcP0 Xh44M11vHHNQUQh9zvj2KXvZicjziq79CjvcUc3WmbbDgZU29eU+EU0sQa2xmPfj rBYFeFrNy3eyoIu2jFyI =J8+t -----END PGP SIGNATURE----- --6sj9mcRtP+pTWLOo-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: thierry.reding@gmail.com (Thierry Reding) Date: Tue, 12 Apr 2016 14:21:41 +0200 Subject: [PATCH v5 15/46] pwm: introduce the pwm_state concept In-Reply-To: <20160412141718.5fe4cf24@bbrezillon> References: <1459368249-13241-1-git-send-email-boris.brezillon@free-electrons.com> <1459368249-13241-16-git-send-email-boris.brezillon@free-electrons.com> <20160412114904.GM18882@ulmo.ba.sec> <20160412141718.5fe4cf24@bbrezillon> Message-ID: <20160412122141.GP18882@ulmo.ba.sec> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Tue, Apr 12, 2016 at 02:17:18PM +0200, Boris Brezillon wrote: > On Tue, 12 Apr 2016 13:49:04 +0200 > Thierry Reding wrote: > > > On Wed, Mar 30, 2016 at 10:03:38PM +0200, Boris Brezillon wrote: > > > The PWM state, represented by its period, duty_cycle and polarity, > > > is currently directly stored in the PWM device. > > > Declare a pwm_state structure embedding those field so that we can later > > > use this struct to atomically update all the PWM parameters at once. > > > > > > All pwm_get_xxx() helpers are now implemented as wrappers around > > > pwm_get_state(). > > > > > > Signed-off-by: Boris Brezillon > > > --- > > > drivers/pwm/core.c | 8 ++++---- > > > include/linux/pwm.h | 54 +++++++++++++++++++++++++++++++++++++++++------------ > > > 2 files changed, 46 insertions(+), 16 deletions(-) > > > > > > diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c > > > index 6433059..f3f91e7 100644 > > > --- a/drivers/pwm/core.c > > > +++ b/drivers/pwm/core.c > > > @@ -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->state.polarity = polarity; > > > > Would this not more correctly be assigned to pwm->args.polarity? After > > all this is setting up the "initial" state, much like DT or the lookup > > tables would for duty cycle and period. > > Yes, I wasn't sure about the pwm_add_with_polarity() meaning. To me, > all the reference info should be extracted from DT, PWM lookup table or > driver specific ->request() implementation, but I can definitely > initialize the args.polarity here too. > > Should I keep the pwm->state.polarity assignment (to set the initial > polarity when the driver does not support hardware readout)? Wouldn't this work automatically as part of the pwm_apply_args() helper if we extended it with this setting? Thierry -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: