]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
pwm: atmel-hlcdc: Fix clock imbalance related to suspend support
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Fri, 26 Jan 2024 12:04:33 +0000 (13:04 +0100)
committerSasha Levin <sashal@kernel.org>
Tue, 26 Mar 2024 22:19:26 +0000 (18:19 -0400)
[ Upstream commit e25ac87d3f831fed002c34aadddaf4ebb4ea45ec ]

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")
Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Link: https://lore.kernel.org/r/b51ea92b0a45eff3dc83b08adefd43d930df996c.1706269232.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pwm/pwm-atmel-hlcdc.c

index e271d920151e471c8d6622841c7b432557da8c46..5f6612e1dd34dd8a3b87b220a0fa91bba4152301 100644 (file)
@@ -187,7 +187,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;