diff options
author | Takashi Iwai <tiwai@suse.de> | 2011-05-16 05:45:15 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-05-16 05:45:15 -0400 |
commit | f9759301c68a274302e434daa135926c25ca51ca (patch) | |
tree | a60ab695db1f273ec87471cc0df62b63da5c1434 /sound/pci/hda/patch_conexant.c | |
parent | cf27f29ae2a4a0feed75262361f9f7dff20230b1 (diff) |
ALSA: hda - Don't create multiple same volume/boost controls in Cxt auto-parser
Check the routing more exactly for avoiding the duplicated controls for
the very same effect for multiple capture routes in Conexant auto-parser.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_conexant.c')
-rw-r--r-- | sound/pci/hda/patch_conexant.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 28664e1c1ae5..ed983a0b0dc1 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -109,6 +109,7 @@ struct conexant_spec { | |||
109 | struct auto_pin_cfg autocfg; | 109 | struct auto_pin_cfg autocfg; |
110 | struct hda_input_mux private_imux; | 110 | struct hda_input_mux private_imux; |
111 | int imux_cfg_idx[HDA_MAX_NUM_INPUTS]; /* corresponding autocfg.input */ | 111 | int imux_cfg_idx[HDA_MAX_NUM_INPUTS]; /* corresponding autocfg.input */ |
112 | hda_nid_t imux_boost_nid[HDA_MAX_NUM_INPUTS]; /* boost widget */ | ||
112 | hda_nid_t imux_adcs[HDA_MAX_NUM_INPUTS]; | 113 | hda_nid_t imux_adcs[HDA_MAX_NUM_INPUTS]; |
113 | hda_nid_t imux_pins[HDA_MAX_NUM_INPUTS]; | 114 | hda_nid_t imux_pins[HDA_MAX_NUM_INPUTS]; |
114 | hda_nid_t private_adc_nids[HDA_MAX_NUM_INPUTS]; | 115 | hda_nid_t private_adc_nids[HDA_MAX_NUM_INPUTS]; |
@@ -3651,6 +3652,7 @@ static void cx_auto_parse_input(struct hda_codec *codec) | |||
3651 | const char *label; | 3652 | const char *label; |
3652 | label = hda_get_autocfg_input_label(codec, cfg, i); | 3653 | label = hda_get_autocfg_input_label(codec, cfg, i); |
3653 | spec->imux_cfg_idx[imux->num_items] = i; | 3654 | spec->imux_cfg_idx[imux->num_items] = i; |
3655 | spec->imux_boost_nid[imux->num_items] = 0; | ||
3654 | spec->imux_adcs[imux->num_items] = adc; | 3656 | spec->imux_adcs[imux->num_items] = adc; |
3655 | spec->imux_pins[imux->num_items] = | 3657 | spec->imux_pins[imux->num_items] = |
3656 | cfg->inputs[i].pin; | 3658 | cfg->inputs[i].pin; |
@@ -3997,7 +3999,7 @@ static int cx_auto_add_boost_volume(struct hda_codec *codec, int idx, | |||
3997 | { | 3999 | { |
3998 | struct conexant_spec *spec = codec->spec; | 4000 | struct conexant_spec *spec = codec->spec; |
3999 | hda_nid_t mux, nid; | 4001 | hda_nid_t mux, nid; |
4000 | int con; | 4002 | int i, con; |
4001 | 4003 | ||
4002 | nid = spec->imux_pins[idx]; | 4004 | nid = spec->imux_pins[idx]; |
4003 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) | 4005 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
@@ -4007,9 +4009,16 @@ static int cx_auto_add_boost_volume(struct hda_codec *codec, int idx, | |||
4007 | false, 0); | 4009 | false, 0); |
4008 | if (con < 0) | 4010 | if (con < 0) |
4009 | return 0; | 4011 | return 0; |
4010 | if (get_wcaps(codec, mux) & AC_WCAP_OUT_AMP) | 4012 | for (i = 0; i < idx; i++) { |
4013 | if (spec->imux_boost_nid[i] == mux) | ||
4014 | return 0; /* already present */ | ||
4015 | } | ||
4016 | |||
4017 | if (get_wcaps(codec, mux) & AC_WCAP_OUT_AMP) { | ||
4018 | spec->imux_boost_nid[idx] = mux; | ||
4011 | return cx_auto_add_volume(codec, label, " Boost", 0, | 4019 | return cx_auto_add_volume(codec, label, " Boost", 0, |
4012 | mux, HDA_OUTPUT); | 4020 | mux, HDA_OUTPUT); |
4021 | } | ||
4013 | return 0; | 4022 | return 0; |
4014 | } | 4023 | } |
4015 | 4024 | ||
@@ -4050,6 +4059,8 @@ static int cx_auto_build_input_controls(struct hda_codec *codec) | |||
4050 | return err; | 4059 | return err; |
4051 | 4060 | ||
4052 | if (!multi_connection) { | 4061 | if (!multi_connection) { |
4062 | if (i > 0) | ||
4063 | continue; | ||
4053 | err = cx_auto_add_capture_volume(codec, nid, | 4064 | err = cx_auto_add_capture_volume(codec, nid, |
4054 | "Capture", "", cidx); | 4065 | "Capture", "", cidx); |
4055 | } else { | 4066 | } else { |