Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] No sound Lenovo X1 Fold 16 Gen 1 #5274

Open
leskunberg opened this issue Dec 13, 2024 · 48 comments
Open

[BUG] No sound Lenovo X1 Fold 16 Gen 1 #5274

leskunberg opened this issue Dec 13, 2024 · 48 comments
Labels
ADL Applies to Alder Lake platform bug Something isn't working SDW Applies to SoundWire bus for codec connection

Comments

@leskunberg
Copy link

Describe the bug
No sound comes from any of the unit speakers(There are 3). The configuration seems correct. The DMIC works correctly. Bluetooth works correctly. Using the USB-C port to a headphone jack also works correctly.

To Reproduce
Install arch linux with kernel 6.12.4 then boot the laptop. Same result with Ubuntu 24.10

Reproduction Rate
Always

Expected behavior
Sound should come from the speakers

Impact
No audio, which is annoying

Environment

  1. Branch name and commit hash of the 2 repositories: sof (firmware/topology) and linux (kernel driver).
    • Kernel: 6.12.4
    • SOF: 2024.09.2-1
  2. Name of the topology file
    • Topology: I've tried a few, all fail to produce sound
  3. Name of the platform(s) on which the bug is observed.
    • Platform: Lenovo X1 Fold 16 Gen 1

Screenshots or console output
Screenshot from 2024-12-13 15-51-35
Screenshot from 2024-12-13 15-52-02

Alsa-info

Any help would be greatly appreciated!

@leskunberg leskunberg added the bug Something isn't working label Dec 13, 2024
@kv2019i kv2019i added HDA Applies to HD-Audio bus for codec connection ADL Applies to Alder Lake platform and removed HDA Applies to HD-Audio bus for codec connection labels Dec 17, 2024
@kv2019i
Copy link
Collaborator

kv2019i commented Dec 17, 2024

Hmm, SOF firmware is loading fine, PCH-DMIC and HDMI/DP seem to be working find, but no codecs found for speakers. The alsa-info has this:

Realtek 0x000232025d131601
Realtek 0x000030025d131601

... so looks like a pair of RT1316. @bardliao @ujfalusi is this a configuration we've seen before?

@kv2019i kv2019i added the SDW Applies to SoundWire bus for codec connection label Dec 17, 2024
@bardliao bardliao transferred this issue from thesofproject/sof Dec 17, 2024
@bardliao
Copy link
Collaborator

Hmm, SOF firmware is loading fine, PCH-DMIC and HDMI/DP seem to be working find, but no codecs found for speakers. The alsa-info has this:

Realtek 0x000232025d131601 Realtek 0x000030025d131601

... so looks like a pair of RT1316. @bardliao @ujfalusi is this a configuration we've seen before?

No, it looks like a speaker only configuration. @leskunberg Can you confirm that there is no jack supported by the laptop?

@ujfalusi
Copy link
Collaborator

@leskunberg
Copy link
Author

leskunberg commented Dec 17, 2024

Hmm, SOF firmware is loading fine, PCH-DMIC and HDMI/DP seem to be working find, but no codecs found for speakers. The alsa-info has this:
Realtek 0x000232025d131601 Realtek 0x000030025d131601
... so looks like a pair of RT1316. @bardliao @ujfalusi is this a configuration we've seen before?

No, it looks like a speaker only configuration. @leskunberg Can you confirm that there is no jack supported by the laptop?

I can confirm it does not have a headphone jack. As a work around I was using a USB-C to 2.5mm converter. That is working without any problems on all USB-C ports.

@bardliao
Copy link
Collaborator

@leskunberg Can you try #5275? And the topology file:
sof-adl-rt1316-l02.zip

@leskunberg
Copy link
Author

leskunberg commented Dec 18, 2024

@leskunberg Can you try #5275? And the topology file: sof-adl-rt1316-l02.zip

The kernel referenced in #5275 has been built and it has attempted to load the topology file. Here is the resulting alsa-info

A noteworthy part:

[    7.371911] snd_sof:sof_select_ipc_and_paths: sof-audio-pci-intel-tgl 0000:00:1f.3: Module parameter used, changed tplg path to /usr/lib/firmware/intel/sof-tplg
[    7.371913] snd_sof:sof_select_ipc_and_paths: sof-audio-pci-intel-tgl 0000:00:1f.3: Module parameter used, changed tplg name to sof-adl-rt1316-l02.tplg
[    7.376314] snd_sof:sof_test_topology_file: sof-audio-pci-intel-tgl 0000:00:1f.3: Failed to open topology file: /usr/lib/firmware/intel/sof-tplg/sof-adl-rt1316-l02.tplg
[    7.376319] sof-audio-pci-intel-tgl 0000:00:1f.3: SOF firmware and/or topology file not found.
[    7.377975] sof-audio-pci-intel-tgl 0000:00:1f.3: Supported default profiles
[    7.377977] sof-audio-pci-intel-tgl 0000:00:1f.3: - ipc type 0 (Requested):
[    7.377978] sof-audio-pci-intel-tgl 0000:00:1f.3:  Firmware file: intel/sof/sof-adl.ri
[    7.377980] sof-audio-pci-intel-tgl 0000:00:1f.3:  Topology file: intel/sof-tplg/sof-adl-rt1316-l02.tplg
[    7.377981] sof-audio-pci-intel-tgl 0000:00:1f.3: Verify the path/name override module parameters.

The file certainly exists

[leif@x1 ~]$ ls -lah /usr/lib/firmware/intel/sof-tplg/sof-adl-rt1316-l02.tplg
-rw-r--r-- 1 root root 33K Dec 17 02:52 /usr/lib/firmware/intel/sof-tplg/sof-adl-rt1316-l02.tplg

Pacman output showing sof-firmware:

[leif@x1 ~]$ pacman -Q | grep sof
sof-firmware 2024.09.2-1
sof-tools 2024.09.2-1

Does the topology file require special handling? I am loading it with the following modprobe:

[leif@x1 ~]$ cat /etc/modprobe.d/test-sof.conf 
options snd_sof_pci tplg_path=/usr/lib/firmware/intel/sof-tplg tplg_filename=sof-adl-rt1316-l02.tplg

@ujfalusi
Copy link
Collaborator

@leskunberg, the path should be relative to the firmware dir, so:

options snd_sof_pci tplg_path=intel/sof-tplg tplg_filename=sof-adl-rt1316-l02.tplg

But in theory you can drop both the path and the filename parameter.

@ujfalusi
Copy link
Collaborator

@leskunberg, there is really no need to specify the tplg_path via module parameter, it is the default one anyways.

@leskunberg
Copy link
Author

leskunberg commented Dec 18, 2024

@leskunberg, the path should be relative to the firmware dir, so:

options snd_sof_pci tplg_path=intel/sof-tplg tplg_filename=sof-adl-rt1316-l02.tplg

But in theory you can drop both the path and the filename parameter.

Thank you @ujfalusi ! That did it. Here is the updated alsa-info

[    6.304077] sof-audio-pci-intel-tgl 0000:00:1f.3: error: can't connect DAI ALH3.IN stream SDW0-Capture
[    6.305845] sof-audio-pci-intel-tgl 0000:00:1f.3: failed to add widget type 28 name : ALH3.IN stream SDW0-Capture
[    6.312068] sof-audio-pci-intel-tgl 0000:00:1f.3: error: tplg component load failed -22
[    6.314091] sof-audio-pci-intel-tgl 0000:00:1f.3: error: failed to load DSP topology -22
[    6.315775] sof-audio-pci-intel-tgl 0000:00:1f.3: ASoC: error at snd_soc_component_probe on 0000:00:1f.3: -22

@leskunberg
Copy link
Author

Out of curiosity does the topology need to match the speakers? If there is a pair of RT1316's should there be another for the third speaker?

For reference here is the speaker locations circled in red:
Screenshot from 2024-12-18 04-53-37

@ujfalusi
Copy link
Collaborator

[    6.185991] sof-audio-pci-intel-tgl 0000:00:1f.3: No SoundWire machine driver found for the ACPI-reported configuration:
[    6.185994] sof-audio-pci-intel-tgl 0000:00:1f.3: link 0 mfg_id 0x025d part_id 0x1316 version 0x3
[    6.185997] sof-audio-pci-intel-tgl 0000:00:1f.3: link 2 mfg_id 0x025d part_id 0x1316 version 0x3
[    6.185999] sof-audio-pci-intel-tgl 0000:00:1f.3: hda codecs found, mask 4
[    6.186000] sof-audio-pci-intel-tgl 0000:00:1f.3: using HDA machine driver skl_hda_dsp_generic now
[    6.186002] sof-audio-pci-intel-tgl 0000:00:1f.3: NHLT device BT(0) detected, ssp_mask 0x4
[    6.186004] sof-audio-pci-intel-tgl 0000:00:1f.3: BT link detected in NHLT tables: 0x4
[    6.186006] snd_intel_dspcfg:intel_nhlt_get_dmic_geo: sof-audio-pci-intel-tgl 0000:00:1f.3: found 2 format definitions
[    6.186007] snd_intel_dspcfg:intel_nhlt_get_dmic_geo: sof-audio-pci-intel-tgl 0000:00:1f.3: max channels found 4
[    6.186009] snd_intel_dspcfg:intel_nhlt_get_dmic_geo: sof-audio-pci-intel-tgl 0000:00:1f.3: Array with 4 dmics
[    6.186010] snd_intel_dspcfg:intel_nhlt_get_dmic_geo: sof-audio-pci-intel-tgl 0000:00:1f.3: dmic number 4 max_ch 4
[    6.186012] sof-audio-pci-intel-tgl 0000:00:1f.3: DMICs detected in NHLT tables: 4

@bardliao, We still don't have a machine driver match?

@leskunberg
Copy link
Author

leskunberg commented Dec 18, 2024

It seems a little strange that when greping for speakers via acpi only two devices show up. There should be a third shouldn't there?

[leif@x1 ~]$ cat /sys/bus/acpi/devices/*/adr | grep 025
0x000232025d131601
0x000030025d131601

@bardliao
Copy link
Collaborator

@leskunberg Can you share the output of "uname -a"? Just want to make sure you are booting with your kernel.
From the log, your kernel still uses the generic HDA machine driver.

[    6.185991] sof-audio-pci-intel-tgl 0000:00:1f.3: No SoundWire machine driver found for the ACPI-reported configuration:
...
[    6.186000] sof-audio-pci-intel-tgl 0000:00:1f.3: using HDA machine driver skl_hda_dsp_generic now

And as @ujfalusi mentioned, please remove the options snd_sof_pci tplg_path=/usr/lib/firmware/intel/sof-tplg tplg_filename=sof-adl-rt1316-l02.tplg. The topology should be selected by the driver. If it doesn't select the right one, then we need to fix it in the driver.

And please add sof-dyndbg.conf.txt to the /etc/modprobe.d/ folder to get more debug log.

Regarding the speaker locations, I assume 0x000232025d131601 is for the left speaker and 0x000030025d131601 is the right speaker. I have no idea about the third speaker. However, a rt1316 amp can support 2 speakers. So, maybe one rt1316 driver 1 speaker and the other rt1316 driver 2 speakers. I guess the UCM needs to be changed if we want to support that configuration.

@ujfalusi
Copy link
Collaborator

and to me it looks like that two of the three can be used at any given time, one is 'fixed' the other is selected based on the device fold status.
Could be different speaker output from one codec or a physical switch from one speaker to the other (unlikely, can cause artifacts)

@leskunberg
Copy link
Author

leskunberg commented Dec 18, 2024

@leskunberg Can you share the output of "uname -a"? Just want to make sure you are booting with your kernel. From the log, your kernel still uses the generic HDA machine driver.

[    6.185991] sof-audio-pci-intel-tgl 0000:00:1f.3: No SoundWire machine driver found for the ACPI-reported configuration:
...
[    6.186000] sof-audio-pci-intel-tgl 0000:00:1f.3: using HDA machine driver skl_hda_dsp_generic now

And as @ujfalusi mentioned, please remove the options snd_sof_pci tplg_path=/usr/lib/firmware/intel/sof-tplg tplg_filename=sof-adl-rt1316-l02.tplg. The topology should be selected by the driver. If it doesn't select the right one, then we need to fix it in the driver.

And please add sof-dyndbg.conf.txt to the /etc/modprobe.d/ folder to get more debug log.

Regarding the speaker locations, I assume 0x000232025d131601 is for the left speaker and 0x000030025d131601 is the right speaker. I have no idea about the third speaker. However, a rt1316 amp can support 2 speakers. So, maybe one rt1316 driver 1 speaker and the other rt1316 driver 2 speakers. I guess the UCM needs to be changed if we want to support that configuration.

uname -a:

[leif@x1 ~]$ uname -a
Linux x1 6.13.0-rc2-g2b55d42bd9ac #3 SMP PREEMPT_DYNAMIC Tue Dec 17 17:19:25 MST 2024 x86_64 GNU/Linux

I do have the sof-dyndbg.conf loaded via modprobe: (trimmed for scrolling)

Here is the updated alsa-info. The correct topology file does not seem to load. I have also removed the options snd_sof_pci tplg_path=/usr/lib/firmware/intel/sof-tplg tplg_filename=sof-adl-rt1316-l02.tplg as requested

@leskunberg
Copy link
Author

and to me it looks like that two of the three can be used at any given time, one is 'fixed' the other is selected based on the device fold status. Could be different speaker output from one codec or a physical switch from one speaker to the other (unlikely, can cause artifacts)

Interesting that the amp supports two speakers. As a guess the speaker selection should probably be done outside the kernel(certainly outside the scope of this work). There likely needs to be some sort of event that detects what orientation the device is in and toggles which speakers are active. Maybe this can be done with a custom lua config for pipewire

This is my first escapade into the sound side of the kernel. Forgive the elementary questions.

@ujfalusi
Copy link
Collaborator

@leskunberg, can you share the dmesg output instead of the alsa-info? PA/PW probing of the audio devices are pushing the relevant information out from the kernel log part of alsa-info.

@leskunberg
Copy link
Author

leskunberg commented Dec 18, 2024

@leskunberg, can you share the dmesg output instead of the alsa-info? PA/PW probing of the audio devices are pushing the relevant information out from the kernel log part of alsa-info.

raw text sof.txt

@ujfalusi
Copy link
Collaborator

OK, it is still eaten up :(
can you add log_buf_len=4M to the kernel cmd line and reboot and attach the raw, unfiltered dmesg as attachment?

@ujfalusi
Copy link
Collaborator

@leskunberg , can you edit the #5274 (comment) and remove the inline kernel log to make scrolling a bit less effort ;)

@leskunberg
Copy link
Author

leskunberg commented Dec 18, 2024

OK, it is still eaten up :( can you add log_buf_len=4M to the kernel cmd line and reboot and attach the raw, unfiltered dmesg as attachment?

Full dmesg
dmesg.txt

@bardliao
Copy link
Collaborator

@leskunberg We need to figure out why soundwire machine driver is not select.

Please add options snd_soc_acpi dyndbg=+pmf, and apply below patch

git diff
diff --git a/sound/soc/soc-acpi.c b/sound/soc/soc-acpi.c
index 270f9777942f..dbd2a5e3fab1 100644
--- a/sound/soc/soc-acpi.c
+++ b/sound/soc/soc-acpi.c
@@ -145,9 +145,13 @@ bool snd_soc_acpi_sdw_link_slaves_found(struct device *dev,
                link_id = SDW_DISCO_LINK_ID(adr);
                version = SDW_VERSION(adr);

+               dev_info(dev, "bard: checking adr %llx \n", adr);
                for (j = 0; j < peripherals->num_peripherals; j++) {
                        struct sdw_slave *peripheral = peripherals->array[j];

+                       dev_info(dev, "bard: peripheral %d link_id %d part_id %#x mfg_id %#x version %#x\n",
+                                       j, peripheral->bus->link_id, peripheral->id.part_id,
+                                       peripheral->id.mfg_id, peripheral->id.sdw_version);
                        /* find out how many identical parts were reported on that link */
                        if (peripheral->bus->link_id == link_id &&
                            peripheral->id.part_id == part_id &&
diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c
index 720803dadee8..b710208f26d0 100644
--- a/sound/soc/sof/intel/hda.c
+++ b/sound/soc/sof/intel/hda.c
@@ -1108,6 +1108,7 @@ static struct snd_soc_acpi_mach *hda_sdw_machine_select(struct snd_sof_dev *sdev
                return NULL;
        }

+       dev_info(sdev->dev, "bard: link_mask %#x\n", link_mask);
        /*
         * Select SoundWire machine driver if needed using the
         * alternate tables. This case deals with SoundWire-only
@@ -1124,6 +1125,7 @@ static struct snd_soc_acpi_mach *hda_sdw_machine_select(struct snd_sof_dev *sdev
                 * link_mask supported by hw and then go on searching
                 * link_adr
                 */
+               dev_info(sdev->dev, "bard: mach link_mask %#x\n", mach->link_mask);
                if (~link_mask & mach->link_mask)
                        continue;

Then share the dmesg again, thanks.

@leskunberg
Copy link
Author

@leskunberg We need to figure out why soundwire machine driver is not select.

Please add options snd_soc_acpi dyndbg=+pmf, and apply below patch

git diff
diff --git a/sound/soc/soc-acpi.c b/sound/soc/soc-acpi.c
index 270f9777942f..dbd2a5e3fab1 100644
--- a/sound/soc/soc-acpi.c
+++ b/sound/soc/soc-acpi.c
@@ -145,9 +145,13 @@ bool snd_soc_acpi_sdw_link_slaves_found(struct device *dev,
                link_id = SDW_DISCO_LINK_ID(adr);
                version = SDW_VERSION(adr);

+               dev_info(dev, "bard: checking adr %llx \n", adr);
                for (j = 0; j < peripherals->num_peripherals; j++) {
                        struct sdw_slave *peripheral = peripherals->array[j];

+                       dev_info(dev, "bard: peripheral %d link_id %d part_id %#x mfg_id %#x version %#x\n",
+                                       j, peripheral->bus->link_id, peripheral->id.part_id,
+                                       peripheral->id.mfg_id, peripheral->id.sdw_version);
                        /* find out how many identical parts were reported on that link */
                        if (peripheral->bus->link_id == link_id &&
                            peripheral->id.part_id == part_id &&
diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c
index 720803dadee8..b710208f26d0 100644
--- a/sound/soc/sof/intel/hda.c
+++ b/sound/soc/sof/intel/hda.c
@@ -1108,6 +1108,7 @@ static struct snd_soc_acpi_mach *hda_sdw_machine_select(struct snd_sof_dev *sdev
                return NULL;
        }

+       dev_info(sdev->dev, "bard: link_mask %#x\n", link_mask);
        /*
         * Select SoundWire machine driver if needed using the
         * alternate tables. This case deals with SoundWire-only
@@ -1124,6 +1125,7 @@ static struct snd_soc_acpi_mach *hda_sdw_machine_select(struct snd_sof_dev *sdev
                 * link_mask supported by hw and then go on searching
                 * link_adr
                 */
+               dev_info(sdev->dev, "bard: mach link_mask %#x\n", mach->link_mask);
                if (~link_mask & mach->link_mask)
                        continue;

Then share the dmesg again, thanks.

It is currently being loaded in the following:

[leif@ravn modprobe.d]$ head sof-dynamic-debug-modprobe.conf 
# ACPI
options snd_sof_acpi dyndbg=+pmf
options snd_sof_acpi_intel_byt dyndbg=+pmf
options snd_sof_acpi_intel_bdw dyndbg=+pmf
options snd_sof_intel_byt dyndbg=+pmf
options snd_sof_intel_bdw dyndbg=+pmf

# PCI
options snd_sof_pci dyndbg=+pmf
options snd_sof_pci_intel_apl dyndbg=+pmf

@ujfalusi
Copy link
Collaborator

ujfalusi commented Dec 18, 2024

@leskunberg and just to be sure can you check if you really have the patch from #5275 :

grep sof-adl-rt1316-l02.tplg sound/soc/intel/common/*

if you don't then:

wget https://github.com/thesofproject/linux/pull/5275/commits/778a6efc5827eef5227919192a91fa35d5fb66c7.patch
patch -p1 < 778a6efc5827eef5227919192a91fa35d5fb66c7.patch
or if you have cloned the tree:
git am 778a6efc5827eef5227919192a91fa35d5fb66c7.patch

@leskunberg
Copy link
Author

leskunberg commented Dec 18, 2024

@leskunberg and just to be sure can you check if you really have the patch from #5275 :

grep sof-adl-rt1316-l02.tplg sound/soc/intel/common/*

if you don't then:

wget https://github.com/thesofproject/linux/pull/5275/commits/778a6efc5827eef5227919192a91fa35d5fb66c7.patch
patch -p1 < 778a6efc5827eef5227919192a91fa35d5fb66c7.patch
or if you have cloned the tree:
git am 778a6efc5827eef5227919192a91fa35d5fb66c7.patch

Looks like the kernel didn't have the patch, it does now. Here is the updated dmesg output:

dmesg.txt

One thing of note is that the topology file originally couldn't be found as the naming sof-adl-rt1316-l02-4ch.tplg was what sof was looking for. I renamed the file from sof-adl-rt1316-l02.tplg to sof-adl-rt1316-l02-4ch.tplg and it seemed to take; although with the current error:

[    7.818876] sof-audio-pci-intel-tgl 0000:00:1f.3: error: can't connect DAI ALH3.IN stream SDW0-Capture
[    7.820565] sof-audio-pci-intel-tgl 0000:00:1f.3: failed to add widget type 28 name : ALH3.IN stream SDW0-Capture
[    7.822318] sof_sdw sof_sdw: ASoC: failed to load widget ALH3.IN
[    7.825178] sof_sdw sof_sdw: ASoC: topology: could not load header: -22
[    7.826758] sof-audio-pci-intel-tgl 0000:00:1f.3: error: tplg component load failed -22
[    7.828248] sof-audio-pci-intel-tgl 0000:00:1f.3: error: failed to load DSP topology -22
[    7.830067] sof-audio-pci-intel-tgl 0000:00:1f.3: ASoC: error at snd_soc_component_probe on 0000:00:1f.3: -22
[    7.832394] sof_sdw sof_sdw: ASoC: failed to instantiate card -22
[    7.834016] sof_sdw sof_sdw: error -EINVAL: snd_soc_register_card failed -22
[    7.835971] sof_sdw sof_sdw: probe with driver sof_sdw failed with error -22

There seems to be more interesting log output in dmesg as well

@ranj063
Copy link
Collaborator

ranj063 commented Dec 18, 2024

@bardliao did you generate the topology file manually? Looks like a missing stream name in the topology causing the failure to connect?

@bardliao
Copy link
Collaborator

Looks like we made some progress.
@leskunberg Please add options snd_soc_sdw_utils dyndbg=+pmf and get the dmesg again. Then we can grep "create dai link" from the dmesg to check the DAI link ids.
@ranj063
The error: can't connect DAI ALH3.IN stream SDW0-Capture error is probably that I uses -DNO_JACK to build the topology which doesn't actually remove the jack PCMs. See thesofproject/sof#9740.
@leskunberg Please try the sof-adl-rt1316-l02-4ch.tplg below.
sof-adl-rt1316-l02-4ch.zip

@leskunberg
Copy link
Author

Looks like we made some progress. @leskunberg Please add options snd_soc_sdw_utils dyndbg=+pmf and get the dmesg again. Then we can grep "create dai link" from the dmesg to check the DAI link ids. @ranj063 The error: can't connect DAI ALH3.IN stream SDW0-Capture error is probably that I uses -DNO_JACK to build the topology which doesn't actually remove the jack PCMs. See thesofproject/sof#9740. @leskunberg Please try the sof-adl-rt1316-l02-4ch.tplg below. sof-adl-rt1316-l02-4ch.zip

Excellent. Here is the new output:

[    7.507124] snd_soc_sof_sdw:sof_card_dai_links_create: sof_sdw sof_sdw: DAI link numbers: sdw 2, ssp 0, dmic 2, hdmi 3, bt: 0
[    7.507126] snd_soc_sdw_utils:asoc_sdw_init_dai_link: sof_sdw sof_sdw: create dai link SDW2-Playback, id 2
[    7.507134] snd_soc_sdw_utils:asoc_sdw_init_dai_link: sof_sdw sof_sdw: create dai link SDW2-Capture, id 3
[    7.507136] snd_soc_sdw_utils:asoc_sdw_init_dai_link: sof_sdw sof_sdw: create dai link dmic01, id 4
[    7.507137] snd_soc_sdw_utils:asoc_sdw_init_dai_link: sof_sdw sof_sdw: create dai link dmic16k, id 5
[    7.507138] snd_soc_sdw_utils:asoc_sdw_init_dai_link: sof_sdw sof_sdw: create dai link iDisp1, id 6
[    7.507140] snd_soc_sdw_utils:asoc_sdw_init_dai_link: sof_sdw sof_sdw: create dai link iDisp2, id 7
[    7.507141] snd_soc_sdw_utils:asoc_sdw_init_dai_link: sof_sdw sof_sdw: create dai link iDisp3, id 8

Full dmesg:
dmesg.txt

@ujfalusi
Copy link
Collaborator

@bardliao, why it wants to connect DAI HDA3.OUT stream iDisp4?
On my TGL-sdw (intel/sof-tplg/sof-tgl-rt715-rt711-rt1308-mono.tplg) machine the dmesg | grep iDisp is

[  216.756960] snd_soc_sdw_utils:asoc_sdw_init_dai_link: sof_sdw sof_sdw: create dai link iDisp1, id 5
[  216.756968] snd_soc_sdw_utils:asoc_sdw_init_dai_link: sof_sdw sof_sdw: create dai link iDisp2, id 6
[  216.756976] snd_soc_sdw_utils:asoc_sdw_init_dai_link: sof_sdw sof_sdw: create dai link iDisp3, id 7
[  216.756985] snd_soc_sdw_utils:asoc_sdw_init_dai_link: sof_sdw sof_sdw: create dai link iDisp4, id 8
[  216.758607] snd_sof:sof_widget_ready: sof-audio-pci-intel-tgl 0000:00:1f.3: tplg: widget 30 (HDA0.OUT) is ready [type: 27, pipe: 6, pins: 0 / 0, stream: iDisp1]
[  216.758615] snd_sof:sof_connect_dai_widget: sof-audio-pci-intel-tgl 0000:00:1f.3: tplg: connected widget HDA0.OUT -> DAI link iDisp1
[  216.758703] snd_sof:sof_widget_ready: sof-audio-pci-intel-tgl 0000:00:1f.3: tplg: widget 36 (HDA1.OUT) is ready [type: 27, pipe: 7, pins: 0 / 0, stream: iDisp2]
[  216.758711] snd_sof:sof_connect_dai_widget: sof-audio-pci-intel-tgl 0000:00:1f.3: tplg: connected widget HDA1.OUT -> DAI link iDisp2
[  216.758796] snd_sof:sof_widget_ready: sof-audio-pci-intel-tgl 0000:00:1f.3: tplg: widget 42 (HDA2.OUT) is ready [type: 27, pipe: 8, pins: 0 / 0, stream: iDisp3]
[  216.758805] snd_sof:sof_connect_dai_widget: sof-audio-pci-intel-tgl 0000:00:1f.3: tplg: connected widget HDA2.OUT -> DAI link iDisp3
[  216.759732] snd_sof:sof_link_load: sof-audio-pci-intel-tgl 0000:00:1f.3: tplg: 1 hw_configs found, default id: 5 for dai link iDisp1!
[  216.759738] snd_sof:sof_link_load: sof-audio-pci-intel-tgl 0000:00:1f.3: tplg: 1 hw_configs found, default id: 6 for dai link iDisp2!
[  216.759746] snd_sof:sof_link_load: sof-audio-pci-intel-tgl 0000:00:1f.3: tplg: 1 hw_configs found, default id: 7 for dai link iDisp3!

@bardliao
Copy link
Collaborator

@bardliao, why it wants to connect DAI HDA3.OUT stream iDisp4? On my TGL-sdw (intel/sof-tplg/sof-tgl-rt715-rt711-rt1308-mono.tplg) machine the dmesg | grep iDisp is

[  216.756960] snd_soc_sdw_utils:asoc_sdw_init_dai_link: sof_sdw sof_sdw: create dai link iDisp1, id 5
[  216.756968] snd_soc_sdw_utils:asoc_sdw_init_dai_link: sof_sdw sof_sdw: create dai link iDisp2, id 6
[  216.756976] snd_soc_sdw_utils:asoc_sdw_init_dai_link: sof_sdw sof_sdw: create dai link iDisp3, id 7
[  216.756985] snd_soc_sdw_utils:asoc_sdw_init_dai_link: sof_sdw sof_sdw: create dai link iDisp4, id 8
[  216.758607] snd_sof:sof_widget_ready: sof-audio-pci-intel-tgl 0000:00:1f.3: tplg: widget 30 (HDA0.OUT) is ready [type: 27, pipe: 6, pins: 0 / 0, stream: iDisp1]
[  216.758615] snd_sof:sof_connect_dai_widget: sof-audio-pci-intel-tgl 0000:00:1f.3: tplg: connected widget HDA0.OUT -> DAI link iDisp1
[  216.758703] snd_sof:sof_widget_ready: sof-audio-pci-intel-tgl 0000:00:1f.3: tplg: widget 36 (HDA1.OUT) is ready [type: 27, pipe: 7, pins: 0 / 0, stream: iDisp2]
[  216.758711] snd_sof:sof_connect_dai_widget: sof-audio-pci-intel-tgl 0000:00:1f.3: tplg: connected widget HDA1.OUT -> DAI link iDisp2
[  216.758796] snd_sof:sof_widget_ready: sof-audio-pci-intel-tgl 0000:00:1f.3: tplg: widget 42 (HDA2.OUT) is ready [type: 27, pipe: 8, pins: 0 / 0, stream: iDisp3]
[  216.758805] snd_sof:sof_connect_dai_widget: sof-audio-pci-intel-tgl 0000:00:1f.3: tplg: connected widget HDA2.OUT -> DAI link iDisp3
[  216.759732] snd_sof:sof_link_load: sof-audio-pci-intel-tgl 0000:00:1f.3: tplg: 1 hw_configs found, default id: 5 for dai link iDisp1!
[  216.759738] snd_sof:sof_link_load: sof-audio-pci-intel-tgl 0000:00:1f.3: tplg: 1 hw_configs found, default id: 6 for dai link iDisp2!
[  216.759746] snd_sof:sof_link_load: sof-audio-pci-intel-tgl 0000:00:1f.3: tplg: 1 hw_configs found, default id: 7 for dai link iDisp3!

There are 4 iDisp PCMs in topology1 topologies by default. Let me change it to 3.

@bardliao
Copy link
Collaborator

@leskunberg Can you try the topology?
sof-adl-rt1316-l02-4ch.zip

@ujfalusi
Copy link
Collaborator

@bardliao, for me iDisp1-4 is created, but in the case of Fold, only iDisp1-3. Confusing.

@leskunberg
Copy link
Author

@leskunberg Can you try the topology? sof-adl-rt1316-l02-4ch.zip

[    7.565798] sof_sdw sof_sdw: ASoC: physical link dmic01 (id 3) not exist
[    7.565823] sof_sdw sof_sdw: ASoC: topology: could not load header: -22
[    7.565868] sof-audio-pci-intel-tgl 0000:00:1f.3: error: tplg component load failed -22
[    7.565882] sof-audio-pci-intel-tgl 0000:00:1f.3: error: failed to load DSP topology -22
[    7.565896] sof-audio-pci-intel-tgl 0000:00:1f.3: ASoC: error at snd_soc_component_probe on 0000:00:1f.3: -22
[    7.565939] sof_sdw sof_sdw: ASoC: failed to instantiate card -22
[    7.566009] sof_sdw sof_sdw: error -EINVAL: snd_soc_register_card failed -22
[    7.566037] sof_sdw sof_sdw: probe with driver sof_sdw failed with error -22

Full dmesg:
dmesg.txt

@bardliao
Copy link
Collaborator

@bardliao, for me iDisp1-4 is created, but in the case of Fold, only iDisp1-3. Confusing.

If SOF_SDW_TGL_HDMI quirk is set in the machine driver, iDisp1-4 will be created.

@bardliao
Copy link
Collaborator

Here you go @leskunberg
sof-adl-rt1316-l02-4ch.zip

@leskunberg
Copy link
Author

leskunberg commented Dec 19, 2024

Here you go @leskunberg sof-adl-rt1316-l02-4ch.zip

@bardliao we are getting close. There is now the option to select a new audio output, and see that there is a left and a right channel test, but when clicking on either it freezes. No sound comes on when playing a video either.

[ 171.960552] soundwire_intel soundwire_intel.link.0: ASoC: error at snd_soc_dai_hw_params on SDW0 Pin2: -22

dmesg has lots of interesting logs:
dmesg.txt

@leskunberg
Copy link
Author

Additional screenshot of alsamixer

Screenshot from 2024-12-19 08-21-02

@leskunberg
Copy link
Author

Additional Dmesg log for when attempting to play something in firefox:

[  101.266008] sof-audio-pci-intel-tgl 0000:00:1f.3: SDW0 Pin2 widget not found, check amp link num in the topology
[  101.266013] soundwire_intel soundwire_intel.link.0: ASoC: error at snd_soc_dai_hw_params on SDW0 Pin2: -22
[  101.266021] sdw_deprepare_stream: subdevice #0-Playback: inconsistent state state 1

@bardliao
Copy link
Collaborator

@leskunberg Please try sof-adl-rt1316-l02-4ch.zip The error of "SDW0 Pin2" is that the "SDW0 Pin2" DAI was missed in the previous topology.

@leskunberg
Copy link
Author

@leskunberg Please try sof-adl-rt1316-l02-4ch.zip The error of "SDW0 Pin2" is that the "SDW0 Pin2" DAI was missed in the previous topology.

@bardliao looks like the configuration options have disappeared and I cannot see the card in alsamixer

[    7.63335d8] sof-audio-pci-intel-tgl 0000:00:1f.3: Failed to setup widget PIPELINE.4.DMIC0.IN
[    7.633419] sof-audio-pci-intel-tgl 0000:00:1f.3: error: tplg component load failed -22
[    7.636649] sof-audio-pci-intel-tgl 0000:00:1f.3: error: failed to load DSP topology -22
[    7.637645] sof-audio-pci-intel-tgl 0000:00:1f.3: ASoC: error at snd_soc_component_probe on 0000:00:1f.3: -22

Dmesg:
dmesg.txt

@bardliao
Copy link
Collaborator

@leskunberg Thanks for testing. Please try sof-adl-rt1316-l02-4ch.zip. Hope it works.

@leskunberg
Copy link
Author

@leskunberg Thanks for testing. Please try sof-adl-rt1316-l02-4ch.zip. Hope it works.

We have success! All speakers are producing sound and things have cleaned up quite a bit on the menus. The only issue is that the R and L channels are swapped. Thank you for the help @bardliao

@bardliao
Copy link
Collaborator

@leskunberg It should be easy to fix the swapped issue. Please apply the updated #5275 and the topology.
sof-adl-rt1316-l02-4ch.zip

@leskunberg
Copy link
Author

leskunberg commented Dec 20, 2024

@leskunberg It should be easy to fix the swapped issue. Please apply the updated #5275 and the topology. sof-adl-rt1316-l02-4ch.zip

@bardliao Can confirm that both the kernel patch and the new topology works great. Thank you very much for all the hard work @bardliao and @ujfalusi. This is great.

@leskunberg
Copy link
Author

leskunberg commented Dec 22, 2024

After running some further tests this weekend, there has been an error popping up in dmesg:

"""
[ 7.918135] sof_sdw sof_sdw: hda_dsp_hdmi_build_controls: no PCM in topology for HDMI converter 3
[ 10.266490] sof-audio-pci-intel-tgl 0000:00:1f.3: ipc tx error for 0x60010000 (msg/reply size: 108/20): -5
[ 10.266493] sof-audio-pci-intel-tgl 0000:00:1f.3: sof_ipc3_pcm_hw_params: pcm7 (HDMI 3), dir 0: STREAM_PCM_PARAMS ipc failed for stream_tag 1
[ 10.266495] sof-audio-pci-intel-tgl 0000:00:1f.3: ASoC: error at snd_soc_pcm_component_hw_params on 0000:00:1f.3: -5
[ 10.266498] HDMI 3: ASoC: error at __soc_pcm_hw_params on HDMI 3: -5
[ 10.266504] HDMI 3: ASoC: error at dpcm_fe_dai_hw_params on HDMI 3: -5
"""
There doesn't seem to be any functional issues with the setup. All speakers are working perfectly and the HDMI USB-C ports are still functional to route audio through. Maybe they can be safely ignored
Attached Dmesg:
dmesg.txt

@bardliao
Copy link
Collaborator

I guess that is fine. I can see
HDMI 2: ASoC: error at __soc_pcm_hw_params on HDMI 2: -5 and HDMI 3: ASoC: error at __soc_pcm_hw_params on HDMI 3: -5 in the dmesg.
I guess that is because your monitor is connected to HDMI 1 but you were trying to open HDMI 2 and 3. Let's see if @kv2019i has any comment when he is back from holidays.

@ujfalusi
Copy link
Collaborator

I guess that is fine. I can see HDMI 2: ASoC: error at __soc_pcm_hw_params on HDMI 2: -5 and HDMI 3: ASoC: error at __soc_pcm_hw_params on HDMI 3: -5 in the dmesg. I guess that is because your monitor is connected to HDMI 1 but you were trying to open HDMI 2 and 3. Let's see if @kv2019i has any comment when he is back from holidays.

@bardliao, the firmware reports error for the 0x60010000 message for the second and third HDMI PCM (pcm6 and pcm7), the error is -5.
The sequence looks like a PW/PA probe in dmesg: open/h_params, prepare, hw_free, close.
pcm2 (Speaker), dir 0: stream_tag 1 - OK
pcm10 (DMIC), dir 1: stream_tag 1 - OK
pcm5 (HDMI 1), dir 0: stream_tag 1 - OK
pcm6 (HDMI 2), dir 0: stream_tag 1 - nOK
pcm7 (HDMI 3), dir 0: stream_tag 1 - nOK
and for pcm6-7 there are multiple retries to find something which is accepted, but the fw always returns -5

I cannot reproduce the issue locally on my TGL sdw machine :(

@leskunberg
Copy link
Author

I guess that is fine. I can see HDMI 2: ASoC: error at __soc_pcm_hw_params on HDMI 2: -5 and HDMI 3: ASoC: error at __soc_pcm_hw_params on HDMI 3: -5 in the dmesg. I guess that is because your monitor is connected to HDMI 1 but you were trying to open HDMI 2 and 3. Let's see if @kv2019i has any comment when he is back from holidays.

@bardliao, the firmware reports error for the 0x60010000 message for the second and third HDMI PCM (pcm6 and pcm7), the error is -5. The sequence looks like a PW/PA probe in dmesg: open/h_params, prepare, hw_free, close. pcm2 (Speaker), dir 0: stream_tag 1 - OK pcm10 (DMIC), dir 1: stream_tag 1 - OK pcm5 (HDMI 1), dir 0: stream_tag 1 - OK pcm6 (HDMI 2), dir 0: stream_tag 1 - nOK pcm7 (HDMI 3), dir 0: stream_tag 1 - nOK and for pcm6-7 there are multiple retries to find something which is accepted, but the fw always returns -5

I cannot reproduce the issue locally on my TGL sdw machine :(

It is important to note there is no external devices plugged into the unit. Testing the most recent patch and tplg over the past week has not yeilded any noticeable bugs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ADL Applies to Alder Lake platform bug Something isn't working SDW Applies to SoundWire bus for codec connection
Projects
None yet
Development

No branches or pull requests

5 participants