Skip to contentSkip to conversation

pwm: imx-tpm: force 'real_period' to be zero in suspend

PATCH Applied Clark Wang 3 participants 3 messages May 5, 2023 – Jun 23, 2023

Subsystems (2)
lore
Share & tools
lore

Clark Wang

author
#0 lore raw

PATCH 1/1 pwm: imx-tpm: force 'real_period' to be zero in suspend

From: Fancy Fang <[email protected]>

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.

---
 drivers/pwm/pwm-imx-tpm.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/pwm/pwm-imx-tpm.c +7 -0
index 5e2b452ee5f2..98ab65c89685 100644
@@ -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;
Signature · 1 line
2.34.1
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Clark Wang

From: Fancy Fang <[email protected]>

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.

Fixes 738a1cfec2ed ("pwm: Add i.MX TPM PWM driver support")

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
#2 lore raw
In reply to Clark Wang
Quoted 6 lines · Clark Wang

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,

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