Re: Oops in hdac_hda_dev_probe (6.7-rc7)

From: Takashi Iwai
Date: Fri Dec 29 2023 - 12:11:55 EST


On Fri, 29 Dec 2023 16:24:18 +0100,
Dominik Brodowski wrote:
>
> Hi Takashi,
>
> many thanks for your response. Your patch helps half-way: the oops goes
> away, but so does the sound... With your patch, the decisive lines in dmesg
> are:
>
> sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware info: version 2:2:0-57864
> sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware: ABI 3:22:1 Kernel ABI 3:23:0
> sof_sdw sof_sdw: ASoC: CODEC DAI intel-hdmi-hifi1 not registered
> sof_sdw sof_sdw: snd_soc_register_card failed -517
> sof_sdw sof_sdw: ASoC: CODEC DAI intel-hdmi-hifi1 not registered
> sof_sdw sof_sdw: snd_soc_register_card failed -517
> platform sof_sdw: deferred probe pending
>
> With a revert of the a0575b4add21, it is:
>
> sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware info: version 2:2:0-57864
> sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware: ABI 3:22:1 Kernel ABI 3:23:0
> sof-audio-pci-intel-tgl 0000:00:1f.3: Topology: ABI 3:22:1 Kernel ABI 3:23:0
> sof_sdw sof_sdw: ASoC: Parent card not yet available, widget card binding deferred
> sof_sdw sof_sdw: hda_dsp_hdmi_build_controls: no PCM in topology for HDMI converter 3
> input: sof-soundwire HDMI/DP,pcm=5 as /devices/pci0000:00/0000:00:1f.3/sof_sdw/sound/card0/input14
> input: sof-soundwire HDMI/DP,pcm=6 as /devices/pci0000:00/0000:00:1f.3/sof_sdw/sound/card0/input15
> input: sof-soundwire HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:1f.3/sof_sdw/sound/card0/input16
>
> Maybe this helps a bit further?

Thanks for quick testing.
It shows at least that my guess wasn't wrong.

The problem could be the initialization order in the caller side.
Can the patch below work instead?


Takashi

-- 8< --
--- a/sound/soc/sof/intel/hda-codec.c
+++ b/sound/soc/sof/intel/hda-codec.c
@@ -113,7 +113,9 @@ EXPORT_SYMBOL_NS_GPL(hda_codec_jack_check, SND_SOC_SOF_HDA_AUDIO_CODEC);
#define is_generic_config(x) 0
#endif

-static struct hda_codec *hda_codec_device_init(struct hdac_bus *bus, int addr, int type)
+static struct hda_codec *hda_codec_device_init(struct hdac_bus *bus, int addr,
+ int type,
+ struct hdac_hda_priv *hda_priv)
{
struct hda_codec *codec;
int ret;
@@ -126,6 +128,10 @@ static struct hda_codec *hda_codec_device_init(struct hdac_bus *bus, int addr, i

codec->core.type = type;

+ hda_priv->codec = codec;
+ hda_priv->dev_index = addr;
+ dev_set_drvdata(&codec->core.dev, hda_priv);
+
ret = snd_hdac_device_register(&codec->core);
if (ret) {
dev_err(bus->dev, "failed to register hdac device\n");
@@ -163,15 +169,12 @@ static int hda_codec_probe(struct snd_sof_dev *sdev, int address)
if (!hda_priv)
return -ENOMEM;

- codec = hda_codec_device_init(&hbus->core, address, HDA_DEV_LEGACY);
+ codec = hda_codec_device_init(&hbus->core, address, HDA_DEV_LEGACY,
+ hda_priv);
ret = PTR_ERR_OR_ZERO(codec);
if (ret < 0)
return ret;

- hda_priv->codec = codec;
- hda_priv->dev_index = address;
- dev_set_drvdata(&codec->core.dev, hda_priv);
-
if ((resp & 0xFFFF0000) == IDISP_VID_INTEL) {
if (!hbus->core.audio_component) {
dev_dbg(sdev->dev,