Message ID | b51ea92b0a45eff3dc83b08adefd43d930df996c.1706269232.git.u.kleine-koenig@pengutronix.de |
---|---|
State | Accepted |
Headers | show |
Series | pwm: atmel-hlcdc: Two improvements | expand |
On 26.01.2024 14:04, Uwe Kleine-König wrote: > The suspend callback disables the periph clock when the PWM is enabled > and resume reenables this clock if the PWM was disabled before. Judging > from the code comment it's suspend that is wrong here. Fix accordingly. > > Fixes: f9bb9da7c09d ("pwm: atmel-hlcdc: Implement the suspend/resume hooks") > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> I don't have the HW to check it but it looks good to me: Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev> > --- > drivers/pwm/pwm-atmel-hlcdc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/pwm/pwm-atmel-hlcdc.c b/drivers/pwm/pwm-atmel-hlcdc.c > index 3f2c5031a3ba..1f6fc9a9fcf3 100644 > --- a/drivers/pwm/pwm-atmel-hlcdc.c > +++ b/drivers/pwm/pwm-atmel-hlcdc.c > @@ -185,7 +185,7 @@ static int atmel_hlcdc_pwm_suspend(struct device *dev) > struct atmel_hlcdc_pwm *atmel = dev_get_drvdata(dev); > > /* Keep the periph clock enabled if the PWM is still running. */ > - if (pwm_is_enabled(&atmel->chip.pwms[0])) > + if (!pwm_is_enabled(&atmel->chip.pwms[0])) > clk_disable_unprepare(atmel->hlcdc->periph_clk); > > return 0;
diff --git a/drivers/pwm/pwm-atmel-hlcdc.c b/drivers/pwm/pwm-atmel-hlcdc.c index 3f2c5031a3ba..1f6fc9a9fcf3 100644 --- a/drivers/pwm/pwm-atmel-hlcdc.c +++ b/drivers/pwm/pwm-atmel-hlcdc.c @@ -185,7 +185,7 @@ static int atmel_hlcdc_pwm_suspend(struct device *dev) struct atmel_hlcdc_pwm *atmel = dev_get_drvdata(dev); /* Keep the periph clock enabled if the PWM is still running. */ - if (pwm_is_enabled(&atmel->chip.pwms[0])) + if (!pwm_is_enabled(&atmel->chip.pwms[0])) clk_disable_unprepare(atmel->hlcdc->periph_clk); return 0;
The suspend callback disables the periph clock when the PWM is enabled and resume reenables this clock if the PWM was disabled before. Judging from the code comment it's suspend that is wrong here. Fix accordingly. Fixes: f9bb9da7c09d ("pwm: atmel-hlcdc: Implement the suspend/resume hooks") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> --- drivers/pwm/pwm-atmel-hlcdc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)