aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/pci/hda/patch_realtek.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 18d53d2036a3..b4f78952381a 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -5200,7 +5200,8 @@ static int alc_auto_create_input_ctls(struct hda_codec *codec,
5200{ 5200{
5201 struct alc_spec *spec = codec->spec; 5201 struct alc_spec *spec = codec->spec;
5202 struct hda_input_mux *imux = &spec->private_imux[0]; 5202 struct hda_input_mux *imux = &spec->private_imux[0];
5203 int i, err, idx, type, type_idx = 0; 5203 int i, err, idx, type_idx = 0;
5204 const char *prev_label = NULL;
5204 5205
5205 for (i = 0; i < cfg->num_inputs; i++) { 5206 for (i = 0; i < cfg->num_inputs; i++) {
5206 hda_nid_t pin; 5207 hda_nid_t pin;
@@ -5210,12 +5211,13 @@ static int alc_auto_create_input_ctls(struct hda_codec *codec,
5210 if (!alc_is_input_pin(codec, pin)) 5211 if (!alc_is_input_pin(codec, pin))
5211 continue; 5212 continue;
5212 5213
5213 type = cfg->inputs[i].type; 5214 label = hda_get_autocfg_input_label(codec, cfg, i);
5214 if (i > 0 && type == cfg->inputs[i - 1].type) 5215 if (prev_label && !strcmp(label, prev_label))
5215 type_idx++; 5216 type_idx++;
5216 else 5217 else
5217 type_idx = 0; 5218 type_idx = 0;
5218 label = hda_get_autocfg_input_label(codec, cfg, i); 5219 prev_label = label;
5220
5219 if (mixer) { 5221 if (mixer) {
5220 idx = get_connection_index(codec, mixer, pin); 5222 idx = get_connection_index(codec, mixer, pin);
5221 if (idx >= 0) { 5223 if (idx >= 0) {
@@ -10819,25 +10821,30 @@ static int alc_auto_add_mic_boost(struct hda_codec *codec)
10819{ 10821{
10820 struct alc_spec *spec = codec->spec; 10822 struct alc_spec *spec = codec->spec;
10821 struct auto_pin_cfg *cfg = &spec->autocfg; 10823 struct auto_pin_cfg *cfg = &spec->autocfg;
10822 int i, err, type; 10824 int i, err;
10823 int type_idx = 0; 10825 int type_idx = 0;
10824 hda_nid_t nid; 10826 hda_nid_t nid;
10827 const char *prev_label = NULL;
10825 10828
10826 for (i = 0; i < cfg->num_inputs; i++) { 10829 for (i = 0; i < cfg->num_inputs; i++) {
10827 if (cfg->inputs[i].type > AUTO_PIN_MIC) 10830 if (cfg->inputs[i].type > AUTO_PIN_MIC)
10828 break; 10831 break;
10829 nid = cfg->inputs[i].pin; 10832 nid = cfg->inputs[i].pin;
10830 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) { 10833 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) {
10831 char label[32]; 10834 const char *label;
10832 type = cfg->inputs[i].type; 10835 char boost_label[32];
10833 if (i > 0 && type == cfg->inputs[i - 1].type) 10836
10837 label = hda_get_autocfg_input_label(codec, cfg, i);
10838 if (prev_label && !strcmp(label, prev_label))
10834 type_idx++; 10839 type_idx++;
10835 else 10840 else
10836 type_idx = 0; 10841 type_idx = 0;
10837 snprintf(label, sizeof(label), "%s Boost Volume", 10842 prev_label = label;
10838 hda_get_autocfg_input_label(codec, cfg, i)); 10843
10839 err = add_control(spec, ALC_CTL_WIDGET_VOL, label, 10844 snprintf(boost_label, sizeof(boost_label),
10840 type_idx, 10845 "%s Boost Volume", label);
10846 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10847 boost_label, type_idx,
10841 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); 10848 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10842 if (err < 0) 10849 if (err < 0)
10843 return err; 10850 return err;