aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_auto_parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda/hda_auto_parser.c')
-rw-r--r--sound/pci/hda/hda_auto_parser.c56
1 files changed, 39 insertions, 17 deletions
diff --git a/sound/pci/hda/hda_auto_parser.c b/sound/pci/hda/hda_auto_parser.c
index 4f7d2dfcef7b..4ec6dc88b7f8 100644
--- a/sound/pci/hda/hda_auto_parser.c
+++ b/sound/pci/hda/hda_auto_parser.c
@@ -141,7 +141,6 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec,
141 memset(sequences_hp, 0, sizeof(sequences_hp)); 141 memset(sequences_hp, 0, sizeof(sequences_hp));
142 assoc_line_out = 0; 142 assoc_line_out = 0;
143 143
144 codec->ignore_misc_bit = true;
145 end_nid = codec->start_nid + codec->num_nodes; 144 end_nid = codec->start_nid + codec->num_nodes;
146 for (nid = codec->start_nid; nid < end_nid; nid++) { 145 for (nid = codec->start_nid; nid < end_nid; nid++) {
147 unsigned int wid_caps = get_wcaps(codec, nid); 146 unsigned int wid_caps = get_wcaps(codec, nid);
@@ -157,9 +156,6 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec,
157 continue; 156 continue;
158 157
159 def_conf = snd_hda_codec_get_pincfg(codec, nid); 158 def_conf = snd_hda_codec_get_pincfg(codec, nid);
160 if (!(get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid)) &
161 AC_DEFCFG_MISC_NO_PRESENCE))
162 codec->ignore_misc_bit = false;
163 conn = get_defcfg_connect(def_conf); 159 conn = get_defcfg_connect(def_conf);
164 if (conn == AC_JACK_PORT_NONE) 160 if (conn == AC_JACK_PORT_NONE)
165 continue; 161 continue;
@@ -502,6 +498,38 @@ static const char *check_output_sfx(hda_nid_t nid, const hda_nid_t *pins,
502 return channel_sfx[i]; 498 return channel_sfx[i];
503} 499}
504 500
501static const char *check_output_pfx(struct hda_codec *codec, hda_nid_t nid)
502{
503 unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid);
504 int attr = snd_hda_get_input_pin_attr(def_conf);
505
506 /* check the location */
507 switch (attr) {
508 case INPUT_PIN_ATTR_DOCK:
509 return "Dock ";
510 case INPUT_PIN_ATTR_FRONT:
511 return "Front ";
512 }
513 return "";
514}
515
516static int get_hp_label_index(struct hda_codec *codec, hda_nid_t nid,
517 const hda_nid_t *pins, int num_pins)
518{
519 int i, j, idx = 0;
520
521 const char *pfx = check_output_pfx(codec, nid);
522
523 i = find_idx_in_nid_list(nid, pins, num_pins);
524 if (i < 0)
525 return -1;
526 for (j = 0; j < i; j++)
527 if (pfx == check_output_pfx(codec, pins[j]))
528 idx++;
529
530 return idx;
531}
532
505static int fill_audio_out_name(struct hda_codec *codec, hda_nid_t nid, 533static int fill_audio_out_name(struct hda_codec *codec, hda_nid_t nid,
506 const struct auto_pin_cfg *cfg, 534 const struct auto_pin_cfg *cfg,
507 const char *name, char *label, int maxlen, 535 const char *name, char *label, int maxlen,
@@ -509,20 +537,13 @@ static int fill_audio_out_name(struct hda_codec *codec, hda_nid_t nid,
509{ 537{
510 unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid); 538 unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid);
511 int attr = snd_hda_get_input_pin_attr(def_conf); 539 int attr = snd_hda_get_input_pin_attr(def_conf);
512 const char *pfx = "", *sfx = ""; 540 const char *pfx, *sfx = "";
513 541
514 /* handle as a speaker if it's a fixed line-out */ 542 /* handle as a speaker if it's a fixed line-out */
515 if (!strcmp(name, "Line Out") && attr == INPUT_PIN_ATTR_INT) 543 if (!strcmp(name, "Line Out") && attr == INPUT_PIN_ATTR_INT)
516 name = "Speaker"; 544 name = "Speaker";
517 /* check the location */ 545 pfx = check_output_pfx(codec, nid);
518 switch (attr) { 546
519 case INPUT_PIN_ATTR_DOCK:
520 pfx = "Dock ";
521 break;
522 case INPUT_PIN_ATTR_FRONT:
523 pfx = "Front ";
524 break;
525 }
526 if (cfg) { 547 if (cfg) {
527 /* try to give a unique suffix if needed */ 548 /* try to give a unique suffix if needed */
528 sfx = check_output_sfx(nid, cfg->line_out_pins, cfg->line_outs, 549 sfx = check_output_sfx(nid, cfg->line_out_pins, cfg->line_outs,
@@ -532,8 +553,8 @@ static int fill_audio_out_name(struct hda_codec *codec, hda_nid_t nid,
532 indexp); 553 indexp);
533 if (!sfx) { 554 if (!sfx) {
534 /* don't add channel suffix for Headphone controls */ 555 /* don't add channel suffix for Headphone controls */
535 int idx = find_idx_in_nid_list(nid, cfg->hp_pins, 556 int idx = get_hp_label_index(codec, nid, cfg->hp_pins,
536 cfg->hp_outs); 557 cfg->hp_outs);
537 if (idx >= 0) 558 if (idx >= 0)
538 *indexp = idx; 559 *indexp = idx;
539 sfx = ""; 560 sfx = "";
@@ -739,7 +760,8 @@ void snd_hda_pick_fixup(struct hda_codec *codec,
739 for (q = quirk; q->subvendor; q++) { 760 for (q = quirk; q->subvendor; q++) {
740 unsigned int vendorid = 761 unsigned int vendorid =
741 q->subdevice | (q->subvendor << 16); 762 q->subdevice | (q->subvendor << 16);
742 if (vendorid == codec->subsystem_id) { 763 unsigned int mask = 0xffff0000 | q->subdevice_mask;
764 if ((codec->subsystem_id & mask) == (vendorid & mask)) {
743 id = q->value; 765 id = q->value;
744#ifdef CONFIG_SND_DEBUG_VERBOSE 766#ifdef CONFIG_SND_DEBUG_VERBOSE
745 name = q->name; 767 name = q->name;