All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] ASoC: rt711: wait for the delayed work to finish when the system suspends
@ 2020-09-21  9:43 shumingf
  2020-09-21 14:29 ` Pierre-Louis Bossart
  0 siblings, 1 reply; 2+ messages in thread
From: shumingf @ 2020-09-21  9:43 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: oder_chiou, jack.yu, alsa-devel, lars, mengdong.lin, derek.fang,
	Shuming Fan, flove, pierre-louis.bossart

From: Shuming Fan <shumingf@realtek.com>

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

Signed-off-by: Shuming Fan <shumingf@realtek.com>
---
 sound/soc/codecs/rt711-sdw.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sound/soc/codecs/rt711-sdw.c b/sound/soc/codecs/rt711-sdw.c
index 28d663673320..3a8ca600d1cf 100644
--- a/sound/soc/codecs/rt711-sdw.c
+++ b/sound/soc/codecs/rt711-sdw.c
@@ -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;
-- 
2.28.0


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

* Re: [PATCH 2/2] ASoC: rt711: wait for the delayed work to finish when the system suspends
  2020-09-21  9:43 [PATCH 2/2] ASoC: rt711: wait for the delayed work to finish when the system suspends shumingf
@ 2020-09-21 14:29 ` Pierre-Louis Bossart
  0 siblings, 0 replies; 2+ messages in thread
From: Pierre-Louis Bossart @ 2020-09-21 14:29 UTC (permalink / raw)
  To: shumingf, broonie, lgirdwood
  Cc: oder_chiou, jack.yu, alsa-devel, lars, mengdong.lin, derek.fang,
	flove, pierre-louis.bossart



On 9/21/20 4:43 AM, shumingf@realtek.com wrote:
> From: Shuming Fan <shumingf@realtek.com>
> 
> To avoid the IO error, we need to cancel the delayed work and wait for it to finish.
> 
> Signed-off-by: Shuming Fan <shumingf@realtek.com>

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.

BugLink: https://github.com/thesofproject/linux/issues/2443
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

> ---
>   sound/soc/codecs/rt711-sdw.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/sound/soc/codecs/rt711-sdw.c b/sound/soc/codecs/rt711-sdw.c
> index 28d663673320..3a8ca600d1cf 100644
> --- a/sound/soc/codecs/rt711-sdw.c
> +++ b/sound/soc/codecs/rt711-sdw.c
> @@ -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;
> 

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

end of thread, other threads:[~2020-09-21 16:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-21  9:43 [PATCH 2/2] ASoC: rt711: wait for the delayed work to finish when the system suspends shumingf
2020-09-21 14:29 ` Pierre-Louis Bossart

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.