2015-09-13 16:13 GMT+08:00 Takashi Iwai tiwai@suse.de:
On Sat, 12 Sep 2015 23:09:43 +0200, Arthur Borsboom wrote:
Hi Takashi,
Previous month Raymond Yau has done great work to get the audio working
for
the Asus N751JK laptop. He developed 7 patches, which I have tested and confirmed working on this laptop.
Raymond is not responding for about two weeks (maybe on holiday?). Would you mind to post these patches on the mailinglist (the correct way) and/or merge them in a way the get into the mainline kernel a.s.a.p?
Sorry, it can't be done like that. The patches aren't yet in acceptable forms, and it needs more changes to be merged to mainline. It must be done by someone who did it originally or who has the hardware and test.
I don't have the hardware, the alternate approach is to create headset jack (SND_JACK_HEADSET) and skip the creation of headset mic phanton jack instead of headphone jack and headset mic jack since implement sense_nid and slave_nid is not easy to debug
What you need is adding "Jack Headset" to pulseaudio analog-input-headset-mic.conf since "Headset Jack" kctl already in analog-out-headphones.conf
static int get_input_jack_type(struct hda_codec *codec, hda_nid_t nid) { + struct hda_gen_spec *spec = codec->spec; + struct auto_pin_cfg *cfg = &spec->autocfg; unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid); 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 == auto_cfg_hp_pins(cfg)[0])) + return SND_JACK_HEADSET; return SND_JACK_HEADPHONE; case AC_JACK_SPDIF_OUT: case AC_JACK_DIG_OTHER_OUT:
const struct auto_pin_cfg *cfg) { const hda_nid_t *p; + struct hda_gen_spec *spec = codec->spec; int i, err;
for (i = 0; i < cfg->num_inputs; i++) { @@ -482,6 +499,12 @@ int snd_hda_jack_add_kctls(struct hda_codec *codec, err = add_jack_kctl(codec, cfg->inputs[i].pin, cfg, "Headphone Mic"); } else + if (cfg->inputs[i].is_headset_mic && + spec->hs_mic_use_hp_sense && + !is_jack_detectable(codec, cfg->inputs[i].pin)) { + err = 0; + + } else err = add_jack_kctl(codec, cfg->inputs[i].pin, cfg, NULL); if (err < 0) @@ -489,14 +512,21 @@ int snd_hda_jack_add_kctls(struct hda_codec *codec, }
for (i = 0, p = cfg->line_out_pins; i < cfg->line_outs; i++, p++) { - err = add_jack_kctl(codec, *p, cfg, NULL); + if (is_subwoofer(codec, *p, i, cfg->line_outs) && + is_external_pin(codec, *p)) + err = add_jack_kctl(codec, *p, cfg, "Ext Subwoofer"); + else + err = add_jack_kctl(codec, *p, cfg, NULL); if (err < 0) return err; } for (i = 0, p = cfg->hp_pins; i < cfg->hp_outs; i++, p++) { if (*p == *cfg->line_out_pins) /* might be duplicated */ break; - err = add_jack_kctl(codec, *p, cfg, NULL); + if (i == 0 && spec->hs_mic_use_hp_sense) + err = add_jack_kctl(codec, *p, cfg, "Headset"); + else + err = add_jack_kctl(codec, *p, cfg, NULL); if (err < 0) return err; }
change the pin to hp pin when mic pin is headset mic
+bool is_headset_mic(struct hda_codec *codec, hda_nid_t nid) +{ + struct hda_gen_spec *spec = codec->spec; + struct auto_pin_cfg *cfg = &spec->autocfg; + int i; + + for (i = 0; i < cfg->num_inputs; i++) + if (nid == cfg->inputs[i].pin) + return cfg->inputs[i].is_headset_mic; + return false; +} +
@@ -4384,6 +4399,8 @@ void snd_hda_gen_mic_autoswitch(struct hda_codec *codec, /* don't detect pins retasked as outputs */ if (snd_hda_codec_get_pin_target(codec, pin) & AC_PINCTL_OUT_EN) continue; + if (is_headset_mic(codec, pin) && spec->hs_mic_use_hp_sense) + pin = auto_cfg_hp_pins(cfg)[0]; if (snd_hda_jack_detect_state(codec, pin) == HDA_JACK_PRESENT) { mux_select(codec, 0, spec->am_entry[i].idx); return;