mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] pwm: brcmstb: Utilize appropriate clock APIs in suspend/resume
@ 2023-10-04 17:54 Florian Fainelli
  2023-10-05  6:20 ` Uwe Kleine-König
  2023-10-12 13:55 ` Thierry Reding
  0 siblings, 2 replies; 3+ messages in thread
From: Florian Fainelli @ 2023-10-04 17:54 UTC (permalink / raw)
  To: linux-pwm
  Cc: Florian Fainelli, Thierry Reding, Uwe Kleine-König,
	Broadcom internal kernel review list,
	moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE, open list

[-- Attachment #1: Type: text/plain, Size: 1042 bytes --]

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);
 
 	return 0;
 }
-- 
2.34.1


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4221 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] pwm: brcmstb: Utilize appropriate clock APIs in suspend/resume
  2023-10-04 17:54 [PATCH] pwm: brcmstb: Utilize appropriate clock APIs in suspend/resume Florian Fainelli
@ 2023-10-05  6:20 ` Uwe Kleine-König
  2023-10-12 13:55 ` Thierry Reding
  1 sibling, 0 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2023-10-05  6:20 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: linux-pwm, Thierry Reding, Broadcom internal kernel review list,
	moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE, open list

[-- Attachment #1: Type: text/plain, Size: 1567 bytes --]

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

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] pwm: brcmstb: Utilize appropriate clock APIs in suspend/resume
  2023-10-04 17:54 [PATCH] pwm: brcmstb: Utilize appropriate clock APIs in suspend/resume Florian Fainelli
  2023-10-05  6:20 ` Uwe Kleine-König
@ 2023-10-12 13:55 ` Thierry Reding
  1 sibling, 0 replies; 3+ messages in thread
From: Thierry Reding @ 2023-10-12 13:55 UTC (permalink / raw)
  To: linux-pwm, Florian Fainelli
  Cc: Uwe Kleine-König, Broadcom internal kernel review list,
	linux-arm-kernel, linux-kernel


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,
-- 
Thierry Reding <thierry.reding@gmail.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-10-12 13:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-04 17:54 [PATCH] pwm: brcmstb: Utilize appropriate clock APIs in suspend/resume Florian Fainelli
2023-10-05  6:20 ` Uwe Kleine-König
2023-10-12 13:55 ` Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®