Bug 110591 - White noise in headphones on Dell Latitude E5550/ALC3235 (w/ hda-analyzer diff)
Summary: White noise in headphones on Dell Latitude E5550/ALC3235 (w/ hda-analyzer diff)
Status: RESOLVED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: Sound(ALSA) (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Jaroslav Kysela
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-09 21:24 UTC by Andrey Vihrov
Modified: 2016-05-08 21:51 UTC (History)
3 users (show)

See Also:
Kernel Version: 4.3.3
Subsystem:
Regression: No
Bisected commit-id:


Attachments
ALSA info (43.68 KB, text/plain)
2016-01-09 21:24 UTC, Andrey Vihrov
Details
hda-analyzer diff (854 bytes, patch)
2016-01-09 21:25 UTC, Andrey Vihrov
Details | Diff
Test fix patch (836 bytes, patch)
2016-01-12 08:31 UTC, Takashi Iwai
Details | Diff
ALSA info (38.56 KB, text/plain)
2016-04-23 21:42 UTC, Viktor Pal
Details
ALSA info (defaults) (40.05 KB, text/plain)
2016-04-24 18:08 UTC, Viktor Pal
Details
card0_codec#0_no_headset (3.86 KB, text/plain)
2016-04-25 19:50 UTC, Viktor Pal
Details
card1_codec#0_no_headset (12.47 KB, text/plain)
2016-04-25 19:50 UTC, Viktor Pal
Details
card0_codec#0_with_adapter_cable (3.86 KB, text/plain)
2016-04-25 19:51 UTC, Viktor Pal
Details
card1_codec#0_with_adapter_cable (12.46 KB, text/plain)
2016-04-25 19:51 UTC, Viktor Pal
Details
card0_codec#0_with_samsung_headset (3.86 KB, text/plain)
2016-04-25 19:52 UTC, Viktor Pal
Details
card1_codec#0_with_samsung_headset (12.46 KB, text/plain)
2016-04-25 19:52 UTC, Viktor Pal
Details

Description Andrey Vihrov 2016-01-09 21:24:27 UTC
Created attachment 199161 [details]
ALSA info

I observe white noise on the headphone channel on a Dell Latitude E5550 (Realtek ALC3235 audio codec) with Linux 4.3.3.

- Changing audio mixer settings seems to have no effect.
- I tested all models specified for ALC3xxx in https://www.kernel.org/doc/Documentation/sound/alsa/HD-Audio-Models.txt and found no difference.
- Using the hda-analyzer script I found that the configuration of one mixer element needs to be adjusted. Diff output from the script is attached below.
Comment 1 Andrey Vihrov 2016-01-09 21:25:11 UTC
Created attachment 199171 [details]
hda-analyzer diff
Comment 3 Andrey Vihrov 2016-01-10 19:30:08 UTC
I applied the patch to the vanilla 4.3.3 kernel. After booting the new kernel and disabling "Loopback Mixing" in the mixer, the noise is gone.
Comment 4 Takashi Iwai 2016-01-12 08:31:14 UTC
I suppose applying the same quirk for E7450 works for E5550?
Try the patch below.
Comment 5 Takashi Iwai 2016-01-12 08:31:36 UTC
Created attachment 199391 [details]
Test fix patch
Comment 6 Andrey Vihrov 2016-01-12 20:03:32 UTC
Confirmed. I built Linux 4.3.3 with the patch and there is no noise with this kernel.
Comment 7 Takashi Iwai 2016-01-12 20:32:52 UTC
Good to hear.  I submitted and merged the fix patch.  It'll be included in the next pull request and backpoted to stable kernels eventually.
Comment 8 Andrey Vihrov 2016-01-12 20:34:37 UTC
Thanks!
Comment 9 Viktor Pal 2016-04-23 21:42:02 UTC
Hi sorry for commenting on this thread, but I came across this why searching for a solution for the same issue.
I also have Dell Latitude E5550 running Ubuntu 16.04 with the following kernel and I can hear the mentioned noise very clearly.
Kernel version:
Linux 4.4.0-21-generic #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016 x86_64 x86_64 GNU/Linux

Any idea why this could be happening?
I suppose this should already be fixed in the kernel version I'm using.

Also attaching ALSA script output.
Comment 10 Viktor Pal 2016-04-23 21:42:52 UTC
Created attachment 213841 [details]
ALSA info
Comment 11 Viktor Pal 2016-04-23 22:00:27 UTC
I also played around with the hda-analyzer and it seems that by default the values Andrey suggested are already effective.
The changes he suggested unfortunately only decrease the level of noise.
It only goes away when you mute all the values for the node (Node 0x0d) like this (but then there is no sound at all):
-  Amp-In vals: [0x00 0x00] [0x80 0x80]
+  Amp-In vals: [0x80 0x80] [0x80 0x80]
Comment 12 Raymond 2016-04-24 16:32:45 UTC
your pin defsult are different 


    8.955704] snd_hda_codec_generic hdaudioC1D0: autoconfig for Generic: line_outs=1 (0x16/0x0/0x0/0x0/0x0) type:line
[    8.955709] snd_hda_codec_generic hdaudioC1D0:    speaker_outs=1 (0x14/0x0/0x0/0x0/0x0)
[    8.955712] snd_hda_codec_generic hdaudioC1D0:    hp_outs=1 (0x15/0x0/0x0/0x0/0x0)
[    8.955714] snd_hda_codec_generic hdaudioC1D0:    mono: mono_out=0x0
[    8.955716] snd_hda_codec_generic hdaudioC1D0:    inputs:
[    8.955719] snd_hda_codec_generic hdaudioC1D0:      Dock Mic=0x19
[    8.955721] snd_hda_codec_generic hdaudioC1D0:      Internal Mic=0x13



https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda?id=a22aa26f754bebc6e5ca7c503339b4812d714e89


+	[ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
+		.type = HDA_FIXUP_PINS,
+		.v.pins = (const struct hda_pintbl[]) {
+			{ 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
+			{ 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
+			{ }
+		},
+		.chained = true,
+		.chain_id = ALC269_FIXUP_HEADSET_MODE

are you using headset, headphone or mic ?
Comment 13 Raymond 2016-04-24 16:37:24 UTC
/sys/class/sound/hwC1D0/driver_pin_configs:

/sys/class/sound/hwC1D0/user_pin_configs:


headset only support when there are 

0x18 0x01a1913d
0x1a 0x01a1913c
Comment 14 Viktor Pal 2016-04-24 18:07:23 UTC
Hi Raymund,

thanks for the very quick response.
I tried with two headphones (that are only headphones, no mic included).
When using these the noise is terrible.

I also tried a headset that I got with my Samsung Galaxy S2 phone years ago.
With that one the noise is still noticeable but compared to the headphones it is a lot better.
I don't know though if that is compatible with that connector as I have seen that there are different pin layouts.
Though the sound setting GUI recognizes the sound input when I select "Headset Microphone", so based on that it should be okay.

I ordered one of these and will get it next week and try the headphones with that:
http://www.inline-info.de/de/inline-detail/artikel/15503/

I just realized that I already head some options for the snd hda module set based on some Internet searches trying to resolve the problem.
I just removed these and the defaults changed to the following after a restart:
[   13.573600] snd_hda_codec_realtek hdaudioC1D0: autoconfig for ALC3235: line_outs=1 (0x16/0x0/0x0/0x0/0x0) type:line
[   13.573605] snd_hda_codec_realtek hdaudioC1D0:    speaker_outs=1 (0x14/0x0/0x0/0x0/0x0)
[   13.573610] snd_hda_codec_realtek hdaudioC1D0:    hp_outs=1 (0x15/0x0/0x0/0x0/0x0)
[   13.573612] snd_hda_codec_realtek hdaudioC1D0:    mono: mono_out=0x0
[   13.573614] snd_hda_codec_realtek hdaudioC1D0:    inputs:
[   13.573619] snd_hda_codec_realtek hdaudioC1D0:      Dock Mic=0x19
[   13.573622] snd_hda_codec_realtek hdaudioC1D0:      Headset Mic=0x1a
[   13.573624] snd_hda_codec_realtek hdaudioC1D0:      Internal Mic=0x13

# cat /sys/class/sound/hwC1D0/driver_pin_configs
0x16 0x21014020
0x19 0x21a19030
0x1a 0x01a1913c

# cat /sys/class/sound/hwC1D0/user_pin_configs # empty

Also attaching the ALSA info crated after the revert.

Regarding the noise, reverting these module options did not have any affect on the noise.

I hope that makes sense and thanks again for the help.

Thanks
Comment 15 Viktor Pal 2016-04-24 18:08:28 UTC
Created attachment 213891 [details]
ALSA info (defaults)
Comment 16 Raymond 2016-04-25 07:13:29 UTC
do your user manual mention support of headphone ?


can the codec detect the type of your headset (CTIA / OMTP) ?


https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda?id=cd262518a3ae4465e8e51c29641d98c4ed0651a1
Comment 17 Raymond 2016-04-25 07:13:36 UTC
do your user manual mention support of headphone ?


can the codec detect the type of your headset (CTIA / OMTP) ?


https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda?id=cd262518a3ae4465e8e51c29641d98c4ed0651a1
Comment 18 Viktor Pal 2016-04-25 18:18:44 UTC
The manual says "headset connector".
Page 7-8:
http://topics-cdn.dell.com/pdf/latitude-e5550-laptop_Owner's%20Manual_en-us.pdf

The picture next to the port also shows a headset.

I also received the cable linked above today that separates MIC and headphone and I get the same results with both headphones and the headset.
The description page for the cable linked above explicitly mentions "DELL-Latitude-Notebooks" and it says that the connector is CTIA.
So I guess this should be the right cable.
I also found this post which says Dell support does not know if the port is CTIA or OMTP: http://en.community.dell.com/support-forums/laptop/f/3518/t/19667972

Regarding your question:
"can the codec detect the type of your headset (CTIA / OMTP) ?"

How could I figure this out?

I also just realized that somehow the sound got into strange state where was only able to hear some parts of the music I was listening.
In sound settings pressing test left and test right sounded on both sides of the headphone no matter which I pressed.
In this state though the noise wasn't there (absolutely not).
After plugging the headphone (the cable I bought) out and in the sound normalized and the noise came back.


Thanks again for the help.
Comment 19 Viktor Pal 2016-04-25 19:49:13 UTC
Okay after taking another look at the commit again I just realized what you need.
Attaching files with adapter cable headset and without headset plugged in.
Comment 20 Viktor Pal 2016-04-25 19:50:01 UTC
Created attachment 214171 [details]
card0_codec#0_no_headset
Comment 21 Viktor Pal 2016-04-25 19:50:33 UTC
Created attachment 214181 [details]
card1_codec#0_no_headset
Comment 22 Viktor Pal 2016-04-25 19:51:06 UTC
Created attachment 214191 [details]
card0_codec#0_with_adapter_cable
Comment 23 Viktor Pal 2016-04-25 19:51:41 UTC
Created attachment 214201 [details]
card1_codec#0_with_adapter_cable
Comment 24 Viktor Pal 2016-04-25 19:52:26 UTC
Created attachment 214211 [details]
card0_codec#0_with_samsung_headset
Comment 25 Viktor Pal 2016-04-25 19:52:52 UTC
Created attachment 214221 [details]
card1_codec#0_with_samsung_headset
Comment 26 Viktor Pal 2016-04-25 19:54:22 UTC
Files dumped:
/proc/asound/card0/codec#0
/proc/asound/card1/codec#0

Module parameter was set:
# cat /sys/module/snd_hda_codec/parameters/dump_coef
1
Comment 27 Viktor Pal 2016-04-25 21:05:57 UTC
Okay one additional info that might help.
When I copy something from an NFS drive or browse an NFS drive in Nautilus the white noise changes or there is additionally to it (my ears are not that sensible) a "high tone", "high frequency" buzzing noise.
No other copy from local to local or from /dev/urandom or any other network traffic causes this based on my tests.
Comment 28 Viktor Pal 2016-04-25 22:18:15 UTC
Raymond, its seems that my last sentence lead me to the solution.
My home server is connected to my router through a powerline adapter (http://www.devolo.com/en/Products/dLAN-1200+/).
The NFS traffic made me suspicious and I removed both ends from the plug and all the noise magically went away.
I don't know if this is a design flaw in the laptop or in the powerline adapter, but this seems to be pretty awkward.
This is absolutely reproducible,  plug in and the noise is there, plug out and everything is okay...


Thanks much for your help.
Comment 29 Raymond 2016-04-26 03:24:36 UTC
+	case 0x10ec0293:
+		/* Combo Jack auto detect */
+		val = alc_read_coef_idx(codec, 0x4a);
+		alc_write_coef_idx(codec, 0x4a, (val & 0xfff0) | 0x0008);
+		/* Set to ctia type */
+		alc_write_coef_idx(codec, 0x45, 0xD429);
+		msleep(300);
+		val = alc_read_coef_idx(codec, 0x46);
+		is_ctia = (val & 0x0070) == 0x0070;
+		break;

only debug version print the headset type in system log


	codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
		    is_ctia ? "yes" : "no");
	spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
}


http://voices.canonical.com/david.henningsson/2014/03/07/headset-jacks-on-newer-laptops/

http://bazaar.launchpad.net/~unity-settings-daemon-team/unity-settings-daemon/trunk/view/head:/plugins/media-keys/what-did-you-plug-in/pa-backend.c
Comment 30 Viktor Pal 2016-05-08 21:51:29 UTC
Raymond, sorry for the delayed response.
Thanks for the links. It seems that this headphone/headset connector "thing" is pretty messed up.

Do I need to recompile the kernel with CONFIG_SND_DEBUG_VERBOSE to get the headset type in the system log?

I realized since then that other electrical activities also generate some noise in the headphone/headset like switching the light on or of or some activities done by the dishwasher (without the powerline adapter being plugged in).
These are much-much weaker though than the one generated by the powerline adapter.

Regarding unity-settings-daemon, I don't use unity, I have the Ubuntu GNOME image installed so it is mostly Gnome processes and nothing Unity specific.

Note You need to log in before you can comment on or make changes to this bug.