From: Thierry Reding <thierry.reding@gmail.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: linux-pwm@vger.kernel.org,
Sebastien Bourdelin <sebastien.bourdelin@savoirfairelinux.com>,
linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de
Subject: Re: [PATCH 3/4] bus: ts-nbus: convert to atomic PWM API
Date: Wed, 14 Nov 2018 13:15:04 +0100 [thread overview]
Message-ID: <20181114121504.GE2620@ulmo> (raw)
In-Reply-To: <20181026184157.16371-3-u.kleine-koenig@pengutronix.de>
[-- Attachment #1.1: Type: text/plain, Size: 1945 bytes --]
On Fri, Oct 26, 2018 at 08:41:57PM +0200, Uwe Kleine-König wrote:
> The legacy PWM API should be removed in the long run, so convert a user
> to the atomic PWM API.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> drivers/bus/ts-nbus.c | 20 +++++++-------------
> 1 file changed, 7 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/bus/ts-nbus.c b/drivers/bus/ts-nbus.c
> index 073fd9011154..51f5ed870ad1 100644
> --- a/drivers/bus/ts-nbus.c
> +++ b/drivers/bus/ts-nbus.c
> @@ -282,7 +282,7 @@ EXPORT_SYMBOL_GPL(ts_nbus_write);
> static int ts_nbus_probe(struct platform_device *pdev)
> {
> struct pwm_device *pwm;
> - struct pwm_args pargs;
> + struct pwm_state pstate;
> struct device *dev = &pdev->dev;
> struct ts_nbus *ts_nbus;
> int ret;
> @@ -305,25 +305,19 @@ static int ts_nbus_probe(struct platform_device *pdev)
> return ret;
> }
>
> - pwm_get_args(pwm, &pargs);
> - if (!pargs.period) {
> + pwm_get_state_default(pwm, &pstate);
> + if (!pstate.period) {
> dev_err(&pdev->dev, "invalid PWM period\n");
> return -EINVAL;
> }
>
> - /*
> - * FIXME: pwm_apply_args() should be removed when switching to
> - * the atomic PWM API.
> - */
> - pwm_apply_args(pwm);
> - ret = pwm_config(pwm, pargs.period, pargs.period);
> + /* We can start the FPGA and populate the peripherals now. */
> + pstate.enabled = true;
> + pstate.duty_cycle = pstate.period;
> + ret = pwm_apply_state(pwm, &pstate);
> if (ret < 0)
> return ret;
>
> - /*
> - * we can now start the FPGA and populate the peripherals.
> - */
> - pwm_enable(pwm);
> ts_nbus->pwm = pwm;
>
> /*
This looks suspiciously like the PWM is actually powering this bus. It
would've been better to model that as a PWM driven regulator rather than
an PWM consumer.
Either way I don't see why pwm_get_state_default() would be useful here.
Thierry
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: thierry.reding@gmail.com (Thierry Reding)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/4] bus: ts-nbus: convert to atomic PWM API
Date: Wed, 14 Nov 2018 13:15:04 +0100 [thread overview]
Message-ID: <20181114121504.GE2620@ulmo> (raw)
In-Reply-To: <20181026184157.16371-3-u.kleine-koenig@pengutronix.de>
On Fri, Oct 26, 2018 at 08:41:57PM +0200, Uwe Kleine-K?nig wrote:
> The legacy PWM API should be removed in the long run, so convert a user
> to the atomic PWM API.
>
> Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
> ---
> drivers/bus/ts-nbus.c | 20 +++++++-------------
> 1 file changed, 7 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/bus/ts-nbus.c b/drivers/bus/ts-nbus.c
> index 073fd9011154..51f5ed870ad1 100644
> --- a/drivers/bus/ts-nbus.c
> +++ b/drivers/bus/ts-nbus.c
> @@ -282,7 +282,7 @@ EXPORT_SYMBOL_GPL(ts_nbus_write);
> static int ts_nbus_probe(struct platform_device *pdev)
> {
> struct pwm_device *pwm;
> - struct pwm_args pargs;
> + struct pwm_state pstate;
> struct device *dev = &pdev->dev;
> struct ts_nbus *ts_nbus;
> int ret;
> @@ -305,25 +305,19 @@ static int ts_nbus_probe(struct platform_device *pdev)
> return ret;
> }
>
> - pwm_get_args(pwm, &pargs);
> - if (!pargs.period) {
> + pwm_get_state_default(pwm, &pstate);
> + if (!pstate.period) {
> dev_err(&pdev->dev, "invalid PWM period\n");
> return -EINVAL;
> }
>
> - /*
> - * FIXME: pwm_apply_args() should be removed when switching to
> - * the atomic PWM API.
> - */
> - pwm_apply_args(pwm);
> - ret = pwm_config(pwm, pargs.period, pargs.period);
> + /* We can start the FPGA and populate the peripherals now. */
> + pstate.enabled = true;
> + pstate.duty_cycle = pstate.period;
> + ret = pwm_apply_state(pwm, &pstate);
> if (ret < 0)
> return ret;
>
> - /*
> - * we can now start the FPGA and populate the peripherals.
> - */
> - pwm_enable(pwm);
> ts_nbus->pwm = pwm;
>
> /*
This looks suspiciously like the PWM is actually powering this bus. It
would've been better to model that as a PWM driven regulator rather than
an PWM consumer.
Either way I don't see why pwm_get_state_default() would be useful here.
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20181114/6e41b905/attachment.sig>
next prev parent reply other threads:[~2018-11-14 12:15 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-26 18:41 [PATCH 1/4] pwm: Add new helper to initialize a pwm_state variable with defaults Uwe Kleine-König
2018-10-26 18:41 ` Uwe Kleine-König
2018-10-26 18:41 ` [PATCH 2/4] ARM: S3C24XX: rx1950: make use of atomic PWM API Uwe Kleine-König
2018-10-26 18:41 ` Uwe Kleine-König
2018-10-29 10:46 ` Krzysztof Kozlowski
2018-10-29 10:46 ` Krzysztof Kozlowski
2018-11-14 9:15 ` Uwe Kleine-König
2018-11-14 9:15 ` Uwe Kleine-König
2018-11-14 12:08 ` Thierry Reding
2018-11-14 12:08 ` Thierry Reding
2018-11-15 8:58 ` Uwe Kleine-König
2018-11-15 8:58 ` Uwe Kleine-König
2018-11-15 16:15 ` Thierry Reding
2018-11-15 16:15 ` Thierry Reding
2018-11-15 21:00 ` Uwe Kleine-König
2018-11-15 21:00 ` Uwe Kleine-König
2018-10-26 18:41 ` [PATCH 3/4] bus: ts-nbus: convert to " Uwe Kleine-König
2018-10-26 18:41 ` Uwe Kleine-König
2018-11-14 12:15 ` Thierry Reding [this message]
2018-11-14 12:15 ` Thierry Reding
2018-10-26 18:41 ` [PATCH 4/4] bus: ts-nbus: weaken driver dependency to allow broader compile testing Uwe Kleine-König
2018-10-26 18:41 ` Uwe Kleine-König
2018-11-14 12:18 ` Thierry Reding
2018-11-14 12:18 ` Thierry Reding
2018-10-29 11:33 ` [PATCH 1/4] pwm: Add new helper to initialize a pwm_state variable with defaults Thierry Reding
2018-10-29 11:33 ` Thierry Reding
2018-11-03 14:25 ` Uwe Kleine-König
2018-11-03 14:25 ` Uwe Kleine-König
2018-11-08 15:13 ` Uwe Kleine-König
2018-11-08 15:13 ` Uwe Kleine-König
2018-11-14 12:32 ` Thierry Reding
2018-11-14 12:32 ` Thierry Reding
2018-11-15 9:16 ` Uwe Kleine-König
2018-11-15 9:16 ` Uwe Kleine-König
2018-11-15 16:21 ` Thierry Reding
2018-11-15 16:21 ` Thierry Reding
2018-11-15 21:05 ` Uwe Kleine-König
2018-11-15 21:05 ` Uwe Kleine-König
2018-11-16 10:24 ` Thierry Reding
2018-11-16 10:24 ` Thierry Reding
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181114121504.GE2620@ulmo \
--to=thierry.reding@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pwm@vger.kernel.org \
--cc=sebastien.bourdelin@savoirfairelinux.com \
--cc=u.kleine-koenig@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.