Message ID | 20211130090606.529348-1-kai.vehmanen@linux.intel.com |
---|---|
State | New |
Headers | show |
Series | ASoC: SOF: Intel: Retry codec probing if it fails | expand |
On Tue, 30 Nov 2021 11:06:06 +0200, Kai Vehmanen wrote: > From: Hui Wang <hui.wang@canonical.com> > > On the latest Lenovo Thinkstation laptops, we often experience the > speaker failure after rebooting, check the dmesg, we could see: > sof-audio-pci-intel-tgl 0000:00:1f.3: codec #0 probe error, ret: -5 > > The analogue codec on the machine is ALC287, then we designed a > testcase to reboot and check the codec probing result repeatedly, we > found the analogue codec probing always failed at least once within > several minutes to several hours (roughly 1 reboot per min). This > issue happens on all laptops of this Thinkstation model, but with > legacy HDA driver, we couldn't reproduce this issue on those laptops. > And so far, this issue is not reproduced on machines which don't > belong to this model. > > [...] Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-linus Thanks! [1/1] ASoC: SOF: Intel: Retry codec probing if it fails commit: 046aede2f847676f93a2ea4f48b77909c51dba40 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
diff --git a/sound/soc/sof/intel/hda-codec.c b/sound/soc/sof/intel/hda-codec.c index 6744318de612..13cd96e6724a 100644 --- a/sound/soc/sof/intel/hda-codec.c +++ b/sound/soc/sof/intel/hda-codec.c @@ -22,6 +22,7 @@ #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC) #define IDISP_VID_INTEL 0x80860000 +#define CODEC_PROBE_RETRIES 3 /* load the legacy HDA codec driver */ static int request_codec_module(struct hda_codec *codec) @@ -121,12 +122,15 @@ static int hda_codec_probe(struct snd_sof_dev *sdev, int address, u32 hda_cmd = (address << 28) | (AC_NODE_ROOT << 20) | (AC_VERB_PARAMETERS << 8) | AC_PAR_VENDOR_ID; u32 resp = -1; - int ret; + int ret, retry = 0; + + do { + mutex_lock(&hbus->core.cmd_mutex); + snd_hdac_bus_send_cmd(&hbus->core, hda_cmd); + snd_hdac_bus_get_response(&hbus->core, address, &resp); + mutex_unlock(&hbus->core.cmd_mutex); + } while (resp == -1 && retry++ < CODEC_PROBE_RETRIES); - mutex_lock(&hbus->core.cmd_mutex); - snd_hdac_bus_send_cmd(&hbus->core, hda_cmd); - snd_hdac_bus_get_response(&hbus->core, address, &resp); - mutex_unlock(&hbus->core.cmd_mutex); if (resp == -1) return -EIO; dev_dbg(sdev->dev, "HDA codec #%d probed OK: response: %x\n",