Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: codecs: wcd938x: fix soundwire initialisation race

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@vger.kernel.org # 5.14
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reported-by: Steev Klimaszewski <steev@kali.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Tested-by: Steev Klimaszewski <steev@kali.org>
Link: https://lore.kernel.org/r/20230701094723.29379-1-johan+linaro@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Johan Hovold and committed by
Mark Brown
6f492568 055509cd

+9
+9
sound/soc/codecs/wcd938x.c
··· 3081 3081 static int wcd938x_soc_codec_probe(struct snd_soc_component *component) 3082 3082 { 3083 3083 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); 3084 + struct sdw_slave *tx_sdw_dev = wcd938x->tx_sdw_dev; 3084 3085 struct device *dev = component->dev; 3086 + unsigned long time_left; 3085 3087 int ret, i; 3088 + 3089 + time_left = wait_for_completion_timeout(&tx_sdw_dev->initialization_complete, 3090 + msecs_to_jiffies(2000)); 3091 + if (!time_left) { 3092 + dev_err(dev, "soundwire device init timeout\n"); 3093 + return -ETIMEDOUT; 3094 + } 3086 3095 3087 3096 snd_soc_component_init_regmap(component, wcd938x->regmap); 3088 3097