Bug 958439 - Noise in headphones when shutting down or rebooting
Noise in headphones when shutting down or rebooting
Status: RESOLVED FIXED
Classification: openSUSE
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Sound
Current
Other Other
: P5 - None : Minor (vote)
: ---
Assigned To: Takashi Iwai
E-mail List
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2015-12-09 00:35 UTC by Benjamin Poirier
Modified: 2016-05-10 00:23 UTC (History)
1 user (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
video recording of reboot with noise (1.54 MB, video/mp4)
2015-12-09 00:35 UTC, Benjamin Poirier
Details
alsa-info.sh output (44.67 KB, text/plain)
2015-12-09 15:38 UTC, Benjamin Poirier
Details
Fix patch (1.44 KB, patch)
2015-12-10 11:25 UTC, Takashi Iwai
Details | Diff
Revised fix patch #1 (2.14 KB, patch)
2015-12-10 22:50 UTC, Takashi Iwai
Details | Diff
Revised fix patch #2 (1.44 KB, patch)
2015-12-10 22:51 UTC, Takashi Iwai
Details | Diff
Patch to power down codec to D3 at reboot/shutdown (1.63 KB, patch)
2015-12-14 13:31 UTC, Takashi Iwai
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Poirier 2015-12-09 00:35:11 UTC
Created attachment 658764 [details]
video recording of reboot with noise

When I reboot or poweroff with headphones plugged in there is about 4s of
noise at the very end of the reboot sequence. Most of the times it is like
white noise but sometimes its different. When headphones are not plugged in I
don't hear a similar noise from the laptop speaker.

I first noticed this with Factory kernel 4.3.0-2 but I've tested with 4.0 and
3.12.50 and the same noise is present.

I don't have a very good setup to record the sound but I've included a video
to try to capture it. The offending sound starts at ~15s.

The machine is a ThinkPad X1 Carbon 2nd (Generation).
The cound card in use, described by `pacmd info`, is:
        name: <alsa_card.pci-0000_00_1b.0>
        driver: <module-alsa-card.c>
        owner module: 8
        properties:
                alsa.card = "2"
                alsa.card_name = "HDA Intel PCH"
                alsa.long_card_name = "HDA Intel PCH at 0xf0534000 irq 48"
                alsa.driver_name = "snd_hda_intel"
                device.bus_path = "pci-0000:00:1b.0"
                sysfs.path = "/devices/pci0000:00/0000:00:1b.0/sound/card2"
                device.bus = "pci"
                device.vendor.id = "8086"
                device.vendor.name = "Intel Corporation"
                device.product.id = "9c20"
                device.product.name = "8 Series HD Audio Controller"
                device.form_factor = "internal"
                device.string = "2"
                device.description = "Built-in Audio"
                module-udev-detect.discovered = "1"
                device.icon_name = "audio-card-pci"
        profiles:
                input:analog-stereo: Analog Stereo Input (priority 60, available: unknown)
                output:analog-stereo: Analog Stereo Output (priority 6000, available: unknown)
                output:analog-stereo+input:analog-stereo: Analog Stereo Duplex (priority 6060, available: unknown)
                off: Off (priority 0, available: unknown)
        active profile: <output:analog-stereo+input:analog-stereo>
        sinks:
                alsa_output.pci-0000_00_1b.0.analog-stereo/#2: Built-in Audio Analog Stereo
        sources:
                alsa_output.pci-0000_00_1b.0.analog-stereo.monitor/#3: Monitor of Built-in Audio Analog Stereo
                alsa_input.pci-0000_00_1b.0.analog-stereo/#4: Built-in Audio Analog Stereo
        ports:
                analog-input-internal-mic: Internal Microphone (priority 8900, latency offset 0 usec, available: unknown)
                        properties:
                                device.icon_name = "audio-input-microphone"
                analog-input-mic: Microphone (priority 8700, latency offset 0 usec, available: no)
                        properties:
                                device.icon_name = "audio-input-microphone"
                analog-output-speaker: Speakers (priority 10000, latency offset 0 usec, available: no)
                        properties:
                                device.icon_name = "audio-speakers"
                analog-output-headphones: Headphones (priority 9000, latency offset 0 usec, available: yes)
                        properties:
                                device.icon_name = "audio-headphones"
Comment 1 Takashi Iwai 2015-12-09 10:17:18 UTC
Could you provide alsa-info.sh output?  Run the script with --no-upload option and attach to Bugzilla.
Comment 2 Benjamin Poirier 2015-12-09 15:38:20 UTC
Created attachment 658843 [details]
alsa-info.sh output
Comment 3 Takashi Iwai 2015-12-09 15:42:36 UTC
Could you try to pass the following option to snd-hda-intel?
  options snd-hda-intel model=,tpt440-dock

The comma after "model=" is no typo, it means the second entry.
Comment 4 Benjamin Poirier 2015-12-09 18:20:10 UTC
I've set this option, reloaded the module and rebooted, the noise was still
there at reboot.
Rebooted once more, the noise was still there.

I noticed different "ports" so I would say the option was effective but did
not solve the problem:
root@f1:~# journalctl -b -4 | grep snd
Dec 08 15:09:05 f1 kernel: snd_hda_intel 0000:00:03.0: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
Dec 08 15:09:05 f1 kernel: snd_hda_codec_realtek hdaudioC1D0: autoconfig for ALC3232: line_outs=1 (0x14/0x0/0x0/0x0/0x0) type:speaker
Dec 08 15:09:05 f1 kernel: snd_hda_codec_realtek hdaudioC1D0:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
Dec 08 15:09:05 f1 kernel: snd_hda_codec_realtek hdaudioC1D0:    hp_outs=1 (0x15/0x0/0x0/0x0/0x0)
Dec 08 15:09:05 f1 kernel: snd_hda_codec_realtek hdaudioC1D0:    mono: mono_out=0x0
Dec 08 15:09:05 f1 kernel: snd_hda_codec_realtek hdaudioC1D0:    inputs:
Dec 08 15:09:05 f1 kernel: snd_hda_codec_realtek hdaudioC1D0:      Mic=0x1a
Dec 08 15:09:05 f1 kernel: snd_hda_codec_realtek hdaudioC1D0:      Internal Mic=0x12
Dec 08 15:09:05 f1 kernel: usbcore: registered new interface driver snd-usb-audio
root@f1:~# journalctl -b | grep snd
Dec 09 10:02:42 f1 kernel: snd_hda_intel 0000:00:03.0: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
Dec 09 10:02:42 f1 kernel: snd_hda_codec_realtek hdaudioC1D0: autoconfig for ALC3232: line_outs=1 (0x14/0x0/0x0/0x0/0x0) type:speaker
Dec 09 10:02:42 f1 kernel: snd_hda_codec_realtek hdaudioC1D0:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
Dec 09 10:02:42 f1 kernel: snd_hda_codec_realtek hdaudioC1D0:    hp_outs=2 (0x16/0x15/0x0/0x0/0x0)
Dec 09 10:02:42 f1 kernel: snd_hda_codec_realtek hdaudioC1D0:    mono: mono_out=0x0
Dec 09 10:02:42 f1 kernel: snd_hda_codec_realtek hdaudioC1D0:    inputs:
Dec 09 10:02:42 f1 kernel: snd_hda_codec_realtek hdaudioC1D0:      Dock Mic=0x19
Dec 09 10:02:42 f1 kernel: snd_hda_codec_realtek hdaudioC1D0:      Mic=0x1a
Dec 09 10:02:42 f1 kernel: snd_hda_codec_realtek hdaudioC1D0:      Internal Mic=0x12
Dec 09 10:02:42 f1 kernel: usbcore: registered new interface driver snd-usb-audio
Comment 5 Takashi Iwai 2015-12-09 19:00:31 UTC
OK, then try the patch found in bug 958504, and use "tpt440" instead of "tpt440-dock" in model option.  I don't think this would make difference, but to be sure.

Is the problem only at reboot/shutdown?  If so, does it any change if you mute the output before reboot/shutdown?
Comment 6 Benjamin Poirier 2015-12-10 01:39:05 UTC
(In reply to Takashi Iwai from comment #5)
> OK, then try the patch found in bug 958504, and use "tpt440" instead of
> "tpt440-dock" in model option.  I don't think this would make difference,
> but to be sure.

Takashi, you rule! With 9a811230481243f384b8036c6a558bfdbd961f78 and the
tpt440 module parameter there is no more noise at shutdown and it also gets
rid of some poping at startup.

> 
> Is the problem only at reboot/shutdown?  If so, does it any change if you
> mute the output before reboot/shutdown?

Yes, it's only at reboot/shutdown. I also tested unloading snd_hda_intel but
it did not produce the noise then. I tested muting before testing the patch
above and muting did not help.
Comment 7 Takashi Iwai 2015-12-10 11:23:58 UTC
Great, could you then try the patch below on top of the current stable branch?  Don't forget to remove model option, too.
Once when confirmed to work, I'll merge this fix to upstream.
Comment 8 Takashi Iwai 2015-12-10 11:25:23 UTC
Created attachment 658943 [details]
Fix patch
Comment 9 Benjamin Poirier 2015-12-10 18:26:56 UTC
The patch fixes the issue of the noise at reboot most of the time. I still
noticed it 2 times over ~12 reboots. I'm almost sure I was testing the right
kernel with the right patch at those times but I doubt myself.

More importantly, I've noticed that with the patch I no longer have a console
beep! The "Beep" channel in alsamixer is no longer there. If I remove the
"spec->gen.mixer_nid = 0;" then the noise at reboot is fixed and I still have
the console beep.

In addition, I've noticed another very similar issue that could perhaps be
dealt with while we're working on this: when I physically plug in the
headphones, there is the same popping and noise that I could hear at shutdown.
This is always there, with or without the patch.
Comment 10 Takashi Iwai 2015-12-10 22:50:11 UTC
OK, then we should apply the shutup fixup generically to all thinkpad models.
Could you try the two patches below instead of the previous one?

About the noise at HP plug: you can try the below in addition.
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4200,6 +4200,7 @@ static void alc_fixup_tpt440_dock(struct hda_codec *codec\
,
        if (action == HDA_FIXUP_ACT_PRE_PROBE) {
                spec->shutup = alc_no_shutup; /* reduce click noise */
                spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
+               spec->gen.auto_mute_via_amp = 1;
                codec->power_save_node = 0; /* avoid click noises */
                snd_hda_apply_pincfgs(codec, pincfgs);
        }
Comment 11 Takashi Iwai 2015-12-10 22:50:52 UTC
Created attachment 658984 [details]
Revised fix patch #1
Comment 12 Takashi Iwai 2015-12-10 22:51:16 UTC
Created attachment 658985 [details]
Revised fix patch #2
Comment 13 Benjamin Poirier 2015-12-12 02:05:18 UTC
I tested with 9a81123 plus the patches from comment 11 and comment 12. This
time I was careful to pick the correct kernel and I observed the result over
ten boots:

no click at startup
no noise at reboot

no click at startup
noise at reboot      ***

noise at startup     ***
no noise at reboot

no click at startup
no noise at reboot

noise at startup     ***
no noise at reboot

no click at startup
no noise at reboot

no click at startup
no noise at reboot

no click at startup
noise at reboot      ***

noise at startup     ***
no noise at reboot

no noise at startup
no noise at reboot

Considering that without the patches there is always a click at startup and
some noise at shutdown, I would say that this is an improvement but it is not
perfect. I feel like the two times when there was a noise at reboot, it came a
little bit later. Comparing to the video in comment 0 where the noise occurs
while the kernel log is still displayed, now the noise occured after the
monitor went dark.

Afterwards, I added the patch in comment 10. It did not improve the noise when
plugging in the headphones however.
Comment 14 Takashi Iwai 2015-12-14 13:30:47 UTC
If the issue still occurs intermittently, this might be because of the power status at reboot/shutdown.  Could you try the patch below in addition to previous two?
Comment 15 Takashi Iwai 2015-12-14 13:31:25 UTC
Created attachment 659213 [details]
Patch to power down codec to D3 at reboot/shutdown
Comment 16 Benjamin Poirier 2015-12-14 21:49:05 UTC
I tested with 9a81123 plus the patches from comment 11, 12 and 15. Like I did
previously, I tested over ten reboots and I'm happy to report that this time
it was flawless: no noise at reboot, no click at startup. The noise when
plugging in headphones is also gone. Well done.
Comment 17 Takashi Iwai 2015-12-15 15:53:28 UTC
The fixes are merged to upstream and backported to openSUSE-42.1, stable and master branches now.  Let's close.
Comment 18 Benjamin Poirier 2015-12-15 17:01:37 UTC
Thank you for your help in debugging this issue.
Comment 19 Swamp Workflow Management 2016-01-29 13:15:17 UTC
openSUSE-SU-2016:0280-1: An update that solves 10 vulnerabilities and has 18 fixes is now available.

Category: security (important)
Bug References: 865096,865259,913996,950178,950998,952621,954324,954532,954647,955422,956708,957152,957988,957990,958439,958463,958504,958510,958886,958951,959190,959399,960021,960710,961263,961509,962075,962597
CVE References: CVE-2015-7550,CVE-2015-8539,CVE-2015-8543,CVE-2015-8550,CVE-2015-8551,CVE-2015-8552,CVE-2015-8569,CVE-2015-8575,CVE-2015-8767,CVE-2016-0728
Sources used:
openSUSE Leap 42.1 (src):    kernel-debug-4.1.15-8.1, kernel-default-4.1.15-8.1, kernel-docs-4.1.15-8.3, kernel-ec2-4.1.15-8.1, kernel-obs-build-4.1.15-8.2, kernel-obs-qa-4.1.15-8.1, kernel-obs-qa-xen-4.1.15-8.1, kernel-pae-4.1.15-8.1, kernel-pv-4.1.15-8.1, kernel-source-4.1.15-8.1, kernel-syms-4.1.15-8.1, kernel-vanilla-4.1.15-8.1, kernel-xen-4.1.15-8.1
Comment 20 Swamp Workflow Management 2016-04-12 10:12:27 UTC
openSUSE-SU-2016:1008-1: An update that solves 15 vulnerabilities and has 26 fixes is now available.

Category: security (important)
Bug References: 814440,884701,949936,951440,951542,951626,951638,953527,954018,954404,954405,954876,958439,958463,958504,959709,960561,960563,960710,961263,961500,961509,962257,962866,962977,963746,963765,963767,963931,965125,966137,966179,966259,966437,966684,966693,968018,969356,969582,970845,971125
CVE References: CVE-2015-1339,CVE-2015-7799,CVE-2015-7872,CVE-2015-7884,CVE-2015-8104,CVE-2015-8709,CVE-2015-8767,CVE-2015-8785,CVE-2015-8787,CVE-2015-8812,CVE-2016-0723,CVE-2016-2069,CVE-2016-2184,CVE-2016-2383,CVE-2016-2384
Sources used:
openSUSE Leap 42.1 (src):    kernel-debug-4.1.20-11.1, kernel-default-4.1.20-11.1, kernel-docs-4.1.20-11.3, kernel-ec2-4.1.20-11.1, kernel-obs-build-4.1.20-11.2, kernel-obs-qa-4.1.20-11.1, kernel-obs-qa-xen-4.1.20-11.1, kernel-pae-4.1.20-11.1, kernel-pv-4.1.20-11.1, kernel-source-4.1.20-11.1, kernel-syms-4.1.20-11.1, kernel-vanilla-4.1.20-11.1, kernel-xen-4.1.20-11.1