ALSA: hda - Introduce "Headset Mic" name
PATCH 1/1 ALSA: hda - Introduce "Headset Mic" name
Headset mic jacks, i e TRRS style jacks with Headphone Left, Headphone Right, Mic and GND signals, are becoming increasingly common and are now being shipped by several manufacturers.
Unfortunately, the HDA specification does not give us any hint of whether a Mic pin belongs to such a jack or not, but it would still be helpful for the user to know (especially if there is one TRS Mic jack and one TRRS headset jack).
This new fixup causes the first (non-dock, non-internal) mic to be a headset mic jack. The algorithm can be later refined if needed.
--- sound/pci/hda/hda_auto_parser.c | 24 ++++++++++++++++++++++-- sound/pci/hda/hda_auto_parser.h | 2 ++ sound/pci/hda/patch_sigmatel.c | 6 +++++- 3 files changed, 29 insertions(+), 3 deletions(-)
sound/pci/hda/hda_auto_parser.c +22 -2
@@ -260,6 +260,22 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec, } } +/* Take first mic to be a headset mic pin */ +if (cond_flags &HDA_PINCFG_HEADSET_MIC ) { +for (i =0 ; i < cfg->num_inputs; i++) { +int attr; +unsigned int def_conf; +if (cfg->inputs[i].type !=AUTO_PIN_MIC ) +continue ; + def_conf =snd_hda_codec_get_pincfg (codec, cfg->inputs[i].pin); + attr =snd_hda_get_input_pin_attr (def_conf); +if (attr <=INPUT_PIN_ATTR_DOCK ) +continue ; + cfg->inputs[i].is_headset_mic =1 ; +break ; + } + } +/* FIX-UP: * If no line-out is defined but multiple HPs are found, * some of them might be the real line-outs.
@@ -388,6 +404,7 @@ EXPORT_SYMBOL_HDA(snd_hda_get_input_pin_attr);*/ static const char *hda_get_input_pin_label (struct hda_codec *codec, +const struct auto_pin_cfg_item *item,hda_nid_t pin,bool check_location) {unsigned int def_conf;
@@ -400,6 +417,8 @@ static const char *hda_get_input_pin_label(struct hda_codec *codec,switch (get_defcfg_device (def_conf)) {case AC_JACK_MIC_IN : +if (item && item->is_headset_mic) +return "Headset Mic" ;if (!check_location)return "Mic" ; attr =snd_hda_get_input_pin_attr (def_conf);
@@ -480,7 +499,8 @@ const char *hda_get_autocfg_input_label(struct hda_codec *codec, has_multiple_pins =1 ;if (has_multiple_pins && type ==AUTO_PIN_MIC ) has_multiple_pins &=check_mic_location_need (codec, cfg, input); -return hda_get_input_pin_label (codec, cfg->inputs[input].pin, +return hda_get_input_pin_label (codec, &cfg->inputs[input], + cfg->inputs[input].pin, has_multiple_pins); }EXPORT_SYMBOL_HDA (hda_get_autocfg_input_label);
@@ -649,7 +669,7 @@ int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid, } }if (!name) - name =hda_get_input_pin_label (codec, nid, true); + name =hda_get_input_pin_label (codec,NULL , nid, true);break ; }if (!name)
sound/pci/hda/hda_auto_parser.h +2 -0
@@ -36,6 +36,7 @@ enum {struct auto_pin_cfg_item {hda_nid_t pin;int type; +int is_headset_mic:1 ; };struct auto_pin_cfg ;
@@ -80,6 +81,7 @@ struct auto_pin_cfg {/* bit-flags for snd_hda_parse_pin_def_config() behavior */ #define HDA_PINCFG_NO_HP_FIXUP (1 << 0)/* no HP-split */ #define HDA_PINCFG_NO_LO_FIXUP (1 << 1)/* don't take other outs as LO */ +#define HDA_PINCFG_HEADSET_MIC (1 << 2)/* Take first mic as headset mic */ int snd_hda_parse_pin_defcfg(struct hda_codec *codec, struct auto_pin_cfg *cfg,
sound/pci/hda/patch_sigmatel.c +5 -1
@@ -3528,8 +3528,12 @@ static int stac_parse_auto_config(struct hda_codec *codec) {struct sigmatel_spec *spec = codec->spec;int err; +int flags =0 ; - err =snd_hda_parse_pin_defcfg (codec, &spec->gen.autocfg,NULL ,0 ); +if (spec->headset_jack) + flags |=HDA_PINCFG_HEADSET_MIC ; + + err =snd_hda_parse_pin_defcfg (codec, &spec->gen.autocfg,NULL , flags);if (err <0 )return err;
Signature · 1 line
1.7.9.5
At Thu, 21 Mar 2013 11:32:57 +0100,
Quoted 88 lines · David Henningsson
Headset mic jacks, i e TRRS style jacks with Headphone Left, Headphone Right, Mic and GND signals, are becoming increasingly common and are now being shipped by several manufacturers.
Unfortunately, the HDA specification does not give us any hint of whether a Mic pin belongs to such a jack or not, but it would still be helpful for the user to know (especially if there is one TRS Mic jack and one TRRS headset jack).
This new fixup causes the first (non-dock, non-internal) mic to be a headset mic jack. The algorithm can be later refined if needed.
Signed-off-by David Henningsson <[email protected]>--- sound/pci/hda/hda_auto_parser.c | 24 ++++++++++++++++++++++-- sound/pci/hda/hda_auto_parser.h | 2 ++ sound/pci/hda/patch_sigmatel.c | 6 +++++- 3 files changed, 29 insertions(+), 3 deletions(-)sound/pci/hda/hda_auto_parser.c +22
-2@@ -260,6 +260,22 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec, } } +/* Take first mic to be a headset mic pin */ +if (cond_flags &HDA_PINCFG_HEADSET_MIC ) { +for (i =0 ; i < cfg->num_inputs; i++) { +int attr; +unsigned int def_conf; +if (cfg->inputs[i].type !=AUTO_PIN_MIC ) +continue ; + def_conf =snd_hda_codec_get_pincfg (codec, cfg->inputs[i].pin); + attr =snd_hda_get_input_pin_attr (def_conf); +if (attr <=INPUT_PIN_ATTR_DOCK ) +continue ; + cfg->inputs[i].is_headset_mic =1 ; +break ; + } + } +/* FIX-UP: * If no line-out is defined but multiple HPs are found, * some of them might be the real line-outs. @@ -388,6 +404,7 @@ EXPORT_SYMBOL_HDA(snd_hda_get_input_pin_attr);*/ static const char *hda_get_input_pin_label (struct hda_codec *codec, +const struct auto_pin_cfg_item *item,hda_nid_t pin,bool check_location) {unsigned int def_conf;@@ -400,6 +417,8 @@ static const char *hda_get_input_pin_label(struct hda_codec *codec,switch (get_defcfg_device (def_conf)) {case AC_JACK_MIC_IN : +if (item && item->is_headset_mic) +return "Headset Mic" ;if (!check_location)return "Mic" ; attr =snd_hda_get_input_pin_attr (def_conf);@@ -480,7 +499,8 @@ const char *hda_get_autocfg_input_label(struct hda_codec *codec, has_multiple_pins =1 ;if (has_multiple_pins && type ==AUTO_PIN_MIC ) has_multiple_pins &=check_mic_location_need (codec, cfg, input); -return hda_get_input_pin_label (codec, cfg->inputs[input].pin, +return hda_get_input_pin_label (codec, &cfg->inputs[input], + cfg->inputs[input].pin, has_multiple_pins); }EXPORT_SYMBOL_HDA (hda_get_autocfg_input_label);@@ -649,7 +669,7 @@ int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid, } }if (!name) - name =hda_get_input_pin_label (codec, nid, true); + name =hda_get_input_pin_label (codec,NULL , nid, true);break ; }if (!name)sound/pci/hda/hda_auto_parser.h +0
-0
sound/pci/hda/hda_auto_parser.h enum { · line 39
Quoted 4 lines
sound/pci/hda/hda_auto_parser.h +1
-0@@ -36,6 +36,7 @@ enum {struct auto_pin_cfg_item {hda_nid_t pin;int type; +int is_headset_mic:1 ;
Use unsigned int for bit-fields. Otherwise you'll hit a mess of signedness.
Quoted 18 lines
sound/pci/hda/hda_auto_parser.h +1
-0};struct auto_pin_cfg ;@@ -80,6 +81,7 @@ struct auto_pin_cfg {/* bit-flags for snd_hda_parse_pin_def_config() behavior */ #define HDA_PINCFG_NO_HP_FIXUP (1 << 0)/* no HP-split */ #define HDA_PINCFG_NO_LO_FIXUP (1 << 1)/* don't take other outs as LO */ +#define HDA_PINCFG_HEADSET_MIC (1 << 2)/* Take first mic as headset mic */ int snd_hda_parse_pin_defcfg(struct hda_codec *codec, struct auto_pin_cfg *cfg,sound/pci/hda/patch_sigmatel.c +0
-0@@ -3528,8 +3528,12 @@ static int stac_parse_auto_config(struct hda_codec *codec) {struct sigmatel_spec *spec = codec->spec;
sound/pci/hda/patch_sigmatel.c static int stac_parse_auto_config(struct hda_codec *codec) · line 3538
Quoted 10 lines
sound/pci/hda/patch_sigmatel.c +5
-1int err; +int flags =0 ; - err =snd_hda_parse_pin_defcfg (codec, &spec->gen.autocfg,NULL ,0 ); +if (spec->headset_jack) + flags |=HDA_PINCFG_HEADSET_MIC ; + + err =snd_hda_parse_pin_defcfg (codec, &spec->gen.autocfg,NULL , flags);if (err <0 )return err;
The definition of spec->headset_jack is missing?
thanks,
Takashi
Quoted 89 lines · Takashi Iwai
At Thu, 21 Mar 2013 11:32:57 +0100,
Quoted 87 lines · David Henningsson
Headset mic jacks, i e TRRS style jacks with Headphone Left, Headphone Right, Mic and GND signals, are becoming increasingly common and are now being shipped by several manufacturers.
Unfortunately, the HDA specification does not give us any hint of whether a Mic pin belongs to such a jack or not, but it would still be helpful for the user to know (especially if there is one TRS Mic jack and one TRRS headset jack).
This new fixup causes the first (non-dock, non-internal) mic to be a headset mic jack. The algorithm can be later refined if needed.
Signed-off-by David Henningsson <[email protected]>--- sound/pci/hda/hda_auto_parser.c | 24 ++++++++++++++++++++++-- sound/pci/hda/hda_auto_parser.h | 2 ++ sound/pci/hda/patch_sigmatel.c | 6 +++++- 3 files changed, 29 insertions(+), 3 deletions(-)sound/pci/hda/hda_auto_parser.c +22
-2@@ -260,6 +260,22 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec, } } +/* Take first mic to be a headset mic pin */ +if (cond_flags &HDA_PINCFG_HEADSET_MIC ) { +for (i =0 ; i < cfg->num_inputs; i++) { +int attr; +unsigned int def_conf; +if (cfg->inputs[i].type !=AUTO_PIN_MIC ) +continue ; + def_conf =snd_hda_codec_get_pincfg (codec, cfg->inputs[i].pin); + attr =snd_hda_get_input_pin_attr (def_conf); +if (attr <=INPUT_PIN_ATTR_DOCK ) +continue ; + cfg->inputs[i].is_headset_mic =1 ; +break ; + } + } +/* FIX-UP: * If no line-out is defined but multiple HPs are found, * some of them might be the real line-outs. @@ -388,6 +404,7 @@ EXPORT_SYMBOL_HDA(snd_hda_get_input_pin_attr);*/ static const char *hda_get_input_pin_label (struct hda_codec *codec, +const struct auto_pin_cfg_item *item,hda_nid_t pin,bool check_location) {unsigned int def_conf;@@ -400,6 +417,8 @@ static const char *hda_get_input_pin_label(struct hda_codec *codec,switch (get_defcfg_device (def_conf)) {case AC_JACK_MIC_IN : +if (item && item->is_headset_mic) +return "Headset Mic" ;if (!check_location)return "Mic" ; attr =snd_hda_get_input_pin_attr (def_conf);@@ -480,7 +499,8 @@ const char *hda_get_autocfg_input_label(struct hda_codec *codec, has_multiple_pins =1 ;if (has_multiple_pins && type ==AUTO_PIN_MIC ) has_multiple_pins &=check_mic_location_need (codec, cfg, input); -return hda_get_input_pin_label (codec, cfg->inputs[input].pin, +return hda_get_input_pin_label (codec, &cfg->inputs[input], + cfg->inputs[input].pin, has_multiple_pins); }EXPORT_SYMBOL_HDA (hda_get_autocfg_input_label);@@ -649,7 +669,7 @@ int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid, } }if (!name) - name =hda_get_input_pin_label (codec, nid, true); + name =hda_get_input_pin_label (codec,NULL , nid, true);break ; }if (!name)sound/pci/hda/hda_auto_parser.h +0
-0
Quoted 8 lines
sound/pci/hda/hda_auto_parser.h enum { · line 39
Quoted 5 lines
sound/pci/hda/hda_auto_parser.h +1
-0@@ -36,6 +36,7 @@ enum {struct auto_pin_cfg_item {hda_nid_t pin;int type; +int is_headset_mic:1 ;Use unsigned int for bit-fields. Otherwise you'll hit a mess of signedness.
Ok, will fix.
Quoted 23 lines
Quoted 23 lines
sound/pci/hda/hda_auto_parser.h +1
-0};struct auto_pin_cfg ;@@ -80,6 +81,7 @@ struct auto_pin_cfg {/* bit-flags for snd_hda_parse_pin_def_config() behavior */ #define HDA_PINCFG_NO_HP_FIXUP (1 << 0)/* no HP-split */ #define HDA_PINCFG_NO_LO_FIXUP (1 << 1)/* don't take other outs as LO */ +#define HDA_PINCFG_HEADSET_MIC (1 << 2)/* Take first mic as headset mic */ int snd_hda_parse_pin_defcfg(struct hda_codec *codec, struct auto_pin_cfg *cfg,sound/pci/hda/patch_sigmatel.c +1
-0@@ -3528,8 +3528,12 @@ static int stac_parse_auto_config(struct hda_codec *codec) {struct sigmatel_spec *spec = codec->spec;int err; +int flags =0 ;
Quoted 10 lines
sound/pci/hda/patch_sigmatel.c static int stac_parse_auto_config(struct hda_codec *codec) · line 3538
Quoted 7 lines
sound/pci/hda/patch_sigmatel.c +4
-1- err =snd_hda_parse_pin_defcfg (codec, &spec->gen.autocfg,NULL ,0 ); +if (spec->headset_jack) + flags |=HDA_PINCFG_HEADSET_MIC ; + + err =snd_hda_parse_pin_defcfg (codec, &spec->gen.autocfg,NULL , flags);if (err <0 )return err;The definition of
spec->headset_jackis missing?
It was added in sigmatel_spec in Oct 2012. If you prefer, I could send the changes to patch_sigmatel in a separate patch?
Signature · 2 lines
David Henningsson, Canonical Ltd. https://launchpad.net/~diwic
Quoted 148 lines · David Henningsson
Quoted 97 lines · Takashi Iwai
At Thu, 21 Mar 2013 11:32:57 +0100,
Quoted 95 lines · David Henningsson
Headset mic jacks, i e TRRS style jacks with Headphone Left, Headphone Right, Mic and GND signals, are becoming increasingly common and are now being shipped by several manufacturers.
Unfortunately, the HDA specification does not give us any hint of whether a Mic pin belongs to such a jack or not, but it would still be helpful for the user to know (especially if there is one TRS Mic jack and one TRRS headset jack).
This new fixup causes the first (non-dock, non-internal) mic to be a headset mic jack. The algorithm can be later refined if needed.
Signed-off-by David Henningsson <[email protected]>--- sound/pci/hda/hda_auto_parser.c | 24 ++++++++++++++++++++++-- sound/pci/hda/hda_auto_parser.h | 2 ++ sound/pci/hda/patch_sigmatel.c | 6 +++++- 3 files changed, 29 insertions(+), 3 deletions(-)sound/pci/hda/hda_auto_parser.c +16
-0@@ -260,6 +260,22 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec, } } +/* Take first mic to be a headset mic pin */ +if (cond_flags &HDA_PINCFG_HEADSET_MIC ) { +for (i =0 ; i < cfg->num_inputs; i++) { +int attr; +unsigned int def_conf; +if (cfg->inputs[i].type !=AUTO_PIN_MIC ) +continue ; + def_conf =snd_hda_codec_get_pincfg (codec, cfg->inputs[i].pin); + attr =snd_hda_get_input_pin_attr (def_conf); +if (attr <=INPUT_PIN_ATTR_DOCK ) +continue ; + cfg->inputs[i].is_headset_mic =1 ; +break ; + } + } +/* FIX-UP: * If no line-out is defined but multiple HPs are found,
* some of them might be the real line-outs.sound/pci/hda/hda_auto_parser.c +3
-0@@ -388,6 +404,7 @@ EXPORT_SYMBOL_HDA(snd_hda_get_input_pin_attr);*/ static const char *hda_get_input_pin_label (struct hda_codec *codec, +const struct auto_pin_cfg_item *item,hda_nid_t pin,bool check_location) {unsigned int def_conf;@@ -400,6 +417,8 @@ static const char *hda_get_input_pin_label(struct hda_codec *codec, switch (get_defcfg_device(def_conf)) {case AC_JACK_MIC_IN : +if (item && item->is_headset_mic) +return "Headset Mic" ;if (!check_location)return "Mic" ;attr = snd_hda_get_input_pin_attr(def_conf);sound/pci/hda/hda_auto_parser.c +2
-1@@ -480,7 +499,8 @@ const char *hda_get_autocfg_input_label(structhda_codec *codec, has_multiple_pins =1 ;if (has_multiple_pins && type ==AUTO_PIN_MIC ) has_multiple_pins &=check_mic_location_need (codec, cfg, input); -return hda_get_input_pin_label (codec, cfg->inputs[input].pin, +return hda_get_input_pin_label (codec, &cfg->inputs[input], + cfg->inputs[input].pin, has_multiple_pins);} EXPORT_SYMBOL_HDA(hda_get_autocfg_input_label);sound/pci/hda/hda_auto_parser.c +1
-1@@ -649,7 +669,7 @@ int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid, } }if (!name) - name =hda_get_input_pin_label (codec, nid, true); + name =hda_get_input_pin_label (codec,NULL , nid, true);break ; }if (!name)sound/pci/hda/hda_auto_parser.h +0
-0Quoted 8 lines
sound/pci/hda/hda_auto_parser.h enum { · line 39
Quoted 5 lines
sound/pci/hda/hda_auto_parser.h +1
-0@@ -36,6 +36,7 @@ enum {struct auto_pin_cfg_item {hda_nid_t pin;int type; +int is_headset_mic:1 ;Use unsigned int for bit-fields. Otherwise you'll hit a mess of signedness.
Ok, will fix.
Quoted 27 lines
Quoted 27 lines
sound/pci/hda/hda_auto_parser.h +0
-0};struct auto_pin_cfg ;@@ -80,6 +81,7 @@ struct auto_pin_cfg {/* bit-flags for snd_hda_parse_pin_def_config() behavior */ #define HDA_PINCFG_NO_HP_FIXUP (1 << 0)/* no HP-split */ #define HDA_PINCFG_NO_LO_FIXUP (1 << 1)/* don't take other outs as LO */
+#defineHDA_PINCFG_HEADSET_MIC(1 << 2) /* Take first mic as headset mic */int snd_hda_parse_pin_defcfg(struct
hda_codec*codec,
structauto_pin_cfg*cfg,sound/pci/hda/patch_sigmatel.c +1
-0@@ -3528,8 +3528,12 @@ static int stac_parse_auto_config(struct hda_codec *codec) {struct sigmatel_spec *spec = codec->spec;int err; +int flags =0 ;Quoted 11 lines
Quoted 8 lines
sound/pci/hda/patch_sigmatel.c +4
-1- err =snd_hda_parse_pin_defcfg (codec, &spec->gen.autocfg,NULL ,0 ); +if (spec->headset_jack) + flags |=HDA_PINCFG_HEADSET_MIC ; + + err =snd_hda_parse_pin_defcfg (codec, &spec->gen.autocfg,NULL , flags);if (err <0 )return err;The definition of
spec->headset_jackis missing?
Quoted 2 lines
It was added in
sigmatel_specin Oct 2012. If you prefer, I could send the changes topatch_sigmatelin a separate patch?
Btw; this change for patch_sigmatel is just a first example. I intend to add more headset mics later, and this fixup also makes it easier for others to submit such patches.
But if I get this name into the kernel now I can also add it to PulseAudio before the 4.0 freeze, which is quite soon.
Signature · 2 lines
David Henningsson, Canonical Ltd. https://launchpad.net/~diwic
At Thu, 21 Mar 2013 11:57:08 +0100,
Quoted 153 lines · David Henningsson
Quoted 148 lines · David Henningsson
Quoted 97 lines · Takashi Iwai
At Thu, 21 Mar 2013 11:32:57 +0100,
Quoted 95 lines · David Henningsson
Headset mic jacks, i e TRRS style jacks with Headphone Left, Headphone Right, Mic and GND signals, are becoming increasingly common and are now being shipped by several manufacturers.
Unfortunately, the HDA specification does not give us any hint of whether a Mic pin belongs to such a jack or not, but it would still be helpful for the user to know (especially if there is one TRS Mic jack and one TRRS headset jack).
This new fixup causes the first (non-dock, non-internal) mic to be a headset mic jack. The algorithm can be later refined if needed.
Signed-off-by David Henningsson <[email protected]>--- sound/pci/hda/hda_auto_parser.c | 24 ++++++++++++++++++++++-- sound/pci/hda/hda_auto_parser.h | 2 ++ sound/pci/hda/patch_sigmatel.c | 6 +++++- 3 files changed, 29 insertions(+), 3 deletions(-)sound/pci/hda/hda_auto_parser.c +16
-0@@ -260,6 +260,22 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec, } } +/* Take first mic to be a headset mic pin */ +if (cond_flags &HDA_PINCFG_HEADSET_MIC ) { +for (i =0 ; i < cfg->num_inputs; i++) { +int attr; +unsigned int def_conf; +if (cfg->inputs[i].type !=AUTO_PIN_MIC ) +continue ; + def_conf =snd_hda_codec_get_pincfg (codec, cfg->inputs[i].pin); + attr =snd_hda_get_input_pin_attr (def_conf); +if (attr <=INPUT_PIN_ATTR_DOCK ) +continue ; + cfg->inputs[i].is_headset_mic =1 ; +break ; + } + } +/* FIX-UP: * If no line-out is defined but multiple HPs are found,
* some of them might be the real line-outs.sound/pci/hda/hda_auto_parser.c +3
-0@@ -388,6 +404,7 @@ EXPORT_SYMBOL_HDA(snd_hda_get_input_pin_attr);*/ static const char *hda_get_input_pin_label (struct hda_codec *codec, +const struct auto_pin_cfg_item *item,hda_nid_t pin,bool check_location) {unsigned int def_conf;@@ -400,6 +417,8 @@ static const char *hda_get_input_pin_label(struct hda_codec *codec, switch (get_defcfg_device(def_conf)) {case AC_JACK_MIC_IN : +if (item && item->is_headset_mic) +return "Headset Mic" ;if (!check_location)return "Mic" ;attr = snd_hda_get_input_pin_attr(def_conf);sound/pci/hda/hda_auto_parser.c +2
-1@@ -480,7 +499,8 @@ const char *hda_get_autocfg_input_label(structhda_codec *codec, has_multiple_pins =1 ;if (has_multiple_pins && type ==AUTO_PIN_MIC ) has_multiple_pins &=check_mic_location_need (codec, cfg, input); -return hda_get_input_pin_label (codec, cfg->inputs[input].pin, +return hda_get_input_pin_label (codec, &cfg->inputs[input], + cfg->inputs[input].pin, has_multiple_pins);} EXPORT_SYMBOL_HDA(hda_get_autocfg_input_label);sound/pci/hda/hda_auto_parser.c +1
-1@@ -649,7 +669,7 @@ int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid, } }if (!name) - name =hda_get_input_pin_label (codec, nid, true); + name =hda_get_input_pin_label (codec,NULL , nid, true);break ; }if (!name)sound/pci/hda/hda_auto_parser.h +0
-0Quoted 8 lines
sound/pci/hda/hda_auto_parser.h enum { · line 39
Quoted 5 lines
sound/pci/hda/hda_auto_parser.h +1
-0@@ -36,6 +36,7 @@ enum {struct auto_pin_cfg_item {hda_nid_t pin;int type; +int is_headset_mic:1 ;Use unsigned int for bit-fields. Otherwise you'll hit a mess of signedness.
Ok, will fix.
Quoted 27 lines
Quoted 27 lines
sound/pci/hda/hda_auto_parser.h +0
-0};struct auto_pin_cfg ;@@ -80,6 +81,7 @@ struct auto_pin_cfg {/* bit-flags for snd_hda_parse_pin_def_config() behavior */ #define HDA_PINCFG_NO_HP_FIXUP (1 << 0)/* no HP-split */ #define HDA_PINCFG_NO_LO_FIXUP (1 << 1)/* don't take other outs as LO */
+#defineHDA_PINCFG_HEADSET_MIC(1 << 2) /* Take first mic as headset mic */int snd_hda_parse_pin_defcfg(struct
hda_codec*codec,
structauto_pin_cfg*cfg,sound/pci/hda/patch_sigmatel.c +1
-0@@ -3528,8 +3528,12 @@ static int stac_parse_auto_config(struct hda_codec *codec) {struct sigmatel_spec *spec = codec->spec;int err; +int flags =0 ;Quoted 11 lines
Quoted 8 lines
sound/pci/hda/patch_sigmatel.c +4
-1- err =snd_hda_parse_pin_defcfg (codec, &spec->gen.autocfg,NULL ,0 ); +if (spec->headset_jack) + flags |=HDA_PINCFG_HEADSET_MIC ; + + err =snd_hda_parse_pin_defcfg (codec, &spec->gen.autocfg,NULL , flags);if (err <0 )return err;The definition of
spec->headset_jackis missing?Quoted 2 lines
It was added in
sigmatel_specin Oct 2012. If you prefer, I could send the changes topatch_sigmatelin a separate patch?
Quoted 6 lines
Btw; this change for
patch_sigmatelis just a first example. I intend to add more headset mics later, and this fixup also makes it easier for others to submit such patches.But if I get this name into the kernel now I can also add it to PulseAudio before the 4.0 freeze, which is quite soon.
It's rather a new feature, so I'll push it to 3.10.
Takashi
Quoted 10 lines · Takashi Iwai
At Thu, 21 Mar 2013 11:57:08 +0100,
Quoted 8 lines · David Henningsson
Quoted 5 lines · David Henningsson
Quoted 1 line · Takashi Iwai
The definition of
spec->headset_jackis missing?It was added in
sigmatel_specin Oct 2012. If you prefer, I could send the changes topatch_sigmatelin a separate patch?
Quoted 8 lines
Quoted 6 lines
Btw; this change for
patch_sigmatelis just a first example. I intend to add more headset mics later, and this fixup also makes it easier for others to submit such patches.But if I get this name into the kernel now I can also add it to PulseAudio before the 4.0 freeze, which is quite soon.
It's rather a new feature, so I'll push it to 3.10.
That's fine. Did you apply v2 of the patch(es)?
Signature · 2 lines
David Henningsson, Canonical Ltd. https://launchpad.net/~diwic
At Thu, 21 Mar 2013 14:42:14 +0100,
Quoted 16 lines · David Henningsson
Quoted 14 lines · Takashi Iwai
At Thu, 21 Mar 2013 11:57:08 +0100,
Quoted 12 lines · David Henningsson
Quoted 5 lines · David Henningsson
Quoted 1 line · Takashi Iwai
The definition of
spec->headset_jackis missing?It was added in
sigmatel_specin Oct 2012. If you prefer, I could send the changes topatch_sigmatelin a separate patch?Btw; this change for
patch_sigmatelis just a first example. I intend to add more headset mics later, and this fixup also makes it easier for others to submit such patches.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
But if I get this name into the kernel now I can also add it to PulseAudio before the 4.0 freeze, which is quite soon.
It's rather a new feature, so I'll push it to 3.10.
That's fine. Did you apply v2 of the patch(es)?
Yes, applied now. Thanks!
Takashi
At Thu, 21 Mar 2013 11:47:03 +0100,
Quoted 135 lines · David Henningsson
Quoted 89 lines · Takashi Iwai
At Thu, 21 Mar 2013 11:32:57 +0100,
Quoted 87 lines · David Henningsson
Headset mic jacks, i e TRRS style jacks with Headphone Left, Headphone Right, Mic and GND signals, are becoming increasingly common and are now being shipped by several manufacturers.
Unfortunately, the HDA specification does not give us any hint of whether a Mic pin belongs to such a jack or not, but it would still be helpful for the user to know (especially if there is one TRS Mic jack and one TRRS headset jack).
This new fixup causes the first (non-dock, non-internal) mic to be a headset mic jack. The algorithm can be later refined if needed.
Signed-off-by David Henningsson <[email protected]>--- sound/pci/hda/hda_auto_parser.c | 24 ++++++++++++++++++++++-- sound/pci/hda/hda_auto_parser.h | 2 ++ sound/pci/hda/patch_sigmatel.c | 6 +++++- 3 files changed, 29 insertions(+), 3 deletions(-)sound/pci/hda/hda_auto_parser.c +22
-2@@ -260,6 +260,22 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec, } } +/* Take first mic to be a headset mic pin */ +if (cond_flags &HDA_PINCFG_HEADSET_MIC ) { +for (i =0 ; i < cfg->num_inputs; i++) { +int attr; +unsigned int def_conf; +if (cfg->inputs[i].type !=AUTO_PIN_MIC ) +continue ; + def_conf =snd_hda_codec_get_pincfg (codec, cfg->inputs[i].pin); + attr =snd_hda_get_input_pin_attr (def_conf); +if (attr <=INPUT_PIN_ATTR_DOCK ) +continue ; + cfg->inputs[i].is_headset_mic =1 ; +break ; + } + } +/* FIX-UP: * If no line-out is defined but multiple HPs are found, * some of them might be the real line-outs. @@ -388,6 +404,7 @@ EXPORT_SYMBOL_HDA(snd_hda_get_input_pin_attr);*/ static const char *hda_get_input_pin_label (struct hda_codec *codec, +const struct auto_pin_cfg_item *item,hda_nid_t pin,bool check_location) {unsigned int def_conf;@@ -400,6 +417,8 @@ static const char *hda_get_input_pin_label(struct hda_codec *codec,switch (get_defcfg_device (def_conf)) {case AC_JACK_MIC_IN : +if (item && item->is_headset_mic) +return "Headset Mic" ;if (!check_location)return "Mic" ; attr =snd_hda_get_input_pin_attr (def_conf);@@ -480,7 +499,8 @@ const char *hda_get_autocfg_input_label(struct hda_codec *codec, has_multiple_pins =1 ;if (has_multiple_pins && type ==AUTO_PIN_MIC ) has_multiple_pins &=check_mic_location_need (codec, cfg, input); -return hda_get_input_pin_label (codec, cfg->inputs[input].pin, +return hda_get_input_pin_label (codec, &cfg->inputs[input], + cfg->inputs[input].pin, has_multiple_pins); }EXPORT_SYMBOL_HDA (hda_get_autocfg_input_label);@@ -649,7 +669,7 @@ int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid, } }if (!name) - name =hda_get_input_pin_label (codec, nid, true); + name =hda_get_input_pin_label (codec,NULL , nid, true);break ; }if (!name)sound/pci/hda/hda_auto_parser.h +0
-0Quoted 8 lines
sound/pci/hda/hda_auto_parser.h enum { · line 39
Quoted 5 lines
sound/pci/hda/hda_auto_parser.h +1
-0@@ -36,6 +36,7 @@ enum {struct auto_pin_cfg_item {hda_nid_t pin;int type; +int is_headset_mic:1 ;Use unsigned int for bit-fields. Otherwise you'll hit a mess of signedness.
Ok, will fix.
Quoted 23 lines
Quoted 23 lines
sound/pci/hda/hda_auto_parser.h +1
-0};struct auto_pin_cfg ;@@ -80,6 +81,7 @@ struct auto_pin_cfg {/* bit-flags for snd_hda_parse_pin_def_config() behavior */ #define HDA_PINCFG_NO_HP_FIXUP (1 << 0)/* no HP-split */ #define HDA_PINCFG_NO_LO_FIXUP (1 << 1)/* don't take other outs as LO */ +#define HDA_PINCFG_HEADSET_MIC (1 << 2)/* Take first mic as headset mic */ int snd_hda_parse_pin_defcfg(struct hda_codec *codec, struct auto_pin_cfg *cfg,sound/pci/hda/patch_sigmatel.c +1
-0@@ -3528,8 +3528,12 @@ static int stac_parse_auto_config(struct hda_codec *codec) {struct sigmatel_spec *spec = codec->spec;int err; +int flags =0 ;Quoted 10 lines
sound/pci/hda/patch_sigmatel.c static int stac_parse_auto_config(struct hda_codec *codec) · line 3538
Quoted 7 lines
sound/pci/hda/patch_sigmatel.c +4
-1- err =snd_hda_parse_pin_defcfg (codec, &spec->gen.autocfg,NULL ,0 ); +if (spec->headset_jack) + flags |=HDA_PINCFG_HEADSET_MIC ; + + err =snd_hda_parse_pin_defcfg (codec, &spec->gen.autocfg,NULL , flags);if (err <0 )return err;The definition of
spec->headset_jackis missing?
Quoted 2 lines
It was added in
sigmatel_specin Oct 2012. If you prefer, I could send the changes topatch_sigmatelin a separate patch?
Oh, sorry, I forgot this was added.
Takashi