[PATCH] pwm: meson: Explicitly set .polarity in .get_state()

Martin Blumenstingl martin.blumenstingl at googlemail.com
Mon Mar 13 12:54:15 PDT 2023


On Mon, Mar 13, 2023 at 10:51 AM Uwe Kleine-König
<u.kleine-koenig at pengutronix.de> wrote:
[...]
> Another option is to do something like that:
>
> diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c
> index 16d79ca5d8f5..25a177a3fa00 100644
> --- a/drivers/pwm/pwm-meson.c
> +++ b/drivers/pwm/pwm-meson.c
> @@ -162,8 +162,10 @@ static int meson_pwm_calc(struct meson_pwm *meson, struct pwm_device *pwm,
>         duty = state->duty_cycle;
>         period = state->period;
>
> -       if (state->polarity == PWM_POLARITY_INVERSED)
> +       if (state->polarity == PWM_POLARITY_INVERSED) {
> +               WARN_ONCE(1, "Wrongly trying to support inversed polarity. Please report to linux-pwm at vger.kernel.org if you rely on this\n");
>                 duty = period - duty;
> +       }
>
>         fin_freq = clk_get_rate(channel->clk);
>         if (fin_freq == 0) {
>
> and then drop that faked support in a year or so if nobody spoke up.
>
> Disclaimer: I assume Thierry is not a fan of this approach, he opposed
> similar warnings in the past.
I personally think it's fine to have this warning.
If Thierry has no objections in this case then it'll help us find
whether we really need proper support in PWM core or we can just
remove this fake support from pwm-meson


Best regards,
Martin



More information about the linux-amlogic mailing list