This is a note to let you know that I've just added the patch titled ASoC: codecs: wcd938x: fix codec initialisation race to the 6.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: asoc-codecs-wcd938x-fix-codec-initialisation-race.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 85a61b1ce461a3f62f1019e5e6423c393c542bff Mon Sep 17 00:00:00 2001 From: Johan Hovold <johan+linaro@xxxxxxxxxx> Date: Fri, 30 Jun 2023 14:03:18 +0200 Subject: ASoC: codecs: wcd938x: fix codec initialisation race From: Johan Hovold <johan+linaro@xxxxxxxxxx> commit 85a61b1ce461a3f62f1019e5e6423c393c542bff upstream. Make sure to resume the codec and soundwire device before trying to read the codec variant and configure the device during component probe. This specifically avoids interpreting (a masked and shifted) -EBUSY errno as the variant: wcd938x_codec audio-codec: ASoC: error at soc_component_read_no_lock on audio-codec for register: [0x000034b0] -16 when the soundwire device happens to be suspended, which in turn prevents some headphone controls from being registered. Fixes: 8d78602aa87a ("ASoC: codecs: wcd938x: add basic driver") Cc: stable@xxxxxxxxxxxxxxx # 5.14 Cc: Srinivas Kandagatla <srinivas.kandagatla@xxxxxxxxxx> Reported-by: Steev Klimaszewski <steev@xxxxxxxx> Signed-off-by: Johan Hovold <johan+linaro@xxxxxxxxxx> Link: https://lore.kernel.org/r/20230630120318.6571-1-johan+linaro@xxxxxxxxxx Signed-off-by: Mark Brown <broonie@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- sound/soc/codecs/wcd938x.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/sound/soc/codecs/wcd938x.c +++ b/sound/soc/codecs/wcd938x.c @@ -3095,6 +3095,10 @@ static int wcd938x_soc_codec_probe(struc snd_soc_component_init_regmap(component, wcd938x->regmap); + ret = pm_runtime_resume_and_get(dev); + if (ret < 0) + return ret; + wcd938x->variant = snd_soc_component_read_field(component, WCD938X_DIGITAL_EFUSE_REG_0, WCD938X_ID_MASK); @@ -3112,6 +3116,8 @@ static int wcd938x_soc_codec_probe(struc (WCD938X_DIGITAL_INTR_LEVEL_0 + i), 0); } + pm_runtime_put(dev); + wcd938x->hphr_pdm_wd_int = regmap_irq_get_virq(wcd938x->irq_chip, WCD938X_IRQ_HPHR_PDM_WD_INT); wcd938x->hphl_pdm_wd_int = regmap_irq_get_virq(wcd938x->irq_chip, Patches currently in stable-queue which might be from johan+linaro@xxxxxxxxxx are queue-6.1/asoc-codecs-wcd938x-fix-missing-mbhc-init-error-handling.patch queue-6.1/asoc-codecs-wcd938x-fix-resource-leaks-on-component-remove.patch queue-6.1/asoc-qdsp6-audioreach-fix-topology-probe-deferral.patch queue-6.1/asoc-codecs-wcd938x-fix-missing-clsh-ctrl-error-handling.patch queue-6.1/asoc-codecs-wcd938x-fix-soundwire-initialisation-race.patch queue-6.1/asoc-codecs-wcd934x-fix-resource-leaks-on-component-remove.patch queue-6.1/asoc-codecs-wcd938x-fix-codec-initialisation-race.patch queue-6.1/asoc-codecs-wcd-mbhc-v2-fix-resource-leaks-on-component-remove.patch