linux-pwm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Thierry Reding <thierry.reding@gmail.com>,
	Lee Jones <lee.jones@linaro.org>
Cc: linux-tegra@vger.kernel.org, linux-pwm@vger.kernel.org,
	kernel@pengutronix.de, Philipp Zabel <p.zabel@pengutronix.de>,
	Jonathan Hunter <jonathanh@nvidia.com>
Subject: Re: [PATCH v1 5/6] pwm: tegra: Implement .apply callback
Date: Fri, 16 Jul 2021 09:30:30 +0200	[thread overview]
Message-ID: <20210716073030.dzhs5j5rrnrdke4u@pengutronix.de> (raw)
In-Reply-To: <20210617095145.163694-6-u.kleine-koenig@pengutronix.de>

[-- Attachment #1: Type: text/plain, Size: 1526 bytes --]

Hello,

On Thu, Jun 17, 2021 at 11:51:44AM +0200, Uwe Kleine-König wrote:
> To ease review this reuses the formerly implemented callbacks.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/pwm/pwm-tegra.c | 32 +++++++++++++++++++++++++++++---
>  1 file changed, 29 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/pwm/pwm-tegra.c b/drivers/pwm/pwm-tegra.c
> index 11a10b575ace..1161c6323e60 100644
> --- a/drivers/pwm/pwm-tegra.c
> +++ b/drivers/pwm/pwm-tegra.c
> @@ -227,10 +227,36 @@ static void tegra_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm)
>  	clk_disable_unprepare(pc->clk);
>  }
>  
> +static int tegra_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
> +			   const struct pwm_state *state)
> +{
> +	int err;
> +
> +	if (state->polarity != PWM_POLARITY_INVERSED)
> +		return -EINVAL;
> +
> +	if (!state->enabled) {
> +		if (pwm->state.enabled)
> +			tegra_pwm_disable(chip, pwm);
> +		return 0;
> +	}
> +
> +	if (state->period != pwm->state.period ||
> +	    state->duty_cycle != pwm->state.duty_cycle) {
> +		err = tegra_pwm_config(pwm->chip, pwm, (int)state->duty_cycle,
> +				       (int)state->period);

This patch has the same problem as my other apply conversions. I'll have
to rework that before it is safe to take this.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  parent reply	other threads:[~2021-07-16  7:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-17  9:51 [PATCH v1 0/6] pwm: tegra: several improvements Uwe Kleine-König
2021-06-17  9:51 ` [PATCH v1 1/6] pwm: tegra: Drop an if block with an always false condition Uwe Kleine-König
2021-06-17  9:51 ` [PATCH v1 2/6] pwm: tegra: Don't modify HW state in .remove callback Uwe Kleine-König
2021-06-17  9:51 ` [PATCH v1 3/6] pwm: tegra: Don't needlessly enable and disable the clock in .remove() Uwe Kleine-König
2021-06-17  9:51 ` [PATCH v1 4/6] pwm: tegra: Assert reset only after the PWM was unregistered Uwe Kleine-König
2021-06-17  9:51 ` [PATCH v1 5/6] pwm: tegra: Implement .apply callback Uwe Kleine-König
2021-06-28 12:29   ` Thierry Reding
2021-06-28 16:46     ` Uwe Kleine-König
2021-07-16  7:30   ` Uwe Kleine-König [this message]
2021-06-17  9:51 ` [PATCH v1 6/6] pwm: tegra: unfold legacy callbacks into tegra_pwm_apply() Uwe Kleine-König

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=20210716073030.dzhs5j5rrnrdke4u@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=jonathanh@nvidia.com \
    --cc=kernel@pengutronix.de \
    --cc=lee.jones@linaro.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=thierry.reding@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).