thesofproject / linux

Linux kernel source tree
Other
90 stars 129 forks source link

[BUG] HP Omen 15-ek0010ca Comet Lake - consitent gap in audio when sending audio to left channel, delayed audio starts #4710

Open RustyClanker opened 10 months ago

RustyClanker commented 10 months ago

This issue has been plaguing me for a long time, I have scoured the Internet and can not find anything related or a solution that works. I have stripped the sound system down to just ALSA with the raw driver outputs (no Pulse, no Pipewire, no JACK) and the issue is still present. I can plug headphones into the headphone jack and the issue is not present. I have been very hesitant to open an issue on this, but I have run out of stuff to dig into or try.

Retasking of the pins does nothing, shutting off power save does not correct the issue, using legacy drivers vs SOF does nothing, looping a silent sound in the background does not fix it.

There is a delayed start to audio if sending through both left and right channels, as long as the sound stays constant (through both channels) it will plays without issue. Once the sound stops, after a few seconds the delay will happen again. This is not related to powering save or idling, as disabling either does nothing to correct it.

If I start up speaker-test and send audio only though the left channel, there is a consistent 1 second gap in the sound output (plays for 1 second, silence for one second). If I do the same through the right channel, the output is constant with no issue. Using the GNOME control panel and doing a sound test, either Front or Left or Front or Right is cut off or there is a cut in audio in the middle of one of the words. I believe where it is cutting is related to the timing of pressing the test button in relation to when the test button was pressed in previous tests (pressing it right away after the audio stops or waiting a few seconds).

If a put a constant audio stream up (I was using random music from soundcloud), and move the balance toward the left channel, it starts the 1 second gap interval not quite all the way to left on the slider.

At this point, it is either the hardware or the driver. Audio in Windows works without issue (left and right channel play audio with no gap interval). Booting into Windows and then back into Linux does not fix the issue. It also happens regardless of the distro, Ubuntu, Pop_OS, Manjaro, Endeavour, Elementary, Debian, and ones I've forgotten. I think the only one I didn't try was Fedora.

Right now I am using a fresh install of Manjaro, all of the below is with Pipewire running using wireplumber as the media session manager. Again, it running has no bearing on the issue, I can turn it all off and the issue persists.

> dmesg | grep -E 'nvidia|skl|snd|sof'
[    2.617250] snd_hda_intel 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040100
[    2.617354] snd_hda_intel 0000:00:1f.3: Digital mics found on Skylake+ platform, using SOF driver
[    2.617427] snd_hda_intel 0000:01:00.1: enabling device (0000 -> 0002)
[    2.617532] snd_hda_intel 0000:01:00.1: Handle vga_switcheroo audio client
[    2.928771] nvidia: loading out-of-tree module taints kernel.
[    2.928779] nvidia: module license 'NVIDIA' taints kernel.
[    2.928783] nvidia: module verification failed: signature and/or required key missing - tainting kernel
[    2.928783] nvidia: module license taints kernel.
[    3.136677] nvidia-nvlink: Nvlink Core is being initialized, major device number 509
[    3.137416] nvidia 0000:01:00.0: enabling device (0000 -> 0003)
[    3.137509] nvidia 0000:01:00.0: vgaarb: changed VGA decodes: olddecodes=io+mem,decodes=none:owns=none
[    3.174746] snd_soc_skl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040100
[    3.174842] snd_soc_skl 0000:00:1f.3: Digital mics found on Skylake+ platform, using SOF driver
[    3.295998] sof-audio-pci-intel-cnl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040100
[    3.296111] sof-audio-pci-intel-cnl 0000:00:1f.3: Digital mics found on Skylake+ platform, using SOF driver
[    3.296124] sof-audio-pci-intel-cnl 0000:00:1f.3: enabling device (0000 -> 0002)
[    3.296292] sof-audio-pci-intel-cnl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if 0x040100
[    3.301109] nvidia-modeset: Loading NVIDIA Kernel Mode Setting Driver for UNIX platforms  535.129.03  Thu Oct 19 18:42:12 UTC 2023
[    3.336003] [drm] [nvidia-drm] [GPU ID 0x00000100] Loading driver
[    3.336005] [drm] Initialized nvidia-drm 0.0.0 20160202 for 0000:01:00.0 on minor 0
[    3.439461] sof-audio-pci-intel-cnl 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[    3.510191] sof-audio-pci-intel-cnl 0000:00:1f.3: use msi interrupt mode
[    3.540223] sof-audio-pci-intel-cnl 0000:00:1f.3: hda codecs found, mask 5
[    3.540228] sof-audio-pci-intel-cnl 0000:00:1f.3: using HDA machine driver skl_hda_dsp_generic now
[    3.540232] sof-audio-pci-intel-cnl 0000:00:1f.3: DMICs detected in NHLT tables: 2
[    3.545758] sof-audio-pci-intel-cnl 0000:00:1f.3: Firmware info: version 2:2:0-57864
[    3.545762] sof-audio-pci-intel-cnl 0000:00:1f.3: Firmware: ABI 3:22:1 Kernel ABI 3:23:0
[    3.545768] sof-audio-pci-intel-cnl 0000:00:1f.3: unknown sof_ext_man header type 3 size 0x30
[    3.676251] sof-audio-pci-intel-cnl 0000:00:1f.3: Firmware info: version 2:2:0-57864
[    3.676254] sof-audio-pci-intel-cnl 0000:00:1f.3: Firmware: ABI 3:22:1 Kernel ABI 3:23:0
[    3.689259] sof-audio-pci-intel-cnl 0000:00:1f.3: Topology: ABI 3:22:1 Kernel ABI 3:23:0
[    3.689457] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: Parent card not yet available, widget card binding deferred
[    3.707159] snd_hda_codec_realtek ehdaudio0D0: autoconfig for ALC245: line_outs=1 (0x17/0x0/0x0/0x0/0x0) type:speaker
[    3.707162] snd_hda_codec_realtek ehdaudio0D0:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
[    3.707163] snd_hda_codec_realtek ehdaudio0D0:    hp_outs=1 (0x21/0x0/0x0/0x0/0x0)
[    3.707164] snd_hda_codec_realtek ehdaudio0D0:    mono: mono_out=0x0
[    3.707165] snd_hda_codec_realtek ehdaudio0D0:    inputs:
[    3.707166] snd_hda_codec_realtek ehdaudio0D0:      Mic=0x19
[    3.750001] nvidia_uvm: module uses symbols nvUvmInterfaceDisableAccessCntr from proprietary module nvidia, inheriting taint.
[    3.751457] snd_hda_codec_realtek ehdaudio0D0: ASoC: sink widget AIF1TX overwritten
[    3.751463] snd_hda_codec_realtek ehdaudio0D0: ASoC: source widget AIF1RX overwritten
[    3.751570] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget hifi3 overwritten
[    3.751574] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget hifi2 overwritten
[    3.751577] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget hifi1 overwritten
[    3.751580] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: source widget Codec Output Pin1 overwritten
[    3.751583] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget Codec Input Pin1 overwritten
[    3.751587] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget Analog Codec Playback overwritten
[    3.751590] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget Digital Codec Playback overwritten
[    3.751594] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget Alt Analog Codec Playback overwritten
[    3.751599] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: source widget Analog Codec Capture overwritten
[    3.751603] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: source widget Digital Codec Capture overwritten
[    3.751606] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: source widget Alt Analog Codec Capture overwritten
[    3.762981] input: sof-hda-dsp Mic as /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card1/input28
[    3.763013] input: sof-hda-dsp Headphone as /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card1/input29
[    3.763038] input: sof-hda-dsp HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card1/input30
[    3.763063] input: sof-hda-dsp HDMI/DP,pcm=4 as /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card1/input31
[    3.763088] input: sof-hda-dsp HDMI/DP,pcm=5 as /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card1/input32
[    3.870253] nvidia-uvm: Loaded the UVM driver, major device number 507.

> Relevant bits from /proc/asound/card1/codec\#0, let me know if all of it is needed
Node 0x02 [Audio Output] wcaps 0x41d: Stereo Amp-Out
  Control: name="Headphone Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Amp-Out caps: ofs=0x57, nsteps=0x57, stepsize=0x02, mute=0
  Amp-Out vals:  [0x34 0x34]
  Converter: stream=0, channel=0
  PCM:
    rates [0x40]: 48000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0

Node 0x03 [Audio Output] wcaps 0x41d: Stereo Amp-Out
  Control: name="Speaker Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Amp-Out caps: ofs=0x57, nsteps=0x57, stepsize=0x02, mute=0
  Amp-Out vals:  [0x38 0x38]
  Converter: stream=0, channel=0
  PCM:
    rates [0x40]: 48000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0

Node 0x06 [Audio Output] wcaps 0x411: Stereo
  Converter: stream=0, channel=0
  PCM:
    rates [0x40]: 48000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0

Node 0x17 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out
  Control: name="Speaker 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:  [0x00 0x00]
  Pincap 0x0000001c: OUT HP Detect
  Pin Default 0x90170180: [Fixed] Speaker at Int N/A
    Conn = Analog, Color = Unknown
    DefAssociation = 0x8, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x40: OUT
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 4
     0x02 0x03* 0x06 0x08

Node 0x21 [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 0x03211020: [Jack] HP Out at Ext Left
    Conn = 1/8, Color = Black
    DefAssociation = 0x2, Sequence = 0x0
  Pin-ctls: 0xc0: OUT HP
  Unsolicited: tag=01, enabled=1
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 2
     0x02* 0x03

> lspci -vvv -nn -s 00:1f.3
00:1f.3 Multimedia audio controller [0401]: Intel Corporation Comet Lake PCH cAVS [8086:06c8]
    Subsystem: Hewlett-Packard Company Comet Lake PCH cAVS [103c:878a]
    Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
    Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
    Latency: 32, Cache Line Size: 64 bytes
    Interrupt: pin A routed to IRQ 191
    IOMMU group: 14
    Region 0: Memory at 6044110000 (64-bit, non-prefetchable) [size=16K]
    Region 4: Memory at 6044000000 (64-bit, non-prefetchable) [size=1M]
    Capabilities: [50] Power Management version 3
        Flags: PMEClk- DSI- D1- D2- AuxCurrent=55mA PME(D0-,D1-,D2-,D3hot+,D3cold+)
        Status: D3 NoSoftRst+ PME-Enable+ DSel=0 DScale=0 PME-
    Capabilities: [80] Vendor Specific Information: Len=14 <?>
    Capabilities: [60] MSI: Enable+ Count=1/1 Maskable- 64bit+
        Address: 00000000fee003d8  Data: 0000
    Kernel driver in use: sof-audio-pci-intel-cnl
    Kernel modules: snd_hda_intel, snd_soc_skl, snd_sof_pci_intel_cnl

> lspci -vvv -nn -s 01:00.1
01:00.1 Audio device [0403]: NVIDIA Corporation TU116 High Definition Audio Controller [10de:1aeb] (rev a1)
    Subsystem: Hewlett-Packard Company TU116 High Definition Audio Controller [103c:878a]
    Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
    Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
    Latency: 0, Cache Line Size: 64 bytes
    Interrupt: pin B routed to IRQ 190
    IOMMU group: 2
    Region 0: Memory at 78080000 (32-bit, non-prefetchable) [size=16K]
    Capabilities: [60] Power Management version 3
        Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
        Status: D3 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
    Capabilities: [68] MSI: Enable+ Count=1/1 Maskable- 64bit+
        Address: 00000000fee00b18  Data: 0000
    Capabilities: [78] Express (v2) Endpoint, MSI 00
        DevCap: MaxPayload 256 bytes, PhantFunc 0, Latency L0s unlimited, L1 <64us
            ExtTag+ AttnBtn- AttnInd- PwrInd- RBE+ FLReset- SlotPowerLimit 75W
        DevCtl: CorrErr- NonFatalErr- FatalErr- UnsupReq-
            RlxdOrd+ ExtTag+ PhantFunc- AuxPwr- NoSnoop+
            MaxPayload 128 bytes, MaxReadReq 512 bytes
        DevSta: CorrErr- NonFatalErr- FatalErr- UnsupReq- AuxPwr- TransPend-
        LnkCap: Port #0, Speed 8GT/s, Width x16, ASPM L0s L1, Exit Latency L0s <1us, L1 <4us
            ClockPM+ Surprise- LLActRep- BwNot- ASPMOptComp+
        LnkCtl: ASPM L0s L1 Enabled; RCB 64 bytes, Disabled- CommClk+
            ExtSynch- ClockPM+ AutWidDis- BWInt- AutBWInt-
        LnkSta: Speed 8GT/s, Width x16
            TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
        DevCap2: Completion Timeout: Range AB, TimeoutDis+ NROPrPrP- LTR+
             10BitTagComp- 10BitTagReq- OBFF Via message, ExtFmt- EETLPPrefix-
             EmergencyPowerReduction Not Supported, EmergencyPowerReductionInit-
             FRS- TPHComp- ExtTPHComp-
             AtomicOpsCap: 32bit- 64bit- 128bitCAS-
        DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis- LTR- 10BitTagReq- OBFF Disabled,
             AtomicOpsCtl: ReqEn-
        LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete- EqualizationPhase1-
             EqualizationPhase2- EqualizationPhase3- LinkEqualizationRequest-
             Retimer- 2Retimers- CrosslinkRes: unsupported
    Capabilities: [100 v2] Advanced Error Reporting
        UESta:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
        UEMsk:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
        UESvrt: DLP+ SDES+ TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
        CESta:  RxErr- BadTLP- BadDLLP- Rollover- Timeout- AdvNonFatalErr-
        CEMsk:  RxErr- BadTLP- BadDLLP- Rollover- Timeout- AdvNonFatalErr+
        AERCap: First Error Pointer: 00, ECRCGenCap- ECRCGenEn- ECRCChkCap- ECRCChkEn-
            MultHdrRecCap- MultHdrRecEn- TLPPfxPres- HdrLogCap-
        HeaderLog: 00000000 00000000 00000000 00000000
    Kernel driver in use: snd_hda_intel
    Kernel modules: snd_hda_intel

Let me know if anything else is required.

Thanks!

plbossart commented 10 months ago

@RustyClanker Can you clarify this

If I start up speaker-test and send audio only though the left channel, there is a consistent 1 second gap in the sound output (plays for 1 second, silence for one second). If I do the same through the right channel, the output is constant with no issue. 

if you use 'speaker-test -Dhw:0,0 -c2 -r48000 -FS16_LE -t sine' you'll get sine wave playing for one second on left and one second on right. That's the point of speaker-test, to make sure we hear what speaker is used.

From your description I wonder if it's actually the right speaker that's problematic and playing both L+R

RustyClanker commented 10 months ago

I was using, 'speaker-test -Dhw:1,0 -c2 -s1' to test out just the left speaker with just the default noise. The noise was consistent out the right (if I use -s2) and gaps in audio out the left.

I used what you provided above (just changing the card, 0 is nvidia HDMI, 1 is Intel), it just sounds like a busy tone on a phone. When I plug my headphones into the jack, it's a consistent tone on both channels using the same command.

> speaker-test -D hw:1,0 -c 2 -r48000 -FS16_LE -t sine

speaker-test 1.2.10

Playback device is hw:1,0
Stream parameters are 48000Hz, S16_LE, 2 channels
Sine wave rate is 440.0000Hz
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 96 to 16384
Period size range from 48 to 4096
Using max buffer size 16384
Periods = 4
was set period_size = 4096
was set buffer_size = 16384
 0 - Front Left
 1 - Front Right
Time per period = 5.632568
 0 - Front Left
 1 - Front Right
Time per period = 5.974272
 0 - Front Left
 1 - Front Right
Time per period = 5.972868
 0 - Front Left
 1 - Front Right
plbossart commented 10 months ago

Sorry, I am not following.

With the speaker-test -D hw:1,0 -c 2 -r48000 -FS16_LE -t sine command, you should hear a signal on only one of the two headphones at a time.

If yes, is the problem only with speakers?

if yes, can you please check with the legacy HDaudio driver, without SOF.

It's likely that you have a codec configuration issue and not an SOF driver issue. See https://thesofproject.github.io/latest/getting_started/intel_debug/suggestions.html#disable-sof-on-pci-hdaudio-devices-to-test-audio-playback

RustyClanker commented 10 months ago

Sorry, I am not following.

With the speaker-test -D hw:1,0 -c 2 -r48000 -FS16_LE -t sine command, you should hear a signal on only one of the two headphones at a time.

If yes, is the problem only with speakers?

The problem is with the internal speakers only, when running that command with the internal speakers I hear what sounds like a busy tone on a phone; this happens on both the left and right speaker. During the test, the audio starts out of the left speaker, 1 second on, 1 second off, 1 second on. It then switches to the right speaker and the same audio pattern, 1 second on, 1 second off, 1 second on.

My second test was to plug my headphones into the jack on the left side of my laptop and repeat the same command. During the test, the audio is a constant tone out of the left headphone earpiece. Then then switches to the right headphone earpiece and is a constant tone.

Hopefully this will be more clear:

Internal laptop speakers 0 - Front Left -> broken tone, 1 second on, 1 second off 1 - Front Right -> broken tone, 1 second on, 1 second off

Headphones plugged into physical jack 0 - Front Left -> constant tone 1 - Front Right -> constant tone

if yes, can you please check with the legacy HDaudio driver, without SOF.

It's likely that you have a codec configuration issue and not an SOF driver issue. See https://thesofproject.github.io/latest/getting_started/intel_debug/suggestions.html#disable-sof-on-pci-hdaudio-devices-to-test-audio-playback

I had tried the legacy drivers before using dsp_driver=1, but I will do it again in order to run the above speaker-test vs what I had been running before and let you know the results. But having just typed that, I have a feeling you are right, the issue persisted when I bypassed the SOF drivers before.

RustyClanker commented 10 months ago

So I rebooted with only the legacy drivers and while the right speaker now has a constant tone in the output, the left still has the broken tone. So you are correct, this is not a SOF issue.

Internal laptop speakers 0 - Front Left -> broken tone, 1 second on, 1 second off 1 - Front Right -> constant tone

> dmesg | grep -E 'nvidia|skl|snd|sof'

[    2.995154] snd_hda_intel 0000:00:1f.3: enabling device (0000 -> 0002)
[    2.996444] snd_hda_intel 0000:01:00.1: enabling device (0000 -> 0002)
[    2.996554] snd_hda_intel 0000:01:00.1: Disabling MSI
[    2.996564] snd_hda_intel 0000:01:00.1: Handle vga_switcheroo audio client
[    3.289070] nvidia: loading out-of-tree module taints kernel.
[    3.289080] nvidia: module license 'NVIDIA' taints kernel.
[    3.289084] nvidia: module verification failed: signature and/or required key missing - tainting kernel
[    3.289086] nvidia: module license taints kernel.
[    3.616869] nvidia-nvlink: Nvlink Core is being initialized, major device number 509
[    3.617879] nvidia 0000:01:00.0: enabling device (0000 -> 0003)
[    3.618030] nvidia 0000:01:00.0: vgaarb: changed VGA decodes: olddecodes=io+mem,decodes=none:owns=none
[    3.742303] nvidia-modeset: Loading NVIDIA Kernel Mode Setting Driver for UNIX platforms  535.129.03  Thu Oct 19 18:42:12 UTC 2023
[    3.782192] [drm] [nvidia-drm] [GPU ID 0x00000100] Loading driver
[    3.782195] [drm] Initialized nvidia-drm 0.0.0 20160202 for 0000:01:00.0 on minor 0
[    3.899404] snd_hda_intel 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[    4.007178] snd_hda_codec_realtek hdaudioC0D0: autoconfig for ALC245: line_outs=1 (0x17/0x0/0x0/0x0/0x0) type:speaker
[    4.007183] snd_hda_codec_realtek hdaudioC0D0:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
[    4.007185] snd_hda_codec_realtek hdaudioC0D0:    hp_outs=1 (0x21/0x0/0x0/0x0/0x0)
[    4.007187] snd_hda_codec_realtek hdaudioC0D0:    mono: mono_out=0x0
[    4.007188] snd_hda_codec_realtek hdaudioC0D0:    inputs:
[    4.007189] snd_hda_codec_realtek hdaudioC0D0:      Mic=0x19
[    4.237786] nvidia_uvm: module uses symbols nvUvmInterfaceDisableAccessCntr from proprietary module nvidia, inheriting taint.
[    4.362208] nvidia-uvm: Loaded the UVM driver, major device number 507.
plbossart commented 10 months ago

thanks for the clarifications @RustyClanker. The SOF driver provides a single output and there's nothing that changes the data pushed to the HDaudio codec. The speaker/headphone handling is entirely done in the codec.

If it's a periodic problem, then it's likely that there's some sort of timer that mucks with the output. Possibly a jack detection issue with a calibration gone bad.

Transferring this to Linux repo.

plbossart commented 10 months ago

@tiwai does this sort of periodic gap with internal speakers only ring a bell? Not sure if there's a quirk for this?

tiwai commented 10 months ago

It doesn't sound like a common problem, hence I don't know of a suitable existing quirk. It made me wonder, though, at which point this delay happens at all. Is the playback really "delayed", i.e. starting the first sample after a certain time? Or are the first samples dropped (silent) for that period? In the former case, it means that the transfer didn't happen, and it implies that either it's stopping at somewhere in the trigger callback (there is a loop for sync) or the hardware does something weird by itself. In the latter case, it might some hardware-controlled amp up/down sequence.

RustyClanker commented 10 months ago

It doesn't sound like a common problem, hence I don't know of a suitable existing quirk. It made me wonder, though, at which point this delay happens at all. Is the playback really "delayed", i.e. starting the first sample after a certain time? Or are the first samples dropped (silent) for that period? In the former case, it means that the transfer didn't happen, and it implies that either it's stopping at somewhere in the trigger callback (there is a loop for sync) or the hardware does something weird by itself. In the latter case, it might some hardware-controlled amp up/down sequence.

Is there any way I can turn debugging on for this to try and pinpoint where the issue might exist? I noticed quite a few entries for HP Omen 15 ekxxxx in the Linux hardware database (linux-hardware.org), but nothing more than 'detected' listed for the audio hardware.

Is there anything I can do in Windows to try and get some useful info? I saw references to using QEMU with a Windows image and drivers to grab a dump of information. But it looked more related to actually getting sound vs an odd ball handling of the audio.

Willing to dig into this as time permits, just need a general idea of what I should be looking for and possible ways to grab traces.

Thanks for the help so far, my flailing around seems to be slowly moving into a focused path. :D

RustyClanker commented 10 months ago

I booted into Windows and ran RtHDDump to get an idea what is different, attached is that dump plus the dump from Linux with dump_coeff set to true.

The coefficient differences for widget 0x20 are as follows:

Linux                 Windows
Coeff 0x08: 0x6a8c    Index 0x08  0x6A0C
Coeff 0x0d: 0xa030    Index 0x0D  0xA02F
Coeff 0x10: 0x0020    Index 0x10  0x0220
Coeff 0x1a: 0x8003    Index 0x1A  0x8C03
Coeff 0x2b: 0x0000    Index 0x2B  0xFFFF
Coeff 0x37: 0xfe05    Index 0x37  0xFE15
Coeff 0x38: 0xd909    Index 0x38  0x7909
Coeff 0x45: 0x5089    Index 0x45  0xD089
Coeff 0x46: 0x0004    Index 0x46  0x00F4
Coeff 0x4a: 0x2010    Index 0x4A  0x20E0
Coeff 0x66: 0x0000    Index 0x66  0x03F0
Coeff 0x67: 0xf000    Index 0x67  0x1000

I tried setting each, one by one using hda-verb, but they didn't seem to make a difference, and I found that 0x2b would not set in Linux.

The other differences I noticed were in regard to pin routing, in Linux pin 0x17 is routed to pin 0x03 and pin 0x21 is routed to 0x02. In Windows, 0x17 is routed to 0x02 with output MUX select to 0x02 and pin 0x21 is routed to 0x02 with the output mux select to 0x03.

I noticed some differences in VREF and EAPD (0 in Windows for any node that has it set to 1 in Linux). The codec listing for Linux also seems to be missing some widgets (0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59), all vendor widgets, but only 0x53, 0x54, 0x56, 0x57, and 0x58 having values set. I have not tried adding those vendor widgets using hda-verb (can I add non-listed widgets?).

RtHDDump_20231124_idle.txt

alc245_intelhda_linux_codec0.txt

plbossart commented 10 months ago

FWIW I'd try to set the same routing as Windows, who knows it might help with presence detection and other fun stuff.

RustyClanker commented 9 months ago

I made up a patch file to send to snd-hda-intel, but it doesn't seem to be affecting anything. All of the verbs are from when Windows is idle after login.

[ 2.792049] snd_hda_intel 0000:01:00.1: Applying patch firmware 'hp-omen-15-ek0010ca-audio.fw'

Checking the codec file in /proc, just shows the original values.

> /etc/modprobe.d/hp-omen-15-ek0010ca-audio.conf
options snd_hda_intel patch=hp-omen-15-ek0010ca-audio.fw

> /lib/firmware/hp-omen-15-ek0010ca-audio.fw
[codec]
0x10ec0245 0x103c878a 0

[model]
auto

[pincfg]
0x17 0x90170180
0x19 0x03a11040
0x21 0x03211020

[verb]
0x01 0x715 0x0004
0x01 0x716 0x0004
0x01 0x717 0x0004
0x02 0x706 0x0030
0x07 0x706 0x0020
0x17 0x701 0x0000
0x19 0x707 0x0021
0x21 0x701 0x0001
0x20 0x500 0x08
0x20 0x400 0x6A0C
0x20 0x500 0x0D
0x20 0x400 0xA02F
0x20 0x500 0x10
0x20 0x400 0x0220
0x20 0x500 0x1A
0x20 0x400 0x8C03
0x20 0x500 0x2B
0x20 0x400 0xFFFF
0x20 0x500 0x37
0x20 0x400 0xFE15
0x20 0x500 0x38
0x20 0x400 0x7909
0x20 0x500 0x45
0x20 0x400 0xD089
0x20 0x500 0x46
0x20 0x400 0x00F4
0x20 0x500 0x4A
0x20 0x400 0x20E0
0x20 0x500 0x66
0x20 0x400 0x03F0
0x20 0x500 0x67
0x20 0x400 0x1000
0x53 0x500 0x00
0x53 0x400 0x601A
0x53 0x500 0x01
0x53 0x400 0x0400
0x53 0x500 0x02
0x53 0x400 0x8000
0x53 0x500 0x03
0x53 0x400 0x1FDf
0x53 0x500 0x09
0x53 0x400 0x0200
0x54 0x500 0x00
0x54 0x400 0x2000
0x54 0x500 0x03
0x54 0x400 0x1FDF
0x54 0x500 0x09
0x54 0x400 0x0200
0x56 0x500 0x00
0x56 0x400 0x821C
0x56 0x500 0x02
0x56 0x400 0x74C4
0x56 0x500 0x03
0x56 0x400 0x482A
0x56 0x500 0x04
0x56 0x400 0x6400
0x56 0x500 0x05
0x56 0x400 0x77C6
0x56 0x500 0x06
0x56 0x400 0x1018
0x57 0x500 0x03
0x57 0x400 0x45A3
0x57 0x500 0x04
0x57 0x400 0x826C
0x57 0x500 0x05
0x57 0x400 0x3680
0x57 0x500 0x06
0x57 0x400 0x1AC2
0x57 0x500 0x08
0x57 0x400 0xAAAA
0x58 0x500 0x00
0x58 0x400 0x7888
0x58 0x500 0x03
0x58 0x400 0x31CC
0x58 0x500 0x09
0x58 0x400 0x1F00
0x58 0x500 0x0B
0x58 0x400 0xFF17
0x58 0x500 0x0C
0x58 0x400 0x00E0
0x58 0x500 0x0F
0x58 0x400 0xF0C9
0x58 0x500 0x11
0x58 0x400 0x0621
0x58 0x500 0x14
0x58 0x400 0xC000
0x58 0x500 0x15
0x58 0x400 0x4842
0x58 0x500 0x16
0x58 0x400 0x019C
0x58 0x500 0x17
0x58 0x400 0x0021
0x58 0x500 0x19
0x58 0x400 0xFFD2
0x58 0x500 0x1A
0x58 0x400 0xFFA4
0x58 0x500 0x1B
0x58 0x400 0xC000
plbossart commented 9 months ago

Just to double-check, the patch was used with "options snd-intel-dspcfg dsp_driver=1", yes?

RustyClanker commented 9 months ago

That is correct, I'm using the legacy driver. Doing some more checking it seems like it may have changed some stuff as right now I don't have audio out of my speakers. I'll have to play around some more. :)

[    2.438254] snd_hda_intel 0000:00:1f.3: enabling device (0000 -> 0002)
[    2.438391] snd_hda_intel 0000:00:1f.3: Applying patch firmware 'hp-omen-15-ek0010ca-audio.fw'
[    2.438477] snd_hda_intel 0000:01:00.1: enabling device (0000 -> 0002)
[    2.438528] snd_hda_intel 0000:01:00.1: Disabling MSI
[    2.438533] snd_hda_intel 0000:01:00.1: Handle vga_switcheroo audio client
[    3.119286] snd_hda_intel 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[    3.228555] snd_hda_codec_realtek hdaudioC0D0: autoconfig for ALC245: line_outs=1 (0x17/0x0/0x0/0x0/0x0) type:speaker
[    3.228559] snd_hda_codec_realtek hdaudioC0D0:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
[    3.228561] snd_hda_codec_realtek hdaudioC0D0:    hp_outs=1 (0x21/0x0/0x0/0x0/0x0)
[    3.228562] snd_hda_codec_realtek hdaudioC0D0:    mono: mono_out=0x0
[    3.228563] snd_hda_codec_realtek hdaudioC0D0:    inputs:
[    3.228564] snd_hda_codec_realtek hdaudioC0D0:      Mic=0x19