pwm: pxa: Use abrupt shutdown mode
authorDoug Brown <doug@schmorgal.com>
Fri, 2 Dec 2022 18:35:23 +0000 (19:35 +0100)
committerThierry Reding <thierry.reding@gmail.com>
Tue, 6 Dec 2022 11:46:14 +0000 (12:46 +0100)
Switch to abrupt shutdown mode in order to stop the clock as soon as
possible when PWM is disabled. This minimizes the possibility of the
clock being re-enabled while it is still in the process of turning off,
which will result in the clock ending up erroneously disabled.

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-5-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

index cf4d22c91929feaa0bcc51c91a9ae41a4cdc694b..00063ead7c0aee6e2e184650abaa628af95da323 100644 (file)
@@ -85,7 +85,7 @@ static int pxa_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
        else
                dc = mul_u64_u64_div_u64(pv + 1, duty_ns, period_ns);
 
-       writel(prescale, pc->mmio_base + offset + PWMCR);
+       writel(prescale | PWMCR_SD, pc->mmio_base + offset + PWMCR);
        writel(dc, pc->mmio_base + offset + PWMDCR);
        writel(pv, pc->mmio_base + offset + PWMPCR);