Skip to content

Commit 85a61b1

Browse files
jhovoldbroonie
authored andcommitted
ASoC: codecs: wcd938x: fix codec initialisation race
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: 8d78602 ("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> Link: https://lore.kernel.org/r/20230630120318.6571-1-johan+linaro@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent b1db244 commit 85a61b1

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

sound/soc/codecs/wcd938x.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3085,6 +3085,10 @@ static int wcd938x_soc_codec_probe(struct snd_soc_component *component)
30853085

30863086
snd_soc_component_init_regmap(component, wcd938x->regmap);
30873087

3088+
ret = pm_runtime_resume_and_get(dev);
3089+
if (ret < 0)
3090+
return ret;
3091+
30883092
wcd938x->variant = snd_soc_component_read_field(component,
30893093
WCD938X_DIGITAL_EFUSE_REG_0,
30903094
WCD938X_ID_MASK);
@@ -3098,6 +3102,8 @@ static int wcd938x_soc_codec_probe(struct snd_soc_component *component)
30983102
(WCD938X_DIGITAL_INTR_LEVEL_0 + i), 0);
30993103
}
31003104

3105+
pm_runtime_put(dev);
3106+
31013107
wcd938x->hphr_pdm_wd_int = regmap_irq_get_virq(wcd938x->irq_chip,
31023108
WCD938X_IRQ_HPHR_PDM_WD_INT);
31033109
wcd938x->hphl_pdm_wd_int = regmap_irq_get_virq(wcd938x->irq_chip,

0 commit comments

Comments
 (0)