Bug 107491

Summary: No sound from speakers, works with headphones, HP 6550b
Product: Drivers Reporter: wdahl
Component: Sound(ALSA)Assignee: Jaroslav Kysela (perex)
Status: RESOLVED CODE_FIX    
Severity: blocking CC: superquad.vortex2, tiwai
Priority: P1    
Hardware: Intel   
OS: Linux   
Kernel Version: somewhere in 3.19+ Subsystem:
Regression: Yes Bisected commit-id:
Attachments: text -alsa-info as root
windows driver ini files
Fix patch
Revised patch
Revised patch (v3)

Description wdahl 2015-11-08 14:22:57 UTC
Created attachment 192441 [details]
text -alsa-info as root

I used to have installed ubuntu 14.04 with theirs 3.19 kernel. Sometime last month, laptop speaker stopped  working. I thought it had broken and I started using headphones. (only now I know that it was one minor kernel update, I'm not sure which one, I used 3.19 before and it worked perfectly. http://changelogs.ubuntu.com/changelogs/pool/main/l/linux-lts-vivid/linux-lts-vivid_3.19.0-32.37~14.04.1/changelog

After ubuntu 15.10 was relesed I decided to have some fun and updated to 15.10(ubuntu with 4.2 kernel)

But after I installed windows 7 for dual boot, sound with hp drivers worked. I started going through linux setting. If in program alsamixer I switch auto-mute to disable, sound starts to work with laptop speakers, but it speakers doesnt mute when I plug in headphones..

Codec: IDT 92HD75B3X5
Address: 0
AFG Function Id: 0x1 (unsol 1)
Vendor Id: 0x111d7603
Subsystem Id: 0x103c146d
Revision Id: 0x100202

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Maybe this is source of the problem

In linux with problematic sound
cat /sys/class/sound/hwC0D0/init_pin_configs
0x0a 0x2121101f
0x0b 0x03a1102e
0x0c 0x90a70120
0x0d 0x90170110
0x0e 0x21811040
0x0f 0x03211030
0x14 0x40f000f0
0x18 0x40f000f0
0x19 0x40f000f0
0x1e 0x40f000f0
0x1f 0x40f000f0
0x20 0x40f000f0


BUT in windows driver installer ini file for my sound card 103c146d(from ini file stwrt 103c146d -->file 01A1.INI
[HKR\Settings\pin]
[HKR\Settings\Pin\0A]
CfgDflt = dword: 0x0121202F
CfgCurr = dword: 0x0121201F
AltCfg = hex: 1F,20,21,01,2F,20,21,01
[HKR\Settings\Pin\0B]
CfgDflt = dword: 0x03A12050
Bias = hex: FF,04,02
[HKR\Settings\Pin\0C]
CfgDflt = dword: 0x90A70040
[HKR\Settings\Pin\0D]
CfgDflt = dword: 0x90170010
ExtAmpCtrl = hex: 00,05,02
[HKR\Settings\Pin\0E]
CfgDflt = dword: 0x2181205E
PathNode = hex: 0x1B
[HKR\Settings\Pin\0F]
CfgDflt = dword: 0x03212020
CfgCurr = dword: 0x0321201F
AltCfg = hex: 20,20,21,03,1F,20,21,03
Action = hex: 81,0A
[HKR\Settings\Pin\14]
CfgDflt = dword: 0x9037005A
[HKR\Settings\Pin\18]
CfgDflt = dword: 0x40F000F0
[HKR\Settings\Pin\19]
CfgDflt = dword: 0x40F000F0
[HKR\Settings\Pin\1E]
CfgDflt = dword: 0x40F000F0
[HKR\Settings\Pin\1F]
CfgDflt = dword: 0x40F000F0
[HKR\Settings\Pin\20]
CfgDflt = dword: 0x40F000F0
Comment 1 wdahl 2015-11-08 14:28:01 UTC
Created attachment 192451 [details]
windows driver ini files
Comment 2 Raymond 2015-11-08 15:30:56 UTC
Node 0x0a [Pin Complex] wcaps 0x400181: Stereo
  Pincap 0x0000001c: OUT HP Detect
  Pin Default 0x2121101f: [Jack] HP Out at Sep Rear
    Conn = 1/8, Color = Black
    DefAssociation = 0x1, Sequence = 0xf
  Pin-ctls: 0xc0: OUT HP
  Unsolicited: tag=01, enabled=1
  Connection: 3
     0x10 0x11 0x17*
Node 0x0b [Pin Complex] wcaps 0x400081: Stereo
  Pincap 0x00001724: IN Detect
    Vref caps: HIZ 50 GRD 80
  Pin Default 0x03a1102e: [Jack] Mic at Ext Left
    Conn = 1/8, Color = Black
    DefAssociation = 0x2, Sequence = 0xe
  Pin-ctls: 0x24: IN VREF_80
  Unsolicited: tag=04, enabled=1
Node 0x0c [Pin Complex] wcaps 0x400081: Stereo
  Pincap 0x00001724: IN Detect
    Vref caps: HIZ 50 GRD 80
  Pin Default 0x90a70120: [Fixed] Mic at Int N/A
    Conn = Analog, Color = Unknown
    DefAssociation = 0x2, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x24: IN VREF_80
  Unsolicited: tag=00, enabled=0
Node 0x0d [Pin Complex] wcaps 0x400181: Stereo
  Pincap 0x00000014: OUT Detect
  Pin Default 0x90170110: [Fixed] Speaker at Int N/A
    Conn = Analog, Color = Unknown
    DefAssociation = 0x1, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x00:
  Unsolicited: tag=00, enabled=0
  Connection: 3
     0x10 0x11 0x17*
Node 0x0e [Pin Complex] wcaps 0x400081: Stereo
  Pincap 0x00001724: IN Detect
    Vref caps: HIZ 50 GRD 80
  Pin Default 0x21811040: [Jack] Line In at Sep Rear
    Conn = 1/8, Color = Black
    DefAssociation = 0x4, Sequence = 0x0
  Pin-ctls: 0x20: IN VREF_HIZ
  Unsolicited: tag=05, enabled=1
Node 0x0f [Pin Complex] wcaps 0x400181: Stereo
  Pincap 0x00000014: OUT Detect
  Pin Default 0x03211030: [Jack] HP Out at Ext Left
    Conn = 1/8, Color = Black
    DefAssociation = 0x3, Sequence = 0x0
  Pin-ctls: 0x40: OUT
  Unsolicited: tag=02, enabled=1
  Connection: 3
     0x10 0x11 0x17*
Node 0x10 [Audio Output] wcaps 0xd0c05: Stereo Amp-Out R/L
  Control: name="Speaker+LO Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Control: name="Speaker+LO Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Device: name="92HD75B3X5 Analog", type="Audio", device=0
  Amp-Out caps: N/A
  Amp-Out vals:  [0x5c 0x5c]
  Converter: stream=5, channel=0
  Power states: 
  Power: setting=D0, actual=D0
  Delay: 13 samples
Node 0x11 [Audio Output] wcaps 0xd0c05: Stereo Amp-Out R/L
  Control: name="Headphone Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Control: name="Headphone Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Amp-Out caps: N/A
  Amp-Out vals:  [0xb5 0xb5]
  Converter: stream=5, channel=0
  Power states: 
  Power: setting=D3, actual=D3
  Delay: 13 samples


idt codecs does not have mute switch at those pin complex

this mean that either headphone jack and dock headphone jack share volume and switch
or dock headphone jack and speaker share volume and switch
Comment 3 Raymond 2015-11-08 15:33:53 UTC
control.27 {
		iface CARD
		name 'Headphone Jack'
		value true
		comment {
			access read
			type BOOLEAN
			count 1
		}
	}
	control.28 {
		iface CARD
		name 'Dock Headphone Jack'
		value false
		comment {
			access read
			type BOOLEAN
			count 1
		}
	}
	control.29 {
		iface CARD
		name 'Speaker Phantom Jack'
		value true
		comment {
			access read
			type BOOLEAN
			count 1
		}
	}


this mean that speaker+lo playback volume/switch is incorrect if headphone and dock headphone jacks are created
Comment 4 Raymond 2015-11-08 15:38:07 UTC
25.014933] snd_hda_codec_idt hdaudioC0D0: autoconfig for 92HD75B3X5: line_outs=1 (0xf/0x0/0x0/0x0/0x0) type:line
[   25.014937] snd_hda_codec_idt hdaudioC0D0:    speaker_outs=1 (0xd/0x0/0x0/0x0/0x0)
[   25.014939] snd_hda_codec_idt hdaudioC0D0:    hp_outs=1 (0xa/0x0/0x0/0x0/0x0)
[   25.014941] snd_hda_codec_idt hdaudioC0D0:    mono: mono_out=0x0
[   25.014942] snd_hda_codec_idt hdaudioC0D0:    inputs:
[   25.014944] snd_hda_codec_idt hdaudioC0D0:      Internal Mic=0xc
[   25.014946] snd_hda_codec_idt hdaudioC0D0:      Mic=0xb
[   25.014948] snd_hda_codec_idt hdaudioC0D0:      Line=0xe

if node 0x0a is your dock headphone, your headphone are put in line out instead of hp_out
Comment 5 Raymond 2015-11-08 15:55:08 UTC
your speaker


Node 0x17 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
  Control: name="Internal Mic Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=3, ofs=0
  Control: name="Internal Mic Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=3, ofs=0
  Control: name="Mic Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=3, ofs=0
  Control: name="Mic Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=3, ofs=0
  Control: name="Line Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=3, ofs=0
  Control: name="Line Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=3, ofs=0
  Amp-In caps: ofs=0x17, nsteps=0x1f, stepsize=0x05, mute=1
  Amp-In vals:  [0x17 0x17] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80]
  Connection: 5
     0x10 0x11 0x14 0x1a 0x1b


as you enable analog mixing , the headphone jacks and speaker are connected to node 0x10 through audio mixer node 0x17
Comment 7 wdahl 2015-11-09 12:56:26 UTC
This problem may be same as in bug 106961, but patch(+	case 0x103c1473) wont fix my problem because my subsystem id is 0x103c146d

There must be (or will be when they will update kernel/distro) many more users(https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1450027   https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1462229)

From hp drivers for vendor id 111d device id 0x7603

HDAUDIO\FUNC_01&VEN_111D&DEV_7603&SUBSYS_103C1722=B-01A1.INI
HDAUDIO\FUNC_01&VEN_111D&DEV_7603&SUBSYS_103C1726=B-01A1.INI
HDAUDIO\FUNC_01&VEN_111D&DEV_7603&SUBSYS_103C307E=B-01A1.INI
HDAUDIO\FUNC_01&VEN_111D&DEV_7603&SUBSYS_103C1455=B-01A1.INI
HDAUDIO\FUNC_01&VEN_111D&DEV_7603&SUBSYS_103C146D=B-01A1.INI
HDAUDIO\FUNC_01&VEN_111D&DEV_7603&SUBSYS_103C1471=B-01A1.INI
HDAUDIO\FUNC_01&VEN_111D&DEV_7603&SUBSYS_103C1725=B-01A2.INI
HDAUDIO\FUNC_01&VEN_111D&DEV_7603&SUBSYS_103C1729=B-01A2.INI
HDAUDIO\FUNC_01&VEN_111D&DEV_7603&SUBSYS_103C3081=B-01A2.INI
HDAUDIO\FUNC_01&VEN_111D&DEV_7603&SUBSYS_103C1458=B-01A2.INI
HDAUDIO\FUNC_01&VEN_111D&DEV_7603&SUBSYS_103C1470=B-01A2.INI
HDAUDIO\FUNC_01&VEN_111D&DEV_7603&SUBSYS_103C147A=B-01A2.INI
HDAUDIO\FUNC_01&VEN_111D&DEV_7603&SUBSYS_103C1723=B-01A3.INI
HDAUDIO\FUNC_01&VEN_111D&DEV_7603&SUBSYS_103C1727=B-01A3.INI
HDAUDIO\FUNC_01&VEN_111D&DEV_7603&SUBSYS_103C307F=B-01A3.INI
HDAUDIO\FUNC_01&VEN_111D&DEV_7603&SUBSYS_103C1456=B-01A3.INI
HDAUDIO\FUNC_01&VEN_111D&DEV_7603&SUBSYS_103C146E=B-01A3.INI
HDAUDIO\FUNC_01&VEN_111D&DEV_7603&SUBSYS_103C1472=B-01A3.INI
HDAUDIO\FUNC_01&VEN_111D&DEV_7603&SUBSYS_103C1724=B-01A4.INI
HDAUDIO\FUNC_01&VEN_111D&DEV_7603&SUBSYS_103C1728=B-01A4.INI
HDAUDIO\FUNC_01&VEN_111D&DEV_7603&SUBSYS_103C3080=B-01A4.INI
HDAUDIO\FUNC_01&VEN_111D&DEV_7603&SUBSYS_103C1457=B-01A4.INI
HDAUDIO\FUNC_01&VEN_111D&DEV_7603&SUBSYS_103C146F=B-01A4.INI
HDAUDIO\FUNC_01&VEN_111D&DEV_7603&SUBSYS_103C1473=B-01A4.INI
HDAUDIO\FUNC_01&VEN_111D&DEV_7603&SUBSYS_103C1520=B-01B1.INI
HDAUDIO\FUNC_01&VEN_111D&DEV_7603&SUBSYS_103C1523=B-01B1.INI
HDAUDIO\FUNC_01&VEN_111D&DEV_7603&SUBSYS_103C1524=B-01B2.INI
HDAUDIO\FUNC_01&VEN_111D&DEV_7603&SUBSYS_103C1525=B-01B2.INI
HDAUDIO\FUNC_01&VEN_111D&DEV_7603&SUBSYS_103C172A=B-01C.INI
HDAUDIO\FUNC_01&VEN_111D&DEV_7603&SUBSYS_103C172B=B-01C.INI
HDAUDIO\FUNC_01&VEN_111D&DEV_7603&SUBSYS_103C7007=B-01D.INI
HDAUDIO\FUNC_01&VEN_111D&DEV_7603&SUBSYS_103C7008=B-01E.INI
HDAUDIO\FUNC_01&VEN_111D&DEV_7603&SUBSYS_103C1521=B-01F.INI


>>>>>>>>>>>>>>>

Better patch would be adding addition cases

case 0x103c1455
case 0x103c1456
case 0x103c1457
case 0x103c1458
case 0x103c146d
case 0x103c146e
case 0x103c146f
case 0x103c1470
case 0x103c1471
case 0x103c1472
case 0x103c1473
case 0x103c147a




But for other devices(7605, 7608, 7666, 7667) from same vendor id from drivers(see stwrt.ini) I have no clue
Comment 8 Takashi Iwai 2015-11-09 13:20:51 UTC
Are all these you listed up with a docking station port?  Most of HP laptops have no dock port, thus the fix won't be necessary.
Comment 9 Takashi Iwai 2015-11-09 13:54:31 UTC
In anyway, we should handle these cases more smartly.  Could you try the patch below?
Comment 10 Takashi Iwai 2015-11-09 13:54:52 UTC
Created attachment 192501 [details]
Fix patch
Comment 11 Takashi Iwai 2015-11-09 16:10:31 UTC
Created attachment 192531 [details]
Revised patch

Use this one instead.
Comment 12 Raymond 2015-11-10 01:14:14 UTC
if both pins assign the same default assoc, sequence number 0x1f

node 0xa dock headphone is still the first HP pin after sort by sequence


pin_cfg = (pin_cfg & (~(AC_DEFCFG_DEF_ASSOC | AC_DEFCFG_SEQUENCE))) |
		0x1f;

	snd_hda_codec_set_pincfg(codec, 0x0f, pin_cfg);


for stac9221 , port 0xa and 0xd can be connected to same audio output, HP and Speaker  must share volume/switch 


https://launchpadlibrarian.net/222846030/AlsaInfo.txt


is there any way to dinstinguish dual headphone jacks and HP/dock HP jacks ?
Comment 13 Takashi Iwai 2015-11-10 06:55:09 UTC
(In reply to Raymond from comment #12)
> if both pins assign the same default assoc, sequence number 0x1f
> 
> node 0xa dock headphone is still the first HP pin after sort by sequence

In this particular case, it doesn't matter, as we have only two DACs.  Otherwise, there shouldn't have been any problem from the beginning.
 
> for stac9221 , port 0xa and 0xd can be connected to same audio output, HP
> and Speaker  must share volume/switch 

The fixup is applied to 92HD71bx codecs, not to others.
Comment 14 Raymond 2015-11-10 11:01:49 UTC
if you hardcode snd_hda_codec_set_pincfg(codec, 0x0f, pin_cfg) only fix node 0xf

snd_hda_codec_set_pincfg(codec, 0x0f, pin_cfg);


there is no need to call fixup_hp_headphone twice



if (is_hp_output(codec, 0x0a) && is_hp_output(codec, 0x0f)) {
           fixup_hp_headphone(codec, 0x0a);
           fixup_hp_headphone(codec, 0x0f)
Comment 15 Takashi Iwai 2015-11-10 11:45:15 UTC
Ah, thanks, it's a typo.  Of course it should change the given pin.
The revised patch is below.
Comment 16 Takashi Iwai 2015-11-10 11:45:47 UTC
Created attachment 192641 [details]
Revised patch (v3)
Comment 17 Raymond 2015-11-12 01:27:16 UTC
(In reply to wdahl from comment #7)
> This problem may be same as in bug 106961, but patch(+        case
> 0x103c1473) wont
> fix my problem because my subsystem id is 0x103c146d
> 
> There must be (or will be when they will update kernel/distro) many more
> users(https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1450027  

this one also need fixup of speaker and auto mic using line in 

Node 0x0d [Pin Complex] wcaps 0x400181: Stereo
  Control: name="Speaker Phantom Jack", index=0, device=0
  Pincap 0x00000014: OUT Detect
  Pin Default 0x01014010: [Jack] Line Out at Ext Rear
    Conn = 1/8, Color = Green
    DefAssociation = 0x1, Sequence = 0x0
  Pin-ctls: 0x00:
  Unsolicited: tag=00, enabled=0
  Connection: 3
     0x10* 0x11 0x17
Node 0x0e [Pin Complex] wcaps 0x400081: Stereo
  Control: name="Line Jack", index=0, device=0
  Pincap 0x00001724: IN Detect
    Vref caps: HIZ 50 GRD 80
  Pin Default 0x0181302e: [Jack] Line In at Ext Rear
    Conn = 1/8, Color = Blue
    DefAssociation = 0x2, Sequence = 0xe
  Pin-ctls: 0x20: IN VREF_HIZ
  Unsolicited: tag=05, enabled=1
Node 0x0f [Pin Complex] wcaps 0x400181: Stereo
  Control: name="Headphone Jack", index=0, device=0
  Pincap 0x00000014: OUT Detect
  Pin Default 0x40f000f0: [N/A] Other at Ext N/A
    Conn = Unknown, Color = Unknown
    DefAssociation = 0xf, Sequence = 0x0
  Pin-ctls: 0x40: OUT
  Unsolicited: tag=02, enabled=1
  Connection: 3
     0x10* 0x11 0x17



> https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1462229)
>
Comment 18 Takashi Iwai 2016-01-20 11:35:19 UTC
Fixed in 4.4-rc3.