diff options
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 308bb575bc06..cbde019d3d52 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -277,6 +277,12 @@ static bool alc_dyn_adc_pcm_resetup(struct hda_codec *codec, int cur) | |||
277 | return false; | 277 | return false; |
278 | } | 278 | } |
279 | 279 | ||
280 | static inline hda_nid_t get_capsrc(struct alc_spec *spec, int idx) | ||
281 | { | ||
282 | return spec->capsrc_nids ? | ||
283 | spec->capsrc_nids[idx] : spec->adc_nids[idx]; | ||
284 | } | ||
285 | |||
280 | /* select the given imux item; either unmute exclusively or select the route */ | 286 | /* select the given imux item; either unmute exclusively or select the route */ |
281 | static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx, | 287 | static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx, |
282 | unsigned int idx, bool force) | 288 | unsigned int idx, bool force) |
@@ -303,8 +309,7 @@ static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx, | |||
303 | adc_idx = spec->dyn_adc_idx[idx]; | 309 | adc_idx = spec->dyn_adc_idx[idx]; |
304 | } | 310 | } |
305 | 311 | ||
306 | nid = spec->capsrc_nids ? | 312 | nid = get_capsrc(spec, adc_idx); |
307 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; | ||
308 | 313 | ||
309 | /* no selection? */ | 314 | /* no selection? */ |
310 | num_conns = snd_hda_get_conn_list(codec, nid, NULL); | 315 | num_conns = snd_hda_get_conn_list(codec, nid, NULL); |
@@ -1054,8 +1059,19 @@ static bool alc_rebuild_imux_for_auto_mic(struct hda_codec *codec) | |||
1054 | spec->imux_pins[2] = spec->dock_mic_pin; | 1059 | spec->imux_pins[2] = spec->dock_mic_pin; |
1055 | for (i = 0; i < 3; i++) { | 1060 | for (i = 0; i < 3; i++) { |
1056 | strcpy(imux->items[i].label, texts[i]); | 1061 | strcpy(imux->items[i].label, texts[i]); |
1057 | if (spec->imux_pins[i]) | 1062 | if (spec->imux_pins[i]) { |
1063 | hda_nid_t pin = spec->imux_pins[i]; | ||
1064 | int c; | ||
1065 | for (c = 0; c < spec->num_adc_nids; c++) { | ||
1066 | hda_nid_t cap = get_capsrc(spec, c); | ||
1067 | int idx = get_connection_index(codec, cap, pin); | ||
1068 | if (idx >= 0) { | ||
1069 | imux->items[i].index = idx; | ||
1070 | break; | ||
1071 | } | ||
1072 | } | ||
1058 | imux->num_items = i + 1; | 1073 | imux->num_items = i + 1; |
1074 | } | ||
1059 | } | 1075 | } |
1060 | spec->num_mux_defs = 1; | 1076 | spec->num_mux_defs = 1; |
1061 | spec->input_mux = imux; | 1077 | spec->input_mux = imux; |
@@ -1452,7 +1468,7 @@ static void alc_apply_fixup(struct hda_codec *codec, int action) | |||
1452 | switch (fix->type) { | 1468 | switch (fix->type) { |
1453 | case ALC_FIXUP_SKU: | 1469 | case ALC_FIXUP_SKU: |
1454 | if (action != ALC_FIXUP_ACT_PRE_PROBE || !fix->v.sku) | 1470 | if (action != ALC_FIXUP_ACT_PRE_PROBE || !fix->v.sku) |
1455 | break;; | 1471 | break; |
1456 | snd_printdd(KERN_INFO "hda_codec: %s: " | 1472 | snd_printdd(KERN_INFO "hda_codec: %s: " |
1457 | "Apply sku override for %s\n", | 1473 | "Apply sku override for %s\n", |
1458 | codec->chip_name, modelname); | 1474 | codec->chip_name, modelname); |
@@ -1957,10 +1973,8 @@ static int alc_build_controls(struct hda_codec *codec) | |||
1957 | if (!kctl) | 1973 | if (!kctl) |
1958 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); | 1974 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); |
1959 | for (i = 0; kctl && i < kctl->count; i++) { | 1975 | for (i = 0; kctl && i < kctl->count; i++) { |
1960 | const hda_nid_t *nids = spec->capsrc_nids; | 1976 | err = snd_hda_add_nid(codec, kctl, i, |
1961 | if (!nids) | 1977 | get_capsrc(spec, i)); |
1962 | nids = spec->adc_nids; | ||
1963 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); | ||
1964 | if (err < 0) | 1978 | if (err < 0) |
1965 | return err; | 1979 | return err; |
1966 | } | 1980 | } |
@@ -2747,8 +2761,7 @@ static int alc_auto_create_input_ctls(struct hda_codec *codec) | |||
2747 | } | 2761 | } |
2748 | 2762 | ||
2749 | for (c = 0; c < num_adcs; c++) { | 2763 | for (c = 0; c < num_adcs; c++) { |
2750 | hda_nid_t cap = spec->capsrc_nids ? | 2764 | hda_nid_t cap = get_capsrc(spec, c); |
2751 | spec->capsrc_nids[c] : spec->adc_nids[c]; | ||
2752 | idx = get_connection_index(codec, cap, pin); | 2765 | idx = get_connection_index(codec, cap, pin); |
2753 | if (idx >= 0) { | 2766 | if (idx >= 0) { |
2754 | spec->imux_pins[imux->num_items] = pin; | 2767 | spec->imux_pins[imux->num_items] = pin; |
@@ -3694,8 +3707,7 @@ static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin) | |||
3694 | if (!pin) | 3707 | if (!pin) |
3695 | return 0; | 3708 | return 0; |
3696 | for (i = 0; i < spec->num_adc_nids; i++) { | 3709 | for (i = 0; i < spec->num_adc_nids; i++) { |
3697 | hda_nid_t cap = spec->capsrc_nids ? | 3710 | hda_nid_t cap = get_capsrc(spec, i); |
3698 | spec->capsrc_nids[i] : spec->adc_nids[i]; | ||
3699 | int idx; | 3711 | int idx; |
3700 | 3712 | ||
3701 | idx = get_connection_index(codec, cap, pin); | 3713 | idx = get_connection_index(codec, cap, pin); |