diff options
-rw-r--r-- | sound/pci/hda/hda_auto_parser.c | 24 | ||||
-rw-r--r-- | sound/pci/hda/hda_auto_parser.h | 2 |
2 files changed, 24 insertions, 2 deletions
diff --git a/sound/pci/hda/hda_auto_parser.c b/sound/pci/hda/hda_auto_parser.c index a3ea76a4c9d2..6b173b343697 100644 --- a/sound/pci/hda/hda_auto_parser.c +++ b/sound/pci/hda/hda_auto_parser.c | |||
@@ -260,6 +260,22 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec, | |||
260 | } | 260 | } |
261 | } | 261 | } |
262 | 262 | ||
263 | /* Take first mic to be a headset mic pin */ | ||
264 | if (cond_flags & HDA_PINCFG_HEADSET_MIC) { | ||
265 | for (i = 0; i < cfg->num_inputs; i++) { | ||
266 | int attr; | ||
267 | unsigned int def_conf; | ||
268 | if (cfg->inputs[i].type != AUTO_PIN_MIC) | ||
269 | continue; | ||
270 | def_conf = snd_hda_codec_get_pincfg(codec, cfg->inputs[i].pin); | ||
271 | attr = snd_hda_get_input_pin_attr(def_conf); | ||
272 | if (attr <= INPUT_PIN_ATTR_DOCK) | ||
273 | continue; | ||
274 | cfg->inputs[i].is_headset_mic = 1; | ||
275 | break; | ||
276 | } | ||
277 | } | ||
278 | |||
263 | /* FIX-UP: | 279 | /* FIX-UP: |
264 | * If no line-out is defined but multiple HPs are found, | 280 | * If no line-out is defined but multiple HPs are found, |
265 | * some of them might be the real line-outs. | 281 | * some of them might be the real line-outs. |
@@ -388,6 +404,7 @@ EXPORT_SYMBOL_HDA(snd_hda_get_input_pin_attr); | |||
388 | */ | 404 | */ |
389 | 405 | ||
390 | static const char *hda_get_input_pin_label(struct hda_codec *codec, | 406 | static const char *hda_get_input_pin_label(struct hda_codec *codec, |
407 | const struct auto_pin_cfg_item *item, | ||
391 | hda_nid_t pin, bool check_location) | 408 | hda_nid_t pin, bool check_location) |
392 | { | 409 | { |
393 | unsigned int def_conf; | 410 | unsigned int def_conf; |
@@ -400,6 +417,8 @@ static const char *hda_get_input_pin_label(struct hda_codec *codec, | |||
400 | 417 | ||
401 | switch (get_defcfg_device(def_conf)) { | 418 | switch (get_defcfg_device(def_conf)) { |
402 | case AC_JACK_MIC_IN: | 419 | case AC_JACK_MIC_IN: |
420 | if (item && item->is_headset_mic) | ||
421 | return "Headset Mic"; | ||
403 | if (!check_location) | 422 | if (!check_location) |
404 | return "Mic"; | 423 | return "Mic"; |
405 | attr = snd_hda_get_input_pin_attr(def_conf); | 424 | attr = snd_hda_get_input_pin_attr(def_conf); |
@@ -480,7 +499,8 @@ const char *hda_get_autocfg_input_label(struct hda_codec *codec, | |||
480 | has_multiple_pins = 1; | 499 | has_multiple_pins = 1; |
481 | if (has_multiple_pins && type == AUTO_PIN_MIC) | 500 | if (has_multiple_pins && type == AUTO_PIN_MIC) |
482 | has_multiple_pins &= check_mic_location_need(codec, cfg, input); | 501 | has_multiple_pins &= check_mic_location_need(codec, cfg, input); |
483 | return hda_get_input_pin_label(codec, cfg->inputs[input].pin, | 502 | return hda_get_input_pin_label(codec, &cfg->inputs[input], |
503 | cfg->inputs[input].pin, | ||
484 | has_multiple_pins); | 504 | has_multiple_pins); |
485 | } | 505 | } |
486 | EXPORT_SYMBOL_HDA(hda_get_autocfg_input_label); | 506 | 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, | |||
649 | } | 669 | } |
650 | } | 670 | } |
651 | if (!name) | 671 | if (!name) |
652 | name = hda_get_input_pin_label(codec, nid, true); | 672 | name = hda_get_input_pin_label(codec, NULL, nid, true); |
653 | break; | 673 | break; |
654 | } | 674 | } |
655 | if (!name) | 675 | if (!name) |
diff --git a/sound/pci/hda/hda_auto_parser.h b/sound/pci/hda/hda_auto_parser.h index f74807138b49..c7826ce0818d 100644 --- a/sound/pci/hda/hda_auto_parser.h +++ b/sound/pci/hda/hda_auto_parser.h | |||
@@ -36,6 +36,7 @@ enum { | |||
36 | struct auto_pin_cfg_item { | 36 | struct auto_pin_cfg_item { |
37 | hda_nid_t pin; | 37 | hda_nid_t pin; |
38 | int type; | 38 | int type; |
39 | unsigned int is_headset_mic:1; | ||
39 | }; | 40 | }; |
40 | 41 | ||
41 | struct auto_pin_cfg; | 42 | struct auto_pin_cfg; |
@@ -80,6 +81,7 @@ struct auto_pin_cfg { | |||
80 | /* bit-flags for snd_hda_parse_pin_def_config() behavior */ | 81 | /* bit-flags for snd_hda_parse_pin_def_config() behavior */ |
81 | #define HDA_PINCFG_NO_HP_FIXUP (1 << 0) /* no HP-split */ | 82 | #define HDA_PINCFG_NO_HP_FIXUP (1 << 0) /* no HP-split */ |
82 | #define HDA_PINCFG_NO_LO_FIXUP (1 << 1) /* don't take other outs as LO */ | 83 | #define HDA_PINCFG_NO_LO_FIXUP (1 << 1) /* don't take other outs as LO */ |
84 | #define HDA_PINCFG_HEADSET_MIC (1 << 2) /* Take first mic as headset mic */ | ||
83 | 85 | ||
84 | int snd_hda_parse_pin_defcfg(struct hda_codec *codec, | 86 | int snd_hda_parse_pin_defcfg(struct hda_codec *codec, |
85 | struct auto_pin_cfg *cfg, | 87 | struct auto_pin_cfg *cfg, |