linux-pwm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pwm: imx-tpm: force 'real_period' to be zero in suspend
@ 2023-05-05  6:58 Clark Wang
  2023-06-14  8:59 ` Uwe Kleine-König
  2023-06-23 14:51 ` Thierry Reding
  0 siblings, 2 replies; 3+ messages in thread
From: Clark Wang @ 2023-05-05  6:58 UTC (permalink / raw)
  To: thierry.reding, u.kleine-koenig, shawnguo, s.hauer, festevam
  Cc: kernel, linux-imx, linux-pwm, linux-arm-kernel, linux-kernel

From: Fancy Fang <chen.fang@nxp.com>

During suspend, all the tpm registers will lose values.
So the 'real_period' value of struct 'imx_tpm_pwm_chip'
should be forced to be zero to force the period update
code can be executed after system resume back.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
---
 drivers/pwm/pwm-imx-tpm.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/pwm/pwm-imx-tpm.c b/drivers/pwm/pwm-imx-tpm.c
index 5e2b452ee5f2..98ab65c89685 100644
--- a/drivers/pwm/pwm-imx-tpm.c
+++ b/drivers/pwm/pwm-imx-tpm.c
@@ -397,6 +397,13 @@ static int __maybe_unused pwm_imx_tpm_suspend(struct device *dev)
 	if (tpm->enable_count > 0)
 		return -EBUSY;
 
+	/*
+	 * Force 'real_period' to be zero to force period update code
+	 * can be executed after system resume back, since suspend causes
+	 * the period related registers to become their reset values.
+	 */
+	tpm->real_period = 0;
+
 	clk_disable_unprepare(tpm->clk);
 
 	return 0;
-- 
2.34.1


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

* Re: [PATCH] pwm: imx-tpm: force 'real_period' to be zero in suspend
  2023-05-05  6:58 [PATCH] pwm: imx-tpm: force 'real_period' to be zero in suspend Clark Wang
@ 2023-06-14  8:59 ` Uwe Kleine-König
  2023-06-23 14:51 ` Thierry Reding
  1 sibling, 0 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2023-06-14  8:59 UTC (permalink / raw)
  To: Clark Wang
  Cc: thierry.reding, shawnguo, s.hauer, festevam, linux-arm-kernel,
	linux-pwm, linux-imx, kernel, linux-kernel

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

On Fri, May 05, 2023 at 02:58:39PM +0800, Clark Wang wrote:
> From: Fancy Fang <chen.fang@nxp.com>
> 
> During suspend, all the tpm registers will lose values.
> So the 'real_period' value of struct 'imx_tpm_pwm_chip'
> should be forced to be zero to force the period update
> code can be executed after system resume back.
> 
> Signed-off-by: Fancy Fang <chen.fang@nxp.com>
> Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>

Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Fixes: 738a1cfec2ed ("pwm: Add i.MX TPM PWM driver support")

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: imx-tpm: force 'real_period' to be zero in suspend
  2023-05-05  6:58 [PATCH] pwm: imx-tpm: force 'real_period' to be zero in suspend Clark Wang
  2023-06-14  8:59 ` Uwe Kleine-König
@ 2023-06-23 14:51 ` Thierry Reding
  1 sibling, 0 replies; 3+ messages in thread
From: Thierry Reding @ 2023-06-23 14:51 UTC (permalink / raw)
  To: u.kleine-koenig, shawnguo, s.hauer, festevam, Clark Wang
  Cc: kernel, linux-imx, linux-pwm, linux-arm-kernel, linux-kernel


On Fri, 05 May 2023 14:58:39 +0800, Clark Wang wrote:
> During suspend, all the tpm registers will lose values.
> So the 'real_period' value of struct 'imx_tpm_pwm_chip'
> should be forced to be zero to force the period update
> code can be executed after system resume back.
> 
> 

Applied, thanks!

[1/1] pwm: imx-tpm: force 'real_period' to be zero in suspend
      commit: 661dfb7f46298e53f6c3deaa772fa527aae86193

Best regards,
-- 
Thierry Reding <thierry.reding@gmail.com>

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

end of thread, other threads:[~2023-06-23 14:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-05  6:58 [PATCH] pwm: imx-tpm: force 'real_period' to be zero in suspend Clark Wang
2023-06-14  8:59 ` Uwe Kleine-König
2023-06-23 14:51 ` Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).