Bug 99721
Summary: | Thinkpad T440s - Sound muted when docked to ThinkPad Pro Dock | ||
---|---|---|---|
Product: | Drivers | Reporter: | Fabian Franzen (flammi88) |
Component: | Sound(ALSA) | Assignee: | Jaroslav Kysela (perex) |
Status: | RESOLVED CODE_FIX | ||
Severity: | normal | CC: | nospam, public, superquad.vortex2, tiwai, twoflower2012 |
Priority: | P1 | ||
Hardware: | All | ||
OS: | Linux | ||
Kernel Version: | 4.0.0-040000-generic | Subsystem: | |
Regression: | No | Bisected commit-id: | |
Attachments: |
alsa-info output
Patch to make dock headphone jack as line out Patch to handle both headphones equally alsa-info.sh output for comment 34 |
Description
Fabian Franzen
2015-06-09 20:04:50 UTC
The volume is set up by PulseAudio, so it's basically a job of PA. Did you upgrade PA to 6.0? Yes, I use pulseaudio 6.0: fabian@flammi-pc:~$ pulseaudio --version pulseaudio 6.0 Hmm, okay... But while disscussing this on launchpad there was a point, where the mapping of the pins of the docking station pins seems to be incorrectly mapped to line out, triggering this bug (I am familiar enough with the sound system to be 100% sure about this). Is there an easy way to check this? Try to mute/unmute "Line Out" mixer switch. If this actually mutes/unmutes the dock headphone, the pin for the dock headphone jack is correct (0x16). If so, the next step is to check whether the jack detection works. Try to use hda-verb like: hda-verb /dev/snd/hwC1D0 0x16 GET_PIN_SENSE 0 It should return a value with bit 31 on when the jack is plugged. Try both jack plugged and unplugged and see whether correct values are returned. Then try to check the jack sense of NID 0x15 instead of 0x16. If all work fine, it implies that PA doesn't handle "Dock Headphone Jack" as line-out. We may fix either PA side or kernel side. http://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/src/modules/alsa/mixer/paths/analog-output-headphones.conf?id=594da41d07edcebc5fd319388852a66cc3f12ace it is strange that jack dock headphone is also in headphones.conf https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda?id=1c37c22332a2d2c1b4ab32177a4f847c7fe06e38 the driver add dock headphone jack + { 0x16, 0x21211010 }, /* dock headphone */ + { 0x19, 0x21a11010 }, /* dock mic */ seem auto parser silently change one of the headphone jack to line out https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda?id=03ad6a8c93b6df2d65c305b5b5f9474068b45bfb https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda?id=3abb4f4d0e7aaad0d12004b5057f4486a688752b that is the reason you get "Speaker+LO playback volume" and line out playback switch Simple mixer control 'Auto-Mute Mode',0 Capabilities: enum Items: 'Disabled' 'Speaker Only' 'Line Out+Speaker' Item0: 'Line Out+Speaker' driver regard it as line out jack instead of dock headphone jack Yeah, it's a known inconsistency. The former PA didn't take care of LO+Speaker, so it worked, but now it tries to mute. In anyway, if the all tests in comment 3 pass, try the patch below. This will change the dock headphone as a real dock line out. But the drawback is that it omits the headphone amp bit, so depending on the hardware, it might sounds in different level. If so, we need a bit more changes. Another way to fix is to deal with both dock and normal headphone jacks equally. That is, no exclusive mute. If this is a preferred option for PA, the second patch may work. Created attachment 179431 [details]
Patch to make dock headphone jack as line out
Created attachment 179441 [details]
Patch to handle both headphones equally
speaker+lo volume was turned off when jack dock headphone is plugged do pulseaudio really need to turn off since you lost the original volume when headphone is unplugged ? http://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/src/modules/alsa/mixer/paths/analog-output-headphones.conf?id=aec811798cd883a454b9b5cd82c77831906bbd2d +[Element Speaker+LO] +switch = off +volume = off https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda/hda_codec.c?id=5832fcf8b55cfdbd7d8511f747d15fd20ed4703d seem this patch change the behaviour when there are two headphone jacks, and randomly assign one headphone jack to line out even when location are at Sep and ext https://bugzilla.kernel.org/show_bug.cgi?id=99681 the headphone jack was changed to line out while dock headphone jack was put in hp_pins if you require specifc sequence number, both headphone jacks need to be fixed instead of adding dock headphone jack (In reply to Raymond from comment #11) > https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/ > pci/hda/hda_codec.c?id=5832fcf8b55cfdbd7d8511f747d15fd20ed4703d > > seem this patch change the behaviour when there are two headphone jacks, and > randomly assign one headphone jack to line out even when location are at Sep > and ext It's not random. (In reply to Raymond from comment #12) > https://bugzilla.kernel.org/show_bug.cgi?id=99681 > > the headphone jack was changed to line out while dock headphone jack was put > in hp_pins > > if you require specifc sequence number, both headphone jacks need to be > fixed instead of adding dock headphone jack No, the current implementation was intentional in order to mute the builtin headphone over the dock headphone. This was a preferred behavior in the past. The only missing piece was the mismatching with the jack control and the mixer controls now PA mandates (it wasn't ago). OTOH, looking at PA's behavior, it might be more reasonable to handle both headphones equally. This is done by the patch in comment 9. Okay, I had some time to perform the tests mentioned in comment 3. Here are the results: 1) After "amixer --card 1 sset 'Line Out' mute" the sound gets muted and after "amixer --card 1 sset 'Line Out' unmute" the sound gets unmuted again as expected. Everything tested in docked state. 2) Jack-Detection 2.1) With jack plugged into the docking station: hda-verb /dev/snd/hwC1D0 0x16 GET_PIN_SENSE 0 nid = 0x16, verb = 0xf09, param = 0x0 value = 0x80000000 2.2) With jack unplugged from docking station: hda-verb /dev/snd/hwC1D0 0x16 GET_PIN_SENSE 0 nid = 0x16, verb = 0xf09, param = 0x0 value = 0x0 3) Sense of NID 0x15 (speaker jack plugged into docking station) hda-verb /dev/snd/hwC1D0 0x15 GET_PIN_SENSE 0 nid = 0x15, verb = 0xf09, param = 0x0 value = 0x0 I assume that was what you expected? I have applied your patch from comment 9 to a vanilla 4.0.5 kernel and installed that on my machine. The results looks very promising, the "Speaker+LO" is not shown anymore in alsamixer/amixer and the sound is working now out of the box when I plug the jack into the docking station or dock/undock the whole laptop from docking station. If desired I can also test the patch from comment 8 or provide further information. Are the pin fixup correct ? ThinkPad Pro Dock 65W 1x Stereo/Mic Combo Audio Port seem only one combo jack do the icon near the combo jack of the dock station look like a headset , headphone or line out? http://mailman.alsa-project.org/pipermail/alsa-devel/2014-May/076319.html > > a) Using: > ------------------ > [codec] > 0x10ec0292 0x17aa220c 0 > > [pincfg] > 0x16 0x2121101f > 0x19 0x21a10030 > ------------------ > I get LOW VOLUME sound from the dock headphone ONLY when also laptop > headphone connector is plugged in. > > b) Using: > ------------------ > [codec] > 0x10ec0292 0x17aa220c 0 > > [pincfg] > 0x16 0x2121101f > 0x19 0x21a10030 > 0x1b 0x2121101f > ------------------ > I get HIGH VOLUME sound from the dock headphones when no laptop > headphones are connected, but LOW VOLUME sound when both are plugged in. do your t440s behave the same way ? http://support.lenovo.com/us/en/documents/pd028003 The audio connector does not support a conventional microphone. do this mean the node 1a is not correct ? your t440s only support internal mic, headset mic and dock headset mic Node 0x1a [Pin Complex] wcaps 0x40048b: Stereo Amp-In Control: name="Mic Boost Volume", index=0, device=0 ControlAmp: chs=3, dir=In, idx=0, ofs=0 Control: name="Mic Jack", index=0, device=0 Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0 Amp-In vals: [0x00 0x00] Pincap 0x00003724: IN Detect Vref caps: HIZ 50 GRD 80 100 Pin Default 0x03a11020: [Jack] Mic at Ext Left Conn = 1/8, Color = Black DefAssociation = 0x2, Sequence = 0x0 Pin-ctls: 0x24: IN VREF_80 Unsolicited: tag=04, enabled=1 Power states: D0 D1 D2 D3 EPSS Power: setting=D0, actual=D0 The combo jack has an headset icon on the docking station. (In reply to Fabian Franzen from comment #20) > The combo jack has an headset icon on the docking station. { 0x19, 0x21a11010 }, /* dock mic */ this mean node 0x19 should be dock headset mic https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda?id=73bdd597823e2231dc882577dbbaf8df92fe1775 the current implemenation assume the computer has only one headset combo jack , there is no vendor coeff to implement another headset combo jack Many hardwares support the headset with two distinct pins and the actual detections without COEF or any other workarounds. Let's hope that Lenovo did it properly for the docks... Will the patch from comment 9 find it's way into the upstream kernel? Not yet. It fixes one side but causes a regression in another side. In the original code, the built-in jack mutes the dock jack automatically. With the patch in comment 9, it's gone, too. The patch in comment 8 keeps the compatibile behavior. So give it a try, too. If this causes the sound output level lower, you can add the line like below: diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -5679,6 +5679,7 @@ static int patch_alc269(struct hda_codec *codec) codec->patch_ops.resume = alc269_resume; #endif spec->shutup = alc269_shutup; + spec->gen.prefer_hp_amp = 1; snd_hda_pick_fixup(codec, alc269_fixup_models, alc269_fixup_tbl, alc269_fixups); if dock hp put in spec-> line out so that headphone can mute dock hp https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda?id=03ad6a8c93b6df2d65c305b5b5f9474068b45bfb i t is bug of this patch to change the name to "speaker+lo" the correct name of the control should be "speaker+dock hp" Can you clearify what regression you are talking about in comment 25? I will give the other patch a try on monday, I am not at home this weekend. Currently, when a headphone is plugged to the laptop's jack while another headphone being plugged to the dock jack, the dock headphone will be muted auotmatically. This is the designed behavior. The patch in comment 9 changes this, and the auto-mute won't happen any longer. If user is already used to this behavior, losing the automute functionality can be seen as a regression. Hmm, If I remember correctly this behavior hasn't changed with the patch in comment 9... I think if i plug in a headphone directly into the laptop, the dock jack got muted automatically. I will also check this on Monday when I am at home again. do you have any headset to test the headset mic ? Grrr, I meant the patch in comment 8. This changes dock headphone as dock line-out, to match with the "Line" volume. This is the preferred patch over another, as it keeps the compatible behavior like before. However, this patch reveals the PA's bug, too. PA (as of 6.0) doesn't have "Dock Line Out" jack control. You need to add the following to /usr/share/pulseaudio/alsa-mixer/paths/analog-output-lineout.conf: [Jack Dock Line Out] required-any = any and the following to /usr/share/pulseaudio/alsa-mixer/paths/analog-output-speaker.conf: [Jack Dock Line Out] state.plugged = no state.unplugged = unknown Please check whether these changes with the patch in comment 8 make things working. (In reply to Takashi Iwai from comment #28) > Currently, when a headphone is plugged to the laptop's jack while another > headphone being plugged to the dock jack, the dock headphone will be muted > auotmatically. This is the designed behavior. The patch in comment 9 > changes this, and the auto-mute won't happen any longer. > > If user is already used to this behavior, losing the automute functionality > can be seen as a regression. if headset mic has higher prirotity than dock headset mic in auto mic select, this mean headset must auto mute dock headset I decided to take the fix like in comment 9. Now the fix patch (implemented slightly differenrly) was queued in for-linus branch, and will be included in 4.2-rc1, backported to stable kernels eventually later. ec56af67a10a0d82b79027878a81fce08d002d50 ALSA: hda - Fix Dock Headphone on Thinkpad X250 seen as a Line Out Similar problem here on kernel 4.2.0-16-generic #19-Ubuntu SMP and alsa-driver 1.0.25+dfsg-0ubuntu5 (that should already include the fix, right?). The machine is a Thinkpad T440p (same sound chip); my sound got muted as soon as I plugged in my headphones into the machine (no docking station here). Fixed (temporarily?) by following this guide: http://unix.stackexchange.com/questions/218108/no-output-from-headphones-jack-occasionally-although-system-displays-output (In reply to twoflower2012 from comment #34) > Similar problem here on kernel 4.2.0-16-generic #19-Ubuntu SMP and > alsa-driver 1.0.25+dfsg-0ubuntu5 (that should already include the fix, > right?). > > The machine is a Thinkpad T440p (same sound chip); my sound got muted as > soon as I plugged in my headphones into the machine (no docking station > here). > > Fixed (temporarily?) by following this guide: > http://unix.stackexchange.com/questions/218108/no-output-from-headphones- > jack-occasionally-although-system-displays-output you have to post output of alsa-info.sh 0x15 0x0321101f 0x16 0x21211010 this won't force the driver put node 0x15 in spec->gen.autocfg.hp_pins[0]; since alc_headset_mode expect combo jack is first hp_pins as hda_auto_parser sort the pins by sequence number static void alc_update_headset_mode(struct hda_codec *codec) { struct alc_spec *spec = codec->spec; hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]]; hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; 54.347454] snd_hda_codec_realtek hdaudioC1D0: autoconfig for ALC3232: line_outs=1 (0x14/0x0/0x0/0x0/0x0) type:speaker [ 54.347458] snd_hda_codec_realtek hdaudioC1D0: speaker_outs=0 (0x0/0x0/0x0/0x0/0x0) [ 54.347460] snd_hda_codec_realtek hdaudioC1D0: hp_outs=2 (0x16/0x15/0x0/0x0/0x0) [ 54.347462] snd_hda_codec_realtek hdaudioC1D0: mono: mono_out=0x0 [ 54.347464] snd_hda_codec_realtek hdaudioC1D0: inputs: [ 54.347466] snd_hda_codec_realtek hdaudioC1D0: Dock Mic=0x19 [ 54.347468] snd_hda_codec_realtek hdaudioC1D0: Mic=0x1a [ 54.347471] snd_hda_codec_realtek hdaudioC1D0: Internal Mic=0x12 Created attachment 191161 [details] alsa-info.sh output for comment 34 Update: The problem still persists: The sound from the headphone works if they are not plugged in at boot. Booting with headphones plugged in mutes sound from the headphones until the next complete power off; even across operating systems. your alsa-info still not contain patch in comment 8 nor comment 9 if the headphone and dock headphone have same sequence number, you still need sort the bits 4-5 of jack location to ensure HP at EXT must before HP at SEP /* Jack location (0x0-0x3f) */ /* common case */ enum { AC_JACK_LOC_NONE, AC_JACK_LOC_REAR, AC_JACK_LOC_FRONT, AC_JACK_LOC_LEFT, AC_JACK_LOC_RIGHT, AC_JACK_LOC_TOP, AC_JACK_LOC_BOTTOM, }; /* bits 4-5 */ enum { AC_JACK_LOC_EXTERNAL = 0x00, AC_JACK_LOC_INTERNAL = 0x10, AC_JACK_LOC_SEPARATE = 0x20, AC_JACK_LOC_OTHER = 0x30, }; https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/tree/sound/pci/hda/hda_auto_parser.c sort_pins_by_sequence(cfg->line_out_pins, line_out, cfg->line_outs); sort_pins_by_sequence(cfg->speaker_pins, speaker_out, cfg->speaker_outs); sort_pins_by_sequence(cfg->hp_pins, hp_out, cfg->hp_outs); Ok, I see that my system is running a very old version of ALSA, so I can't apply the patches directly. I'll need to figure out the update first. Thank you! http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/mixer/paths pulseaudio have dock mic conf but there is no dock headphone conf the control id of headphone jack should be lower than that of dock headphone jack since driver create jack kctl according to the order in hp_pins control.22 { iface CARD name 'Dock Headphone Jack' value false comment { access read type BOOLEAN count 1 } } control.23 { iface CARD name 'Headphone Jack' value false comment { access read type BOOLEAN count 1 } } Node 0x15 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out Control: name="Headphone Playback Switch", index=1, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x80 0x80] Pincap 0x0001001c: OUT HP EAPD Detect EAPD 0x2: EAPD Pin Default 0x0321101f: [Jack] HP Out at Ext Left Conn = 1/8, Color = Black DefAssociation = 0x1, Sequence = 0xf Pin-ctls: 0xc0: OUT HP Unsolicited: tag=02, enabled=1 Power states: D0 D1 D2 D3 EPSS Power: setting=D3, actual=D3 Connection: 2 0x0c 0x0d* Node 0x16 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out Control: name="Headphone Playback Switch", index=0, device=0 ControlAmp: chs=3, dir=Out, idx=0, ofs=0 Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1 Amp-Out vals: [0x80 0x80] Pincap 0x0001001c: OUT HP EAPD Detect EAPD 0x2: EAPD Pin Default 0x411111f0: [N/A] Speaker at Ext Rear Conn = 1/8, Color = Black DefAssociation = 0xf, Sequence = 0x0 Misc = NO_PRESENCE Pin-ctls: 0xc0: OUT HP Unsolicited: tag=01, enabled=1 Power states: D0 D1 D2 D3 EPSS Power: setting=D3, actual=D3 Connection: 2 0x0c 0x0d* the amp out mute values of two headphone pin complex seem different from playback switches Simple mixer control 'Headphone',0 Capabilities: pvolume pswitch Playback channels: Front Left - Front Right Limits: Playback 0 - 87 Mono: Front Left: Playback 0 [0%] [-65.25dB] [off] Front Right: Playback 0 [0%] [-65.25dB] [off] Simple mixer control 'Headphone',1 Capabilities: pswitch Playback channels: Front Left - Front Right Mono: Front Left: Playback [on] Front Right: Playback [on] (In reply to twoflower2012 from comment #37) > Update: The problem still persists: The sound from the headphone works if > they are not plugged in at boot. Booting with headphones plugged in mutes > sound from the headphones until the next complete power off; even across > operating systems. Suspending the system seems to help for me. The problem is gone even after further boots. https://bbs.archlinux.org/viewtopic.php?id=200090 (It seems that this is problem that is actually not related to the original bug. I think you should open a new bug if it's still an issue for you. But the fact that it's a problem across operating systems indicates that it is unlikely to be a kernel bug.) Yes, I don't know if this is related or not; I opened a bug in ubuntu and they wanted me to escalate it here. In any case, it's not operating system independent: Booting into windows with plugged headphones works fine. If I boot into linux with plugged headphones however, the sound stops working until the next complete poweroff (neither rebooting nor suspending works, even if the reboot is used to switch to windows). |