Bug 189411

Summary: [Motherboard: ASUS ROG Ranger VIII, Codec: Realtek ALC1150] No front panel audio output
Product: Drivers Reporter: Zack (enekk)
Component: Sound(ALSA)Assignee: Jaroslav Kysela (perex)
Status: RESOLVED CODE_FIX    
Severity: normal CC: enekk, harry.gindi, tiwai
Priority: P1    
Hardware: Intel   
OS: Linux   
Kernel Version: 4.8.0-1-amd64 Subsystem:
Regression: No Bisected commit-id:
Attachments: Alsa-info.sh output before headphones with dump_coefs on
Alsa-info.sh output after headphones with dump_coefs on
Fix patch

Description Zack 2016-11-30 16:52:55 UTC
My machine is using an ASUS ROG Ranger VIII and the ALC1150 driver does not seem to support the front panel audio output jack.  See here: http://www.alsa-project.org/db/?f=beda691469c55a9e65e5d39fbcc02a434de3fb1c for alsa-info of the situation.  Rear sound works, front mic works, everything works in windows.

Swapping mic and hp ports with hda-jack-retask makes headphones work but breaks mic.  See here: http://www.alsa-project.org/db/?f=62a7b0b1ba9d0311d3984ef0c49a0aa2f64b494d for alsa-info after the retask.
Comment 1 Zack 2016-11-30 16:56:28 UTC
My apologies, one more detail.  Jack detection works, I can see headphones detected as plugged in in Gnome, alsamixer, and pavucontrol, but when I plug them in, no sound will come out of the headphones.

I am more than happy to help with debugging this.  Just let me know what I can do to help.
Comment 2 Takashi Iwai 2016-12-02 13:08:45 UTC
Take alsa-info.sh outputs before and after plugging the headphone, and attach (don't paste) to Bugzilla.  Please run the script with --no-upload option.
Comment 3 Zack 2016-12-02 20:15:43 UTC
Created attachment 246661 [details]
Alsa-info.sh output before headphones with dump_coefs on
Comment 4 Zack 2016-12-02 20:16:02 UTC
Created attachment 246671 [details]
Alsa-info.sh output after headphones with dump_coefs on
Comment 5 Zack 2016-12-02 20:16:58 UTC
I have added the attachments that you requested.
Comment 6 Zack 2016-12-02 20:35:51 UTC
Thanks to "debianuser" on the ALSA users IRC channel for finding three different gpio combinations on Github: https://github.com/torvalds/linux/blob/master/sound/pci/hda/patch_realtek.c:

hda-verb /dev/snd/hwC0D0 1 SET_GPIO_MASK 3
hda-verb /dev/snd/hwC0D0 1 SET_GPIO_DIRECTION 3
hda-verb /dev/snd/hwC0D0 1 SET_GPIO_DATA 3

Running these commands make sound work, but, oddly, it doesn't matter what value they are set to.  I've set them to zero through three and it always works.  In addition, the second command seems to be the one that makes sound actually play, not 100% sure what the other two do.
Comment 7 Takashi Iwai 2016-12-06 15:20:21 UTC
Thanks for the information.  Could you try the patch below?  If it works as is, I'll queue it for merging.
Comment 8 Takashi Iwai 2016-12-06 15:23:09 UTC
Created attachment 247021 [details]
Fix patch
Comment 9 Zack 2016-12-07 01:04:02 UTC
I'm sorry to say that patching the kernel is a bit beyond my experience level.  Could you point me to a good tutorial on it?  The Debian Wiki one seems to not build.  Again, sorry, this is my first go-round with a kernel patch.
Comment 10 Zack 2016-12-13 13:36:17 UTC
Sorry to ask again, but is there any way I can assist you with this one?  I've researched a bit on how to patch the kernel, but what I've tried fails.
Comment 11 fpqc 2016-12-16 04:46:14 UTC
Hiya, Takashi, this patch also applies to the Asus ROG Maximus Hero VIII, probably to all Asus ROG series VIII Intel boards.

Also, I rebuilt my kernel with this patch, and my headphones work.  No problems at all.  You should integrate into mainline asap.
Comment 12 fpqc 2016-12-16 05:00:59 UTC
Also, Takashi, on Windows, this activates an internal amplifier (you can hear it turn on with a 'click') on a headphone plug event.  Right now, with your current patch, the amplifier gets turned on as soon as the computer boots.  I guess a request for enhancement would be to create an additional quirk that makes these hda-verbs get set on a plug event rather than on boot.
Comment 13 Takashi Iwai 2017-01-04 10:28:37 UTC
OK I applied the patch now in git tree.  It'll be merged to 4.10-rc3 or later, at least.

You don't have to worry too much about the amp stuff.  The power consumption can be at most reduced by the runtime PM more radically in anyway.