* [PATCH v2- ALSA 2/3] HDA - create headset mic jack which use headphone pin sense
@ 2015-09-23 2:40 Raymond Yau
0 siblings, 0 replies; 3+ messages in thread
From: Raymond Yau @ 2015-09-23 2:40 UTC (permalink / raw)
To: ALSA Development Mailing List, tiwai, arthurborsboom
- use __snd_hda_jack_add_kctl to create headset mic jack which use
headphone pin sense
- set headset mic jack as slave of headphone jack
- allow non detectable headset mic pin and hs_mic_use_hp_sense pass check
auto mic availability
Signed-off-by: Raymond Yau <superquad.vortex2@gmail.com>
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index 24f9111..e8e4e34 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -4662,7 +4662,9 @@ static int check_auto_mic_availability(struct
hda_codec *codec)
if (!spec->line_in_auto_switch &&
cfg->inputs[i].type != AUTO_PIN_MIC)
return 0; /* only mic is allowed */
- if (!is_jack_detectable(codec, nid))
+ if (!is_jack_detectable(codec, nid) &&
+ !(spec->hs_mic_use_hp_sense &&
+ cfg->inputs[i].is_headset_mic))
return 0; /* no unsol support */
break;
}
diff --git a/sound/pci/hda/hda_generic.h b/sound/pci/hda/hda_generic.h
index 56e4139..96f8214 100644
--- a/sound/pci/hda/hda_generic.h
+++ b/sound/pci/hda/hda_generic.h
@@ -236,6 +236,7 @@ struct hda_gen_spec {
unsigned int indep_hp_enabled:1; /* independent HP enabled */
unsigned int have_aamix_ctl:1;
unsigned int hp_mic_jack_modes:1;
+ unsigned int hs_mic_use_hp_sense:1;
/* additional mute flags (only effective with auto_mute_via_amp=1) */
u64 mute_bits;
diff --git a/sound/pci/hda/hda_jack.c b/sound/pci/hda/hda_jack.c
index d81d65f..c29f05e 100644
--- a/sound/pci/hda/hda_jack.c
+++ b/sound/pci/hda/hda_jack.c
@@ -480,6 +480,10 @@ int snd_hda_jack_add_kctls(struct hda_codec *codec,
const struct auto_pin_cfg *cfg)
{
const hda_nid_t *p;
+ struct hda_jack_tbl *jack;
+ struct hda_gen_spec *spec = codec->spec;
+ hda_nid_t hp_pin = auto_cfg_hp_pins(cfg)[0];
+ hda_nid_t hs_mic_pin = 0;
int i, err;
for (i = 0; i < cfg->num_inputs; i++) {
@@ -493,6 +497,13 @@ 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 &&
+ !is_jack_detectable(codec, cfg->inputs[i].pin) &&
+ spec->hs_mic_use_hp_sense) {
+ hs_mic_pin = cfg->inputs[i].pin;
+ err = __snd_hda_jack_add_kctl(codec, cfg->inputs[i].pin,
+ "Headset Mic", false, hp_pin);
+ } else
err = add_jack_kctl(codec, cfg->inputs[i].pin, cfg,
NULL);
if (err < 0)
@@ -510,6 +521,11 @@ int snd_hda_jack_add_kctls(struct hda_codec *codec,
err = add_jack_kctl(codec, *p, cfg, NULL);
if (err < 0)
return err;
+ if (*p == hp_pin && spec->hs_mic_use_hp_sense && hs_mic_pin) {
+ jack = snd_hda_jack_tbl_get(codec, *p);
+ if (jack)
+ jack->slave_nid = hs_mic_pin;
+ }
}
for (i = 0, p = cfg->speaker_pins; i < cfg->speaker_outs; i++, p++) {
if (*p == *cfg->line_out_pins) /* might be duplicated */
--
2.5.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2- ALSA 2/3] HDA - create headset mic jack which use headphone pin sense
@ 2016-04-05 10:15 Justin Monk
2016-04-05 14:35 ` Raymond Yau
0 siblings, 1 reply; 3+ messages in thread
From: Justin Monk @ 2016-04-05 10:15 UTC (permalink / raw)
To: alsa-devel, superquad.vortex2
Team,
I was wondering when this patch would be available, I figured it would
already be in the down stream. If not I would love to test it. I have
minimal programming skills but would love to help.
Kernel Bug Tracker – Bug 107851
4.2.0-18-generic
currently running
4.4.6-300.fc23.x86_64
Thanks,
Justin Monk
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2- ALSA 2/3] HDA - create headset mic jack which use headphone pin sense
2016-04-05 10:15 [PATCH v2- ALSA 2/3] HDA - create headset mic jack which use headphone pin sense Justin Monk
@ 2016-04-05 14:35 ` Raymond Yau
0 siblings, 0 replies; 3+ messages in thread
From: Raymond Yau @ 2016-04-05 14:35 UTC (permalink / raw)
To: Justin Monk, tiwai; +Cc: ALSA Development Mailing List
>
> Team,
>
> I was wondering when this patch would be available, I figured it would
> already be in the down stream. If not I would love to test it. I have
> minimal programming skills but would love to help.
>
> Kernel Bug Tracker – Bug 107851
>
> 4.2.0-18-generic
>
> currently running
> 4.4.6-300.fc23.x86_64
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=909cadc6c8c7e52149fb4687453277d6cabe8c80
This mean you have to find another way to implement headset mic jack kctl
which use headphone jack pin sense or hack pulseaudio conf file to use
headphone jack to switch headset mic
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-04-05 14:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-05 10:15 [PATCH v2- ALSA 2/3] HDA - create headset mic jack which use headphone pin sense Justin Monk
2016-04-05 14:35 ` Raymond Yau
-- strict thread matches above, loose matches on Subject: below --
2015-09-23 2:40 Raymond Yau
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).