[PATCH] ALSA: Realtek: Early Forbid of runtime PM

Harsha Priya harshapriya.n at intel.com
Thu Aug 27 07:20:43 CEST 2020


For Realtek codecs, pm_runtime_forbid() is called in the probe function 
after the build_controls(). In a stress test, occasionally the runtime
PM calls are invoked before controls are built. This causes the codec to be
runtime suspended before probe completes. Because of this, not all
controls are enumerated correctly and audio does not work until
system is rebooted.

This patch calls pm_runtime_forbid() early to fix the issue.
Multiple stress tests of 2000+ cycles has been done to test the fix.

Signed-off-by: Harsha Priya <harshapriya.n at intel.com>
Signed-off-by: Emmanuel Jillela <emmanuel.jillela at intel.com>
Reviewed-by: Kailang Yang <kailang at realtek.com>

---
 sound/pci/hda/patch_realtek.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 98789691a479..30ea07fd6735 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -8418,6 +8418,7 @@ static int patch_alc269(struct hda_codec *codec)
 {
 	struct alc_spec *spec;
 	int err;
+	struct device *dev = hda_codec_dev(codec);
 
 	err = alc_alloc_spec(codec, 0x0b);
 	if (err < 0)
@@ -8430,6 +8431,8 @@ static int patch_alc269(struct hda_codec *codec)
 #ifdef CONFIG_PM
 	codec->patch_ops.suspend = alc269_suspend;
 	codec->patch_ops.resume = alc269_resume;
+	pm_runtime_dont_use_autosuspend(dev);
+	pm_runtime_forbid(dev);
 #endif
 	spec->shutup = alc_default_shutup;
 	spec->init_hook = alc_default_init;
-- 
2.17.1



More information about the Alsa-devel mailing list