aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda
diff options
context:
space:
mode:
authorDavid Henningsson <david.henningsson@canonical.com>2014-09-23 04:38:18 -0400
committerTakashi Iwai <tiwai@suse.de>2014-09-23 09:57:32 -0400
commit95f72cf2cdf0e612aeaf36d8af51689882fd64db (patch)
tree44da358dd7eaceede5e7d17ef6d9f63b8ab53d7e /sound/pci/hda
parent861a04ed15a48e9af7b591cd8ae3bc46aece1733 (diff)
ALSA: hda - Sort input pins depending on amp caps
If one input has a boost and another one has not, and they're equal otherwise, it's more likely you want to use the input with the boost as your primary input. See hda-emu.git/codecs/canonical/cx20590-lenovo-20b2z00bus-ccert-201305-13496 for an example. Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda')
-rw-r--r--sound/pci/hda/hda_auto_parser.c21
-rw-r--r--sound/pci/hda/hda_auto_parser.h1
2 files changed, 15 insertions, 7 deletions
diff --git a/sound/pci/hda/hda_auto_parser.c b/sound/pci/hda/hda_auto_parser.c
index 51dea49aadd4..fcc5e478c9a1 100644
--- a/sound/pci/hda/hda_auto_parser.c
+++ b/sound/pci/hda/hda_auto_parser.c
@@ -57,12 +57,14 @@ static void sort_pins_by_sequence(hda_nid_t *pins, struct auto_out_pin *list,
57 57
58 58
59/* add the found input-pin to the cfg->inputs[] table */ 59/* add the found input-pin to the cfg->inputs[] table */
60static void add_auto_cfg_input_pin(struct auto_pin_cfg *cfg, hda_nid_t nid, 60static void add_auto_cfg_input_pin(struct hda_codec *codec, struct auto_pin_cfg *cfg,
61 int type) 61 hda_nid_t nid, int type)
62{ 62{
63 if (cfg->num_inputs < AUTO_CFG_MAX_INS) { 63 if (cfg->num_inputs < AUTO_CFG_MAX_INS) {
64 cfg->inputs[cfg->num_inputs].pin = nid; 64 cfg->inputs[cfg->num_inputs].pin = nid;
65 cfg->inputs[cfg->num_inputs].type = type; 65 cfg->inputs[cfg->num_inputs].type = type;
66 cfg->inputs[cfg->num_inputs].has_boost_on_pin =
67 nid_has_volume(codec, nid, HDA_INPUT);
66 cfg->num_inputs++; 68 cfg->num_inputs++;
67 } 69 }
68} 70}
@@ -71,7 +73,12 @@ static int compare_input_type(const void *ap, const void *bp)
71{ 73{
72 const struct auto_pin_cfg_item *a = ap; 74 const struct auto_pin_cfg_item *a = ap;
73 const struct auto_pin_cfg_item *b = bp; 75 const struct auto_pin_cfg_item *b = bp;
74 return (int)(a->type - b->type); 76 if (a->type != b->type)
77 return (int)(a->type - b->type);
78
79 /* In case one has boost and the other one has not,
80 pick the one with boost first. */
81 return (int)(b->has_boost_on_pin - a->has_boost_on_pin);
75} 82}
76 83
77/* Reorder the surround channels 84/* Reorder the surround channels
@@ -268,16 +275,16 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec,
268 cfg->hp_outs++; 275 cfg->hp_outs++;
269 break; 276 break;
270 case AC_JACK_MIC_IN: 277 case AC_JACK_MIC_IN:
271 add_auto_cfg_input_pin(cfg, nid, AUTO_PIN_MIC); 278 add_auto_cfg_input_pin(codec, cfg, nid, AUTO_PIN_MIC);
272 break; 279 break;
273 case AC_JACK_LINE_IN: 280 case AC_JACK_LINE_IN:
274 add_auto_cfg_input_pin(cfg, nid, AUTO_PIN_LINE_IN); 281 add_auto_cfg_input_pin(codec, cfg, nid, AUTO_PIN_LINE_IN);
275 break; 282 break;
276 case AC_JACK_CD: 283 case AC_JACK_CD:
277 add_auto_cfg_input_pin(cfg, nid, AUTO_PIN_CD); 284 add_auto_cfg_input_pin(codec, cfg, nid, AUTO_PIN_CD);
278 break; 285 break;
279 case AC_JACK_AUX: 286 case AC_JACK_AUX:
280 add_auto_cfg_input_pin(cfg, nid, AUTO_PIN_AUX); 287 add_auto_cfg_input_pin(codec, cfg, nid, AUTO_PIN_AUX);
281 break; 288 break;
282 case AC_JACK_SPDIF_OUT: 289 case AC_JACK_SPDIF_OUT:
283 case AC_JACK_DIG_OTHER_OUT: 290 case AC_JACK_DIG_OTHER_OUT:
diff --git a/sound/pci/hda/hda_auto_parser.h b/sound/pci/hda/hda_auto_parser.h
index e941f604f5e5..2b8e29fd73e7 100644
--- a/sound/pci/hda/hda_auto_parser.h
+++ b/sound/pci/hda/hda_auto_parser.h
@@ -38,6 +38,7 @@ struct auto_pin_cfg_item {
38 int type; 38 int type;
39 unsigned int is_headset_mic:1; 39 unsigned int is_headset_mic:1;
40 unsigned int is_headphone_mic:1; /* Mic-only in headphone jack */ 40 unsigned int is_headphone_mic:1; /* Mic-only in headphone jack */
41 unsigned int has_boost_on_pin:1;
41}; 42};
42 43
43struct auto_pin_cfg; 44struct auto_pin_cfg;