Skip to contentSkip to conversation

ASoC: rt711: wait for the delayed work to finish when the system suspends

PATCH In review [email protected] 2 participants 2 messages Sep 21, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 ASoC: rt711: wait for the delayed work to finish when the system suspends

From: Shuming Fan <[email protected]>

To avoid the IO error, we need to cancel the delayed work and wait for it to finish.

---
 sound/soc/codecs/rt711-sdw.c | 4 ++++
 1 file changed, 4 insertions(+)
sound/soc/codecs/rt711-sdw.c +4 -0
index 28d663673320..3a8ca600d1cf 100644
@@ -491,6 +491,10 @@ static int __maybe_unused rt711_dev_suspend(struct device *dev)
 	if (!rt711->hw_init)
 		return 0;
 
+	cancel_delayed_work_sync(&rt711->jack_detect_work);
+	cancel_delayed_work_sync(&rt711->jack_btn_check_work);
+	cancel_work_sync(&rt711->calibration_work);
+
 	regcache_cache_only(rt711->regmap, true);
 
 	return 0;
Signature · 1 line
2.28.0
Reviewed-by on v1 2/2
#1 lore raw
Quoted 5 lines · On 9/21/20 4:43 AM, [email protected] wrote:

From: Shuming Fan <[email protected]>

To avoid the IO error, we need to cancel the delayed work and wait for it to finish.

Thanks Shuming.

For more context we detected a timeout error during suspend-resume stress tests, the problem is similar to an earlier case with interrupt handling already fixed in the SoundWire tree: we want all workqueues to complete before suspending.

Quoted 20 lines
---
  sound/soc/codecs/rt711-sdw.c | 4 ++++
  1 file changed, 4 insertions(+)
sound/soc/codecs/rt711-sdw.c +4 -0
index 28d663673320..3a8ca600d1cf 100644
@@ -491,6 +491,10 @@ static int __maybe_unused rt711_dev_suspend(struct device *dev)
  	if (!rt711->hw_init)
  		return 0;
 
+	cancel_delayed_work_sync(&rt711->jack_detect_work);
+	cancel_delayed_work_sync(&rt711->jack_btn_check_work);
+	cancel_work_sync(&rt711->calibration_work);
+
  	regcache_cache_only(rt711->regmap, true);
 
  	return 0;