diff mbox series

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

Message ID 20231004175414.1738475-1-florian.fainelli@broadcom.com
State Accepted
Headers show
Series pwm: brcmstb: Utilize appropriate clock APIs in suspend/resume | expand

Commit Message

Florian Fainelli Oct. 4, 2023, 5:54 p.m. UTC
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")
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
 drivers/pwm/pwm-brcmstb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Uwe Kleine-König Oct. 5, 2023, 6:20 a.m. UTC | #1
Hello Florian,

On Wed, Oct 04, 2023 at 10:54:14AM -0700, Florian Fainelli wrote:
> 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")
> Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
> ---
>  drivers/pwm/pwm-brcmstb.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pwm/pwm-brcmstb.c b/drivers/pwm/pwm-brcmstb.c
> index a3faa9a3de7c..a7d529bf76ad 100644
> --- a/drivers/pwm/pwm-brcmstb.c
> +++ b/drivers/pwm/pwm-brcmstb.c
> @@ -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);

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

Orthogonally to that, the patch looks fine:

Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Best regards
Uwe
Thierry Reding Oct. 12, 2023, 1:55 p.m. UTC | #2
On Wed, 04 Oct 2023 10:54:14 -0700, Florian Fainelli wrote:
> 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,
diff mbox series

Patch

diff --git a/drivers/pwm/pwm-brcmstb.c b/drivers/pwm/pwm-brcmstb.c
index a3faa9a3de7c..a7d529bf76ad 100644
--- a/drivers/pwm/pwm-brcmstb.c
+++ b/drivers/pwm/pwm-brcmstb.c
@@ -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;
 }