Skip to contentSkip to conversation

pwm: brcmstb: Utilize appropriate clock APIs in suspend/resume

PATCH Applied Florian Fainelli 3 participants 3 messages Oct 4, 2023 – Oct 12, 2023

Subsystems (2)
lore
Share & tools
lore

Florian Fainelli

author maintainer
#0 lore raw

PATCH 1/1 pwm: brcmstb: Utilize appropriate clock APIs in suspend/resume

The suspend/resume functions currently utilize clk_disable()/clk_enable() respectively which may be no-ops with certain clock providers such as SCMI. Fix this to use clk_disable_unprepare() and clk_prepare_enable() respectively as we should.

Fixes 3a9f5957020f ("pwm: Add Broadcom BCM7038 PWM controller support")
---
 drivers/pwm/pwm-brcmstb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pwm/pwm-brcmstb.c +2 -2
index a3faa9a3de7c..a7d529bf76ad 100644
@@ -288,7 +288,7 @@ static int brcmstb_pwm_suspend(struct device *dev)
 {
 	struct brcmstb_pwm *p = dev_get_drvdata(dev);
 
-	clk_disable(p->clk);
+	clk_disable_unprepare(p->clk);
 
 	return 0;
 }
@@ -297,7 +297,7 @@ static int brcmstb_pwm_resume(struct device *dev)
 {
 	struct brcmstb_pwm *p = dev_get_drvdata(dev);
 
-	clk_enable(p->clk);
+	clk_prepare_enable(p->clk);
 
 	return 0;
 }
Signature · 1 line
2.34.1
Acked-by on v1 1/1
#1 lore raw

Hello Florian,

Quoted 25 lines · Florian Fainelli

The suspend/resume functions currently utilize clk_disable()/clk_enable() respectively which may be no-ops with certain clock providers such as SCMI. Fix this to use clk_disable_unprepare() and clk_prepare_enable() respectively as we should.

Fixes 3a9f5957020f ("pwm: Add Broadcom BCM7038 PWM controller support")
---
 drivers/pwm/pwm-brcmstb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pwm/pwm-brcmstb.c +1 -1
index a3faa9a3de7c..a7d529bf76ad 100644
@@ -288,7 +288,7 @@ static int brcmstb_pwm_suspend(struct device *dev)
 {
 	struct brcmstb_pwm *p = dev_get_drvdata(dev);
 
-	clk_disable(p->clk);
+	clk_disable_unprepare(p->clk);
 
 	return 0;
 }

drivers/pwm/pwm-brcmstb.c static int brcmstb_pwm_resume(struct device *dev) · line 300

Quoted 5 lines
drivers/pwm/pwm-brcmstb.c +1 -1
@@ -297,7 +297,7 @@ static int brcmstb_pwm_resume(struct device *dev)
 {
 	struct brcmstb_pwm *p = dev_get_drvdata(dev);
 
-	clk_enable(p->clk);
+	clk_prepare_enable(p->clk);

While at it: Add another patch that checks the return value of clk_prepare_enable()?

Orthogonally to that, the patch looks fine:

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#2 lore raw
In reply to Florian Fainelli
Quoted 6 lines · Florian Fainelli

The suspend/resume functions currently utilize clk_disable()/clk_enable() respectively which may be no-ops with certain clock providers such as SCMI. Fix this to use clk_disable_unprepare() and clk_prepare_enable() respectively as we should.

Applied, thanks!

[1/1] pwm: brcmstb: Utilize appropriate clock APIs in suspend/resume

      commit: 4da07e8a22919fde057b554716e4c5a640d4d805

Best regards,

Signature · 1 line
Thierry Reding <[email protected]>