summaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-01-18 10:01:15 +0100
committerTakashi Iwai <tiwai@suse.de>2013-01-18 10:01:15 +0100
commit9dba205b486152e3d31ab04f3b60efeef035cec5 (patch)
treec25f01d828714bd45ace02f72506b2456afd7ccb /sound/pci
parent8a6c21aee8ab94c35e9db7a4ad35cfeb94f57d59 (diff)
downloadop-kernel-dev-9dba205b486152e3d31ab04f3b60efeef035cec5.zip
op-kernel-dev-9dba205b486152e3d31ab04f3b60efeef035cec5.tar.gz
ALSA: hda - Keep autocfg.input idx value in imux table
Since the imux table entries can be a subset of autocfg.input table, the indices of these aren't always same. For passing the proper index value of autocfg.input at creating input ctl labels (via snd_hda_autocfg_input_label()), keep the corresponding autocfg.input idx value in the index field of each imux item, which isn't used in the generic driver. Also, this makes easier to check the invalid imux pin for stereo mix. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/hda_generic.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index ef4c04a..7444d2e 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -2478,7 +2478,8 @@ static int check_dyn_adc_switch(struct hda_codec *codec)
/* parse capture source paths from the given pin and create imux items */
static int parse_capture_source(struct hda_codec *codec, hda_nid_t pin,
- int num_adcs, const char *label, int anchor)
+ int cfg_idx, int num_adcs,
+ const char *label, int anchor)
{
struct hda_gen_spec *spec = codec->spec;
struct hda_input_mux *imux = &spec->input_mux;
@@ -2501,8 +2502,7 @@ static int parse_capture_source(struct hda_codec *codec, hda_nid_t pin,
if (!imux_added) {
spec->imux_pins[imux->num_items] = pin;
- snd_hda_add_imux_item(imux, label,
- imux->num_items, NULL);
+ snd_hda_add_imux_item(imux, label, cfg_idx, NULL);
imux_added = true;
}
}
@@ -2513,6 +2513,9 @@ static int parse_capture_source(struct hda_codec *codec, hda_nid_t pin,
/*
* create playback/capture controls for input pins
*/
+
+#define CFG_IDX_MIX 99 /* a dummy cfg->input idx for stereo mix */
+
static int create_input_ctls(struct hda_codec *codec)
{
struct hda_gen_spec *spec = codec->spec;
@@ -2556,7 +2559,8 @@ static int create_input_ctls(struct hda_codec *codec)
}
}
- err = parse_capture_source(codec, pin, num_adcs, label, -mixer);
+ err = parse_capture_source(codec, pin, i,
+ num_adcs, label, -mixer);
if (err < 0)
return err;
@@ -2568,7 +2572,7 @@ static int create_input_ctls(struct hda_codec *codec)
}
if (mixer && spec->add_stereo_mix_input) {
- err = parse_capture_source(codec, mixer, num_adcs,
+ err = parse_capture_source(codec, mixer, CFG_IDX_MIX, num_adcs,
"Stereo Mix", 0);
if (err < 0)
return err;
@@ -2909,7 +2913,11 @@ static int create_multi_cap_vol_ctl(struct hda_codec *codec)
for (i = 0; i < imux->num_items; i++) {
const char *label;
bool inv_dmic;
- label = hda_get_autocfg_input_label(codec, &spec->autocfg, i);
+
+ if (imux->items[i].index >= spec->autocfg.num_inputs)
+ continue;
+ label = hda_get_autocfg_input_label(codec, &spec->autocfg,
+ imux->items[i].index);
if (prev_label && !strcmp(label, prev_label))
type_idx++;
else
OpenPOWER on IntegriCloud