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

No sound card detected on custom EHL board with ALC5660I codec on I2S0 #2990

Closed
gbuloz opened this issue Jun 10, 2021 · 103 comments
Closed

No sound card detected on custom EHL board with ALC5660I codec on I2S0 #2990

gbuloz opened this issue Jun 10, 2021 · 103 comments
Labels
ACPI ACPI info is wrong BIOS Related to BIOS bug Something isn't working EHL Applies to Elkhart Lake P3 Low-impact bugs or features

Comments

@gbuloz
Copy link

gbuloz commented Jun 10, 2021

The sound is working under Windows 10, but no sound card detected under Linux (kernel 5.11.11 Fedora 33)
The ACPI of this board has been changed to use codec ID 10EC5660 instead of the original value INTC1027 (that works under Windows but is not supported under Linux). See attached dsdt.dsl file generated under Linux.
dsdt.dsl.gz

At the end of boot I get snd_soc_rt5660 automatically loaded (thanks to ACPI match by snd_soc_acpi_intel_match).
But snd_soc_ehl_rt5660 is not. It can be loaded manually but this does not create any available sound card

[root@localhost update]# cat /sys/bus/acpi/devices/10EC5660\:00/status
15
[root@localhost update]# grep CONFIG_SND_SOC_INTEL_EHL_RT5660_MACH /usr/src/kernels/5.11.11-200.fc33.x86_64/.config
CONFIG_SND_SOC_INTEL_EHL_RT5660_MACH=m
[root@localhost update]# uname -r
5.11.11-200.fc33.x86_64
[root@localhost update]#

[root@localhost ~]# lsmod | grep 5660
snd_soc_rt5660         69632  0
snd_soc_rl6231         20480  1 snd_soc_rt5660
snd_soc_core          331776  5 soundwire_intel,snd_sof,snd_soc_rt5660,snd_sof_intel_hda_common,snd_soc_hdac_hda
snd_pcm               135168  12 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec,soundwire_intel,snd_sof,snd_soc_rt5660,snd_sof_intel_hda_common,snd_sof_intel_ipc,snd_compress,snd_soc_core,snd_hda_core,snd_pcm_dmaengine

[root@localhost ~]# modprobe snd_soc_ehl_rt5660

[root@localhost ~]# lsmod | grep 5660
snd_soc_ehl_rt5660     24576  0
snd_soc_rt5660         69632  0
snd_soc_rl6231         20480  1 snd_soc_rt5660
snd_soc_core          331776  6 soundwire_intel,snd_sof,snd_soc_rt5660,snd_sof_intel_hda_common,snd_soc_hdac_hda,snd_soc_ehl_rt5660
snd_hda_codec         172032  4 snd_hda_codec_hdmi,snd_hda_intel,snd_soc_hdac_hda,snd_soc_ehl_rt5660
snd_hda_core          110592  8 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_ext_core,snd_hda_codec,snd_sof_intel_hda_common,snd_soc_hdac_hda,snd_soc_ehl_rt5660,snd_sof_intel_hda
snd_pcm               135168  12 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec,soundwire_intel,snd_sof,snd_soc_rt5660,snd_sof_intel_hda_common,snd_sof_intel_ipc,snd_compress,snd_soc_core,snd_hda_core,snd_pcm_dmaengine
[root@localhost ~]#

[guest@localhost ~]$ systemctl --user start pulseaudio
[guest@localhost ~]$ arecord -l
arecord: device_list:274: no soundcards found...
[guest@localhost ~]$

Any other verification I can do through /sys or other things for debug ?

@gbuloz gbuloz changed the title No sound card detected on custom EHL board with AlC5660I codec on I2S0 No sound card detected on custom EHL board with ALC5660I codec on I2S0 Jun 10, 2021
@plbossart
Copy link
Member

plbossart commented Jun 10, 2021

@gbuloz can you add this file
sof-dyndbg.conf.txt as /etc/modprobe.d/sof-dyndbg.conf and attach the dmesg log (edit: need to reboot)

Can you also provide the results of "ls /sys/bus/pci/devices/0000:00:1f.3/", just to check if you have an elh_rt5660 device added by the SOF driver.

Thanks!

@plbossart plbossart added the EHL Applies to Elkhart Lake label Jun 10, 2021
@libinyang
Copy link

@gbuloz The ACPI table seems OK now. Besides dmesg, please also attach the lspci -vvvv

@gbuloz
Copy link
Author

gbuloz commented Jun 11, 2021

@plbossart : I've added the .conf file and power-cycled

[root@localhost ~]# ls -l /etc/modprobe.d/sof-dyndbg.conf
-rw-r--r--. 1 root root 2485 11 juin  10:25 /etc/modprobe.d/sof-dyndbg.conf

shutdown+power-cycle
dmesg.log
(edit : I see no debug message in dmesg output, however I have CONFIG_DYNAMIC_DEBUG=y and /sys/kernel/debug/dynamic_debug/control shows many =p so I should get some debug message)

[root@localhost ~]# ls /sys/bus/pci/devices/0000:00:1f.3/
ari_enabled               driver           link           power_state  subsystem
broken_parity_status      driver_override  local_cpulist  remove       subsystem_device
class                     enable           local_cpus     rescan       subsystem_vendor
config                    firmware_node    modalias       resource     supplier:pci:0000:00:02.0
consistent_dma_mask_bits  hdaudioC0D2      msi_bus        resource0    uevent
d3cold_allowed            index            msi_irqs       resource4    vendor
device                    irq              numa_node      revision
dma_mask_bits             label            power          sound

@libinyang :
Here is the output of lspci -vvvv
lspcivvvv.log
Note : I got the following error :

[root@localhost ~]# lspci -vvvv > lspcivvvv.log
pcilib: sysfs_read_vpd: read failed: Input/output error

@plbossart
Copy link
Member

@gbuloz the results show that there is no machine device created, so no machine driver probed.

Without dynamic debug it's going to be hard to figure things out. Not sure if this is a configuration issue, maybe try using our setup in https://github.com/thesofproject/kconfig and run https://github.com/thesofproject/kconfig/blob/master/kconfig-sof-default.sh to generate a .config. This may or may not work on your platform due to other dependencies. This config is just a minimal one for our own tests and a reference to see what options we enable.

@gbuloz
Copy link
Author

gbuloz commented Jun 14, 2021

@plbossart : I've been able to get some debug and got "sof-audio-pci 0000:00:1f.3: error: cl_copy_fw: timeout HDA_DSP_SRAM_REG_ROM_STATUS read"
See dmesg :
dmesg_3.log

I still don't know why dynamic debug did not wotk for snd/sof modules but was working for other drivers. I'm wondering if the modules where running enough to produce at least some debug messages. To be sure I've rebuilt all modules under sound/ (318 modules) with dev_dbg changed to dev_info and pr_debug to pr_info and installed them under updates/, then ran depmod -a and ran dracut -f (because 3 snd modules where in initramfs; now I have many). This gave me an error while still under initramfs about intel/sof/sof-ehl.ri missing, so I added this file to initramfs. And this leads to the full dmesg above.

@plbossart
Copy link
Member

@gbuloz this error typically indicates that the firmware you used was not signed with the key that is known to the CSME (ME) engine. Can you please clarify which SOF firmware you used?

I am also not sure if the results make sense, the errors you see are logged with dev_err, so they would be seen by default. dynamic debug is only useful when we have dev_dbg() in the code.

Weird.

@gbuloz
Copy link
Author

gbuloz commented Jun 14, 2021

@plbrossart : I use only the standard packages from Fedora repos. Currently alsa-sof-firmware-1.6.1-4.fc33.noarch providing the firmware like this :

[root@localhost ~]# ls -l /usr/lib/firmware/intel/sof/sof-ehl.ri /usr/lib/firmware/intel/sof/intel-signed/sof-ehl.ri
-rw-r--r--. 1 root root 360448  4 mars  09:28 /usr/lib/firmware/intel/sof/intel-signed/sof-ehl.ri
lrwxrwxrwx. 1 root root     23 12 mars  20:28 /usr/lib/firmware/intel/sof/sof-ehl.ri -> intel-signed/sof-ehl.ri

And I also don't understand why I did not get these dev_err message before I rebuild all modules under sound/ and install them under updates. I've built them with the same .config than the Fedora distribution, but out-of-tree.
I still also don't understand why the dynamic debug didi not work for snd/sof modules using your sof-dyndbg.conf but worked for other modules for which I added entries in the same sof-dyndbg.conf. I've even added this file to initramfs for testing but this did not help.

@plbossart
Copy link
Member

@gbuloz could you try /usr/lib/firmware/intel/sof/sof-ehl.ri -> community/sof-ehl.ri

I don't know if this was released but that would be the alternate key that's typically used.

@gbuloz
Copy link
Author

gbuloz commented Jun 14, 2021

@plbrossart : unfortunately I have no community subdir, but only a public-signed/ and there's no file for EHL in it : sof-apl.ri sof-cnl.ri sof-icl.ri sof-jsl.ri sof-tgl-h.ri sof-tgl.ri

Edit : I've tried with https://github.com/thesofproject/sof-bin/blob/main/v1.8.x/sof-v1.8-rc2/intel-signed/sof-ehl.ri but same result.
Edit : I need to blacklist pinctrl_elkhartlake on my platform to prevent a kernel oops (https://bugzilla.redhat.com/show_bug.cgi?id=1948468) leading to a very long boot time. This problem is still present with kernel 5.12.9. But it seems the SOF firmware download does not behave the same way with or without pinctrl_elkhartlake blacklisted. I don't know if it's related or just a side effect.
See dmesg_5129_3pinctl.log (not blacklisted) and dmesg_5129_3nopinctl.log (blacklisted)
dmesg_5129_3pinctl.log
dmesg_5129_3nopinctl.log

@mengdonglin mengdonglin added the bug Something isn't working label Jun 15, 2021
@gbuloz
Copy link
Author

gbuloz commented Jun 15, 2021

@libinyang : your debug firmware works much better than the prod one
dmesg_prod.log
dmesg_debug.log
With the debug one I now get :

[root@localhost ~]# lsmod | grep 5660
snd_soc_ehl_rt5660     24576  0
snd_hda_codec         172032  4 snd_hda_codec_hdmi,snd_hda_intel,snd_soc_hdac_hda,snd_soc_ehl_rt5660
snd_soc_rt5660         69632  0
snd_hda_core          110592  8 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_ext_core,snd_hda_codec,snd_sof_intel_hda_common,snd_soc_hdac_hda,snd_soc_ehl_rt5660,snd_sof_intel_hda
snd_soc_rl6231         20480  1 snd_soc_rt5660
snd_soc_core          331776  7 soundwire_intel,snd_sof,snd_soc_rt5660,snd_sof_intel_hda_common,snd_soc_hdac_hda,snd_soc_dmic,snd_soc_ehl_rt5660
snd_pcm               135168  11 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec,soundwire_intel,snd_sof,snd_soc_rt5660,snd_sof_intel_hda_common,snd_compress,snd_soc_core,snd_hda_core,snd_pcm_dmaengine
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# ls /sys/bus/pci/devices/0000:00:1f.3/
ari_enabled               d3cold_allowed  driver_override  index          local_cpus  power        resource0         subsystem_vendor
broken_parity_status      device          ehdaudio0D2      irq            modalias    power_state  resource4         supplier:pci:0000:00:02.0
class                     dma_mask_bits   ehl_rt5660       label          msi_bus     remove       revision          uevent
config                    dmic-codec      enable           link           msi_irqs    rescan       subsystem         vendor
consistent_dma_mask_bits  driver          firmware_node    local_cpulist  numa_node   resource     subsystem_device

I have currently no access to desktop to check if I have new input/output channels, but only have access to text console. Which command do recommand to check ? I've tried with "systemctl --user start pulseaudio" then "arecord -l" but I get "arecord: device_list:274: no soundcards found.."

Please also note my platform is equipped with a CPU sample and that I've been heard from my HW team that the production processors will require some software updates. Could this explain the signature problem with the SOF firmware ?

@plbossart
Copy link
Member

@gbuloz yes, when you receive production devices the firmware is required to use production keys for authentication. It looks like you are in a gray area here.

I can see that the device '/sys/bus/pci/devices/0000:00:1f.3/ehl_rt5660' is created, which is good and expected. Somehow the card is not created though.

if you can't figure out how to enable dynamic debug, you can try a manual probe:

add 'blacklist snd_soc_ehl_rt5660' in /etc/modprobe.d/alsa-base.conf
boot as usual
echo 8 > /proc/sys/kernel/printk
dmesg -C
modprobe snd_soc_ehl_rt5660

@gbuloz
Copy link
Author

gbuloz commented Jun 15, 2021

I've rebuilt all sound modules with pr_debug changed to pr_info and dev_dbg to dev_info and now I get this at boot time "ehl_rt5660 ehl_rt5660: ASoC: codec component i2c-10EC5660:00 not found for link SSP0-Codec"
See full dmesg :
dmesg_debug_dbg.log

@plbossart
Copy link
Member

@gbuloz can you check if the device exists

cat /sys/bus/acpi/devices/i2c-10EC5660:*/status

@gbuloz
Copy link
Author

gbuloz commented Jun 15, 2021

No it does not exist.
Even nothing with : ls /sys/bus/acpi/devices/i*

@plbossart
Copy link
Member

plbossart commented Jun 15, 2021

try

cat /sys/bus/acpi/devices/*10EC5660:*/status

@gbuloz
Copy link
Author

gbuloz commented Jun 15, 2021

[root@localhost ~]# cat /sys/bus/acpi/devices/*10EC5660:*/status
15

@plbossart
Copy link
Member

ls -l /sys/bus/acpi/devices/10EC5660: then?

@gbuloz
Copy link
Author

gbuloz commented Jun 15, 2021

[root@localhost ~]# ls -l /sys/bus/acpi/devices/10EC5660:*
lrwxrwxrwx. 1 root root 0 15 juin  18:04 /sys/bus/acpi/devices/10EC5660:00 -> ../../../devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:56/10EC5660:00
[root@localhost ~]# ls -l /sys/bus/acpi/devices/10EC5660:00/
total 0
-r--r--r--. 1 root root 4096 15 juin  18:05 hid
-r--r--r--. 1 root root 4096 15 juin  18:05 modalias
-r--r--r--. 1 root root 4096 15 juin  18:05 path
lrwxrwxrwx. 1 root root    0 15 juin  18:05 physical_node -> ../../../../../pci0000:00/0000:00:15.3/i2c_designware.1/i2c-1/i2c-10EC5660:00
drwxr-xr-x. 2 root root    0 15 juin  18:05 power
-r--r--r--. 1 root root 4096 15 juin  18:04 status
lrwxrwxrwx. 1 root root    0 15 juin  18:04 subsystem -> ../../../../../../bus/acpi
-rw-r--r--. 1 root root 4096 15 juin  18:04 uevent
-r--r--r--. 1 root root 4096 15 juin  18:05 uid

@plbossart
Copy link
Member

ok, let's try to see if the components were registered:

cat /sys/kernel/debug/asoc/components

cat /sys/kernel/debug/asoc/dais

@gbuloz
Copy link
Author

gbuloz commented Jun 15, 2021

[root@localhost ~]# cat /sys/kernel/debug/asoc/components
0000:00:1f.3
ehdaudio0D2
dmic-codec
snd-soc-dummy
snd-soc-dummy
[root@localhost ~]# cat /sys/kernel/debug/asoc/dais
SSP0 Pin
SSP1 Pin
SSP2 Pin
SSP3 Pin
SSP4 Pin
SSP5 Pin
DMIC01 Pin
DMIC16k Pin
iDisp1 Pin
iDisp2 Pin
iDisp3 Pin
iDisp4 Pin
Analog CPU DAI
Digital CPU DAI
Alt Analog CPU DAI
Analog Codec DAI
Digital Codec DAI
Alt Analog Codec DAI
intel-hdmi-hifi1
intel-hdmi-hifi2
intel-hdmi-hifi3
intel-hdmi-hifi4
dmic-hifi
snd-soc-dummy-dai

@plbossart
Copy link
Member

ok, so something happens in the probe of the snd_soc_rt5660 driver, the required components were not registered with ASoC.

you'll have to instrument rt5660_i2c_probe() to see what happens.

@gbuloz
Copy link
Author

gbuloz commented Jun 15, 2021

I've added several dev_info() into this function (including at first line where I also have a printk) but I get not output as if the probe was not run.
No message at boot time, nor with rmmod+insmod once booted.

@plbossart
Copy link
Member

@gbuloz it's clearly a problem that's not due to SOF then...

Either the ACPI subsystem is unable to probe this device, or there is a conflict, or the BIOS is wrong.

You may also need to use i2cdetect to make sure that there's really an I2c device that matches the address listed in the BIOS.

@libinyang
Copy link

libinyang commented Jun 16, 2021

@gbuloz
Based on the information:

physical_node -> ../../../../../pci0000:00/0000:00:15.3/i2c_designware.1/i2c-1/i2c-10EC5660:00

The codec is located on i2c-1.

However on my CRB, the codec is located on i2c-5, addr: 0x1c

Could you run:

sudo i2cdetect -y -r 5

to check whether i2c-5 has device, and if i2c-5 0x1c shows a device, please run

sudo i2cdump -y 5 0x1c w

and attach the output

@gbuloz
Copy link
Author

gbuloz commented Jun 16, 2021

Yes, it is really on i2c-1 and its device ID is correct (0x6338).
I've also tried to instantiate the I2C device with /sys/bus/i2c/devices/i2c-1/new_device but I got a device busy error but i2cdetect does not report UU at device address. But maybe this is normal for this device.
See probes and dump :
i2c.log

@plbossart
Copy link
Member

Are you sure the DSDT is correct? I see this:

        Scope (_SB.PC00.I2C2)
        {
            Device (HDAC)
            {
                Name (_HID, "INT00000")  // _HID: Hardware ID
                Name (_CID, "INT00000")  // _CID: Compatible ID
                Name (_DDN, "Intel(R) Smart Sound Technology Audio Codec")  // _DDN: DOS Device Name
                Name (_UID, One)  // _UID: Unique ID
                Name (CADR, Zero)
                Name (CDIS, Zero)
                Name (_SUB, "10EC0001")  // _SUB: Subsystem ID
                Method (_INI, 0, NotSerialized)  // _INI: Initialize
                {
                    If ((I2SC == One))
                    {
                        _HID = "INT34C2"
                        _CID = "INT34C2"
                        CADR = 0x1C
                        Return (Zero)
                    }

                    If ((I2SC == 0x02))
                    {
                        _HID = "10EC5660"
                        _CID = "10EC5660"
                        CADR = 0x1C
                        Return (Zero)
                    }
                }

Scope (_SB.PC00.I2C2) <<< is this the right controller?

@gbuloz
Copy link
Author

gbuloz commented Jun 17, 2021

Yes, I also suspected the DSDT.
However I was confident thanks to the multiple declarations of 10EC5660 for the following contexts :
(I2SB == Zero) + Scope (_SB.PC00.I2C0)
(I2SB == One) + Scope (_SB.PC00.I2C1)
(I2SB == 0x02) + Scope (_SB.PC00.I2C2)
(I2SB == 0x03) + Scope (_SB.PC00.I2C3)
(I2SB == 0x04) + Scope (_SB.PC00.I2C4)
(I2SB == 0x05) + Scope (_SB.PC00.I2C5)
I also though this was to deal with a possible change in i2c-x bus number across Linux boots.
But I must admit I'm lost and don't know what to change.

@plbossart
Copy link
Member

I don't have any direct contacts with the EHL BIOS folks or technical information on this @gbuloz. Big companies, different organizations, etc.

Maybe @libinyang can help, if not you may have to talk to your official Intel support.

@gbuloz
Copy link
Author

gbuloz commented Jul 12, 2022

@plbossart : after one year of pain, I now have the required BIOS with the pinctrl fix based on BIOS codebase "5.19_1AWHS_RC1.5.0_016", and I use latest Fedora 36 updates (kernel 5.18.9.
It seems I now have the required audio device created (see f36audio.txt), but I still don't know of to configure things at least from command line to record something from mic-in or line-in, and play to speaker or line-out. arecord and aplay are recording and playing but I don't know from/to what channel.
Also alsamixer when I select card "default:0 sof-ehl-rt5660" gives me many 66 playback settings and 8 capture settings, but none has a meaning to me.
And pavucontrol under desktop only gives me a dummy output audio device.
I'm completely lost in space. :-)

I'm also unable to attach any document (bug ?), so I paste my text file below :
$ cat f36audio.txt
[root@fedora ~]# cat /sys/bus/acpi/devices/10EC5660:/status
15

[root@fedora ~]# ls -l /sys/bus/acpi/devices/10EC5660:*
lrwxrwxrwx. 1 root root 0 Jul 4 12:25 /sys/bus/acpi/devices/10EC5660:00 -> ../../../devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:56/10EC5660:00
[root@fedora ~]# ls -l /sys/bus/acpi/devices/10EC5660:00/
total 0
-r--r--r--. 1 root root 4096 Jul 5 11:25 hid
-r--r--r--. 1 root root 4096 Jul 5 11:25 modalias
-r--r--r--. 1 root root 4096 Jul 5 11:25 path
lrwxrwxrwx. 1 root root 0 Jul 5 11:25 physical_node -> ../../../../../pci0000:00/0000:00:15.3/i2c_designware.1/i2c-1/i2c-10EC5660:00
drwxr-xr-x. 2 root root 0 Jul 5 11:25 power
-r--r--r--. 1 root root 4096 Jul 5 06:28 status
lrwxrwxrwx. 1 root root 0 Jul 4 12:25 subsystem -> ../../../../../../bus/acpi
-rw-r--r--. 1 root root 4096 Jul 4 12:25 uevent
-r--r--r--. 1 root root 4096 Jul 5 11:25 uid
drwxr-xr-x. 3 root root 0 Jul 4 12:25 wakeup
[root@fedora ~]#

[root@fedora ~]# cat /sys/kernel/debug/asoc/components
0000:00:1f.3
ehdaudio0D2
dmic-codec
i2c-10EC5660:00
snd-soc-dummy
snd-soc-dummy
[root@fedora ~]# cat /sys/kernel/debug/asoc/dais
SSP0 Pin
SSP1 Pin
SSP2 Pin
SSP3 Pin
SSP4 Pin
SSP5 Pin
DMIC01 Pin
DMIC16k Pin
iDisp1 Pin
iDisp2 Pin
iDisp3 Pin
iDisp4 Pin
Analog CPU DAI
Digital CPU DAI
Alt Analog CPU DAI
Headset 0
DMIC 1
DMIC16kHz 2
HDMI1 3
HDMI2 4
HDMI3 5
HDMI4 6
Analog Codec DAI
Digital Codec DAI
Alt Analog Codec DAI
intel-hdmi-hifi1
intel-hdmi-hifi2
intel-hdmi-hifi3
intel-hdmi-hifi4
dmic-hifi
rt5660-aif1
snd-soc-dummy-dai
[root@fedora ~]#

[root@fedora ~]# dmesg | grep sof
[ 0.580441] PCI-DMA: Using software bounce buffering for IO (SWIOTLB)
[ 0.580443] software IO TLB: mapped [mem 0x000000006668e000-0x000000006a68e000] (64MB)
[ 0.598288] xor: measuring software checksum speed
[ 1.330333] integrity: Loaded X.509 cert 'Microsoft Corporation UEFI CA 2011: 13adbf4309bd82709c8cd54f316ed522988a1bd4'
[ 1.330356] integrity: Loaded X.509 cert 'Microsoft Windows Production PCA 2011: a92902398e16c49778cd90f99e4f9ae17c55af53'
[ 6.885515] sof-audio-pci-intel-tgl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040100
[ 6.885525] sof-audio-pci-intel-tgl 0000:00:1f.3: Digital mics found on Skylake+ platform, using SOF driver
[ 6.885540] sof-audio-pci-intel-tgl 0000:00:1f.3: enabling device (0000 -> 0002)
[ 6.885847] sof-audio-pci-intel-tgl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if 0x040100
[ 6.886161] sof-audio-pci-intel-tgl 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[ 6.893024] sof-audio-pci-intel-tgl 0000:00:1f.3: use msi interrupt mode
[ 6.919189] sof-audio-pci-intel-tgl 0000:00:1f.3: NHLT_DEVICE_I2S detected, ssp_mask 0x1
[ 6.919199] sof-audio-pci-intel-tgl 0000:00:1f.3: hda codecs found, mask 4
[ 6.947090] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware info: version 2:1:1-3964a
[ 6.947098] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware: ABI 3:21:0 Kernel ABI 3:19:1
[ 6.947101] sof-audio-pci-intel-tgl 0000:00:1f.3: warn: FW ABI is more recent than kernel
[ 6.947205] sof-audio-pci-intel-tgl 0000:00:1f.3: unknown sof_ext_man header type 3 size 0x30
[ 7.065357] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware info: version 2:1:1-3964a
[ 7.065365] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware: ABI 3:21:0 Kernel ABI 3:19:1
[ 7.065368] sof-audio-pci-intel-tgl 0000:00:1f.3: warn: FW ABI is more recent than kernel
[ 7.116379] sof-audio-pci-intel-tgl 0000:00:1f.3: Topology: ABI 3:21:0 Kernel ABI 3:19:1
[ 7.116390] sof-audio-pci-intel-tgl 0000:00:1f.3: warn: topology ABI is more recent than kernel
[ 7.201657] input: sof-ehl-rt5660 HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:1f.3/ehl_rt5660/sound/card0/input9
[ 7.202011] input: sof-ehl-rt5660 HDMI/DP,pcm=4 as /devices/pci0000:00/0000:00:1f.3/ehl_rt5660/sound/card0/input10
[ 7.202348] input: sof-ehl-rt5660 HDMI/DP,pcm=5 as /devices/pci0000:00/0000:00:1f.3/ehl_rt5660/sound/card0/input11
[ 7.202680] input: sof-ehl-rt5660 HDMI/DP,pcm=6 as /devices/pci0000:00/0000:00:1f.3/ehl_rt5660/sound/card0/input12
[root@fedora ~]#
[root@fedora ~]# dmesg | grep snd
[ 6.437892] snd_hda_intel 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040100
[ 6.437901] snd_hda_intel 0000:00:1f.3: Digital mics found on Skylake+ platform, using SOF driver
[ 7.182718] snd_hda_codec_hdmi ehdaudio0D2: ASoC: sink widget AIF1TX overwritten
[ 7.182730] snd_hda_codec_hdmi ehdaudio0D2: ASoC: source widget AIF1RX overwritten
[root@fedora ~]#

guest@fedora ~]$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sofehlrt5660 [sof-ehl-rt5660], device 0: Headset () []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: sofehlrt5660 [sof-ehl-rt5660], device 3: HDMI1 (
) []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: sofehlrt5660 [sof-ehl-rt5660], device 4: HDMI2 () []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: sofehlrt5660 [sof-ehl-rt5660], device 5: HDMI3 (
) []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: sofehlrt5660 [sof-ehl-rt5660], device 6: HDMI4 () []
Subdevices: 1/1
Subdevice #0: subdevice #0
[guest@fedora ~]$
[guest@fedora ~]$ aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
pipewire
PipeWire Sound Server
default
Default ALSA Output (currently PipeWire Media Server)
sysdefault:CARD=sofehlrt5660
sof-ehl-rt5660,
Default Audio Device
[guest@fedora ~]$
[guest@fedora ~]$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: sofehlrt5660 [sof-ehl-rt5660], device 0: Headset (
) []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: sofehlrt5660 [sof-ehl-rt5660], device 1: DMIC () []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: sofehlrt5660 [sof-ehl-rt5660], device 2: DMIC16kHz (
) []
Subdevices: 1/1
Subdevice #0: subdevice #0
[guest@fedora ~]$
[guest@fedora ~]$ arecord -L
null
Discard all samples (playback) or generate zero samples (capture)
pipewire
PipeWire Sound Server
default
Default ALSA Output (currently PipeWire Media Server)
sysdefault:CARD=sofehlrt5660
sof-ehl-rt5660,
Default Audio Device
[guest@fedora ~]$

@plbossart
Copy link
Member

plbossart commented Jul 12, 2022

@gbuloz if you want the card and endpoints to be detected in Fedora/Ubuntu, you have to create a UCM file. see https://github.com/alsa-project/alsa-ucm-conf

alternatively you can use mixer settings, this is what we use in our CI tests. this will only work for command-line tests, Fedora/Ubuntu would not expose the card/endpoints. For this you need the UCM file.

amixer -c sofehlrt5660 cset name='DAC1 MIXL DAC1 Switch' 1
amixer -c sofehlrt5660 cset name='DAC1 MIXR DAC1 Switch' 1
amixer -c sofehlrt5660 cset name='DAC1 MIXL Stereo ADC Switch' 0
amixer -c sofehlrt5660 cset name='DAC1 MIXR Stereo ADC Switch' 0
amixer -c sofehlrt5660 cset name='DAC1 Playback Volume' 50
amixer -c sofehlrt5660 cset name='PGA1.0 1 Master Playback Volume' 32

@gbuloz
Copy link
Author

gbuloz commented Jul 12, 2022

@plbossart : Thanks !

@plbossart
Copy link
Member

@gbuloz after more coffee I realized there is already support for this board in UCM, see ucm2/Intel/sof-ehl-rt5660/. I am not sure why your profile is not detected, maybe there's still a bug.

You could try to test manually with this (commands off the top of my head, some corrections might be needed)


alsaucm -c sof-ehl-rt5660  set _verb HiFi set _enadev Mic
arecord -Dhw:0,1 -c4 -r48000 -fS32_LE -d 10 test-mic.wav

alsaucm -c sof-ehl-rt5660  set _verb HiFi set _enadev Headset
arecord -Dhw:0,1 -c4 -r48000 -fS32_LE -d 10 test-headset-mic.wav

alsaucm -c sof-ehl-rt5660  set _verb HiFi set _enadev Lineout
speaker-test -Dhw:0,0 -c2 -r48000 -t sine

alsaucm -c sof-ehl-rt5660  set _verb HiFi set _enadev Speaker
speaker-test -Dhw:0,0 -c2 -r48000 -t sine

@gbuloz
Copy link
Author

gbuloz commented Jul 13, 2022

@plbossart : these commands are running without error, but no sound. Our custom design based on CRB is working OK under windows so the hardware should be OK. Compared to the CRB we have no speaker, only line-out. Also due to that the ALC5660 GPIO2 used for speaker/line-out commutation (jack contact) is expected to be reused for mic-in/line-in commutation.
In the second alsaucm command above, I see Headset but we have have only a line-in. Is it the same ?
Should I also set the volume and/or unmute some channels to have something working ?

@plbossart
Copy link
Member

@gbuloz if the board is different, the alsamixer and UCM settings will have to be different, and it's possible that the GPIO handling needs to be modified in the driver. @bardliao @oder-chiou do you have settings for rt5660 that can be shared?

@oder-chiou
Copy link

oder-chiou commented Jul 14, 2022

@gbuloz Please use the following command to enable the path of the LOUT

amixer -c sofehlrt5660 cset name='Stereo DAC MIXL DAC L1 Switch' 1
amixer -c sofehlrt5660 cset name='Stereo DAC MIXR DAC R1 Switch' 1
amixer -c sofehlrt5660 cset name='LOUT MIX DAC Switch' 1
amixer -c sofehlrt5660 cset name='Line Out Switch' 1

@gbuloz
Copy link
Author

gbuloz commented Jul 18, 2022

@oder-chiou, @plbossart : thanks for the commands to enable the path to LOUT, but I still have nothing out. I only get a positive glitch ~100mS on LOUT (right and left) when I run "speaker-test -Dhw:0,0 -c2 -r48000 -t sine", and nothing when I run "aplay /usr/share/sounds/alsa/Noise.wav"
Do you have a full set of commands to run including for volume setting and other obscure stuff ? I still don't know which command I have to run to set the volume.
And pavucontrol under desktop only shows a "Dummy output" device and nothing else.

@oder-chiou
Copy link

@gbuloz : You can refer the following UCM config for the full commands.
https://github.com/alsa-project/alsa-ucm-conf/blob/master/ucm2/Intel/kblrt5660/HiFi.conf
There are 2 codec volumes that can be controlled as following.
cset "name='DAC1 Playback Volume' 30"
cset "name='OUT Playback Volume' 19"

@bardliao
Copy link
Collaborator

@gbuloz Can you run the amixer contents command and paste the result here?

@gbuloz
Copy link
Author

gbuloz commented Jul 25, 2022

@bardliao : here is the command output :

[guest@fedora ~]$ amixer contents
numid=4,iface=MIXER,name='Master Playback Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=on
numid=3,iface=MIXER,name='Master Playback Volume'
  ; type=INTEGER,access=rw------,values=2,min=0,max=65536,step=1
  : values=65535,65535
numid=2,iface=MIXER,name='Capture Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=on
numid=1,iface=MIXER,name='Capture Volume'
  ; type=INTEGER,access=rw------,values=2,min=0,max=65536,step=1
  : values=65535,65535

@oder-chiou : I've used some "amixer -c sofehlrt5660 cset ...' commands to set the volume for "'DAC1 Playback Volume" and "'OUT Playback Volume" and have also tried some commands as described in the file ucm2/Intel/kblrt5660/HiFi.conf but I have still nothing out from line out.

I use Fedora 36 with latest updates and found I already have some config files under : /usr/share/alsa/ucm2/Intel/sof-ehl-rt5660/ but something seems missing/wrong so under Xfce desktop the card is not listed in the audio mixer (pavucontrol). I've attached a zip archive of the /usr/share/alsa files :
usr_share_alsa.zip

@bardliao
Copy link
Collaborator

@gbuloz Could you share the output of 'amixer -c sofehlrt5660 contents' command?

@gbuloz
Copy link
Author

gbuloz commented Jul 25, 2022

@bardliao : Thanks. See attachment :
amixer-c-sofehlrt5660.log
{Edit] : Oops I forgot "contents". Please see
amixer-c-sofehlrt5660-contents.log

@bardliao
Copy link
Collaborator

@oder-chiou Is 'OUT Playback Switch' needed? @gbuloz Could you try
amixer -c sofehlrt5660 cset name='OUT Playback Switch' 1?

@oder-chiou
Copy link

@bardliao Yes, it is needed.

@gbuloz
Copy link
Author

gbuloz commented Jul 26, 2022

@ALL : thanks ! I've be able to get something out of Lineout. I've compiled all your commands above into a single script amixer_cmds.sh (see
amixer_cmds.zip
) and had the speaker test OK !
I've also tried some commands in the files under /usr/share/alsa/ucm2/Intel/sof-ehl-rt5660/ to enable/disable lineout and that works.
The only thing I don't understand is that now when I start from a fresh power-on I have the speaker_test OK without running any command before ... bit it works
{Edit] if I boot from a live image (to make sure no persistent setting was saved), it seems the only command in amixer_cmds.sh that was needed to have something out of lineout was "amixer -c sofehlrt5660 cset name='OUT Playback Switch' 1"

Could you tell me what setup commands are needed to record from Linein L+R (on IN1P/IN3P pins on ALC5660 codec) then from an analog MIC (on IN2P pin on ALC5660 codec with BIAS from pin MICBIA1) ?
The file /usr/share/alsa/ucm2/Intel/sof-ehl-rt5660/HiFi.conf only defines "Digital Microphone" or "Headset Microphone".

@oder-chiou
Copy link

Hi,

Add the following dapm routing to the machine driver for using the MICBIAS1.

{"IN2P", NULL, "MICBIAS1"},

Following commands are the recording mixer controls.

Volume:
cset "name='IN1 Boost Volume' 30"
cset "name='IN2 Boost Volume' 30"
cset "name='IN3 Boost Volume' 30"
cset "name='ADC Capture Volume' 30"
cset "name='STO1 ADC Boost Gain Volume' 1"

IN1 to L ch and IN3 to R ch:
cset "name='RECMIXL BST1 Switch' on"
cset "name='RECMIXR BST1 Switch' off"
cset "name='RECMIXL BST2 Switch' off"
cset "name='RECMIXR BST2 Switch' off"
cset "name='RECMIXL BST3 Switch' off"
cset "name='RECMIXR BST3 Switch' on"
cset "name='Sto1 ADC MIXR ADC1 Switch' on"
cset "name='Sto1 ADC MIXL ADC1 Switch' on"

IN2 to L and R ch:
cset "name='RECMIXL BST1 Switch' off"
cset "name='RECMIXR BST1 Switch' off"
cset "name='RECMIXL BST2 Switch' on"
cset "name='RECMIXR BST2 Switch' on"
cset "name='RECMIXL BST3 Switch' off"
cset "name='RECMIXR BST3 Switch' off"
cset "name='Sto1 ADC MIXR ADC1 Switch' on"
cset "name='Sto1 ADC MIXL ADC1 Switch' on"

@gbuloz
Copy link
Author

gbuloz commented Jul 27, 2022

@oder-chiou : Thanks for the commands, but I still have only blank recorded from linein or mic (without bias), but I'm not sure if I use the right arecord arguments. I use -c4 because the command reports an error if I'm using 1 or 2. A dump of the recorded .wav data show it is constant (repeats every 16 bytes = 4 channels x S32_LE)
See my test scripts in
linemic.zip
I've also added "cset name='RECMIXR OUT MIXR Switch' on" and "cset name='ADC Capture Switch' on" but this is not better.

@gbuloz
Copy link
Author

gbuloz commented Aug 4, 2022

@oder-chiou : oops sorry. Your amixer commands work perfectly for line-in and mic-in, but I was not using the right arecord parameters. The right ones are : arecord -Dhw:0,0 -c2 -r48000 -fS32_LE -d 10 test.wav

@ALL : to have the sound device displayed by the Audio mixer (pavucontrol) under Fedora 36 I had to patch some config files according to audiomixerconf.patch (see audiook.zip archive)
audiook.zip
The audio mixer now shows the device : mixer_out.png, mixer_in.png
The I run setlineout.sh to configure for line-out (not sure all commands are required but just to have them all)
The I run setmicin.sh or setlinein.sh to switch to mic or line-in
To use Audacity, make sure to select "JACK audio connection kit" : audacityconf.png
I still have to fix the line-in right channel that is not working, and to replace the scripts with some more automatic/cleaner things.

[Edit 2022-08-05] : The following line must be added to setlinein.sh and setmicin.sh (missing) :
amixer -c sofehlrt5660 cset name='ADC Capture Switch' on
Also mic gain can be increased in setmicin.sh by setting 'STO1 ADC Boost Gain Volume' to 2 or even 3 (instead of 1). Line-in right channel is still not working

@gbuloz
Copy link
Author

gbuloz commented Aug 25, 2022

@oder-chiou : I'm still unable to have the right channel working in line-in mode (left on IN1, right on IN3). The wiring seems OK on IN3 because if I redirect it to the left channel with "RECMIXL BST3 Switch" I get something. Any idea of what is missing/wrong ? I've attached tthe output of "amixer contents"
amixercontents_lineinRfails.txt

@ALL : I've found why my audio device was not displayed under audio mixer (pavucontrol) and the only profile available was "off". This is because my custom board has no DMIC and with the standard UCM2 file /usr/share/alsa/ucm2/Intel/sof-ehl-rt5660/HiFi.conf, this fails because of device "hw:${CardId},1" used for "Mic", and then all the use case "Hifi" is ignored.
I've created specific UCM2 files for my board with lineout, speaker, linein, analogmic, and HDMI, with the required cset commands to enable/disable them

@oder-chiou
Copy link

@gbuloz Please try these controls to verify the path in the codec side 'IF1 ADC Swap Mux' 'RECMIXR BST1 Switch'.

@gbuloz
Copy link
Author

gbuloz commented Aug 31, 2022

@oder-chiou : thanks, but could you explain me a little bit more the procedure ?

@oder-chiou
Copy link

@gbuloz
'IF1 ADC Swap Mux' change to R/L to swap the I2S LR channel to make sure code side is OK.
'RECMIXR BST1 Switch' also could make sure the RECMIXR is working or not.

@gbuloz
Copy link
Author

gbuloz commented Sep 1, 2022

@oder-chiou : the controls work as expected, except that for having something to the right channel from lineinR (IN3 with 'RECMIXR BST3 Switch' on) I need to also enable lineinL (IN1 with 'RECMIXR BST1 Switch' on) or analogmic (IN2 with 'RECMIXR BST2 Switch' on)
lr_1.txt
lr_2.txt
lr_dmesgsof.txt

@gbuloz
Copy link
Author

gbuloz commented Sep 1, 2022

@oder-chiou : and also to have something to the left channel from lineinR (IN3 with 'RECMIXL BST3 Switch' on) I need to also enable lineinL (IN1 with 'RECMIXL BST1 Switch' on) or analogmic (IN2 with 'RECMIXL BST2 Switch' on)

@plbossart
Copy link
Member

@gbuloz this issue seems to be about alsa mixer values now, no longer the initial problem of detecting a card. Can we close and reopen a new issue as needed?

@gbuloz
Copy link
Author

gbuloz commented Jan 6, 2023

@plbossart : Yes I agree, you can close this issue. I'll open a new one for LineIn-Right IN3 not working.

@gbuloz
Copy link
Author

gbuloz commented Jan 6, 2023

For information, the UCM2 files I use on Fedora 36 for a Kontron TRACe-B104 computer that is a custom design based on Intel CRB
ucm2_b104.zip
After installation of UCM2 files, the following command is run to update the symlink to them :
ln -sf ../../Intel/sof-ehl-rt5660-trace-b1/sof-ehl-rt5660-trace-b1.conf /usr/share/alsa/ucm2/conf.d/sof-ehl-rt5660/sof-ehl-rt5660.conf
This adds lineout, speaker, linein, analogmic, and HDMI settings to audio mixer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ACPI ACPI info is wrong BIOS Related to BIOS bug Something isn't working EHL Applies to Elkhart Lake P3 Low-impact bugs or features
Projects
None yet
Development

No branches or pull requests

7 participants