ASoC: codecs: wcd938x: fix soundwire initialisation race
Subsystems (4)
PATCH 1/1 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.
--- sound/soc/codecs/wcd938x.c | 9 +++++++++ 1 file changed, 9 insertions(+)
sound/soc/codecs/wcd938x.c +9 -0
@@ -3080,9 +3080,18 @@ static int wcd938x_irq_init(struct wcd938x_priv *wcd, struct device *dev)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);
Signature · 1 line
2.39.3
Quoted 46 lines · Johan Hovold
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)
-EBUSYerrno as the variant:wcd938x_codec audio-codec: ASoC: error at soc_component_read_no_lock on audio-codec for register: [0x000034b0] -16in 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 [email protected] # 5.14Cc Srinivas Kandagatla <[email protected]>Reported-by Steev Klimaszewski <[email protected]>Signed-off-by Johan Hovold <[email protected]>--- sound/soc/codecs/wcd938x.c | 9 +++++++++ 1 file changed, 9 insertions(+)sound/soc/codecs/wcd938x.c +9
-1@@ -3080,9 +3080,18 @@ static int wcd938x_irq_init(struct wcd938x_priv *wcd, struct device *dev)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); --
Quoted 2 lines
2.39.3
Thank you! Tested with this and the other patch applied on my X13s with a pair of Apple EarPods with 3.5mm Headphone Plug, audio is quite nice through them.
Mark Brown
maintainerQuoted 8 lines · Johan Hovold
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)
-EBUSYerrno as the variant:[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: codecs: wcd938x: fix soundwire initialisation race
commit: 6f49256897083848ce9a59651f6b53fc80462397
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark