Re: [alsa-devel] [ALC668]: Asus N751JK - mic selection not working
Ports:
analog-output-speaker: Speakers (priority: 10000) analog-output-headphones: Headphones (priority: 9000,
not available)
Active Port: analog-output-speaker
When you select model=dell-headset-multi, the driver create "Headphone
Mic Jack" kctl with type 1 which is SND_JACK_HEADPHONE
type 2 is SND_JACK_MICROPHONE
type 3 is SND_JACK_HEADSET but hda jack does not use this type
https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/tree/include/so...
JACK created Headphone Mic, type 1 CTRL: add: Headphone Mic Jack:0 JACK report Headphone Mic, status 0 JACK created Headset Mic Phantom, type 2 CTRL: add: Headset Mic Phantom Jack:0 JACK report Headset Mic Phantom, status 2 CTL Notify: Headset Mic Phantom Jack:0, mask=1 JACK created Internal Mic Phantom, type 2 CTRL: add: Internal Mic Phantom Jack:0 JACK report Internal Mic Phantom, status 2 CTL Notify: Internal Mic Phantom Jack:0, mask=1 JACK created Speaker Front Phantom, type 4 CTRL: add: Speaker Front Phantom Jack:0 JACK report Speaker Front Phantom, status 4 CTL Notify: Speaker Front Phantom Jack:0, mask=1 JACK created External Subwoofer, type 4 CTRL: add: External Subwoofer Jack:0
The problem of hda jack kctls are those retaskable I/O jack controls
- multi io jacks in those 3 stack desktop
- headphone/mic jack in asus netbook
- dell-headset-multi combo jack
the role of the jack in 1) change from input to output when "Channel
mode" change from "2ch" to "4ch" or "6ch"
the role of the jack in 2) and 3) change from Output to Input when
"Capture Source" change from Internal Mic/Headset Mic to Headphone Mic
In your case, Headphone Mic Jack kctl return the presence of HP jack
except when the combo jack is set to support conventional mic (i.e. when the driver change pin ctl of hp pin node 0x15 to zero and set pin ctl of mic pin to IN),
The driver already unmute the internal speaker when you change capture
source to Headphone Mic
The only point is whether pulseaudio still regard this Headphone Mic
Jack as the availability of the headphone port when the capture source is Headphone Mic
http://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/?id=ca4942e89cf462e...
I really appreciate your efforts in this matter. Unfortunately I
understand parts of our talks and I am unsure what I can do.
I am not a kernel / driver developer.
Are there any steps I can do knowing my limited skills on driver
development?
If so, would you mind to describe them step by step, so this beginner
understands? :D
Don't forget cc David since he implement dell-headset-multi
https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pc...
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; + + if (new_headset_mode == spec->current_headset_mode) + return; + + switch (new_headset_mode) { + case ALC_HEADSET_MODE_UNPLUGGED: + alc_headset_mode_unplugged(codec); + spec->gen.hp_jack_present = false; + break; + case ALC_HEADSET_MODE_HEADSET: + if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN) + alc_determine_headset_type(codec); + if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA) + alc_headset_mode_ctia(codec); + else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP) + alc_headset_mode_omtp(codec); + spec->gen.hp_jack_present = true; + break; + case ALC_HEADSET_MODE_MIC: + alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin); + spec->gen.hp_jack_present = false; + break; + case ALC_HEADSET_MODE_HEADPHONE: + alc_headset_mode_default(codec); + spec->gen.hp_jack_present = true; + break; + } + if (new_headset_mode != ALC_HEADSET_MODE_MIC) { + snd_hda_set_pin_ctl_cache(codec, hp_pin, + AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN); + if (spec->headphone_mic_pin) + snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin, + PIN_VREFHIZ); + } + spec->current_headset_mode = new_headset_mode; + + snd_hda_gen_update_outputs(codec); +}
You have to post the output of
pactl list sources
when the is no jack plugged, headphone plugged, headset plugged and mic jack plugged
The logic is defined in alc_update_headset_mode()
Although auto mic selection is disabled when the combo jack can support conventional mic and headset mic
The capture source of these kind of laptop is not as same as the capture source of ac97 codec of pci sound cards, it is not really manually selected in sound preference
When there is no jack plugged in, the capture source should be internal mic.
As the codec cannot differentitate headset, headphone and mic when there is jack plugged in and driver use mux_pin to determine the type of the jack
In pulseaudio term,
[Jack Headphone Mic] can determine the availability of internal mic is YES when unplugged but unknown when plugged
http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/mixe...
[Jack Headphone Mic]
The availability of headphone mic is unknown when plugged and NO when unplugged
http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/mixe...
[Jack Headphone Mic]
The availability of headset mic is unknown when plugged and NO when unplugged
http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/mixe...
It is not exactly UNKNOWN but determined by the capture source when plugged
Result of "pactl list sources" plugged and unplugged in this order, with your previous patches applied.
Nothing: http://pastebin.com/RWuiW0RG Headphones: http://pastebin.com/GvEkQ8HB Microphone: http://pastebin.com/NRiREULS Headset: http://pastebin.com/QuGLFD8A Subwoofer: http://pastebin.com/nxZNGgyY
On 1 August 2015 at 03:41, Raymond Yau superquad.vortex2@gmail.com wrote:
Ports:
analog-output-speaker: Speakers (priority: 10000) analog-output-headphones: Headphones (priority: 9000,
not available)
Active Port: analog-output-speaker
When you select model=dell-headset-multi, the driver create "Headphone
Mic Jack" kctl with type 1 which is SND_JACK_HEADPHONE
type 2 is SND_JACK_MICROPHONE
type 3 is SND_JACK_HEADSET but hda jack does not use this type
https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/tree/include/so...
JACK created Headphone Mic, type 1 CTRL: add: Headphone Mic Jack:0 JACK report Headphone Mic, status 0 JACK created Headset Mic Phantom, type 2 CTRL: add: Headset Mic Phantom Jack:0 JACK report Headset Mic Phantom, status 2 CTL Notify: Headset Mic Phantom Jack:0, mask=1 JACK created Internal Mic Phantom, type 2 CTRL: add: Internal Mic Phantom Jack:0 JACK report Internal Mic Phantom, status 2 CTL Notify: Internal Mic Phantom Jack:0, mask=1 JACK created Speaker Front Phantom, type 4 CTRL: add: Speaker Front Phantom Jack:0 JACK report Speaker Front Phantom, status 4 CTL Notify: Speaker Front Phantom Jack:0, mask=1 JACK created External Subwoofer, type 4 CTRL: add: External Subwoofer Jack:0
The problem of hda jack kctls are those retaskable I/O jack controls
- multi io jacks in those 3 stack desktop
- headphone/mic jack in asus netbook
- dell-headset-multi combo jack
the role of the jack in 1) change from input to output when "Channel
mode" change from "2ch" to "4ch" or "6ch"
the role of the jack in 2) and 3) change from Output to Input when
"Capture Source" change from Internal Mic/Headset Mic to Headphone Mic
In your case, Headphone Mic Jack kctl return the presence of HP jack
except when the combo jack is set to support conventional mic (i.e. when the driver change pin ctl of hp pin node 0x15 to zero and set pin ctl of mic pin to IN),
The driver already unmute the internal speaker when you change capture
source to Headphone Mic
The only point is whether pulseaudio still regard this Headphone Mic
Jack as the availability of the headphone port when the capture source is Headphone Mic
http://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/?id=ca4942e89cf462e...
I really appreciate your efforts in this matter. Unfortunately I
understand parts of our talks and I am unsure what I can do.
I am not a kernel / driver developer.
Are there any steps I can do knowing my limited skills on driver
development?
If so, would you mind to describe them step by step, so this beginner
understands? :D
Don't forget cc David since he implement dell-headset-multi
https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pc...
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;
- if (new_headset_mode == spec->current_headset_mode)
- return;
- switch (new_headset_mode) {
- case ALC_HEADSET_MODE_UNPLUGGED:
- alc_headset_mode_unplugged(codec);
- spec->gen.hp_jack_present = false;
- break;
- case ALC_HEADSET_MODE_HEADSET:
- if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
- alc_determine_headset_type(codec);
- if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
- alc_headset_mode_ctia(codec);
- else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
- alc_headset_mode_omtp(codec);
- spec->gen.hp_jack_present = true;
- break;
- case ALC_HEADSET_MODE_MIC:
- alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
- spec->gen.hp_jack_present = false;
- break;
- case ALC_HEADSET_MODE_HEADPHONE:
- alc_headset_mode_default(codec);
- spec->gen.hp_jack_present = true;
- break;
- }
- if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
- snd_hda_set_pin_ctl_cache(codec, hp_pin,
- AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
- if (spec->headphone_mic_pin)
- snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
- PIN_VREFHIZ);
- }
- spec->current_headset_mode = new_headset_mode;
- snd_hda_gen_update_outputs(codec);
+}
You have to post the output of
pactl list sources
when the is no jack plugged, headphone plugged, headset plugged and mic jack plugged
The logic is defined in alc_update_headset_mode()
Although auto mic selection is disabled when the combo jack can support conventional mic and headset mic
The capture source of these kind of laptop is not as same as the capture source of ac97 codec of pci sound cards, it is not really manually selected in sound preference
When there is no jack plugged in, the capture source should be internal mic.
As the codec cannot differentitate headset, headphone and mic when there is jack plugged in and driver use mux_pin to determine the type of the jack
In pulseaudio term,
[Jack Headphone Mic] can determine the availability of internal mic is YES when unplugged but unknown when plugged
http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/mixe...
[Jack Headphone Mic]
The availability of headphone mic is unknown when plugged and NO when unplugged
http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/mixe...
[Jack Headphone Mic]
The availability of headset mic is unknown when plugged and NO when unplugged
http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/mixe...
It is not exactly UNKNOWN but determined by the capture source when plugged
- External microphone
The Asus N751JK notebook (ALC668) has a 3,5mm 4-ring combo jack for headphones and microphone. The headphone is detected correct and auto-mute works good (jack
detection).
The microphone is not detected and does not work.
I was unable to get it to work with hdajackretask or any of the Asus model
settings, such as:
- options snd_hda_intel model=,asus-mode4
I was able to get the microphone to work with the following setting:
- options snd_hda_intel model=,dell-headset-multi
This setting creates two new items in PulseAudio making a total of three:
- Internal microphone (works out of the box)
- Headset microphone (works indeed with a headset)
- Microphone (don't know if this works, since I don't have a single
microphone, but it does not work with the headset)
Unfortunately the auto-input-device-switch to the Headset microphone does not seem to work. When I plugin a headset, the headphones get detected and the Internal
speakers are muted.
The Input device does not automatically switch from Internal microphone to
Headset microphone.
I have to do this manually, after which it works. I don't know if the microphone has a jack detection. If it does not, maybe it is possible to use the headphones jack detection?
I have added the alsa-info without any snd_intel / alsa modifications
here: http://www.alsa-project.org/db/?f=0b5135bd12f28bb5cb182f83bfa21bc50022faa6
Result of "pactl list sources" plugged and unplugged in this order, with
your previous patches applied.
Nothing: http://pastebin.com/RWuiW0RG Headphones: http://pastebin.com/GvEkQ8HB Microphone: http://pastebin.com/NRiREULS Headset: http://pastebin.com/QuGLFD8A Subwoofer: http://pastebin.com/nxZNGgyY
For dell-headset-multi, [JACK Headphone Mic] may need fix in pulseaudio
conf files
However it seem that Sound Preference in Mate Ubutnu 15.10 Alpha only show active port of the source and You have to use pavucontrol to change the Capture Source/Active port manually after you plug the jack
diff --git a/src/modules/alsa/mixer/paths/analog-input-headphone-mic.conf b/src/modules/alsa/mixer/paths/analog-input-headphone-mic.conf index eb5740a..9930916 100644 --- a/src/modules/alsa/mixer/paths/analog-input-headphone-mic.conf +++ b/src/modules/alsa/mixer/paths/analog-input-headphone-mic.conf @@ -25,6 +25,7 @@ description-key = analog-input-microphone [Jack Headphone Mic] required-any = any state.plugged = unknown +state.unplugged = no
[Element Capture] switch = mute diff --git a/src/modules/alsa/mixer/paths/analog-input-headset-mic.conf b/src/modules/alsa/mixer/paths/analog-input-headset-mic.conf index a67e1db..f7731de 100644 --- a/src/modules/alsa/mixer/paths/analog-input-headset-mic.conf +++ b/src/modules/alsa/mixer/paths/analog-input-headset-mic.conf @@ -34,6 +34,7 @@ state.plugged = unknown
[Jack Headphone Mic] state.plugged = unknown +state.unplugged = no
[Element Capture] switch = mute diff --git a/src/modules/alsa/mixer/paths/analog-input-internal-mic.conf b/src/modules/alsa/mixer/paths/analog-input-internal-mic.conf index 898410a..ae8c97f 100644 --- a/src/modules/alsa/mixer/paths/analog-input-internal-mic.conf +++ b/src/modules/alsa/mixer/paths/analog-input-internal-mic.conf @@ -38,6 +38,10 @@ state.unplugged = unknown state.plugged = no state.unplugged = unknown
+[Jack Headphone Mic] +state.plugged = unknown +state.unplugged = yes + [Jack Internal Mic Phantom] state.plugged = unknown state.unplugged = unknown
Following is a variant of the dell-headset-multi which support headset only
asus_headset model require
1) pin fixup only the headset mic pin and no headphone mic pin 2) create "Headset Mic Jack" kctl by spec->hs_mic_use_hp_sense and new version of __snd_hda_jack_add_kct() with hp_pin as sense_nid "Headset Mic Jack" is also slave of "Headphone Jack"
3) modify check_auto_mic_availability() to allow auto mic selection for headset mic which use hs_mic_use_hp_sense 4) update mux_pin for alc668 codec when spec->auto_mic and alc668_combo_type is equal to ALC_HEADSET_MODE_HEADSET by snd_hda_gen_mic_autoswitch()
This new model only support headset and it does not support headphone nor mic, only headphone has event input device and no headset mic event input
For Dell Alienware 14, 17 and 18 which have three jacks: headset, headphone and mic, auto_mic is not enabled since two of the three capture sources are detectable
I have applied the patch against the mainline kernel 4.2.0-rc5. I have created the file /etc/modprobe.d/alsa-base.conf and added this line and rebooted.
options snd_hda_intel model=,asus-headset
Works --------- Subwoofer Plugging and unplugging 3,5mm jack: PA switches from speakers to headphones and from internal microphone to headset microphone. Playing music on speakers Playing music on headset
Does not work ------------------- Microphone: My voice by the headset is not getting to PA. When playing music the VU meters of the Headphones (= good) and the Microphone (= not good) in PA show both the music playing.
I have applied the patch against the mainline kernel 4.2.0-rc5. I have created the file /etc/modprobe.d/alsa-base.conf and added this
line and rebooted.
options snd_hda_intel model=,asus-headset
Works
Subwoofer Plugging and unplugging 3,5mm jack: PA switches from speakers to
headphones and from internal microphone to headset microphone.
Playing music on speakers Playing music on headset
Does not work
Microphone: My voice by the headset is not getting to PA. When playing music the VU meters of the Headphones (= good) and the
Microphone (= not good) in PA show both the music playing.
Please try alc668_asus_dell_alienware.patch
1) add debug statement to show "Mic 0x1b plugged" or "Internal Mic selected" in snd_hda_gen_mic_autoswitch()
2) show mux_pin before and after calling snd_hda_gen_mic_autoswitch() in alc_update_headset_mode()
3) change codec_dbg() related to headset mode to codec_info()
4) add dell-alienware model to demonstrate the usage of headset jack
new_headset_mode alway change to ALC_HEADSET_MODE_HEADSET when hp_pin is plugged
if (!snd_hda_jack_detect(codec, hp_pin)) new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED; + else if (codec->core.vendor_id == 0x10ec0668 && + spec->gen.hs_mic_use_hp_sense) + new_headset_mode = ALC_HEADSET_MODE_HEADSET; else if (mux_pin == spec->headset_mic_pin) new_headset_mode = ALC_HEADSET_MODE_HEADSET; else if (mux_pin == spec->headphone_mic_pin)
5) change the "Headphone Playback Volume" and "Headphone Playback Switch" to "Headset Playback Volume" and "Headset Playback Switch" for those combo jack which support headset only
Headphone Jack and Headset Mic Jack kctls should return same value at any time and this mean that it won't support headphone As internal mic is only connected to audio input node 0x07 and driver use dynamic ADC switching , headset mic use audio input node 0x08
The stream tag of Converter of one of Audio Output (0x07/0x08) is non zero when the connected mic is selected
Converter: stream=0, channel=0 Can you post the output of alsa-info.sh while recording from headset mic with dump_coef =1 which dump the coeffs in vendor defined widget node 0x20 ?
https://bugzilla.kernel.org/show_bug.cgi?id=87771#c17 Node 0x20 [Vendor Defined Widget] wcaps 0xf00040: Mono Processing caps: benign=0, ncoeff=197
Please check the system log
a) "mic 0x1b plugged" and "Internal Mic select" when you plug and unplug headset
b) whether the driver set your headset to CITA (IPhone) or OMTP (Nokia)
case 0x10ec0668: alc_write_coef_idx(codec, 0x11, 0x0001); alc_write_coef_idx(codec, 0xb7, 0x802b); alc_write_coef_idx(codec, 0x15, 0x0d60); alc_write_coef_idx(codec, 0xc3, 0x0c00); msleep(300); val = alc_read_coef_idx(codec, 0xbe); is_ctia = (val & 0x1c02) == 0x1c02; break; }
snd_printdd("Headset jack detected iPhone-style headset: %s\n", is_ctia ? "yes" : "no"); spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
participants (2)
-
Arthur Borsboom
-
Raymond Yau