Knackende Tonausgabe auf Dell Latitude 14 5495 beheben

Problem

Während der Soundwiedergabe (Musik, Videos, Spiele) oder sogar während einfacher Windows Benachrichtungstöne ist immer wieder ein Knacken zu hören, unabhängig davon ob man die internen Lautsprecher oder externe Lautsprecher oder Köpfhörer nutzt. Dieses Knacken tritt sogar beim Soundtest in den Realtek-Geräte-Einstellungem, im Windows Mixer und im MaxxAudioPro auf. 

Lösung

Die PCIe Stromspareinstellungen müssen weniger aggressiv eingestellt werden. Mit der rechten Maustaste auf das Batterie/Netzteil-Icon in der Taskleiste klicken, "Energieoptionen" auswählen. Da dann "Erweiterte Energieeinstellungen ändern" rechts neben dem Dell Plan anklicken, wird ein anderer Plan verwendet, dann diesen (auch) bearbeiten.  Unten "Erweiterte Energieeinstellungen ändern" anklicken, im Editor dann "PCI Express" aufklappen und darunter dann den einzigen Eintrag "Verbindungszustand-Energieverwaltung". Für beide Einträge oder, je nach persönlicher Vorliebe für saubere Tonausgabe oder länger Batterielaufzeit, nur für den Netzbetrieb die Einstellung "Mittlere Energieeinsparungen" einstellen. Mit einem Klick auf übernehmen wird die Einstellung direkt aktiv. Ich denke nicht (im Sinne von hoffen) , dass diese Einstellung eine größere Auswirkung auf die Akkulaufzeit hat. Fun Fact: wenn man die Einstellung auf maximale Einsparung zurückstellt und auf Übernehmen klickt, hat man eine hohe Chance schon wieder ein Klicken zu hören ;-) 
 
Mein Dank gilt "Francois Villemaire" der die Lösung im Microsoft Forum gepostet hatte. Im Gegensatz zu dem Fall da war ein Ändern der USB Einstellungen nicht notwendig. 

Meine Meinung

Anstatt an einem meiner Projekte zu arbeiten geht wieder mal ein Abend dabei drauf ein Problem bei einem neugekauften Gerät zu analysieren. Das wird langsam echt ärgerlich. Können die Hersteller keine fehlerfreien, 100% getesten Geräte mehr ausliefern? 
 
Zuerst habe ich versucht verschiedene Treiber zu aktualisieren oder zu downgraden, vor allem den Realtek Soundkartentreiber. Dann habe ich an den Soundeinstellungen rumgespielt, vor allem verschiedene Sampling Raten und Bittiefen, wo aber dann beim Testton schon wieder ein knacken zu vernehmen war. Dieses Knacken ist typisch dafür wenn der Datenstrom abreisst, aus welchem Grund auch immer, und hab dann nach den Ursachen für Buffer Underruns gesucht. Meine letzte Soundblaster ist wegen DPC problemen vor ~10 Jahren rausgflogen, deswegen mal nach DPC und Interrupt Problemen gesucht und als die dann Dank LatencyMon und DPC Latency Checker offensichtlich waren, geguckt wer diese verursachen könnte. Die Ursache habe ich zwar nicht gefunden, aber bin auf der Suche nach Hilfe auf den Forum-Eintrag mit der Energieeinstellung gestolpert. Interessanterweise war dieser ISR/DPC Aufruf ~16,6ms lang, was so ziemlich 1/60s (= 60Hz) lang ist, hatte da fast auf irgendein Problem mit der Grafikkarte oder dem Monitor-VSync getippt. Hab wieder was über Windows gelernt, hätte da aber gerne drauf verzichtet. 

Fundstücke während des Debuggens:

 

How to fix bad audio with clicking noises on Dell Latitude 14 5495

Issue

"Clicks" during during audio playback of music, videos or in games and even with the Windows notifications and during sound tests in the Realtek device settings, Windows mixer settings and in MaxxAudioPro. These clicks can be heard when using the internal speaker or with attached external devices like headphones.

Solution

Disable PCI Express Link State Power Management for your power plan. Right click on power/battery notifcation in the task bar, choose "Power Options",  click on "Change Plan Settings" for the Dell power plan or for the power plan you are currently using, then click on "Change advanced power settings". Expand "PCI Express",  expand "Link State Power Management" and set both to "Moderate Power Savings". I do not know how much battery runtime this costs you, so it's up to you whether you prefer good audio or longer battery time. But I doubt that the power consumption will go up noticably. 
 
Kudos to "Francois Villemaire" who found the solution. No need to disable "USB selective suspend settings" or reboot. The settings will applied immediately when you press "Apply". Fun fact, pressing apply after changing the setting back to maximum may result in an distorted confirmation sound ;-)  

Comment

Another evening wasted on analysing a problem of a new device instead on working on my own projects. This is really annyoing.. why can't a new device just simply work? 
 
I tried updating/downgrading various drivers, changing the realtek driver to a generic audio driver, changed sample rate and bit depth for the device. As these clicking noises are typical for buffer underuns I looked for interrupt and DPC problems and after finding these I went on searching for the culprit causing high Interrupt and/or DPC latency, stopped a lot of services and so on. Unfortunately I did not find the cause, it was just suspicious that the longest ISR/DPCs took ~16,6ms (=> 1/60s). Learned more about Windows, so not all the time was wasted. 
 

Tools & web pages used for debugging: 

 

Dell Latitude 14 5495 & Linux (Ubuntu 18.04)

Instructions to boot Linux on the AMD Mobile Ryzen based Dell Latitude 14 5495:

  1. Connect a bootable Linux USB Device (e.g. Optical Drive, Stick, HDD, etc..)
  2. Boot
  3. Rejoice, Linux will run fine

Okay, it was not so easy. I had trouble with getting the UEFI  to boot from my USB device (the IODD). The UEFI just ignored the device and booted into Win10 from the internal SATA SSD, even when the SSD and the Win bootloader were both disabled in the boot manager. In the end I added manually the EFI bootloader from the Live-CD to the bootmanager by choosing "Add boot option" (or so) and then navigating to the *.efi boot loader on the device. Then I was able to boot via the boot manager. Afterwards I removed the boot entry. Might be an issue with the IODD.

 

Update 2018-10-07

Okay, there are more issues:

Boot Medium not found after Linux

This is rather weird, when (re-boot) after using the installed Ubuntu 18.04, the UEFI/BIOS cannot find the boot medium and I have to enter the UEFI setup. Without changing anything, on the next boot, everything is okay again, and the notebook will boot the default UEFI boot entry (which is WIndows). I have no clue what is causing this. 

PCIe Power Management Log Entry

Seems that the PCIe Power Management does not only cause issues with audio output, NVMes do not like it, too: 

Oct  7 00:51:34 notebook kernel: [  411.718618] pcieport 0000:00:01.5: AER: Multiple Corrected error received: id=0008
Oct  7 00:51:34 notebook kernel: [  411.720690] pcieport 0000:00:01.5: PCIe Bus Error: severity=Corrected, type=Data Link Layer, id=000d(Transmitter ID)
Oct  7 00:51:34 notebook kernel: [  411.720698] pcieport 0000:00:01.5:   device [1022:15d3] error status/mask=00001100/00006000
Oct  7 00:51:34 notebook kernel: [  411.720705] pcieport 0000:00:01.5:    [ 8] RELAY_NUM Rollover    
Oct  7 00:51:34 notebook kernel: [  411.720707] pcieport 0000:00:01.5:    [12] Replay Timer Timeout  
Oct  7 00:51:34 notebook kernel: [  411.720716] nvme 0000:04:00.0: PCIe Bus Error: severity=Corrected, type=Data Link Layer, id=0400(Transmitter ID)
Oct  7 00:51:34 notebook kernel: [  411.720718] nvme 0000:04:00.0:   device [126f:2262] error status/mask=00001000/0000e000
Oct  7 00:51:34 notebook kernel: [  411.720720] nvme 0000:04:00.0:    [12] Replay Timer Timeout  
 
Solution is easy, just add pcie_aspm=off to the kernel boot parameters. Source: https://www.thomas-krenn.com/de/wiki/PCIe_Bus_Error_Status_00001100_beheben 
 
Not sure if that is an issue with the NVMe I installed. I replaced the original Intel SATA M.2 with a NVMe ADATA XPG Gammix S11.

Touchpad scrolling does not always work

Haven't found a real solution for this yet. Sometimes scrolling with two fingers on the touchpad does not work. After a reboot it may (or may not) work again.  

Update 2018-12-06

The list grows longer and I renamed this article as booting is no problem, but there are still other issues. 

 

Okay, I tried to do a backup of my windows partition from my installed Ubuntu and a few seconds after pushing over 100MB/s through netcat, the transfer stalled. More precisely, the network connection was dead. Device was up, but nothing went through. In the kernel log I found the entries below. This was reproducible, it also happed in clonezilla, which I tried before and thought the failing connection was a clonezilla issue. Solution or workaround is iommu=soft which was also recommended as alternative workaround for the Lenovo E485 issue. Why can't things just work??? 

Dec  3 23:27:00 notebook kernel: [  162.778572] ------------[ cut here ]------------
Dec  3 23:27:00 notebook kernel: [  162.778604] NETDEV WATCHDOG: enp2s0 (tg3): transmit queue 0 timed out
Dec  3 23:27:00 notebook kernel: [  162.778631] WARNING: CPU: 5 PID: 0 at /build/linux-Y38gIP/linux-4.15.0/net/sched/sch_generic.c:323 dev_watchdog+0x221/0x230
Dec  3 23:27:00 notebook kernel: [  162.778632] Modules linked in: ccm rfcomm arc4 cmac bnep nls_iso8859_1 snd_hda_codec_realtek dell_laptop joydev snd_hda_codec_hdmi snd_hda_codec_generic snd_hda_intel snd_hda_codec snd_hda_core snd_hwdep snd_pcm ath10k_pci snd_seq_midi
 ath10k_core snd_seq_midi_event edac_mce_amd snd_rawmidi btusb ath dell_wmi kvm_amd mac80211 kvm dell_smbios snd_seq irqbypass input_leds hid_multitouch btrtl dcdbas btbcm wmi_bmof sparse_keymap serio_raw btintel dell_wmi_descriptor bluetooth snd_seq_device k10temp snd_t
imer ecdh_generic snd cfg80211 soundcore rtsx_pci_ms memstick shpchp ucsi_acpi typec_ucsi typec dell_rbtn dell_smo8800 mac_hid sch_fq_codel parport_pc ppdev lp parport ip_tables x_tables autofs4 xfs libcrc32c algif_skcipher af_alg dm_crypt amdkfd rtsx_pci_sdmmc amd_iommu
_v2 crct10dif_pclmul crc32_pclmul
Dec  3 23:27:00 notebook kernel: [  162.778705]  ghash_clmulni_intel pcbc amdgpu aesni_intel chash aes_x86_64 i2c_algo_bit crypto_simd ttm glue_helper cryptd drm_kms_helper ahci syscopyarea sysfillrect libahci psmouse sysimgblt fb_sys_fops tg3 drm nvme ptp i2c_piix4 nvme_core rtsx_pci pps_core wmi video i2c_hid hid
Dec  3 23:27:00 notebook kernel: [  162.778735] CPU: 5 PID: 0 Comm: swapper/5 Tainted: G        W        4.15.0-42-generic #45-Ubuntu
Dec  3 23:27:00 notebook kernel: [  162.778737] Hardware name: Dell Inc. Latitude 5495/09H2MJ, BIOS 1.2.3 06/20/2018
Dec  3 23:27:00 notebook kernel: [  162.778740] RIP: 0010:dev_watchdog+0x221/0x230
Dec  3 23:27:00 notebook kernel: [  162.778742] RSP: 0018:ffff88719f743e58 EFLAGS: 00010286
Dec  3 23:27:00 notebook kernel: [  162.778745] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
Dec  3 23:27:00 notebook kernel: [  162.778746] RDX: 0000000000040400 RSI: 00000000000000f6 RDI: 0000000000000300
Dec  3 23:27:00 notebook kernel: [  162.778748] RBP: ffff88719f743e88 R08: 0000000000000001 R09: 0000000000000458
Dec  3 23:27:00 notebook kernel: [  162.778749] R10: ffff88719f743ee0 R11: 0000000000000000 R12: 0000000000000005
Dec  3 23:27:00 notebook kernel: [  162.778751] R13: ffff88719d0cc000 R14: ffff88719d0cc478 R15: ffff88719d0c1580
Dec  3 23:27:00 notebook kernel: [  162.778753] FS:  0000000000000000(0000) GS:ffff88719f740000(0000) knlGS:0000000000000000
Dec  3 23:27:00 notebook kernel: [  162.778755] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Dec  3 23:27:00 notebook kernel: [  162.778756] CR2: 00005556bcadd018 CR3: 000000041952c000 CR4: 00000000003406e0
Dec  3 23:27:00 notebook kernel: [  162.778758] Call Trace:
Dec  3 23:27:00 notebook kernel: [  162.778761]  <IRQ>
Dec  3 23:27:00 notebook kernel: [  162.778767]  ? dev_deactivate_queue.constprop.33+0x60/0x60
Dec  3 23:27:00 notebook kernel: [  162.778773]  call_timer_fn+0x30/0x130
Dec  3 23:27:00 notebook kernel: [  162.778775]  run_timer_softirq+0x3fb/0x450
Dec  3 23:27:00 notebook kernel: [  162.778779]  ? ktime_get+0x43/0xa0
Dec  3 23:27:00 notebook kernel: [  162.778783]  ? lapic_next_event+0x20/0x30
Dec  3 23:27:00 notebook kernel: [  162.778787]  __do_softirq+0xe4/0x2bb
Dec  3 23:27:00 notebook kernel: [  162.778792]  irq_exit+0xb8/0xc0
Dec  3 23:27:00 notebook kernel: [  162.778794]  smp_apic_timer_interrupt+0x79/0x130
Dec  3 23:27:00 notebook kernel: [  162.778797]  apic_timer_interrupt+0x84/0x90
Dec  3 23:27:00 notebook kernel: [  162.778798]  </IRQ>
Dec  3 23:27:00 notebook kernel: [  162.778804] RIP: 0010:cpuidle_enter_state+0xa7/0x2f0
Dec  3 23:27:00 notebook kernel: [  162.778805] RSP: 0018:ffff95c50196be68 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff11
Dec  3 23:27:00 notebook kernel: [  162.778808] RAX: ffff88719f762880 RBX: 00000025e65b82c5 RCX: 000000000000001f
Dec  3 23:27:00 notebook kernel: [  162.778809] RDX: 00000025e65b82c5 RSI: fffffff86bc6ac80 RDI: 0000000000000000
Dec  3 23:27:00 notebook kernel: [  162.778810] RBP: ffff95c50196bea8 R08: 00000000000b5a00 R09: 00000000000f13ac
Dec  3 23:27:00 notebook kernel: [  162.778812] R10: ffff95c50196be38 R11: 00000000000b3abe R12: ffff88719cdf5800
Dec  3 23:27:00 notebook kernel: [  162.778813] R13: 0000000000000002 R14: ffffffffb17806f8 R15: 0000000000000000
Dec  3 23:27:00 notebook kernel: [  162.778817]  ? cpuidle_enter_state+0x97/0x2f0
Dec  3 23:27:00 notebook kernel: [  162.778820]  cpuidle_enter+0x17/0x20
Dec  3 23:27:00 notebook kernel: [  162.778824]  call_cpuidle+0x23/0x40
Dec  3 23:27:00 notebook kernel: [  162.778827]  do_idle+0x18c/0x1f0
Dec  3 23:27:00 notebook kernel: [  162.778829]  cpu_startup_entry+0x73/0x80
Dec  3 23:27:00 notebook kernel: [  162.778832]  start_secondary+0x1ab/0x200
Dec  3 23:27:00 notebook kernel: [  162.778836]  secondary_startup_64+0xa5/0xb0
Dec  3 23:27:00 notebook kernel: [  162.778838] Code: 38 00 49 63 4e e8 eb 92 4c 89 ef c6 05 b9 d7 d8 00 01 e8 83 35 fd ff 89 d9 48 89 c2 4c 89 ee 48 c7 c7 f8 98 39 b1 e8 df 95 80 ff <0f> 0b eb c0 90 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 55 
Dec  3 23:27:00 notebook kernel: [  162.778880] ---[ end trace 6b2996ceccee82db ]---
Dec  3 23:27:00 notebook kernel: [  162.778887] tg3 0000:02:00.0 enp2s0: transmit timed out, resetting
Dec  3 23:27:00 notebook kernel: [  165.372272] tg3 0000:02:00.0 enp2s0: 0x00000000: 0x168714e4, 0x20100406, 0x02000010, 0x00000000
Dec  3 23:27:00 notebook kernel: [  165.372285] tg3 0000:02:00.0 enp2s0: 0x00000010: 0xe022000c, 0x00000000, 0xe021000c, 0x00000000
Dec  3 23:27:00 notebook kernel: [  165.372291] tg3 0000:02:00.0 enp2s0: 0x00000020: 0xe020000c, 0x00000000, 0x00000000, 0x08141028
Dec  3 23:27:00 notebook kernel: [  165.372297] tg3 0000:02:00.0 enp2s0: 0x00000030: 0x00000000, 0x00000048, 0x00000000, 0x000001ff
Dec  3 23:27:00 notebook kernel: [  165.372302] tg3 0000:02:00.0 enp2s0: 0x00000040: 0x00000000, 0xea000000, 0xc8035001, 0x16002008
Dec  3 23:27:00 notebook kernel: [  165.372308] tg3 0000:02:00.0 enp2s0: 0x00000050: 0x00005803, 0x00000000, 0x0086a005, 0x00000000
Dec  3 23:27:00 notebook kernel: [  165.372313] tg3 0000:02:00.0 enp2s0: 0x00000060: 0x00000000, 0x00000000, 0xf1000298, 0x01f802d1
[... 1000s of lines...]

Also in the news: VIDEO_TDR_FAILURE BSODs in Windows while browsing the internet with a chromium based browser.. Given enough time all devices become terrible..