[Gigabyte Z87X-UD3H] PulseAudio switch rapidly port making the sound horrible

Bug #1248116 reported by Willy DAVID
24
This bug affects 4 people
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Fix Released
Undecided
David Henningsson

Bug Description

I have a Realtek sound system integrated to the motherboard Gygabyte Z87X-UD3H (http://www.gigabyte.fr/products/product-page.aspx?pid=4481#sp) having problems on Ubuntu 13.10.

The sound is jerky. When I open the "Volume control PulseAudio" I can see pulseaudio changing the audio output "Internal Audio Analogic Stereo". The port switch rapidly from "Analogic output" to "Analogic headphones" making a jerky sound. ta tA ta tA ta tA.

Do you have a solution to this problem ?

King regards

Will

Revision history for this message
Raymond (superquad-vortex2) wrote :

https://wiki.ubuntu.com/PulseAudio/Log

https://wiki.ubuntu.com/Audio/AlsaInfo

http://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/plain/Documentation/sound/alsa/HD-Audio.txt

Tracepoints
~~~~~~~~~~~
The hd-audio driver gives a few basic tracepoints.
`hda:hda_send_cmd` traces each CORB write while `hda:hda_get_response`
traces the response from RIRB (only when read from the codec driver).
`hda:hda_bus_reset` traces the bus-reset due to fatal error, etc,
`hda:hda_unsol_event` traces the unsolicited events, and
`hda:hda_power_down` and `hda:hda_power_up` trace the power down/up
via power-saving behavior.

Enabling all tracepoints can be done like
------------------------------------------------------------------------
  # echo 1 > /sys/kernel/debug/tracing/events/hda/enable
------------------------------------------------------------------------
t

hda:hda_unsol_event` traces the unsolicited events

try

disable automute by amixer

disable headphone Jack detection by hints or hda-jack-retask

Changed in pulseaudio (Ubuntu):
status: New → Incomplete
Revision history for this message
Willy DAVID (wdavid-euskadi) wrote :

Here is the log of pulseverbose.

I do not know how to enable the tracepoints of alsa doing "echo 1 > /sys/kernel/debug/tracing/events/hda/enable". Even using sudo the terminal replies that I have not the permissions.

I disabled the AutoMute function with amixer.

The problem is still present.

King regards

Revision history for this message
David Henningsson (diwic) wrote :

Hi,

A person having the same issue as you actually had a hardware error - the front HDA panel cable was not correctly connected to the motherboard. So please first check that.

Revision history for this message
Willy DAVID (wdavid-euskadi) wrote :

Hi David,

It's an integrated audio device. So I have not this kind of problems. Then, on the outside, I check with three different kind of devices (headphones, speakers (2)).

Revision history for this message
Raymond (superquad-vortex2) wrote :

seem jack detection problem of your headphone

http://mailman.alsa-project.org/pipermail/alsa-devel/2013-May/062362.html

follow Takashi Iwai procedure to trace the verbs while plugging the headphone

try hdajackretask to disable jack detection of headphone

and set Misc = NO_PRESENCE (bit 8 of pin default) of headphone node (change pin default to 0x02214520) to disable jack detection

ode 0x1b [Pin Complex] wcaps 0x40058f: Stereo Amp-In Amp-Out
  Control: name="Headphone Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Control: name="Front Headphone Jack", index=0, device=0
  Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0
  Amp-In vals: [0x00 0x00]
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals: [0x00 0x00]
  Pincap 0x0001373c: IN OUT HP EAPD Detect
    Vref caps: HIZ 50 GRD 80 100
  EAPD 0x2: EAPD
  Pin Default 0x02214420: [Jack] HP Out at Ext Front
    Conn = 1/8, Color = Green
    DefAssociation = 0x2, Sequence = 0x0
  Pin-ctls: 0xc0: OUT HP VREF_HIZ
  Unsolicited: tag=01, enabled=1
  Power states: D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 5
     0x0c 0x0d 0x0e 0x0f 0x26*

( 0.671| 0.000) D: [pulseaudio] module-alsa-card.c: Jack 'Front Headphone Jack' is now plugged in
( 0.671| 0.000) D: [pulseaudio] device-port.c: Setting port analog-output-headphones to status yes
( 0.671| 0.000) D: [pulseaudio] module-switch-on-port-available.c: finding port analog-output-headphones
( 0.671| 0.000) D: [alsa-sink-ALC898 Analog] alsa-sink.c: Cutting sleep time for the initial iterations by half.
( 0.671| 0.000) D: [alsa-sink-ALC898 Analog] alsa-mixer.c: Activating path analog-output-headphones

  0.680| 0.005) D: [pulseaudio] module-alsa-card.c: Jack 'Front Headphone Jack' is now unplugged
( 0.680| 0.000) D: [pulseaudio] device-port.c: Setting port analog-output-headphones to status no
( 0.680| 0.000) D: [pulseaudio] module-switch-on-port-available.c: finding port analog-output-headphones
( 0.680| 0.000) D: [alsa-sink-ALC898 Analog] alsa-mixer.c: Activating path analog-output
( 0.680| 0.000) D: [alsa-sink-ALC898 Analog] alsa-mixer.c: Path analog-output (Analog Out

( 0.776| 0.092) D: [pulseaudio] module-alsa-card.c: Jack 'Front Headphone Jack' is now plugged in
( 0.776| 0.000) D: [pulseaudio] device-port.c: Setting port analog-output-headphones to status yes
( 0.776| 0.000) D: [pulseaudio] module-switch-on-port-available.c: finding port analog-output-headphones
( 0.776| 0.000) D: [alsa-sink-ALC898 Analog] alsa-mixer.c: Activating path analog-output-headphones

( 0.797| 0.017) D: [pulseaudio] module-alsa-card.c: Jack 'Front Headphone Jack' is now unplugged
( 0.797| 0.000) D: [pulseaudio] device-port.c: Setting port analog-output-headphones to status no
( 0.797| 0.000) D: [pulseaudio] module-switch-on-port-available.c: finding port analog-output-headphones
( 0.797| 0.000) D: [alsa-sink-ALC898 Analog] alsa-mixer.c: Activating path analog-output

Revision history for this message
David Henningsson (diwic) wrote :

> It's an integrated audio device.

This motherboard has a "front panel HDA" connector, which is what I'm talking about here.

If you left this connector unconnected, try disabling it in BIOS. If you connected it to the chassis, check the connection.

Revision history for this message
Kai Michael Hamich (kmh) wrote :

Same issue here....

I reported my problem here: https://bugs.freedesktop.org/show_bug.cgi?id=71766

Revision history for this message
Guillaume (guillaume-desclaux) wrote :

I confirm : same issue on my brand new PC with Gigabyte Z87X-UD3H motherboard...

Solved using hda-jack-retask to disable frontside input/output... not a big deal but definitely not a "solution" !

Raymond :

1/ you should increase the status to "confirmed" ;-)
2/ How can I help you ? More information are required ?

Revision history for this message
Raymond (superquad-vortex2) wrote :

you can use hdajackretask to set Misc bit (MISC=NO_PRESENCE)

bit 8 of pin default of your headphone and mic at ext front

so that driver don't use jack detection on these two pin complex

or

change pulseaudio conf

http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/mixer/paths

to ignore the state of these two jacks

Revision history for this message
Raymond (superquad-vortex2) wrote :

I expect the module-switch-on-port-available can stop switching when it found that the states of jack are unstable (e.g. on and off more than 5 ~ 10 times within a second)

Revision history for this message
Raymond (superquad-vortex2) wrote :

https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/plain/Documentation/sound/alsa/HD-Audio.txt

- jack_detect (bool): specify whether the jack detection is available
  at all on this machine; default true

the alternate way is to specify hint by early patching for your analog codec only

jack_detect=0

Revision history for this message
Guillaume (guillaume-desclaux) wrote :

Thanks ! It works like a charm. No more automatic jack detection but all the jacks are working properly and active simultaneously and the sound is crystal clear. Much better than setting "no presence" with hdajackrestask.

in /etc/modprobe.d just add a file hda-jack-detect.conf with the following lines :

# This file was added as a workaround to the jack detection issue with a Gigabyte GA-Z87X-UD3H motherboard
# If you want to revert the changes, you can simply erase this file and reboot your computer.
options snd-hda-intel patch=hda-jack-detect.fw

And in /lib/firmware add a file hda-jack-detect.fw with the following lines :

          [codec]
          0x10ec0899 0x1458a002 2

          [hint]
          jack_detect = no

Then reboot !

For information : you can check the file /proc/asound/card0/codec* to verify that the [codec] line matches your hardware (vendor-id subsystem-id address)

head -n 10 /proc/asound/card0/codec*

     Codec: Realtek ALC898
     Address: 2
     AFG Function Id: 0x1 (unsol 1)
     Vendor Id: 0x10ec0899
     Subsystem Id: 0x1458a002

Revision history for this message
Guillaume (guillaume-desclaux) wrote :

By the way, you will find in attachment the hd-audio driver tracepoints (I've enabled the trace.log while the bug occurs (randomly switch between front output jack and rear output jack), then I've plugged an headphone on the front jack a few seconds later : the erratic switch disappears)

Revision history for this message
Raymond (superquad-vortex2) wrote :

it is strange that there are numerous hda_power_count in your trace log

https://bugzilla.kernel.org/enter_bug.cgi?product=Drivers

Revision history for this message
Guillaume (guillaume-desclaux) wrote :

If there is anything else I can do to help solving this issue... don't hesitate to ask !

Revision history for this message
Raymond (superquad-vortex2) wrote :

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

you better ask the author whether it is normal to have so many power events in your trace log

Revision history for this message
Raymond (superquad-vortex2) wrote :
Download full text (17.0 KiB)

          <idle>-0 [000] d.h. 334.304791: hda_unsol_event: [0] res=4000081, res_ex=12
   kworker/u16:0-6 [000] .... 334.304829: hda_power_count: [0:2] power_count=1, power_on=1, power_transition=0
   kworker/u16:0-6 [000] .... 334.304831: hda_send_cmd: [0:2] val=21bf0900
   kworker/u16:0-6 [000] .... 334.304873: hda_get_response: [0:2] val=80000000

the driver receive unsolicited event, issue get pin sense and Jack is plugged

   kworker/u16:0-6 [000] .... 334.304874: hda_power_count: [0:2] power_count=0, power_on=1, power_transition=0
   kworker/u16:0-6 [000] .... 334.304878: hda_power_count: [0:2] power_count=1, power_on=1, power_transition=0

driver auto mute the line out by set amp mute

kworker/u16:0-6 [000] .... 334.304878: hda_send_cmd: [0:2] val=21470700
   kworker/u16:0-6 [000] .... 334.304880: hda_power_count: [0:2] power_count=0, power_on=1, power_transition=0
   kworker/u16:0-6 [000] .... 334.304881: hda_power_count: [0:2] power_count=1, power_on=1, power_transition=0
   kworker/u16:0-6 [000] .... 334.304881: hda_send_cmd: [0:2] val=21570700
   kworker/u16:0-6 [000] .... 334.304884: hda_power_count: [0:2] power_count=0, power_on=1, power_transition=0
   kworker/u16:0-6 [000] .... 334.304884: hda_power_count: [0:2] power_count=1, power_on=1, power_transition=0
   kworker/u16:0-6 [000] .... 334.304884: hda_send_cmd: [0:2] val=21670700
   kworker/u16:0-6 [000] .... 334.304887: hda_power_count: [0:2] power_count=0, power_on=1, power_transition=0
   kworker/u16:0-6 [000] .... 334.304887: hda_power_count: [0:2] power_count=1, power_on=1, power_transition=0
   kworker/u16:0-6 [000] .... 334.304888: hda_send_cmd: [0:2] val=21770700
   kworker/u16:0-6 [000] .... 334.304889: hda_power_count: [0:2] power_count=0, power_on=1, power_transition=0

pulseaudio also try to mute line out

alsa-sink-ALC89-2776 [005] .... 334.305163: hda_power_count: [0:2] power_count=1, power_on=1, power_transition=0
 alsa-sink-ALC89-2776 [005] .... 334.305166: hda_power_count: [0:2] power_count=2, power_on=1, power_transition=0
 alsa-sink-ALC89-2776 [005] .... 334.305167: hda_send_cmd: [0:2] val=2153a080
 alsa-sink-ALC89-2776 [005] .... 334.305170: hda_power_count: [0:2] power_count=1, power_on=1, power_transition=0
 alsa-sink-ALC89-2776 [005] .... 334.305171: hda_power_count: [0:2] power_count=0, power_on=1, power_transition=0
 alsa-sink-ALC89-2776 [005] .... 334.305185: hda_power_count: [0:2] power_count=1, power_on=1, power_transition=0
 alsa-sink-ALC89-2776 [005] .... 334.305186: hda_power_count: [0:2] power_count=2, power_on=1, power_transition=0
 alsa-sink-ALC89-2776 [005] .... 334.305186: hda_send_cmd: [0:2] val=21539080
 alsa-sink-ALC89-2776 [005] .... 334.305188: hda_power_count: [0:2] power_count=1, power_on=1, power_transition=0
 alsa-sink-ALC89-2776 [005] .... 334.305189: hda_power_count: [0:2] power_count=0, power_on=1, power_transition=0
 alsa-sink-ALC89-2776 [005] .... 334.305195: hda_power_count: [0:2] power_count=1, power_on=1, power_transition=0
 alsa-sink-ALC89-2776 [005] .... 334.305197: hda_power_count:...

Revision history for this message
Raymond (superquad-vortex2) wrote :

are there any suspend and resume events of snd-hda-Intel occur in system log ?

Revision history for this message
Guillaume (guillaume-desclaux) wrote :

You will find below the hda info in my syslog :

grep hda syslog

Dec 28 12:53:37 ubuntu kernel: [ 2.247883] snd_hda_intel 0000:00:1b.0: irq 47 for MSI/MSI-X
Dec 28 12:53:37 ubuntu kernel: [ 2.664258] hda_intel: Disabling MSI
Dec 28 12:53:37 ubuntu kernel: [ 2.664264] hda-intel 0000:01:00.1: Handle VGA-switcheroo audio client
Dec 28 12:53:37 ubuntu kernel: [ 2.664289] hda-intel 0000:01:00.1: Disabling 64bit DMA
Dec 28 12:53:37 ubuntu kernel: [ 2.667560] hda-intel 0000:01:00.1: Enable delay in RIRB handling
Dec 28 14:15:01 ubuntu kernel: [ 2.734667] hda-intel 0000:00:1b.0: Applying patch firmware 'hda-jack-detect.fw'
Dec 28 14:15:01 ubuntu kernel: [ 2.734777] hda_intel: Disabling MSI
Dec 28 14:15:01 ubuntu kernel: [ 2.734780] hda-intel 0000:01:00.1: Handle VGA-switcheroo audio client
Dec 28 14:15:01 ubuntu kernel: [ 2.734805] hda-intel 0000:01:00.1: Disabling 64bit DMA
Dec 28 14:15:01 ubuntu kernel: [ 2.735424] snd_hda_intel 0000:00:1b.0: irq 47 for MSI/MSI-X
Dec 28 14:15:01 ubuntu kernel: [ 2.738020] hda-intel 0000:01:00.1: Enable delay in RIRB handling

summary: - PulseAudio switch rapidly port making the sound horrible
+ [Gigabyte Z87X-UD3H] PulseAudio switch rapidly port making the sound
+ horrible
Revision history for this message
David Henningsson (diwic) wrote : [PATCH] ALSA: hda - Disable Front HP jack detection on Gigabyte Z87X-UD3H

This motherboard seems to have a flaky jack detection - when the
front HP is not present, the jack state quickly switches on and off.

This has been reported by three people in the bug, so I doubt it's
a user error this time.

BugLink: https://bugs.launchpad.net/bugs/1248116
Signed-off-by: David Henningsson <email address hidden>
---
 sound/pci/hda/patch_realtek.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 16c0caa..6a705a8 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1810,6 +1810,7 @@ enum {
  ALC882_FIXUP_ACER_ASPIRE_7736,
  ALC882_FIXUP_ASUS_W90V,
  ALC889_FIXUP_CD,
+ ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
  ALC889_FIXUP_VAIO_TT,
  ALC888_FIXUP_EEE1601,
  ALC882_FIXUP_EAPD,
@@ -2027,6 +2028,15 @@ static const struct hda_fixup alc882_fixups[] = {
    { }
   }
  },
+ [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
+ .type = HDA_FIXUP_PINS,
+ .v.pins = (const struct hda_pintbl[]) {
+ { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
+ { }
+ },
+ .chained = true,
+ .chain_id = ALC889_FIXUP_CD,
+ },
  [ALC889_FIXUP_VAIO_TT] = {
   .type = HDA_FIXUP_PINS,
   .v.pins = (const struct hda_pintbl[]) {
@@ -2258,7 +2268,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
  SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
  SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
  SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
- SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3", ALC889_FIXUP_CD),
+ SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
  SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
  SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
  SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
--
1.7.9.5

affects: pulseaudio (Ubuntu) → linux (Ubuntu)
Changed in linux (Ubuntu):
status: Incomplete → In Progress
assignee: nobody → David Henningsson (diwic)
Revision history for this message
Takashi Iwai (tiwai) wrote :

At Wed, 1 Jan 2014 14:01:34 +0100,
David Henningsson wrote:
>
> This motherboard seems to have a flaky jack detection - when the
> front HP is not present, the jack state quickly switches on and off.
>
> This has been reported by three people in the bug, so I doubt it's
> a user error this time.
>
> BugLink: https://bugs.launchpad.net/bugs/1248116
> Signed-off-by: David Henningsson <email address hidden>

Applied, thanks.

Takashi

> ---
> sound/pci/hda/patch_realtek.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
> index 16c0caa..6a705a8 100644
> --- a/sound/pci/hda/patch_realtek.c
> +++ b/sound/pci/hda/patch_realtek.c
> @@ -1810,6 +1810,7 @@ enum {
> ALC882_FIXUP_ACER_ASPIRE_7736,
> ALC882_FIXUP_ASUS_W90V,
> ALC889_FIXUP_CD,
> + ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
> ALC889_FIXUP_VAIO_TT,
> ALC888_FIXUP_EEE1601,
> ALC882_FIXUP_EAPD,
> @@ -2027,6 +2028,15 @@ static const struct hda_fixup alc882_fixups[] = {
> { }
> }
> },
> + [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
> + .type = HDA_FIXUP_PINS,
> + .v.pins = (const struct hda_pintbl[]) {
> + { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
> + { }
> + },
> + .chained = true,
> + .chain_id = ALC889_FIXUP_CD,
> + },
> [ALC889_FIXUP_VAIO_TT] = {
> .type = HDA_FIXUP_PINS,
> .v.pins = (const struct hda_pintbl[]) {
> @@ -2258,7 +2268,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
> SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
> SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
> SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
> - SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3", ALC889_FIXUP_CD),
> + SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
> SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
> SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
> SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
> --
> 1.7.9.5
>

Changed in linux (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package linux - 3.15.0-1.5

---------------
linux (3.15.0-1.5) utopic; urgency=low

  [ Tim Gardner ]

  * [Config] Add apm-mustang.dtb to kernel-image udeb
 -- Tim Gardner <email address hidden> Mon, 19 May 2014 14:47:42 -0700

Changed in linux (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Paul Alexander (trap-c) wrote :

Is this fix just for the specific motherboard or all alc882 chips. I have 2 Asus motherboards with alc882 chips that suffer this exact issue. The firmware patch instructions in post by Guillaume (guillaume-desclaux) works on both motherboards.

Revision history for this message
David Henningsson (diwic) wrote :

 > Is this fix just for the specific motherboard or all alc882 chips.

The fix released into Utopic was only for that specific motherboard. If you have the same problem with other motherboards, please file a new bug using the "ubuntu-bug audio" command. But first double-check that everything is right in hardware: that you have put the front panel header correctly on the MB, selected HD-audio vs AC'97 front panel header correctly in BIOS as well. Given that this could be user error I'd like to have at least two-three reports from the same motherboard before upstreaming a disable of jack detect. Thanks.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.