On Thu, 27 Aug 2020 07:20:43 +0200, Harsha Priya wrote:
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@intel.com Signed-off-by: Emmanuel Jillela emmanuel.jillela@intel.com Reviewed-by: Kailang Yang kailang@realtek.com
The behavior shouldn't be specific to that model, also not to codec vendors, but it's rather a generic problem, so it's no right place to correct, I suppose.
Can we simply call pm_runtime_forbid() at creating a codec object like below?
thanks,
Takashi
--- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -1000,6 +1000,9 @@ int snd_hda_codec_device_new(struct hda_bus *bus, struct snd_card *card, if (err < 0) goto error;
+ /* PM runtime needs to be enabled later after binding codec */ + pm_runtime_forbid(&codec->core.dev); + return 0;
error: