Bug 107851

Summary: Missing sub-woofer pin and headset mic Realtek ALC3661
Product: Drivers Reporter: mimran (imranmohd72)
Component: Sound(ALSA)Assignee: Jaroslav Kysela (perex)
Status: NEW ---    
Severity: blocking CC: gaznims, imranmohd72, pachoramos1, superquad.vortex2, trekie
Priority: P1 Keywords: trivial
Hardware: Intel   
OS: Linux   
URL: https://bugzilla.kernel.org/show_bug.cgi?id=104901
See Also: https://bugzilla.kernel.org/show_bug.cgi?id=104901
Kernel Version: 4.8.0-41-generic Subsystem:
Regression: Yes Bisected commit-id:
Attachments: Pin Set
B
C
alsamixer with bass
.
Now with Bass/option
Ubuntu sound Volume
Pulse audio soundoutput screenshot.
comment 68
ref to comment 68
ref to comment 68
ref to comment below
alsamixerwithearphone
soundpanelwithearphonesconnected
ref to comment 77 and mine 80
log file from pulse
alsamixer
dialog box unity
Comment 116
After reboot
Sound
Alsa
htmi
more

Description mimran 2015-11-14 13:36:22 UTC
Missing sub-woofer pin and headset mic 

More details here

https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1302090
Comment 1 mimran 2015-11-14 13:40:01 UTC
you have not set node 0x1a to speaker in /sys/class/sound/hwC1D0/user_pin_configs:

/sys/class/sound/hwC1D0/init_pin_configs:
0x12 0x99a30140
0x14 0x90170110
0x15 0x0321101f
0x16 0x03211020
0x18 0x40030008
0x19 0x03a11030
0x1a 0x411111f0
0x1b 0x411111f0
0x1d 0x41000001
0x1e 0x411111f0
0x1f 0x411111f0

/sys/class/sound/hwC1D0/driver_pin_configs:

/sys/class/sound/hwC1D0/user_pin_configs:
0x12 0x99a30140
0x14 0x90170110
0x15 0x0321101f
0x16 0x03211020
0x18 0x40030008
0x19 0x03a11030
0x1a 0x411111f0
0x1b 0x411111f0
0x1d 0x41000001
0x1e 0x411111f0
0x1f 0x411111f0
Comment 2 mimran 2015-11-14 13:45:01 UTC
#define assoc_of_nid(c,p) get_defcfg_association(snd_hda_codec_get_pincfg(c,p))

     if ((cfg->speaker_outs == 2) && (cfg->hp_outs == 2))
          if (cfg->line_out_type == AUTO_PIN_HP_OUT)
              for(i=0; i<2; i++)
                   if (assoc_of_nid(codec,cfg->line_out_pins[i]) > assoc_of_nid(codec,cfg->speaker_pins[i]))
                            badness++;

add the above in fill_and_eval_dacs() in hda_generic.c after

  if ( spec->mixer_nid) {

  }

this increase badness of cfg->line_out_type == AUTO_PIN_HP_OUT by one when the second headphone have higher def association than subwoofer , driver create speaker and bass speaker volume controls and headphone volume control for headset and headphone
Comment 3 mimran 2015-11-14 13:53:10 UTC
driver seem hardcode to use first pin spec->gen.autocfg.hp_pins[0] as hp of the headset

and imux_pin to determine the selected mic

this mean that if you set the correct pin default of headset mic (headset mic phantom jack)

you can select internal mic, headset mic or mic jack manually using the capture source control

static void alc_update_headset_mode(struct hda_codec *codec)
{
 struct alc_spec *spec = codec->spec;

 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];

 int new_headset_mode;

 if (!snd_hda_jack_detect(codec, hp_pin))
  new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
 else if (mux_pin == spec->headset_mic_pin)
  new_headset_mode = ALC_HEADSET_MODE_HEADSET;
 else if (mux_pin == spec->headphone_mic_pin)
  new_headset_mode = ALC_HEADSET_MODE_MIC;
 else
  new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
Comment 4 mimran 2015-11-14 17:30:25 UTC
This bug relates to another bug report that i some one else have reported
https://bugzilla.kernel.org/show_bug.cgi?id=104901
Comment 5 Raymond 2015-11-15 01:34:24 UTC
can you try the patch 

https://bugs.freedesktop.org/attachment.cgi?id=117571

only those part which is needed by alienware


+static void alc668_fixup_dell_alienware(struct hda_codec *codec,
+				    const struct hda_fixup *fix, int action)
+{
+	const struct hda_pintbl pincfgs[] = {
+		{ 0x1a, 0x99130112 }, /* subwoofer */
+		{ 0x1b, 0x03a1113c }, /* headset mic */
+		{ }
+	};
+	static hda_nid_t preferred_pair[] = {
+		0x14, 0x03,
+		0x1a, 0x04,
+		0x15, 0x02,
+		0x16, 0x02,
+		0
+	};
+	struct alc_spec *spec = codec->spec;
+
+	switch (action) {
+	case HDA_FIXUP_ACT_PRE_PROBE:
+		snd_hda_apply_pincfgs(codec, pincfgs);
+		spec->gen.preferred_dacs = preferred_pair;
+		spec->gen.hs_mic_use_hp_sense = 1;
+		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
+		break;
+	case HDA_FIXUP_ACT_PROBE:
+		alc_probe_headset_mode(codec);
+		break;
+	case HDA_FIXUP_ACT_INIT:
+		spec->current_headset_mode = 0;
+		alc_update_headset_mode(codec);
+		break;
+	case HDA_FIXUP_ACT_BUILD:
+/*
+		better to use default hda 2.1 chmap
+		when we don't know internal subwoofer use which channel
+*/
+		break;
+	}
+}



	{.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
 	{.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
 	{.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
+	{.id = ALC668_FIXUP_DELL_ALIENWARE, .name = "dell-alienware"},
+
Comment 6 Raymond 2015-11-15 01:47:19 UTC
you don't need those part which implement ext subwoofer jack detection using another node pin sense

only need the part which implement headset mic jack using hp pin sense for the headset which must be the first hp pins when your alienware have headset and headphone
Comment 7 Raymond 2015-11-15 01:53:32 UTC
(In reply to mohammed imran from comment #2)
> #define assoc_of_nid(c,p)
> get_defcfg_association(snd_hda_codec_get_pincfg(c,p))
> 
>      if ((cfg->speaker_outs == 2) && (cfg->hp_outs == 2))
>           if (cfg->line_out_type == AUTO_PIN_HP_OUT)
>               for(i=0; i<2; i++)
>                    if (assoc_of_nid(codec,cfg->line_out_pins[i]) >
> assoc_of_nid(codec,cfg->speaker_pins[i]))
>                             badness++;
> 
> add the above in fill_and_eval_dacs() in hda_generic.c after
> 
>   if ( spec->mixer_nid) {
> 
>   }
> 
> this increase badness of cfg->line_out_type == AUTO_PIN_HP_OUT by one when
> the second headphone have higher def association than subwoofer , driver
> create speaker and bass speaker volume controls and headphone volume control
> for headset and headphone

the easyway is to assign preferred dac for the output pins to force which output pin can get a volume control and which pins need to share volume control

spec->gen.preferred_dacs = preferred_pair;
Comment 9 Raymond 2015-11-15 13:58:41 UTC
there is a bug in the above patch which did not call alc_fixup_headset_mode_alc668
Comment 10 mimran 2015-11-15 17:48:10 UTC
Can you give more details as to how and which file should be patched? All this pins and jacks is giving my head a spin.
Comment 11 Raymond 2015-11-16 01:09:00 UTC
https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda/patch_realtek.c?id=73bdd597823e2231dc882577dbbaf8df92fe1775


only patch_realtek.c for missing headset mic and subwoofer

the alienware model is just a variant of dell-headset-multi which don't implement headphone mic since you already have a mic jack and another headphone


you have to maunally select the capture source to select headset mic , mic and internal mic
Comment 12 Raymond 2015-11-16 01:13:41 UTC
you just replaced the headphone mic by subwoofer pin in the fixup

and add the preferred dac for your alienware 


[ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
	.type = HDA_FIXUP_PINS,
	.v.pins = (const struct hda_pintbl[]) {
		{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
			{ }
	},
		.chained = true,
		.chain_id = ALC668_FIXUP_HEADSET_MODE
	},
	[ALC668_FIXUP_HEADSET_MODE] = {
	.type = HDA_FIXUP_FUNC,
	.v.func = alc_fixup_headset_mode_alc668,
	},
 };
Comment 13 Raymond 2015-11-16 01:24:28 UTC
the easy way is to give up the headphone jack and you don't need to share volume control
Comment 14 Raymond 2015-11-16 08:08:18 UTC
once you have confirmed the headset mic is node 0x1b using the minimal change and the subwoofer is node 0x1a , 
determine the channel map of subwoofer

you can renable the headphone jack to use preferred dac to let subwoofer get volume control

change the name of the playback switch to distinguish the headset and headphone
Comment 15 Raymond 2016-04-06 02:41:25 UTC
The patch depend on function __snd_hda_jack_add_kctl which was removed by this patch

https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda/hda_jack.c?id=909cadc6c8c7e52149fb4687453277 d6cabe8c80

You need to create headset jack and skip headset mic phantom jack instead of headphone jack and headset mic jack

 

https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/tree/include/sound/jack.h

enum snd_jack_types { 
SND_JACK_HEADPHONE = 0x0001, 
SND_JACK_MICROPHONE = 0x0002, 
SND_JACK_HEADSET = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE,
Comment 16 Raymond 2016-04-06 02:45:39 UTC
Just remember add delay after headphone is plugged and before you switch headset mic since it need time for codec to differentitate omtp and ctia headset
Comment 18 mimran 2016-04-07 07:23:30 UTC
(In reply to Raymond from comment #17)
> http://mailman.alsa-project.org/pipermail/alsa-devel/2015-September/097754.
> html

So is this issue finally fixed, i mean can i finally enjoy the quality of audio in stereo mode as i do on Windows?
Which Kernel would this fix be available?

And i am not so technically in patching kernels use to do it long ago with available instructions.

Please advise?
Comment 19 Raymond 2016-04-07 08:08:11 UTC
No, you need to recompile alsa driver to create the new headset jack and modifiy pulseaudio conf to use this jack for both headphone and headset mic conf


[Jack Headset]
 required-any = any


https://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/mixer/paths/analog-output-headphones.conf



https://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/mixer/paths/analog-input-headset-mic.conf
Comment 20 Raymond 2016-04-07 08:15:09 UTC
The other patch which add headset mic and subwoofer



http://mailman.alsa-project.org/pipermail/alsa-devel/2015-September/097755.html
Comment 21 mimran 2016-04-07 11:11:00 UTC
(In reply to Raymond from comment #20)
> The other patch which add headset mic and subwoofer
> 
> 
> 
> http://mailman.alsa-project.org/pipermail/alsa-devel/2015-September/097755.
> html

Can you get into the mainline kernel which can then be picked up by other distro's :)
Comment 22 Raymond 2016-04-08 01:15:15 UTC
For alienware which also use alc668 but with headset, headphone and mic jacks

there will be no auto mic selection since you have headset mic and mic jacks 


what you need is 

fix the headset mic pin and disable the headophone mic of model dell-headset-multi 

decide which output pins share volume control since you have headset, headphone, speaker and subwoofer but only three audio output/volume controls
Comment 23 mimran 2016-05-19 19:29:58 UTC
Hello Raymond,
What is the current status of this driver, still having sound issues in kernel
4.4.0-22-generic provided by Ubuntu.
Comment 25 Raymond 2016-05-20 02:42:59 UTC
https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda/patch_realtek.c?id=3231e2053eaeee70bdfb216a78a30f11e88e2243


you need to report to the author if you want to add the support of the headset mic
Comment 26 mimran 2016-05-20 10:13:42 UTC
I have reported the author as requested, and if needed can you please fill in with the details if needed.

Also refer to my post no.24 in which i have installed the latest alsa daily build from here and sound seems to be fine.


https://code.launchpad.net/~ubuntu-audio-dev/+archive/ubuntu/alsa-daily/
Comment 27 Raymond 2016-05-20 12:49:08 UTC
-	[ALC668_FIXUP_ASUS_Nx51] = {
+	[ALC668_FIXUP_ASUS_SUBWOFFER] = {

		.type = HDA_FIXUP_PINS,
		.v.pins = (const struct hda_pintbl[]) {
			{0x1a, 0x90170151}, /* bass speaker */
			{}
		},
		.chained = true,
		.chain_id = ALC662_FIXUP_BASS_CHMAP,
	},
+	[ALC662_FIXUP_ASUS_Nx51] = {
+		.type = HDA_FIXUP_FUNC,
+		.v.func = alc_fixup_headset_mode_alc668,
+		.chained = true,
+		.chain_id = ALC668_FIXUP_ASUS_SUBWOOFER,
+       },
Comment 28 mimran 2016-05-20 15:44:08 UTC
Whats up with the code above?
Comment 29 mimran 2016-05-20 16:58:20 UTC
Hardware ID from my Windows system and the driver as per link

http://pastebin.com/jzHvzGQu

Realtek ALC3661 Audio codec Driver


HDAUDIO\FUNC_01&VEN_10EC&DEV_0668&SUBSYS_102805A9&REV_1000
Comment 30 Raymond 2016-05-21 01:10:20 UTC
https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda/patch_realtek.c?id=3231e2053eaeee70bdfb216a78a30f11e88e2243


This patch only add the suppport of subwoofer as internal subwoofer but it can be detected using jack sense

You need to merge model dell headset multi and the external subwoofer model if your are using headset
Comment 31 Raymond 2016-05-21 01:12:52 UTC
-			{0x1a, 0x90170151}, /* bass speaker */
+			{0x1a, 0x90170051}, /* bass speaker */


just clear misc bit (bit 8 of pin default) which create jack dedect kctl
Comment 32 mimran 2016-05-23 19:22:21 UTC
Created attachment 217131 [details]
Pin Set
Comment 33 mimran 2016-05-23 19:22:45 UTC
Created attachment 217141 [details]
B
Comment 34 mimran 2016-05-23 19:23:04 UTC
Created attachment 217151 [details]
C
Comment 35 mimran 2016-05-23 19:23:44 UTC
Raymond i have attached three screenshots, ok let me know what i need to set here.

Regards.
Comment 36 Raymond 2016-05-23 23:51:26 UTC
Neither hdajackretssk nor early patching can fix the bug after the above patch which add the subwoofer pin 


You have to ask the author to add support of heasdset
Comment 37 mimran 2016-05-24 16:57:37 UTC
Thanks for your patience and understanding. But where will i find the author, the last one who had written the patch, for his laptop asked me to not to email him anymore. 

? Can you write the code? and then submit the patch? if i knew i would have done something about it long time ago.
Comment 38 Raymond 2016-05-25 05:43:28 UTC
since there is not enough DAC or volume controls for the headset, headphone, speaker and subwoofer

when you cannot build kernel and modifiy driver code but just use early patching

you have tp give up the headset and change it to not connected by adding the subwoofer pin


to test the headset and subwoofer, you need to give up the headphone jack and set it as not connwxrrws qhwn using dell-headset-multi and remove headphone mic pin, add subwoofer pin fix and
Comment 39 Raymond 2016-05-25 06:07:34 UTC
https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda/patch_realtek.c?id=73bdd597823e2231dc882577dbbaf8df92fe1775


you need the trimmed version of dell-headset-multi


	[ALC668_FIXUP_DELL_ALIENWARE] = {
+		.type = HDA_FIXUP_PINS,
+		.v.pins = (const struct hda_pintbl[]) {
+			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
+			{ }
+		},
+		.chained = true,
+		.chain_id = ALC668_FIXUP_HEADSET_MODE
+	},


add the subwoofer pin fix and prefreed DAC to force the driver to create bass speaker playback volume


	static hda_nid_t preferred_pair[] = {
+		0x14, 0x03,
+		0x1a, 0x04,
+		0x15, 0x02,
+		0x16, 0x02,
+		0
+	};
+	struct alc_spec *spec = codec->spec;
+
+	switch (action) {
+	case HDA_FIXUP_ACT_PRE_PROBE:
+		spec->gen.preferred_dacs = preferred_pair;
Comment 40 mimran 2016-05-25 18:25:11 UTC
Since you can write code, can't you like submit a patch for this issue? 
Like one patch to fix this issue?
Comment 41 Raymond 2016-05-26 02:09:20 UTC
the first thing you need to find out the subwoofer use left, right or both channels by add subwoofer pin and remove one of the headphone pin 

speaker-test -c 4 -t wav -D hw:1,0


do you hear sound from subwoofer when "Rear left" or "Rear Right" is playing
Comment 42 mimran 2016-05-27 15:03:01 UTC
No i do not hear when Rear Left and Rear Right is played? Now, what? Please advise?


speaker-test -c 4 -t wav -D hw:1,0

speaker-test 1.1.0

Playback device is hw:1,0
Stream parameters are 48000Hz, S16_LE, 4 channels
WAV file(s)
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 32 to 8192
Period size range from 16 to 4096
Using max buffer size 8192
Periods = 4
was set period_size = 2048
was set buffer_size = 8192
 0 - Front Left
 1 - Front Right
 3 - Rear Right
 2 - Rear Left
Time per period = 5.717268
Comment 44 mimran 2016-05-27 20:02:57 UTC
Yes i tried that and i get to hear that "Rear left" or "Rear Right" is playing, using the hdajackretask. Now? then? what next?
Comment 45 mimran 2016-05-27 20:09:55 UTC
But i donot hear anything related to frontleft and front right, ref to comment 43
Comment 46 Raymond 2016-05-28 01:29:23 UTC
you have to post the output of alsa-info.sh after save as boot default and reboot


did you remove  the headset pin complex to force the driver to get the bass speaker playback volume control since three DAC/volume control for headphone, speaker and subwoofer
Comment 47 mimran 2016-05-28 05:17:21 UTC
ALSA INFO before:
http://www.alsa-project.org/db/?f=43497289c2879df5f15f276f689a4cf50bc1cd30


Alsa info, after as instructed,
http://www.alsa-project.org/db/?f=fdba5cc8c2fc390c4b18aabcb81c43c01e556927
.
I just followed the instruction as per that links comment no 11, that's it and conducted the test? And what is headset pin complex ( in plain English please ) :)
.

Output while using HDAjackrestask
hdajackretask
0x12 0x99a30140
0x14 0x90170110
0x15 0x0321101f
0x16 0x03211020
0x18 0x40030008
0x19 0x03a11030
0x1a 0x90100151
0x1b 0x411111f0
0x1d 0x41000001
0x1e 0x411111f0
0x1f 0x411111f0
Comment 48 mimran 2016-05-28 05:18:01 UTC
Created attachment 217991 [details]
alsamixer with bass
Comment 49 mimran 2016-05-28 05:18:42 UTC
Created attachment 218001 [details]
.

HDAjackrestask with the pin set with boot option

regards.
Comment 50 Raymond 2016-05-28 07:47:54 UTC
if you don't make one of the headphone as not connected, you won't get "Bass Speaker Playback Volume", 

you have to give up node 0x15 or 0x16 to get the driver to create bass speaker playback volume controls


Node 0x15 [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 0x0321101f: [Jack] HP Out at Ext Left
    Conn = 1/8, Color = Black
    DefAssociation = 0x1, Sequence = 0xf
  Pin-ctls: 0xc0: OUT HP
  Unsolicited: tag=01, enabled=1
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 3
     0x0c* 0x0d 0x0e
Node 0x16 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out
  Control: name="Headphone Playback Switch", index=1, 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 0x03211020: [Jack] HP Out at Ext Left
    Conn = 1/8, Color = Black
    DefAssociation = 0x2, Sequence = 0x0
  Pin-ctls: 0xc0: OUT HP
  Unsolicited: tag=02, enabled=1
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 3
     0x0c 0x0d* 0x0e

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
  Device: name="ALC3661 Analog", type="Audio", device=0
  Amp-Out caps: ofs=0x57, nsteps=0x57, stepsize=0x02, mute=0
  Amp-Out vals:  [0x00 0x00]
  Converter: stream=5, channel=0
  PCM:
    rates [0x560]: 44100 48000 96000 192000
    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="Headphone Playback Volume", index=1, 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:  [0x56 0x56]
  Converter: stream=5, channel=0
  PCM:
    rates [0x560]: 44100 48000 96000 192000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x04 [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:  [0x56 0x56]
  Converter: stream=5, channel=0
  PCM:
    rates [0x560]: 44100 48000 96000 192000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
Comment 51 Raymond 2016-05-28 07:55:46 UTC
audio output 

speaker playback volume

converter: stream = 5 , channel =0


audio output

bass speaker playback volume


converter: stream = 5, channel = 1


audio output 

Headphone playback volme

converter: stream = 5 , channel = 0


the two speaker support 4 channels playback when channel tags are different
Comment 52 Raymond 2016-05-28 08:09:02 UTC
when playing four channel

one of the converter should has channel = 1

  Converter: stream=5, channel=1


you should hear front left and front right in the headset jack and rear left and rear right on the heaphone jack if node 0x14 is headset 



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
  Device: name="ALC3661 Analog", type="Audio", device=0
  Amp-Out caps: ofs=0x57, nsteps=0x57, stepsize=0x02, mute=0
  Amp-Out vals:  [0x00 0x00]
  Converter: stream=5, channel=0
  PCM:
    rates [0x560]: 44100 48000 96000 192000
    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="Headphone Playback Volume", index=1, 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:  [0x56 0x56]
  Converter: stream=5, channel=0
  PCM:
    rates [0x560]: 44100 48000 96000 192000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
Comment 53 Raymond 2016-05-28 15:22:43 UTC
https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1302090/comments/4



if node 0x15 is headset jack. just need fixup headset mic


{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
Comment 54 Raymond 2016-05-29 01:47:02 UTC
               [ALC668_FIXUP_DELL_ALIENWARE] = {
		.type = HDA_FIXUP_PINS,
		.v.pins = (const struct hda_pintbl[]) {
/* give up the headphone jack 0x16 to test the headset mic */
                        { 0x16,  0x411111f0 }, /* once headset mic work, you need to use preferred DAC to select which two pins share volume control */
                        { 0x1a, 0x90100111 }, /* internal subwoofer */
			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
			{ }
		},
		.chained = true,
		.chain_id = ALC668_FIXUP_HEADSET_MODE
	},




+	SND_PCI_QUIRK(0x1028, 0x05a9, "Dell Alienware14", ALC668_FIXUP_DELL_ALIENWARE),
	SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
	SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Comment 55 mimran 2016-05-29 18:11:57 UTC
Is the code above the patch for our issue?

Also when i do hdajacksense i get this output

sudo hdajacksensetest
[sudo] password for imran: 
Pin 0x05 ( Digital Out, HDMI): present = No
Pin 0x06 ( Digital Out, HDMI): present = No
Pin 0x07 ( Digital Out, HDMI): present = No

Can't get to test my card ? any idea
Comment 57 Raymond 2016-05-30 01:24:54 UTC
(In reply to mohammed imran from comment #56)
> http://voices.canonical.com/david.henningsson/2014/03/07/headset-jacks-on-
> newer-laptops/
> 
> Will this solution work?

http://bazaar.launchpad.net/~unity-settings-daemon-team/unity-settings-daemon/trunk/view/head:/plugins/media-keys/what-did-you-plug-in/pa-backend.c

   Headphone Mic Jack - indicates headphone and mic-in mode share the same jack,
     i e, not two separate jacks. Hardware cannot distinguish between a
     headphone and a mic.
   Headset Mic Phantom Jack - indicates headset jack where hardware can not
     distinguish between headphones and headsets
   Headset Mic Jack - indicates headset jack where hardware can distinguish


dell-headset-multi is designed for dell laptop with only one combo jack


your alienware have three jacks and need to find out whether you can use headset mic without headphone mic fixup

as your alienware also support 5.1 by retasking mic jacks as output which create center/lfe playback volume, so you need to find out whether the subwoofer using same channel as lfe
Comment 58 Raymond 2016-05-30 01:39:03 UTC
you can specify model=dell-headset-multi  and use early patching 

by force the driver to keep node 0x19 as the mic jack instead of headphone mic jack

Pin Default 0x03a11030

add the subwoofer node 0x1a

study the two cases

1) keeping the headphone pin node 0x16 ( speaker and subwoofer share volume control)
2) use prefer DAC so that headset and headphone share volume control
Comment 59 Raymond 2016-05-30 01:48:32 UTC
if both speaker node 0x14 and subwoofer  node 0x1a are connected to node 0x4 through node 0x0e

you can  switch off speaker playback switch and play stereo to find out whether subwoofer use left, right or both channels


imple mixer control 'Speaker',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 87
  Mono:
  Front Left: Playback 87 [100%] [0.00dB] [off]
  Front Right: Playback 87 [100%] [0.00dB] [off]
Simple mixer control 'Bass Speaker',0
  Capabilities: pswitch
  Playback channels: Front Left - Front Right
  Mono:
  Front Left: Playback [on]
  Front Right: Playback [on]


Node 0x14 [Pin Complex] wcaps 0x40058f: Stereo Amp-In Amp-Out
  Control: name="Speaker Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Amp-In caps: N/A
  Amp-In vals:  [0x00 0x00]
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x00 0x00]
  Pincap 0x0001003c: IN OUT HP EAPD Detect
  EAPD 0x2: EAPD
  Pin Default 0x90170110: [Fixed] Speaker at Int N/A
    Conn = Analog, Color = Unknown
    DefAssociation = 0x1, 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: 3
     0x0c 0x0d 0x0e*


Node 0x14 [Pin Complex] wcaps 0x40058f: Stereo Amp-In Amp-Out
  Control: name="Speaker Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Amp-In caps: N/A
  Amp-In vals:  [0x00 0x00]
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x00 0x00]
  Pincap 0x0001003c: IN OUT HP EAPD Detect
  EAPD 0x2: EAPD
  Pin Default 0x90170110: [Fixed] Speaker at Int N/A
    Conn = Analog, Color = Unknown
    DefAssociation = 0x1, 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: 3
     0x0c 0x0d 0x0e*
Comment 60 Raymond 2016-05-30 01:54:17 UTC
Node 0x04 [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:  [0x56 0x56]
  Converter: stream=5, channel=0
  PCM:
    rates [0x560]: 44100 48000 96000 192000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0

Node 0x0e [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
  Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-In vals:  [0x00 0x00] [0x00 0x00]
  Connection: 2
     0x04 0x0b

Node 0x14 [Pin Complex] wcaps 0x40058f: Stereo Amp-In Amp-Out
  Control: name="Speaker Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Amp-In caps: N/A
  Amp-In vals:  [0x00 0x00]
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x00 0x00]
  Pincap 0x0001003c: IN OUT HP EAPD Detect
  EAPD 0x2: EAPD
  Pin Default 0x90170110: [Fixed] Speaker at Int N/A
    Conn = Analog, Color = Unknown
    DefAssociation = 0x1, 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: 3
     0x0c 0x0d 0x0e*

Node 0x1a [Pin Complex] wcaps 0x40058f: Stereo Amp-In Amp-Out
  Control: name="Bass Speaker Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=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 0x0000373c: IN OUT HP Detect
    Vref caps: HIZ 50 GRD 80 100
  Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
    Conn = 1/8, Color = Black
    DefAssociation = 0xf, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x40: OUT VREF_HIZ
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 3
     0x0c 0x0d 0x0e*
Comment 61 mimran 2016-05-30 17:11:58 UTC
Can you advise me how do i use hdajackretask to enable comment 58

Advance override? 

imran@imran-Alienware-14:~$ hdajackretask
0x12 0x99a30140
0x14 0x90170110
0x15 0x0321101f
0x16 0x03211020
0x18 0x40030008
0x19 0x03a11030 -> Mic jack like which? 
0x1a 0x411111f0 -> Subwoofer? like which option from the drop down menu?
0x1b 0x411111f0
0x1d 0x41000001
0x1e 0x411111f0
0x1f 0x411111f0

And what about comment no 58? 

I had a look at hdajackretask, and wondered how to connect the nodes? 

A more practical step by step instructions would be ok? i am bit challenged in this matter.
Comment 62 Raymond 2016-05-31 02:46:32 UTC
in /etc/modprobe.d/alsa-base.conf

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


options snd-hda-intel model=,dell-headset-multi, patch=,/lib/firmware/hdajackretask.fw



only need to fix these pin in hdajackretask.fw


0x16 0x411111f0 this remove headphone jack to allow subwoofer has bass speaker volume control

0x19 0x03a11030  this force to use mic jack instead of headphone mic of dell-headset-multi

0x1a 0x90100111  this fix the subwoofer pin
Comment 63 Raymond 2016-05-31 03:07:11 UTC
/sys/class/sound/hwC1D0/init_pin_configs:
0x12 0x99a30140
0x14 0x90170110
0x15 0x0321101f
0x16 0x03211020
0x18 0x40030008
0x19 0x03a11030
0x1a 0x411111f0
0x1b 0x411111f0
0x1d 0x41000001
0x1e 0x411111f0
0x1f 0x411111f0

/sys/class/sound/hwC1D0/driver_pin_configs:

 0x19 0x03a1913d 
 0x1b 0x03a1113c 

/sys/class/sound/hwC1D0/user_pin_configs:

0x16 0x411111f0
0x19 0x03a11030
0x1a 0x90100111



driver add headphone mic and headset mic


early patching 
remove headphone jack
fix headphone mic to your original mic jack
add subwoofer pin
Comment 64 mimran 2016-05-31 16:39:31 UTC
Created attachment 218421 [details]
Now with Bass/option

.
Comment 65 mimran 2016-05-31 19:45:17 UTC
Ref to comments 62, i have done as you have said and now i believe the issue has being fixed. I now have richer audio output and i am using 2.1. I hope you can view the atachment's that i have done.

This might fix the issue for the short term, but what about a permanent solution? for this particular codec and system so that other's can also benefit or this solution is unique to me only.

I thank you for your patience, and in assisting me.

So now what next? do you need more data?

Please advise?
Comment 66 mimran 2016-05-31 19:46:51 UTC
Created attachment 218441 [details]
Ubuntu sound Volume
Comment 67 mimran 2016-05-31 19:47:27 UTC
Created attachment 218451 [details]
Pulse audio soundoutput screenshot.
Comment 68 Raymond 2016-06-01 01:10:27 UTC
do the subwoofer use left , right or both channel ? ( change the left , right or both volume of bass speaker volume control 


do you hear any high frequency from the subwoofer ?


https://bugs.freedesktop.org/show_bug.cgi?id=95021


can you hear the low frequency sound from the speakers when using 2.1 profile since pulseaudio apply high pass filter to channels other than LFE 


do the headset mic (CTIA or OMTP headset) , internal mic and mic jack work as expected when you select the capture source , you have to manually selected since this method create headset phantom jack internal mic phantom jack and mic jack (i.e. no auto mic selection)
Comment 69 Raymond 2016-06-01 01:23:22 UTC
which channel map should be used for your laptop subwoofer

a)	
       { .channels = 4,
	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
		   SNDRV_CHMAP_LFE, SNDRV_CHMAP_LFE } },
	{ }

b)

	{ .channels = 4,
	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
		   SNDRV_CHMAP_LFE, SNDRV_CHMAP_NA } },


c)

	{ .channels = 4,
	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
		   SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } },
Comment 70 Raymond 2016-06-01 02:01:16 UTC
https://bugs.freedesktop.org/show_bug.cgi?id=95021#c30

do you hear low frequency from the headset/headphone when select 2.1 profile and plug the headset/headphone jack
Comment 71 Raymond 2016-06-01 06:57:35 UTC
can you post the output of alsa-info.sh for the patched driver



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

can you post the pulseaudio vebose log

after select 2.1 profile,  play stereo 

you should see "LR4 filter enabled" in pulseaudio log



http://git.alsa-project.org/?p=alsa-lib.git;a=commitdiff;h=48f1b308cc66152eb6db66742dd0d08d888cda8d;hp=5c4cd46810cef8850b037fca9e38ffd43b0bff22


http://git.alsa-project.org/?p=alsa-lib.git;a=commitdiff;h=5c4cd46810cef8850b037fca9e38ffd43b0bff22;hp=8ad8d22216f818872a764ef5dafcaae1adeee211


it is not clear alsa lib will pick up which channel map when both are available


    { .channels = 4,
	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
		   SNDRV_CHMAP_LFE, SNDRV_CHMAP_LFE } },
	{ }

      { .channels = 6,
         .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
                 SNDRV_CHMAP_RL, SNDRV_CHMAP_RR,
                  SNDRV_CHMAP_FC, SNDRV_CHMAP_LFE } },


for using three jacks for external 5.1

options snd-hda-intel patch=,surround51.fw


0x15 0x02014010     retask headset as line out
0x16 0x02014011     ewtask headphone as line out
0x19 0x02014012     retask mic jack as line out
0x1a 0x90100111     subwoofer


https://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/mixer/paths/analog-output-lineout.conf

https://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/mixer/paths/analog-output-speaker.conf


do line out profile and speaker profile still work since pulseaudio assume headphone jack must exist ?
Comment 72 mimran 2016-06-01 19:06:53 UTC
(In reply to Raymond from comment #68)
> do the subwoofer use left , right or both channel ? ( change the left ,
> right or both volume of bass speaker volume control 
> 
> 
> do you hear any high frequency from the subwoofer ?
> 
> 
> https://bugs.freedesktop.org/show_bug.cgi?id=95021
> 
> 
> can you hear the low frequency sound from the speakers when using 2.1
> profile since pulseaudio apply high pass filter to channels other than LFE 
> 
> 
> do the headset mic (CTIA or OMTP headset) , internal mic and mic jack work
> as expected when you select the capture source , you have to manually
> selected since this method create headset phantom jack internal mic phantom
> jack and mic jack (i.e. no auto mic selection)

Ref to your comment 68, please note that when i select Analog Surround 2.1 output and upon clicking the woofer button i hear a hissing sound.

New screenshots uploaded.
Comment 73 mimran 2016-06-01 19:09:02 UTC
Created attachment 218681 [details]
comment 68
Comment 74 mimran 2016-06-01 19:11:10 UTC
(In reply to Raymond from comment #69)
> which channel map should be used for your laptop subwoofer
> 
> a)    
>        { .channels = 4,
>         .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
>                  SNDRV_CHMAP_LFE, SNDRV_CHMAP_LFE } },
>       { }
> 
> b)
> 
>       { .channels = 4,
>         .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
>                  SNDRV_CHMAP_LFE, SNDRV_CHMAP_NA } },
> 
> 
> c)
> 
>       { .channels = 4,
>         .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
>                  SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } },

Umm i don't know but point a) would make sense or it would work.
Comment 75 mimran 2016-06-01 19:13:57 UTC
Created attachment 218691 [details]
ref to comment 68
Comment 76 mimran 2016-06-01 19:14:16 UTC
Created attachment 218701 [details]
ref to comment 68
Comment 77 mimran 2016-06-01 19:19:35 UTC
Created attachment 218711 [details]
ref to comment below

This is the alsamixer state, when its not connect with a earphone (apple) to the headphone jack.
Comment 78 mimran 2016-06-01 19:24:13 UTC
Created attachment 218721 [details]
alsamixerwithearphone

alsamixerwithearphone
Comment 79 mimran 2016-06-01 19:26:49 UTC
Created attachment 218731 [details]
soundpanelwithearphonesconnected

soundpanel with ear phones connected to headphone jack no audio heard when earphone is connected to headphone jack, this jack with no sound is the middle one and i ear sound from right most one.
Comment 80 mimran 2016-06-01 19:29:34 UTC
(In reply to Raymond from comment #71)
> can you post the output of alsa-info.sh for the patched driver
> 
> 
> 
> https://wiki.ubuntu.com/PulseAudio/Log
> 
> can you post the pulseaudio vebose log
> 
> after select 2.1 profile,  play stereo 
> 
> you should see "LR4 filter enabled" in pulseaudio log
> 
> 
> 
> http://git.alsa-project.org/?p=alsa-lib.git;a=commitdiff;
> h=48f1b308cc66152eb6db66742dd0d08d888cda8d;
> hp=5c4cd46810cef8850b037fca9e38ffd43b0bff22
> 
> 
> http://git.alsa-project.org/?p=alsa-lib.git;a=commitdiff;
> h=5c4cd46810cef8850b037fca9e38ffd43b0bff22;
> hp=8ad8d22216f818872a764ef5dafcaae1adeee211
> 
> 
> it is not clear alsa lib will pick up which channel map when both are
> available
> 
> 
>     { .channels = 4,
>         .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
>                  SNDRV_CHMAP_LFE, SNDRV_CHMAP_LFE } },
>       { }
> 
>       { .channels = 6,
>          .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
>                  SNDRV_CHMAP_RL, SNDRV_CHMAP_RR,
>                   SNDRV_CHMAP_FC, SNDRV_CHMAP_LFE } },
> 
> 
> for using three jacks for external 5.1
> 
> options snd-hda-intel patch=,surround51.fw
> 
> 
> 0x15 0x02014010     retask headset as line out
> 0x16 0x02014011     ewtask headphone as line out
> 0x19 0x02014012     retask mic jack as line out
> 0x1a 0x90100111     subwoofer
> 
> 
> https://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/
> mixer/paths/analog-output-lineout.conf
> 
> https://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/
> mixer/paths/analog-output-speaker.conf
> 
> 
> do line out profile and speaker profile still work since pulseaudio assume
> headphone jack must exist ?

$ alsa-info.sh
ALSA Information Script v 0.4.64
--------------------------------

This script visits the following commands/files to collect diagnostic
information about your ALSA installation and sound related hardware.

  dmesg
  lspci
  lsmod
  aplay
  amixer
  alsactl
  /proc/asound/
  /sys/class/sound/
  ~/.asoundrc (etc.)


Your ALSA information is located at 
http://www.alsa-project.org/db/?f=63e63eb1d3994b9b5b9d4aa30a8903646b54bf96
Comment 81 mimran 2016-06-01 19:32:32 UTC
Created attachment 218741 [details]
ref to comment 77 and mine 80

ref to comment 77 and mine 80
Comment 82 mimran 2016-06-01 19:44:12 UTC
(In reply to Raymond from comment #71)
> can you post the output of alsa-info.sh for the patched driver
> 
> 
> 
> https://wiki.ubuntu.com/PulseAudio/Log
> 
> can you post the pulseaudio vebose log
> 
> after select 2.1 profile,  play stereo 
> 
> you should see "LR4 filter enabled" in pulseaudio log
> 
> 

Is this the line? you looking for?
(  37.895|   0.000) D: [pulseaudio] resampler.c:   lfe filter activated (LR4 type), the crossover_freq = 120Hz

Log attached, thanks.
Comment 83 mimran 2016-06-01 19:45:37 UTC
Created attachment 218751 [details]
log file from pulse

can you post the pulseaudio vebose log
> 
> after select 2.1 profile,  play stereo 
> 
> you should see "LR4 filter enabled" in pulseaudio log
Comment 84 mimran 2016-06-01 19:50:42 UTC
> 
> 
> it is not clear alsa lib will pick up which channel map when both are
> available
> 
> 
>     { .channels = 4,
>         .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
>                  SNDRV_CHMAP_LFE, SNDRV_CHMAP_LFE } },
>       { }
> 
>       { .channels = 6,
>          .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
>                  SNDRV_CHMAP_RL, SNDRV_CHMAP_RR,
>                   SNDRV_CHMAP_FC, SNDRV_CHMAP_LFE } },
> 
> 
> for using three jacks for external 5.1
> 
> options snd-hda-intel patch=,surround51.fw
> 
> 
> 0x15 0x02014010     retask headset as line out
> 0x16 0x02014011     ewtask headphone as line out
> 0x19 0x02014012     retask mic jack as line out
> 0x1a 0x90100111     subwoofer
> 
> 
> https://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/
> mixer/paths/analog-output-lineout.conf
> 
> https://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/
> mixer/paths/analog-output-speaker.conf
> 
> 
> do line out profile and speaker profile still work since pulseaudio assume
> headphone jack must exist ?


Should i do the same as requested in comment 62? edit the mod probe file and firmware file??? advise. 

to much to digest :)
Comment 85 Raymond 2016-06-02 06:10:18 UTC
"
it is pulseaudio resampler mix I00 and I02 for O02 

(  37.895|   0.000) D: [pulseaudio] resampler.c: Resampler:
(  37.895|   0.000) D: [pulseaudio] resampler.c:   rate 44100 -> 44100 (method copy)
(  37.895|   0.000) D: [pulseaudio] resampler.c:   format s16le -> s16le (intermediate s16le)
(  37.895|   0.000) D: [pulseaudio] resampler.c:   channels 2 -> 3 (resampling 2)
(  37.895|   0.000) D: [pulseaudio] resampler.c: Channel matrix:
(  37.895|   0.000) D: [pulseaudio] resampler.c:        I00   I01 
(  37.895|   0.000) D: [pulseaudio] resampler.c:     +------------
(  37.895|   0.000) D: [pulseaudio] resampler.c: O00 | 1.000 0.000
(  37.895|   0.000) D: [pulseaudio] resampler.c: O01 | 0.000 1.000
(  37.895|   0.000) D: [pulseaudio] resampler.c: O02 | 0.500 0.500
(  37.895|   0.000) I: [pulseaudio] remap.c: Using generic matrix remapping
(  37.895|   0.000) D: [pulseaudio] resampler.c:   lfe filter activated (LR4 type), the crossover_freq = 120Hz

as surround21 seem copy LFE to channel 2 and 3, 



  0.189|   0.000) I: [pulseaudio] alsa-sink.c: Using hardware mute control.
(   0.189|   0.000) D: [pulseaudio] alsa-util.c: snd_pcm_dump():
(   0.189|   0.000) D: [pulseaudio] alsa-util.c: Route conversion PCM
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   Transformation table:
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:     0 <- 0
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:     1 <- 1
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:     2 <- 2
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:     3 <- 2
(   0.189|   0.000) D: [pulseaudio] alsa-util.c: Its setup is:
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   stream       : PLAYBACK
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   access       : MMAP_INTERLEAVED
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   format       : S16_LE
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   subformat    : STD
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   channels     : 3
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   rate         : 44100
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   exact rate   : 44100 (44100/1)
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   msbits       : 16
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   buffer_size  : 8192
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   period_size  : 4096
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   period_time  : 92879
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   tstamp_mode  : ENABLE
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   tstamp_type  : MONOTONIC
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   period_step  : 1
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   avail_min    : 7603
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   period_event : 0
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   start_threshold  : -1
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   stop_threshold   : 4611686018427387904
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   silence_threshold: 0
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   silence_size : 0
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   boundary     : 4611686018427387904
(   0.189|   0.000) D: [pulseaudio] alsa-util.c: Slave: Soft volume PCM
(   0.189|   0.000) D: [pulseaudio] alsa-util.c: Control: PCM Playback Volume
(   0.189|   0.000) D: [pulseaudio] alsa-util.c: min_dB: -51
(   0.189|   0.000) D: [pulseaudio] alsa-util.c: max_dB: 0
(   0.189|   0.000) D: [pulseaudio] alsa-util.c: resolution: 256
(   0.189|   0.000) D: [pulseaudio] alsa-util.c: Its setup is:
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   stream       : PLAYBACK
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   access       : MMAP_INTERLEAVED
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   format       : S16_LE
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   subformat    : STD
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   channels     : 4
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   rate         : 44100
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   exact rate   : 44100 (44100/1)
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   msbits       : 16
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   buffer_size  : 8192
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   period_size  : 4096
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   period_time  : 92879
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   tstamp_mode  : ENABLE
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   tstamp_type  : MONOTONIC
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   period_step  : 1
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   avail_min    : 7603
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   period_event : 0
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   start_threshold  : -1
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   stop_threshold   : 4611686018427387904
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   silence_threshold: 0
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   silence_size : 0
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   boundary     : 4611686018427387904
(   0.189|   0.000) D: [pulseaudio] alsa-util.c: Slave: Hardware PCM card 1 'HDA Intel PCH' device 0 subdevice 0
(   0.189|   0.000) D: [pulseaudio] alsa-util.c: Its setup is:
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   stream       : PLAYBACK
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   access       : MMAP_INTERLEAVED
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   format       : S16_LE
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   subformat    : STD
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   channels     : 4
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   rate         : 44100
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   exact rate   : 44100 (44100/1)
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   msbits       : 16
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   buffer_size  : 8192
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   period_size  : 4096
(   0.189|   0.000) D: [pulseaudio] alsa-util.c:   period_time  : 92879
Comment 86 Raymond 2016-06-02 06:28:38 UTC
the driver won't use 2.1 channel map since line out type is line out and line_outs == 3

	if (spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT &&
		    spec->autocfg.line_outs == 2)
			info->stream[SNDRV_PCM_STREAM_PLAYBACK].chmap =
				snd_pcm_2_1_chmaps;


only 5.1 channel map is available even you add the subwoofer pin and subwoofer is not connected to center/lfe


0x15 0x02014010     
0x16 0x02014011     
0x19 0x02014012     
0x1a 0x90100111
Comment 87 Raymond 2016-06-02 06:46:28 UTC
only one line instead of two in alsa-base.conf


snd_hda_intel: model=,dell-headset-multi, patch=,/lib/firmware/hdajackretask.fw
snd_hda_intel: patch=hda-jack-retask.fw,hda-jack-retask.fw,hda-jack-retask.fw,hda-jack-retask.fw

control.16 {
		iface CARD
		name 'Headset Mic Jack'
		value false
		comment {
			access read
			type BOOLEAN
			count 1
		}
	}

this jack seem incorrect since bit 8 of headset mic is set 


{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */

it is strange that no mic jack when early patching 

0x19 0x03a11030
Comment 88 Raymond 2016-06-02 07:07:08 UTC
http://mailman.alsa-project.org/pipermail/alsa-devel/2015-September/097754.html

if headset mic jack cannot be used for jack sense, the alternatively is change the headphone jack (SND_JACK_HEADPHONE) to headset jack (SND_JACK_HEADSET) and skip the creation of headset mic phantom jack 

this also require change of pulseaudio conf files

[Element Headset] to headphones.conf and headset-mic.conf
Comment 89 Raymond 2016-06-02 12:03:25 UTC
since your alienware have headset and headphone jack, only change the first headphone pin from SND_JACK_HEADPHONE to SND_JACK_HEADSET


 static int get_input_jack_type(struct hda_codec *codec, hda_nid_t nid)
 {
     unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid);
+    struct hda_gen_spec *spec = codec->spec;
+    struct auto_pin_cfg *cfg = &spec->autocfg;
     switch (get_defcfg_device(def_conf)) {
     case AC_JACK_LINE_OUT:
     case AC_JACK_SPEAKER:
         return SND_JACK_LINEOUT;
     case AC_JACK_HP_OUT:
+        if (spec->hs_mic_use_hp_sense && (nid == cfg->hp_pins[0]))
+            return SND_JACK_HEADSET;
         return SND_JACK_HEADPHONE;
     case AC_JACK_SPDIF_OUT:
     case AC_JACK_DIG_OTHER_OUT:
Comment 90 mimran 2016-06-02 19:20:16 UTC
(In reply to Raymond from comment #87)
> only one line instead of two in alsa-base.conf
> 
> 
> snd_hda_intel: model=,dell-headset-multi,
> patch=,/lib/firmware/hdajackretask.fw
> snd_hda_intel:
> patch=hda-jack-retask.fw,hda-jack-retask.fw,hda-jack-retask.fw,hda-jack-
> retask.fw
> 
> control.16 {
>               iface CARD
>               name 'Headset Mic Jack'
>               value false
>               comment {
>                       access read
>                       type BOOLEAN
>                       count 1
>               }
>       }
> 
> this jack seem incorrect since bit 8 of headset mic is set 
> 
> 
> { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
> 
> it is strange that no mic jack when early patching 
> 
> 0x19 0x03a11030

Should i copy this whole line into alsa-base.conf?

snd_hda_intel:
> patch=hda-jack-retask.fw,hda-jack-retask.fw,hda-jack-retask.fw,hda-jack-
> retask.fw


what about this code? also in alsa-base.conf?

control.16 {
>               iface CARD
>               name 'Headset Mic Jack'
>               value false
>               comment {
>                       access read
>                       type BOOLEAN
>                       count 1
>               }
>       }

This should be in hda-jack-retask.fw?

{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
Comment 91 mimran 2016-06-02 19:38:37 UTC
(In reply to Raymond from comment #89)
> since your alienware have headset and headphone jack, only change the first
> headphone pin from SND_JACK_HEADPHONE to SND_JACK_HEADSET
> 
> 
>  static int get_input_jack_type(struct hda_codec *codec, hda_nid_t nid)
>  {
>      unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid);
> +    struct hda_gen_spec *spec = codec->spec;
> +    struct auto_pin_cfg *cfg = &spec->autocfg;
>      switch (get_defcfg_device(def_conf)) {
>      case AC_JACK_LINE_OUT:
>      case AC_JACK_SPEAKER:
>          return SND_JACK_LINEOUT;
>      case AC_JACK_HP_OUT:
> +        if (spec->hs_mic_use_hp_sense && (nid == cfg->hp_pins[0]))
> +            return SND_JACK_HEADSET;
>          return SND_JACK_HEADPHONE;
>      case AC_JACK_SPDIF_OUT:
>      case AC_JACK_DIG_OTHER_OUT:

which file for comment 88 and 89? which file to paste this code to?
Comment 92 Raymond 2016-06-03 01:12:50 UTC
http://mailman.alsa-project.org/pipermail/alsa-devel/2015-September/097841.html

> the most important piece of information is missing: *why* this change
is needed.  I can guess, but it has to be clarified to all readers.
At best, give the background information why the current code doesn't
work for some cases and how your change will help.

the purpose of the patch is to make the combo jack of those laptops using alc668 to support headset only and drop support of headphone mic and headphone in order to enable auto mic selection by creating headset jack which report the state of both headphone and headset mic of the combo jack


> +    unsigned int hs_mic_use_hp_sense:1;

> Please give a comment to this new field what it indicates.

flag to indicate the headset mic pin does not support jack sense and rely on the headphone pin jack sense

> >  static int get_input_jack_type(struct hda_codec *codec, hda_nid_t nid)
>  {
>      unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid);
> +    struct hda_gen_spec *spec = codec->spec;
>      switch (get_defcfg_device(def_conf)) {
>      case AC_JACK_LINE_OUT:
>      case AC_JACK_SPEAKER:
>          return SND_JACK_LINEOUT;
>      case AC_JACK_HP_OUT:
> +        if (spec->hs_mic_use_hp_sense)
> +            return SND_JACK_HEADSET;
>          return SND_JACK_HEADPHONE;

. No, this won't work for all cases.  The code in hda_jack.c can't
assume that codec->spec points to a  hda_gen_spec object.  This can be
other codec drivers like ca0132 or hdmi.

> It means that you need either to move the flag into hda_codec struct
or to handle this check differently.


https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/tree/sound/pci/hda/hda_codec.h

/* codec information */
struct hda_codec {
	struct hdac_device core;

+    unsigned int hs_mic_use_hp_sense:1;
#ifdef CONFIG_PM
	unsigned long power_on_acct;
	unsigned long power_off_acct;
	unsigned long power_jiffies;
#endif



https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/tree/sound/pci/hda/hda_jack.c

static int get_input_jack_type(struct hda_codec *codec, hda_nid_t nid)
 {
     unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid);
+    struct hda_gen_spec *spec = codec->spec;
+    struct auto_pin_cfg *cfg = &spec->autocfg;
     switch (get_defcfg_device(def_conf)) {
     case AC_JACK_LINE_OUT:
     case AC_JACK_SPEAKER:
         return SND_JACK_LINEOUT;
     case AC_JACK_HP_OUT:
+        if (codec->hs_mic_use_hp_sense && (nid == cfg->hp_pins[0]))
+            return SND_JACK_HEADSET;
         return SND_JACK_HEADPHONE;
     case AC_JACK_SPDIF_OUT:
     case AC_JACK_DIG_OTHER_OUT:
Comment 93 Raymond 2016-06-03 01:27:00 UTC
https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/tree/Documentation/sound/alsa/HD-Audio.txt



Early Patching
~~~~~~~~~~~~~~
When CONFIG_SND_HDA_PATCH_LOADER=y is set, you can pass a "patch" as a
firmware file for modifying the HD-audio setup before initializing the
codec.  This can work basically like the reconfiguration via sysfs in
the above, but it does it before the first codec configuration.

A patch file is a plain text file which looks like below:

------------------------------------------------------------------------
  [codec]
  0x12345678 0xabcd1234 2

  [model]
  auto

  [pincfg]
  0x12 0x411111f0 

did you set the correct codec id and subsystem id and model

since you need model dell-headset-multi to call the function  alc_fixup_headset_mode_alc668 to init the headset 

and those pin fix to remove headphone mic by the original mic jack and subwoofer
remove the headphone jack so that line out type =speaker for the 2.1 channel map
Comment 94 Raymond 2016-06-03 01:47:00 UTC
!!Module: snd_hda_intel
	align_buffer_size : -1
	bdl_pos_adj : -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
	beep_mode : N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N
	enable : Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y
	enable_msi : -1
	id : (null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null)
	index : -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
	jackpoll_ms : 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
	model : ,dell-headset-multi,,(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null)
	patch : hda-jack-retask.fw,hda-jack-retask.fw,hda-jack-retask.fw,hda-jack-retask.fw,(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null)

I expect only one firmware file for the card 1 instead of firmware file for three cards
Comment 95 Raymond 2016-06-03 02:23:41 UTC
https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/tree/sound/pci/hda/patch_realtek.c

look like you need two new models for headset and  5.1 

static const struct hda_model_fixup alc662_fixup_models[] = {
	{.id = ALC272_FIXUP_MARIO, .name = "mario"},
	{.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
	{.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
	{.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
	{.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
	{.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
	{.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
	{.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
	{.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},	
        {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
	{.id = ALC668_FIXUP_DELL_ALIENWARE, .name = "dell-alienware"},
	{.id = ALC668_FIXUP_DELL_ALIENWARE_51, .name = "dell-51"},
	{}
};
Comment 96 Raymond 2016-06-03 07:01:23 UTC
only need firmware for 0000:00:1b.0 (card 1) for the codec alc668 

[   13.653394] snd_hda_intel 0000:00:03.0: Applying patch firmware 'hda-jack-retask.fw'
[   13.653506] snd_hda_intel 0000:00:1b.0: Applying patch firmware 'hda-jack-retask.fw'
Comment 97 mimran 2016-06-03 09:01:09 UTC
(In reply to Raymond from comment #93)
> https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/tree/
> Documentation/sound/alsa/HD-Audio.txt
> 
> 
> 
> Early Patching
> ~~~~~~~~~~~~~~
> When CONFIG_SND_HDA_PATCH_LOADER=y is set, you can pass a "patch" as a
> firmware file for modifying the HD-audio setup before initializing the
> codec.  This can work basically like the reconfiguration via sysfs in
> the above, but it does it before the first codec configuration.
> 
> A patch file is a plain text file which looks like below:
> 
> ------------------------------------------------------------------------
>   [codec]
>   0x12345678 0xabcd1234 2
> 
>   [model]
>   auto
> 
>   [pincfg]
>   0x12 0x411111f0 
> 
> did you set the correct codec id and subsystem id and model
> 
> since you need model dell-headset-multi to call the function 
> alc_fixup_headset_mode_alc668 to init the headset 
> 
> and those pin fix to remove headphone mic by the original mic jack and
> subwoofer
> remove the headphone jack so that line out type =speaker for the 2.1 channel
> map

data from my hda-jack-restask.fw file

[codec]
0x10ec0668 0x102805a9 0

[pincfg]
0x12 0x99a30140
0x14 0x90170110
0x15 0x0321101f
0x16 0x411111f0
0x18 0x40030008
0x19 0x03a11030
0x1a 0x90100111
0x1b 0x411111f0
0x1d 0x41000001
0x1e 0x411111f0
0x1f 0x411111f0
Comment 98 mimran 2016-06-03 09:15:15 UTC
(In reply to mohammed imran from comment #97)
> (In reply to Raymond from comment #93)
> > https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/tree/
> > Documentation/sound/alsa/HD-Audio.txt
> > 
> > 
> > 
> > Early Patching
> > ~~~~~~~~~~~~~~
> > When CONFIG_SND_HDA_PATCH_LOADER=y is set, you can pass a "patch" as a
> > firmware file for modifying the HD-audio setup before initializing the
> > codec.  This can work basically like the reconfiguration via sysfs in
> > the above, but it does it before the first codec configuration.
> > 
> > A patch file is a plain text file which looks like below:
> > 
> > ------------------------------------------------------------------------
> >   [codec]
> >   0x12345678 0xabcd1234 2
> > 
> >   [model]
> >   auto
> > 
> >   [pincfg]
> >   0x12 0x411111f0 
> > 
> > did you set the correct codec id and subsystem id and model
> > 
> > since you need model dell-headset-multi to call the function 
> > alc_fixup_headset_mode_alc668 to init the headset 
> > 
> > and those pin fix to remove headphone mic by the original mic jack and
> > subwoofer
> > remove the headphone jack so that line out type =speaker for the 2.1
> channel
> > map
> 
> data from my hda-jack-restask.fw file
> 
> [codec]
> 0x10ec0668 0x102805a9 0
> 
> [pincfg]
> 0x12 0x99a30140
> 0x14 0x90170110
> 0x15 0x0321101f
> 0x16 0x411111f0
> 0x18 0x40030008
> 0x19 0x03a11030
> 0x1a 0x90100111
> 0x1b 0x411111f0
> 0x1d 0x41000001
> 0x1e 0x411111f0
> 0x1f 0x411111f0


Amended file in hda-jack-restask.fw
[codec]
0x10ec0668 0x102805a9 0

[pincfg]
0x12 0x99a30140
0x14 0x90170110
0x15 0x0321101f
0x16 0x411111f0
0x18 0x40030008
0x19 0x03a11030
0x1a 0x90100111
0x1b 0x03a1113c /* use as headset mic, without its own jack detect */
0x1d 0x41000001
0x1e 0x411111f0
0x1f 0x411111f0

&&&&&&&&&&&&&&&&&&&

data as per alsa-base.conf
#my entry

snd_hda_intel: model=,dell-headset-multi, patch=,/lib/firmware/hdajackretask.fw
snd_hda_intel: patch=hda-jack-retask.fw,hda-jack-retask.fw,hda-jack-retask.fw,hda-jack-retask.fw

control.16 {
		iface CARD
		name 'Headset Mic Jack'
		value false
		comment {
			access read
			type BOOLEAN
			count 1
		}
	}

am i right? or wrong? file attached.
Comment 99 mimran 2016-06-03 09:37:13 UTC
(In reply to Raymond from comment #93)
> https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/tree/
> Documentation/sound/alsa/HD-Audio.txt
> 
> 
> 
> Early Patching
> ~~~~~~~~~~~~~~
> When CONFIG_SND_HDA_PATCH_LOADER=y is set, you can pass a "patch" as a
> firmware file for modifying the HD-audio setup before initializing the
> codec.  This can work basically like the reconfiguration via sysfs in
> the above, but it does it before the first codec configuration.
> 
> A patch file is a plain text file which looks like below:
> 
> ------------------------------------------------------------------------
>   [codec]
>   0x12345678 0xabcd1234 2
> 
>   [model]
>   auto
> 
>   [pincfg]
>   0x12 0x411111f0 
> 


#my entry

options snd_hda_intel: patch=hda-jack-retask.fw

control.16 {
		iface CARD
		name 'Headset Mic Jack'
		value false
		comment {
			access read
			type BOOLEAN
			count 1
		}
	}
> did you set the correct codec id and subsystem id and model
> 
> since you need model dell-headset-multi to call the function 
> alc_fixup_headset_mode_alc668 to init the headset 
> 
> and those pin fix to remove headphone mic by the original mic jack and
> subwoofer
> remove the headphone jack so that line out type =speaker for the 2.1 channel
> map

data form
Comment 100 Raymond 2016-06-03 10:07:52 UTC
only need this line 

options snd-hda-intel model=,dell-headset-multi patch=,hda-jack-retask.fw

and remove the line created by hda-jack-retask in alsa-base.conf
Comment 101 mimran 2016-06-03 11:06:07 UTC
(In reply to Raymond from comment #100)
> only need this line 
> 
> options snd-hda-intel model=,dell-headset-multi patch=,hda-jack-retask.fw
> 
> and remove the line created by hda-jack-retask in alsa-base.conf

I don't any other line has being created by hda-jack-restask. i have made the necessary amendments.

it is possible for you to remote into my system and you can run the test's needed.
Comment 102 Raymond 2016-06-03 12:49:20 UTC
[codec]
0x10ec0668 0x102805a9 0

[model]
dell-headset-multi

[pincfg]

0x16 0x411111f0
0x19 0x03a11030
0x1a 0x90100111
Comment 103 mimran 2016-06-03 12:56:52 UTC
Created attachment 218841 [details]
alsamixer

alsamixer state , have a look and tell.
Comment 104 Raymond 2016-06-03 13:52:28 UTC
You have to post output of alsa-info.sh

Check whether you have capture source which has three source

Internal Mic, headset Mic and Mic
Comment 105 Raymond 2016-06-03 14:23:05 UTC
http://bazaar.launchpad.net/~unity-settings-daemon-team/unity-settings-daemon/trunk/view/head:/plugins/media-keys/what-did-you-plug-in/pa-backend.c

The “what did you plug in”-dialog is a part of unity-settings-daemom,


this dialog is designed for those dell laptop with single combo jack and won't work on your dell alienware 14

as you cannot select your mic jack since the dialog is only looking of "Headphone mic jack"
Comment 106 Raymond 2016-06-03 23:09:47 UTC
(In reply to mohammed imran from comment #103)
> Created attachment 218841 [details]
> alsamixer
> 
> alsamixer state , have a look and tell.

This look like you are using dell-headset-multi plus subwoofer fix up


If Headphone Mic cannot be fixed up to Mic jack  by early patching  , you need to modify patch_realtek.c to create dell-alienware model
Comment 107 Raymond 2016-06-03 23:33:30 UTC
https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/plain/sound/pci/hda/patch_realtek.c


	[ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
		.type = HDA_FIXUP_PINS,
		.v.pins = (const struct hda_pintbl[]) {
			{ 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
			{ }
		},
		.chained = true,
		.chain_id = ALC668_FIXUP_HEADSET_MODE
	},


the simplest way is 

1) remove 'headphone mic" fixup from ALC668_FIXUP_DELL_MIC_NO_PRESENCE

2) remove node 0x16 "headphone'

3) add subwoofer pin

{ 0x16 , 0x411111f0 },

{ 0x1a , 0x90100111 },


recompile hda driver
Comment 108 Raymond 2016-06-04 02:18:51 UTC
enum {
	ALC662_FIXUP_ASPIRE,
	ALC662_FIXUP_LED_GPIO1,
	ALC662_FIXUP_IDEAPAD,
	ALC272_FIXUP_MARIO,
	ALC662_FIXUP_CZC_P10T,
	ALC662_FIXUP_SKU_IGNORE,
	ALC662_FIXUP_HP_RP5800,
	ALC662_FIXUP_ASUS_MODE1,
	ALC662_FIXUP_ASUS_MODE2,
	ALC662_FIXUP_ASUS_MODE3,
	ALC662_FIXUP_ASUS_MODE4,
	ALC662_FIXUP_ASUS_MODE5,
	ALC662_FIXUP_ASUS_MODE6,
	ALC662_FIXUP_ASUS_MODE7,
	ALC662_FIXUP_ASUS_MODE8,
	ALC662_FIXUP_NO_JACK_DETECT,
	ALC662_FIXUP_ZOTAC_Z68,
	ALC662_FIXUP_INV_DMIC,
	ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
	ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
	ALC662_FIXUP_HEADSET_MODE,
	ALC668_FIXUP_HEADSET_MODE,
	ALC662_FIXUP_BASS_MODE4_CHMAP,
	ALC662_FIXUP_BASS_16,
	ALC662_FIXUP_BASS_1A,
	ALC662_FIXUP_BASS_CHMAP,
	ALC668_FIXUP_AUTO_MUTE,
	ALC668_FIXUP_DELL_DISABLE_AAMIX,
	ALC668_FIXUP_DELL_XPS13,
	ALC662_FIXUP_ASUS_Nx50,
	ALC668_FIXUP_ASUS_Nx51,
        ALC668_FIXUP_DELL_ALIENWARE.
        A:C668_FIXUP_DELL_ALIENWARE_51,
};










	[ALC668_FIXUP_DELL_ALIENWARE] = {
		.type = HDA_FIXUP_PINS,
		.v.pins = (const struct hda_pintbl[]) {
                        { 0x16 , 0x411111f0 },
                        { 0x1a , 0x90100111 },
			{ 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
			{ }
		},
		.chained = true,
		.chain_id = ALC668_FIXUP_HEADSET_MODE
	},

	[ALC668_FIXUP_DELL_ALIENWARE_51] = {
		.type = HDA_FIXUP_PINS,
		.v.pins = (const struct hda_pintbl[]) {
                   {0x15, 0x02014010},     
                   {0x16, 0x02014011},
                   {0x19, 0x02014012},    
			{ }
		},

	},





static const struct hda_model_fixup alc662_fixup_models[] = {
	{.id = ALC272_FIXUP_MARIO, .name = "mario"},
	{.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
	{.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
	{.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
	{.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
	{.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
	{.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
	{.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
	{.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},	
        {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
	{.id = ALC668_FIXUP_DELL_ALIENWARE, .name = "dell-alienware"},
	{.id = ALC668_FIXUP_DELL_ALIENWARE_51, .name = "dell-51"},
	{}
};
Comment 109 Raymond 2016-06-04 04:14:12 UTC
(In reply to mohammed imran from comment #103)
> Created attachment 218841 [details]
> alsamixer
> 
> alsamixer state , have a look and tell.

do the headset mic work as expected or not ?

the early patching fix the pin before driver apply dell-headset-multi model pin fixup

so the mic jack cannot be fix up


you can use hint to disable loopback mixing if this is any noise simolar to xps 13 using ALC668_FIXUP_DELL_DISABLE_AAMIX

[hint]
mixer_nid=0
Comment 110 mimran 2016-06-04 04:48:47 UTC
(In reply to Raymond from comment #104)
> You have to post output of alsa-info.sh
> 
> Check whether you have capture source which has three source
> 
> Internal Mic, headset Mic and Mic

Your ALSA information is located at 

http://www.alsa-project.org/db/?f=cc4c2d4193b7b9ba3ee9be368f1fecb023930b3d
Comment 111 mimran 2016-06-04 04:51:35 UTC
(In reply to Raymond from comment #106)
> (In reply to mohammed imran from comment #103)
> > Created attachment 218841 [details]
> > alsamixer
> > 
> > alsamixer state , have a look and tell.
> 
> This look like you are using dell-headset-multi plus subwoofer fix up
> 
> 
> If Headphone Mic cannot be fixed up to Mic jack  by early patching  , you
> need to modify patch_realtek.c to create dell-alienware model

Yup you are right, when plugging in my earphone (Apple iphones model) i get to see the unity dialog, asking me what i have inserted. Pic attached.
Comment 112 mimran 2016-06-04 04:52:09 UTC
Created attachment 218901 [details]
dialog box unity

Yup you are right, when plugging in my earphone (Apple iphones model) i get to see the unity dialog, asking me what i have inserted. Pic attached.
Comment 113 mimran 2016-06-04 04:55:41 UTC
(In reply to mohammed imran from comment #112)
> Created attachment 218901 [details]
> dialog box unity
> 
> Yup you are right, when plugging in my earphone (Apple iphones model) i get
> to see the unity dialog, asking me what i have inserted. Pic attached.

But the dialog only pops up when i plug it in my headphones with mic icon, the third plughole of the three  O-O-O (Mic-HeadPhone-Headphone/w Mic).
Comment 114 mimran 2016-06-04 04:59:33 UTC
(In reply to Raymond from comment #102)
> [codec]
> 0x10ec0668 0x102805a9 0
> 
> [model]
> dell-headset-multi
> 
> [pincfg]
> 
> 0x16 0x411111f0
> 0x19 0x03a11030
> 0x1a 0x90100111

[codec]
0x10ec0668 0x102805a9 0

[model]
dell-headset-multi

[pincfg]
0x12 0x99a30140
0x14 0x90170110
0x15 0x0321101f
0x16 0x411111f0
0x18 0x40030008
0x19 0x03a11030
0x1a 0x90100111
0x1b 0x03a1113c /* use as headset mic, without its own jack detect */
0x1d 0x41000001
0x1e 0x411111f0
0x1f 0x411111f0

ok, do i need to remove the extra pincfg?
Comment 115 mimran 2016-06-04 05:01:07 UTC
(In reply to Raymond from comment #107)
> https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/plain/sound/pci/
> hda/patch_realtek.c
> 
> 
>       [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
>               .type = HDA_FIXUP_PINS,
>               .v.pins = (const struct hda_pintbl[]) {
>                       { 0x19, 0x03a1913d }, /* use as headphone mic, without
> its own jack
> detect */
>                       { 0x1b, 0x03a1113c }, /* use as headset mic, without
> its own jack detect
> */
>                       { }
>               },
>               .chained = true,
>               .chain_id = ALC668_FIXUP_HEADSET_MODE
>       },
> 
> 
> the simplest way is 
> 
> 1) remove 'headphone mic" fixup from ALC668_FIXUP_DELL_MIC_NO_PRESENCE
> 
> 2) remove node 0x16 "headphone'
> 
> 3) add subwoofer pin
> 
> { 0x16 , 0x411111f0 },
> 
> { 0x1a , 0x90100111 },
> 
> 
> recompile hda driver

Umm, how to do this patching stuff and where to paste this code? Was your a suggestion or a test for me to perform?
Comment 116 Raymond 2016-06-04 11:50:04 UTC
(In reply to mohammed imran from comment #110)
> (In reply to Raymond from comment #104)
> > You have to post output of alsa-info.sh
> > 
> > Check whether you have capture source which has three source
> > 
> > Internal Mic, headset Mic and Mic
> 
> Your ALSA information is located at 
> 
> http://www.alsa-project.org/db/?f=cc4c2d4193b7b9ba3ee9be368f1fecb023930b3d

snd_hda_intel: model=,dell-headset-multi patch=,hda-jack-retask.fw
snd_hda_intel: patch=hda-jack-retask.fw,hda-jack-retask.fw,hda-jack-retask.fw,hda-jack-retask.fw



you still have two lines in alsa-base.conf

options snd-hda-intel model=,dell-headset-multi patch=,hda-jack-retask.fw
options snd-hda-intel patch=hda-jack-retask.fw,hda-jack-retask.fw,hda-jack-retask.fw,hda-jack-retask.fw

you have to remove 

options snd-hda-intel patch=hda-jack-retask.fw,hda-jack-retask.fw,hda-jack-retask.fw,hda-jack-retask.fw
Comment 117 mimran 2016-06-04 16:51:17 UTC
Created attachment 219001 [details]
Comment 116

See only one line that you have asked should remain? i don't know where the extra one got inserted.
Comment 118 mimran 2016-06-04 16:51:48 UTC
(In reply to Raymond from comment #116)
> (In reply to mohammed imran from comment #110)
> > (In reply to Raymond from comment #104)
> > > You have to post output of alsa-info.sh
> > > 
> > > Check whether you have capture source which has three source
> > > 
> > > Internal Mic, headset Mic and Mic
> > 
> > Your ALSA information is located at 
> > 
> > http://www.alsa-project.org/db/?f=cc4c2d4193b7b9ba3ee9be368f1fecb023930b3d
> 
> snd_hda_intel: model=,dell-headset-multi patch=,hda-jack-retask.fw
> snd_hda_intel:
> patch=hda-jack-retask.fw,hda-jack-retask.fw,hda-jack-retask.fw,hda-jack-
> retask.fw
> 
> 
> 
> you still have two lines in alsa-base.conf
> 
> options snd-hda-intel model=,dell-headset-multi patch=,hda-jack-retask.fw
> options snd-hda-intel
> patch=hda-jack-retask.fw,hda-jack-retask.fw,hda-jack-retask.fw,hda-jack-
> retask.fw
> 
> you have to remove 
> 
> options snd-hda-intel
> patch=hda-jack-retask.fw,hda-jack-retask.fw,hda-jack-retask.fw,hda-jack-
> retask.fw

See only one line that you have asked should remain? i don't know where the extra one got inserted.
Comment 119 Raymond 2016-06-05 06:50:55 UTC
(In reply to mohammed imran from comment #115)
> (In reply to Raymond from comment #107)
> >
> https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/plain/sound/pci/
> > hda/patch_realtek.c
> > 
> > 
> >     [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
> >             .type = HDA_FIXUP_PINS,
> >             .v.pins = (const struct hda_pintbl[]) {
> >                     { 0x19, 0x03a1913d }, /* use as headphone mic, without
> its own jack
> > detect */
> >                     { 0x1b, 0x03a1113c }, /* use as headset mic, without
> its own jack detect
> > */
> >                     { }
> >             },
> >             .chained = true,
> >             .chain_id = ALC668_FIXUP_HEADSET_MODE
> >     },
> > 







> Umm, how to do this patching stuff and where to paste this code? Was your a
> suggestion or a test for me to perform?

just append at the end of alc662_fixup[] after [ALC668_FIXUP_ASUS_Nx51]

s
Comment 120 Raymond 2016-06-05 13:09:58 UTC
to enable both headphone and headset, you need to test whether headset and headphone can share volume control by prefered_dacs, this force driver assigned DACs to speaker and bass speaker first


	static hda_nid_t preferred_pair[] = {
+		0x14, 0x02,
+		0x1a, 0x03,
+		0x15, 0x04,
+		0x16, 0x04,
+		0
+	};

+	spec->gen.preferred_dacs = preferred_pair;
Comment 121 mimran 2016-06-07 16:22:43 UTC
(In reply to Raymond from comment #120)
> to enable both headphone and headset, you need to test whether headset and
> headphone can share volume control by prefered_dacs, this force driver
> assigned DACs to speaker and bass speaker first
> 
> 
>       static hda_nid_t preferred_pair[] = {
> +             0x14, 0x02,
> +             0x1a, 0x03,
> +             0x15, 0x04,
> +             0x16, 0x04,
> +             0
> +     };
> 
> +     spec->gen.preferred_dacs = preferred_pair;

So you want me to copy the code above, and edit the patch_realtek.c with the changes above and then recompile a new kernel? right
Comment 122 mimran 2016-08-29 18:48:09 UTC
Hi,

Sorry was away on vacation.

Any update on the issue?
Comment 123 mimran 2016-09-02 10:42:37 UTC
(In reply to Raymond from comment #120)
> to enable both headphone and headset, you need to test whether headset and
> headphone can share volume control by prefered_dacs, this force driver
> assigned DACs to speaker and bass speaker first
> 
> 
>       static hda_nid_t preferred_pair[] = {
> +             0x14, 0x02,
> +             0x1a, 0x03,
> +             0x15, 0x04,
> +             0x16, 0x04,
> +             0
> +     };
> 
> +     spec->gen.preferred_dacs = preferred_pair;

Hey Raymond, any updates yet? or progress? Please advise?
Comment 124 Imran J 2017-03-17 10:25:18 UTC
Hi, can anyone else up take this bug or issue up?
Comment 125 mimran 2017-03-24 10:28:30 UTC
So you fix the sound:

1. Open a Terminal (Ctrl + Alt + T).

2. Write 'sudo su' to login as root.

3. Install via apt 'alsa-tools-gui'.

4. Logout via exit.

5. Write 'hdajackretask' and press enter.


6. Click on 'Intel Haswell HDMI' and select 'Realtek ALC3661'.

7. A lot of new entrys are visible. Select 'Show unconnected pins'.

8. Click on 'Overwrite' on Pin ID '0x1a'.

9. Click on the Context Menu and select 'Line out (Center/LFE)'.

10. Click on 'Apply now' and enter your user password.

11. Click on 'Install boot overwrite' to save the settings permanently.

12. Click on your Volume Icon on the top (Ubuntu Unity) and remove the marker 'mute'.

13. Reboot and your sound work perfect.
Comment 126 Gary 2017-03-29 02:45:05 UTC
Created attachment 255623 [details]
After reboot

Followed the Above on my Alienware 18 running Linux Mint 18.1

I did everything in the list above 

apart from "Click on your Volume Icon on the top (Ubuntu Unity) and remove the marker 'mute'."

as It didn't show anything different in my Sound properties 

The attachment shown is after a reboot 

So its back to the drawing board for me 
Cheers
Gaz
Comment 127 mimran 2017-03-29 12:17:31 UTC
Mine is Alienware 14, and sound is fine now, a major improvement, but as you see the developer of person assisting me,has now disappeared.
I am on Ubuntu 16.10.

mail me on imranmohd72@hotmail.com or come to ubuntu IRC channel and we shall take it from their. see what can be done.

regards.
Comment 128 Gary 2017-03-30 15:17:46 UTC
Ok I did a full reinstall this arvo
First thing I did was the Fix above 

But sadly it has had no effect
Back to the drawing board
Comment 129 mimran 2017-03-30 20:44:40 UTC
I hope someone pics up our bug report.
Comment 130 mimran 2017-03-31 15:10:02 UTC
sudo] password for immu: 
**** List of PLAYBACK Hardware Devices ****
card 0: HDMI [HDA Intel HDMI], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: HDMI [HDA Intel HDMI], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: HDMI [HDA Intel HDMI], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: PCH [HDA Intel PCH], device 0: ALC3661 Analog [ALC3661 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
Comment 131 Gary 2017-04-01 14:00:47 UTC
Here are mine


gaz-alienware # arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC3661 Analog [ALC3661 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Wow I wonder where HDMI has gone
Comment 132 Gary 2017-04-01 14:14:42 UTC
Created attachment 255685 [details]
Sound

Found them


gazalienware-Alienware-18 ~ $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC3661 Analog [ALC3661 Analog]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0





gaz-alienware # lspci | grep -i audio
00:1b.0 Audio device: Intel Corporation 8 Series/C220 Series Chipset High Definition Audio Controller (rev 04)
01:00.1 Audio device: NVIDIA Corporation GK106 HDMI Audio Controller (rev a1)
Comment 133 Gary 2017-04-01 14:25:38 UTC
Created attachment 255687 [details]
Alsa
Comment 134 Gary 2017-04-01 14:26:48 UTC
Created attachment 255689 [details]
htmi
Comment 135 Gary 2017-04-01 14:29:00 UTC
Created attachment 255691 [details]
more