pwm: pxa: Set duty cycle to 0 when disabling PWM
authorDoug Brown <doug@schmorgal.com>
Fri, 2 Dec 2022 18:35:21 +0000 (19:35 +0100)
committerThierry Reding <thierry.reding@gmail.com>
Tue, 6 Dec 2022 11:46:13 +0000 (12:46 +0100)
commit152f2d1def5e4b974947877126ff292a68a8c521
treed4c2be676ea7464f4d2578d88a6347ee2b8e4ba5
parentf956b838934ab06deeee2ce9d5c8dfe64e4beb24
pwm: pxa: Set duty cycle to 0 when disabling PWM

When disabling PWM, the duty cycle needs to be set to 0. This prevents
the previous duty cycle from showing up momentarily when the clock is
re-enabled next time.

Because the clock has to be running in order to configure the duty
cycle, unconditionally enable it early in pxa_pwm_apply and account for
the correct enable count at the end.

Suggested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Doug Brown <doug@schmorgal.com>
Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20221113233639.24244-3-doug@schmorgal.com
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-pxa.c