Bug 65091

Summary: External subwoofer does't work on ASUS N550JV
Product: Drivers Reporter: Fabio Pellegrin (pellegrin.fabio)
Component: Sound(ALSA)Assignee: Jaroslav Kysela (perex)
Status: RESOLVED CODE_FIX    
Severity: normal CC: advait.g.soni, jfesparterov, superquad.vortex2, tiwai
Priority: P1    
Hardware: x86-64   
OS: Linux   
Kernel Version: 3.12 Subsystem:
Regression: No Bisected commit-id:
Attachments: alasa-info.sh output
alsa-info with mode4 sub unplugged
alsa-info with mode4 sub plugged
alsa-info output
alsa-info output when Bass work on the right channel
alsa-info output when Bass works
Patch to add pin 0x1a for bass speaker
preliminary patch

Description Fabio Pellegrin 2013-11-16 15:19:45 UTC
Created attachment 114901 [details]
alasa-info.sh output

I've tried with and without model=asus-mode4 param but subwoofer volume doesn't appear in alsamixer.
Comment 1 Takashi Iwai 2013-11-17 08:59:47 UTC
If you pass model=asus-mode4, the bass speaker mixer element must appear.  If not, it means that you didn't it correctly.  Give alsa-info.sh output with the model option for checking the problem.
Comment 2 Fabio Pellegrin 2013-11-17 17:11:25 UTC
Created attachment 114961 [details]
alsa-info with mode4 sub unplugged

Here it is without sub plugged
Comment 3 Fabio Pellegrin 2013-11-17 17:11:59 UTC
Created attachment 114971 [details]
alsa-info with mode4 sub plugged

and with sub plugged in
Comment 4 Takashi Iwai 2013-11-17 17:54:12 UTC
The model option is an array of strings, and the first instance is passed to HDMI controller and the onboard analog is the second card in your case. 
Pass model=,asus-mode4 instead (see a comma before asus-mode4).
Comment 5 Fabio Pellegrin 2013-11-20 10:03:34 UTC
Created attachment 115231 [details]
alsa-info output

Ok, now Bass Speaker appears in alsamixer.. but no sound from the external sub..
I've tried speaker-test with different params.

Another question: my laptop have a quad speaker array system plus external subwoofer, what is the correct surround profile?
Comment 6 Takashi Iwai 2013-11-20 10:20:22 UTC
If the quad speakers have individual outputs, there should be two stereo pins, plus likely a bass speaker pin.

You just need to play with pins by yourself.  Fortunately, this codec is easy to reroute the outputs.  For the unused pins like 0x16, 0x17, whatever, set the pin control as the output.  This can be done by hda-verb like

    hda-verb /dev/snd/hwC1D0 0x16 SET_PIN_WID 0x40

Or you can use GUI like hda_analyzer or hda-jack-retask.  See Documentation/sound/alsa/HD-Audio.txt.

Another thing to test is to toggle GPIOs.  There are 4 GPIO pins, and they might play some role.  For example, to set GPIO pin 3 (start from 0), run the three commands below:

    hda-verb /dev/snd/hwC1D0 0x01 SET_GPIO_MASK 0x08
    hda-verb /dev/snd/hwC1D0 0x01 SET_GPIO_DIR 0x08
    hda-verb /dev/snd/hwC1D0 0x01 SET_GPIO_DATA 0x08

where 0x08 is the bit 3.  For GPIO0, use 0x01, GPIO1 0x02, and GPIO2 0x04.
Comment 7 Fabio Pellegrin 2013-11-20 15:20:58 UTC
Ok.. i've done a lot of tests and finaly something works!

The pin 0x1a is the pin to work.
I used hdajackretask the override the pin using the settings in pin 0x16:
Connectivity: internal
Location: internal ATAPI
Device: Speaker
Jack: ATAPI
Jack detection: Not Present
Ch group: 1
Ch: Central/LFE

With this setting i can ear sounds from the external subwoofer when front right is playing but not when LFE play.

Reopened hdajackretask and uncheck the override checkbox and everything goes ok.. I don't know why..

Other issues :)
1) Bass Speaker volume work but not the mute toggle
2) I don't understand if speaker test is correct
speaker-test -c6
 0 - Front Left ; ok
 4 - Center ; ok, it seems realy in the front center
 1 - Front Right ; ok
 3 - Rear Right ; very low audio from the right
 2 - Rear Left ; very low audio from the left
 5 - LFE ; Bass Speaker

speaker-test -Dplug:surround51:PCH  -c 6
 0 - Front Left ;ok
 4 - Center ;no sound
 1 - Front Right ;ok
 3 - Rear Right ; Sub woofer!!!! 
 2 - Rear Left ; no sound
 2 - Rear Left ; no sound
Comment 8 Fabio Pellegrin 2013-11-20 15:21:44 UTC
Created attachment 115281 [details]
alsa-info output when Bass work on the right channel
Comment 9 Fabio Pellegrin 2013-11-20 15:22:19 UTC
Created attachment 115291 [details]
alsa-info output when Bass works
Comment 10 Takashi Iwai 2013-11-20 15:59:03 UTC
So, the pin 0x16 is the wrong but 0x1a is the bass speaker?
If so, you should remove model asus-mode4 option in your module config.  This sets NID 0x16 for nothing.

Do you get other two speakers working by some pins?

In anyway, try the patch below, and remove all model and patch option lines.  This enables the pin 0x1a for the bass speaker and sets the channel mapping.
Comment 11 Takashi Iwai 2013-11-20 15:59:42 UTC
Created attachment 115301 [details]
Patch to add pin 0x1a for bass speaker
Comment 12 Fabio Pellegrin 2013-11-20 17:37:04 UTC
Patch doesn't patch: 2 out of 3 hunks FAILED.
I think the problem is the missing ALC662_FIXUP_BASS_CHMAP, i don't have this in my patch_realtek.c
Comment 13 Takashi Iwai 2013-11-20 17:43:08 UTC
Ah OK, then use sound.git tree.

   git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git

Use for-linus branch for now.

If git tree isn't your option, try the patch below before the pin 0x1a patch.
Comment 14 Takashi Iwai 2013-11-20 17:43:30 UTC
Created attachment 115311 [details]
preliminary patch
Comment 15 Fabio Pellegrin 2013-11-20 21:58:34 UTC
preliminary patch doesn't work, some hunks fail.

I've tried the sound.git tree, patched the file and it works! Bass Speaker is recognized and sounds come out with the speaker-test when play LFE. Volume and mute are ok.

I've added a 2.1 surround profile in Pulseaudio and every things seems to works fine in my gnome 3 desktop.

Some issues remain like the wrong channel when i use surround51 profile (comment 7).

For the other 2 speaker:
how can i do the test? I think that the 4 speaker are disposed one near the other, very closed. Naming the speaker Left,CenterLeft,CenterRight and Right respectively, how can i test if the sound the comes from my left is played from the Left or CenterLeft or maybe both without open the laptop?
Comment 16 Takashi Iwai 2013-11-21 06:57:34 UTC
Well, just continue playing with other pins.  Some of them might hit.  Also, try GPIOs, too.  If none of them hits, there is little hope to control anything in a standard way, so we'd need some help from the vendor in anyway.
Comment 17 Takashi Iwai 2013-11-21 07:04:36 UTC
BTW, I'll merge the bass speaker fix patch at first to the upstream, since the rest possible fixes wouldn't conflict, if any in future.  That is, the bass speaker will be supported in 3.13-rc1 kernel.
Comment 18 Takashi Iwai 2013-11-29 07:29:44 UTC
The patches have been merged to the upstream.
Comment 19 Takashi Iwai 2013-12-02 13:03:20 UTC
*** Bug 66271 has been marked as a duplicate of this bug. ***
Comment 20 advait.g.soni 2014-03-28 17:56:15 UTC
Can you please point out which attachment I should download to resolve this bug and how should I use the attachment to do so ?
Comment 21 Raymond 2014-03-29 01:46:47 UTC
do you mean quad speaker array not work as expected ?
Comment 22 Raymond 2014-03-29 01:59:08 UTC
> 
> For the other 2 speaker:
> how can i do the test? I think that the 4 speaker are disposed one near the
> other, very closed. Naming the speaker Left,CenterLeft,CenterRight and Right
> respectively, how can i test if the sound the comes from my left is played
> from the Left or CenterLeft or maybe both without open the laptop?

do you hear sound from two left speakers or right speakers when you play stereo ?

speaker-test -c2 -t wave -D hw:0,0

you need to disable the fixup and find the pin of other two speakers since the Fishpond is foe Asus notebook using sonic master but without quad speaker array
Comment 23 Raymond 2015-10-09 15:23:25 UTC
(In reply to Takashi Iwai from comment #11)
> Created attachment 115301 [details]
> Patch to add pin 0x1a for bass speaker

if the external subwoofer can be detected, why the pin fixup set Misc bit

seem asus laptop with  alc668 are using node 0x1a as subwoofer

https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1451170

user with asus n550lf reported that headset mic work by default