This is a note to let you know that I've just added the patch titled ASoC: codecs: wcd938x: fix soundwire initialisation race to the 6.4-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-soundwire-initialisation-race.patch and it can be found in the queue-6.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 6f49256897083848ce9a59651f6b53fc80462397 Mon Sep 17 00:00:00 2001 From: Johan Hovold <johan+linaro@xxxxxxxxxx> Date: Sat, 1 Jul 2023 11:47:23 +0200 Subject: ASoC: codecs: wcd938x: fix soundwire initialisation race From: Johan Hovold <johan+linaro@xxxxxxxxxx> commit 6f49256897083848ce9a59651f6b53fc80462397 upstream. Make sure that the soundwire device used for register accesses has been enumerated and initialised before trying to read the codec variant 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 in case the soundwire device has not yet been initialised, 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> Tested-by: Steev Klimaszewski <steev@xxxxxxxx> Link: https://lore.kernel.org/r/20230701094723.29379-1-johan+linaro@xxxxxxxxxx Signed-off-by: Mark Brown <broonie@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- sound/soc/codecs/wcd938x.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/sound/soc/codecs/wcd938x.c +++ b/sound/soc/codecs/wcd938x.c @@ -3090,9 +3090,18 @@ static int wcd938x_irq_init(struct wcd93 static int wcd938x_soc_codec_probe(struct snd_soc_component *component) { struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); + struct sdw_slave *tx_sdw_dev = wcd938x->tx_sdw_dev; struct device *dev = component->dev; + unsigned long time_left; int ret, i; + time_left = wait_for_completion_timeout(&tx_sdw_dev->initialization_complete, + msecs_to_jiffies(2000)); + if (!time_left) { + dev_err(dev, "soundwire device init timeout\n"); + return -ETIMEDOUT; + } + snd_soc_component_init_regmap(component, wcd938x->regmap); ret = pm_runtime_resume_and_get(dev); Patches currently in stable-queue which might be from johan+linaro@xxxxxxxxxx are queue-6.4/asoc-codecs-wcd938x-fix-missing-mbhc-init-error-handling.patch queue-6.4/asoc-codecs-wcd938x-fix-resource-leaks-on-component-remove.patch queue-6.4/asoc-qdsp6-audioreach-fix-topology-probe-deferral.patch queue-6.4/asoc-codecs-wcd938x-fix-missing-clsh-ctrl-error-handling.patch queue-6.4/asoc-codecs-wcd938x-fix-soundwire-initialisation-race.patch queue-6.4/asoc-codecs-wcd934x-fix-resource-leaks-on-component-remove.patch queue-6.4/asoc-codecs-wcd938x-fix-codec-initialisation-race.patch queue-6.4/asoc-codecs-wcd-mbhc-v2-fix-resource-leaks-on-component-remove.patch