Bug 215711

Summary: snd_hda_intel not binding to codec
Product: Drivers Reporter: Petr Cerny (bugzilla)
Component: Sound(ALSA)Assignee: Jaroslav Kysela (perex)
Status: NEW ---    
Severity: normal CC: pmenzel+bugzilla.kernel.org, tiwai
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 5.15.29 Subsystem:
Regression: Yes Bisected commit-id:
Attachments: SND_HDA_* excrept from kernel config

Description Petr Cerny 2022-03-21 11:55:17 UTC
Created attachment 300588 [details]
SND_HDA_* excrept from kernel config

On PCI device discovery the Intel HDA codec doesn't bind to appropriate codec (if that is the correct term). The device codec (Conexant) is loaded, but sound doesn't work. Reloading the main module (snd_hda_intel) fixes the issue:

$ echo 1 > /sys/bus/pci/devices/0000:00:1b.0/remove

$ lsmod | sort
Module                  Size  Used by
configs                45056  0
e1000e                225280  0
grace                  16384  1 lockd
irqbypass              16384  1 kvm
iwlwifi               274432  0
kvm                   569344  1 kvm_intel
kvm_intel             229376  0
lockd                  98304  1 nfs
mei                    90112  1 mei_me
mei_me                 28672  0
nfs                   184320  3 nfsv4
nfsv4                 380928  2
sunrpc                274432  9 nfsv4,lockd,nfs
uvcvideo              110592  0
videobuf2_common       45056  4 videobuf2_vmalloc,videobuf2_v4l2,uvcvideo,videobuf2_memops
videobuf2_memops       16384  1 videobuf2_vmalloc
videobuf2_v4l2         24576  1 uvcvideo
videobuf2_vmalloc      16384  1 uvcvideo

$ echo 1 > /sys/bus/pci/rescan
# dmesg output
[ 9218.563134] pci 0000:00:1b.0: [8086:3b56] type 00 class 0x040300
[ 9218.563178] pci 0000:00:1b.0: reg 0x10: [mem 0xc0004000-0xc0007fff 64bit]
[ 9218.563344] pci 0000:00:1b.0: PME# supported from D0 D3hot D3cold
[ 9218.563818] pci 0000:00:1b.0: BAR 0: assigned [mem 0xc0004000-0xc0007fff 64bit]
[ 9218.563846] pci 0000:00:1e.0: PCI bridge to [bus 0e]
[ 9218.598927] snd_hda_intel 0000:00:1b.0: bound 0000:00:02.0 (ops 0xffffffff824a44e0)
[ 9218.609798] snd_hda_intel 0000:00:1b.0: Cannot probe codecs, giving up

$ lsmod | sort
Module                  Size  Used by                                                                                                                                                                                                                                            
configs                45056  0                                                                                                                                                                                                                                                  
e1000e                225280  0                                                                                                                                                                                                                                                  
grace                  16384  1 lockd                                                                                                                                                                                                                                            
irqbypass              16384  1 kvm                                                                                                                                                                                                                                              
iwlwifi               274432  0                                                                                                                                                                                                                                                  
kvm                   569344  1 kvm_intel                                                                                               
kvm_intel             229376  0                                                                                                         
lockd                  98304  1 nfs                                                                                                     
mei                    90112  1 mei_me                                                                                                  
mei_me                 28672  0                                                                                                         
nfs                   184320  3 nfsv4                                                                                                   
nfsv4                 380928  2                                                                                                         
snd                    77824  7 snd_hda_codec_generic,snd_hda_codec_conexant,snd_hwdep,snd_hda_intel,snd_hda_codec,snd_timer,snd_pcm    
snd_hda_codec         118784  3 snd_hda_codec_generic,snd_hda_codec_conexant,snd_hda_intel                                              
snd_hda_codec_conexant    20480  0                                                                                                      
snd_hda_codec_generic    77824  1 snd_hda_codec_conexant                                                                                
snd_hda_core           65536  4 snd_hda_codec_generic,snd_hda_codec_conexant,snd_hda_intel,snd_hda_codec                                
snd_hda_intel          36864  0                                                                                                         
snd_hwdep              16384  1 snd_hda_codec                                                                                           
snd_intel_dspcfg       16384  1 snd_hda_intel                                                                                           
snd_pcm               110592  3 snd_hda_intel,snd_hda_codec,snd_hda_core                                                                
snd_timer              32768  1 snd_pcm                                                                                                 
soundcore              16384  1 snd                                                                                                     
sunrpc                274432  9 nfsv4,lockd,nfs                                                                                         
uvcvideo              110592  0                                                                                                         
videobuf2_common       45056  4 videobuf2_vmalloc,videobuf2_v4l2,uvcvideo,videobuf2_memops
videobuf2_memops       16384  1 videobuf2_vmalloc
videobuf2_v4l2         24576  1 uvcvideo
videobuf2_vmalloc      16384  1 uvcvideo

$ modprobe -rv snd_hda_intel; modprobe -v snd_hda_intel
# dmesg output
[ 9230.886362] snd_hda_intel 0000:00:1b.0: bound 0000:00:02.0 (ops 0xffffffff824a44e0)
[ 9230.895721] snd_hda_codec_conexant hdaudioC0D0: CX20585: BIOS auto-probing.
[ 9230.896677] snd_hda_codec_conexant hdaudioC0D0: autoconfig for CX20585: line_outs=1 (0x1f/0x0/0x0/0x0/0x0) type:speaker
[ 9230.896691] snd_hda_codec_conexant hdaudioC0D0:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
[ 9230.896700] snd_hda_codec_conexant hdaudioC0D0:    hp_outs=2 (0x1c/0x19/0x0/0x0/0x0)
[ 9230.896707] snd_hda_codec_conexant hdaudioC0D0:    mono: mono_out=0x0
[ 9230.896713] snd_hda_codec_conexant hdaudioC0D0:    inputs:
[ 9230.896718] snd_hda_codec_conexant hdaudioC0D0:      Internal Mic=0x23
[ 9230.896724] snd_hda_codec_conexant hdaudioC0D0:      Mic=0x1b
[ 9230.896729] snd_hda_codec_conexant hdaudioC0D0:      Dock Mic=0x1a
[ 9230.908437] snd_hda_codec_generic hdaudioC0D3: autoconfig for Generic: line_outs=0 (0x0/0x0/0x0/0x0/0x0) type:line
[ 9230.908454] snd_hda_codec_generic hdaudioC0D3:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
[ 9230.908461] snd_hda_codec_generic hdaudioC0D3:    hp_outs=0 (0x0/0x0/0x0/0x0/0x0)
[ 9230.908468] snd_hda_codec_generic hdaudioC0D3:    mono: mono_out=0x0
[ 9230.908473] snd_hda_codec_generic hdaudioC0D3:    dig-out=0x5/0x0
[ 9230.908477] snd_hda_codec_generic hdaudioC0D3:    inputs:
[ 9230.916063] input: HDA Intel MID Mic as /devices/pci0000:00/0000:00:1b.0/sound/card0/input52
[ 9230.916216] input: HDA Intel MID Dock Mic as /devices/pci0000:00/0000:00:1b.0/sound/card0/input53
[ 9230.916353] input: HDA Intel MID Dock Headphone as /devices/pci0000:00/0000:00:1b.0/sound/card0/input54
[ 9230.919563] input: HDA Intel MID Headphone as /devices/pci0000:00/0000:00:1b.0/sound/card0/input55
[ 9230.919727] input: HDA Intel MID HDMI as /devices/pci0000:00/0000:00:1b.0/sound/card0/input56

$ lsmod | sort
Module                  Size  Used by
configs                45056  0
e1000e                225280  0
grace                  16384  1 lockd
irqbypass              16384  1 kvm
iwlwifi               274432  0
kvm                   569344  1 kvm_intel
kvm_intel             229376  0
lockd                  98304  1 nfs
mei                    90112  1 mei_me
mei_me                 28672  0
nfs                   184320  3 nfsv4
nfsv4                 380928  2
snd                    77824  7 snd_hda_codec_generic,snd_hda_codec_conexant,snd_hwdep,snd_hda_intel,snd_hda_codec,snd_timer,snd_pcm
snd_hda_codec         118784  3 snd_hda_codec_generic,snd_hda_codec_conexant,snd_hda_intel
snd_hda_codec_conexant    20480  1
snd_hda_codec_generic    77824  2 snd_hda_codec_conexant
snd_hda_core           65536  4 snd_hda_codec_generic,snd_hda_codec_conexant,snd_hda_intel,snd_hda_codec
snd_hda_intel          36864  0
snd_hwdep              16384  1 snd_hda_codec
snd_intel_dspcfg       16384  1 snd_hda_intel
snd_pcm               110592  3 snd_hda_intel,snd_hda_codec,snd_hda_core
snd_timer              32768  1 snd_pcm
soundcore              16384  1 snd
sunrpc                274432  9 nfsv4,lockd,nfs
uvcvideo              110592  0
videobuf2_common       45056  4 videobuf2_vmalloc,videobuf2_v4l2,uvcvideo,videobuf2_memops
videobuf2_memops       16384  1 videobuf2_vmalloc
videobuf2_v4l2         24576  1 uvcvideo
videobuf2_vmalloc      16384  1 uvcvideo


5.15.29, have observed it already at least on 5.10.27, HW is ThinkPad x201 (x220 as well). I'm marking it as regression, since it used to work in the distant past (5.4-ish at least iirc)
Comment 1 Petr Cerny 2022-03-21 11:56:51 UTC
Note that the used by counter for both snd_hda_codec_conexant and snd_hda_codec_generic got increased after reloading snd_hda_intel.
Comment 2 Takashi Iwai 2022-03-28 12:07:36 UTC
Could you try to bisect?  At least it'd be helpful to know which kernel release starts showing that problem.
Comment 3 Petr Cerny 2022-03-28 21:06:37 UTC
(In reply to Takashi Iwai from comment #2)
> Could you try to bisect?  At least it'd be helpful to know which kernel
> release starts showing that problem.

Will try, but it's going to take a while.

In the meantime, any suggestions where this could go wrong on the system configuration side (i.e. PEBKAC)?
Comment 4 Takashi Iwai 2022-03-29 08:05:34 UTC
(In reply to Petr Cerny from comment #3)
> In the meantime, any suggestions where this could go wrong on the system
> configuration side (i.e. PEBKAC)?

Honestly speaking, I have no idea.  As the module probe succeeds, it might be outside the sound driver itself but in a deeper level.
Comment 5 Paul Menzel 2022-10-03 10:51:55 UTC
(In reply to Petr Cerny from comment #3)
> (In reply to Takashi Iwai from comment #2)
> > Could you try to bisect?  At least it'd be helpful to know which kernel
> > release starts showing that problem.
> 
> Will try, but it's going to take a while.

Were you able to get to it, and pinpoint the problem?