* [PATCH] gpio: mvebu/pwm: Refuse requests with inverted polarity
@ 2022-05-11 7:58 Uwe Kleine-König
2022-05-14 12:52 ` Bartosz Golaszewski
0 siblings, 1 reply; 2+ messages in thread
From: Uwe Kleine-König @ 2022-05-11 7:58 UTC (permalink / raw)
To: Thierry Reding, Lee Jones, Linus Walleij, Bartosz Golaszewski,
Andrew Lunn
Cc: Ralph Sennhauser, Rob Herring, linux-pwm, linux-gpio, kernel
The driver doesn't take struct pwm_state::polarity into account when
configuring the hardware, so refuse requests for inverted polarity.
Fixes: 757642f9a584 ("gpio: mvebu: Add limited PWM support")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/gpio/gpio-mvebu.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index 4c1f9e1091b7..92ecaea2d5d4 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -707,6 +707,9 @@ static int mvebu_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
unsigned long flags;
unsigned int on, off;
+ if (state->polarity != PWM_POLARITY_NORMAL)
+ return -EINVAL;
+
val = (unsigned long long) mvpwm->clk_rate * state->duty_cycle;
do_div(val, NSEC_PER_SEC);
if (val > UINT_MAX + 1ULL)
base-commit: 3123109284176b1532874591f7c81f3837bbdc17
--
2.35.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] gpio: mvebu/pwm: Refuse requests with inverted polarity
2022-05-11 7:58 [PATCH] gpio: mvebu/pwm: Refuse requests with inverted polarity Uwe Kleine-König
@ 2022-05-14 12:52 ` Bartosz Golaszewski
0 siblings, 0 replies; 2+ messages in thread
From: Bartosz Golaszewski @ 2022-05-14 12:52 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Thierry Reding, Lee Jones, Linus Walleij, Andrew Lunn,
Ralph Sennhauser, Rob Herring, open list:PWM SUBSYSTEM,
open list:GPIO SUBSYSTEM, Sascha Hauer
On Wed, May 11, 2022 at 9:59 AM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
>
> The driver doesn't take struct pwm_state::polarity into account when
> configuring the hardware, so refuse requests for inverted polarity.
>
> Fixes: 757642f9a584 ("gpio: mvebu: Add limited PWM support")
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> drivers/gpio/gpio-mvebu.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
> index 4c1f9e1091b7..92ecaea2d5d4 100644
> --- a/drivers/gpio/gpio-mvebu.c
> +++ b/drivers/gpio/gpio-mvebu.c
> @@ -707,6 +707,9 @@ static int mvebu_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
> unsigned long flags;
> unsigned int on, off;
>
> + if (state->polarity != PWM_POLARITY_NORMAL)
> + return -EINVAL;
> +
> val = (unsigned long long) mvpwm->clk_rate * state->duty_cycle;
> do_div(val, NSEC_PER_SEC);
> if (val > UINT_MAX + 1ULL)
>
> base-commit: 3123109284176b1532874591f7c81f3837bbdc17
> --
> 2.35.1
>
Applied, thanks!
Bart
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-05-14 12:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-11 7:58 [PATCH] gpio: mvebu/pwm: Refuse requests with inverted polarity Uwe Kleine-König
2022-05-14 12:52 ` Bartosz Golaszewski
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.