diff options
author | Takashi Iwai <tiwai@suse.de> | 2011-11-23 01:52:15 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-11-23 01:52:15 -0500 |
commit | 61071594f64ed12328046f94716d1d744bddc0a1 (patch) | |
tree | 24152470f09990504230aeee5718c358e67c2d47 /sound | |
parent | 6759dc323826c2c806c998cd93945c5476688dd2 (diff) |
ALSA: hda/realtek - Minor cleanup
Use an inline function for the common pattern for assigning a capsrc.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 06c0c12d4fec..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); |
@@ -1058,8 +1063,7 @@ static bool alc_rebuild_imux_for_auto_mic(struct hda_codec *codec) | |||
1058 | hda_nid_t pin = spec->imux_pins[i]; | 1063 | hda_nid_t pin = spec->imux_pins[i]; |
1059 | int c; | 1064 | int c; |
1060 | for (c = 0; c < spec->num_adc_nids; c++) { | 1065 | for (c = 0; c < spec->num_adc_nids; c++) { |
1061 | hda_nid_t cap = spec->capsrc_nids ? | 1066 | hda_nid_t cap = get_capsrc(spec, c); |
1062 | spec->capsrc_nids[c] : spec->adc_nids[c]; | ||
1063 | int idx = get_connection_index(codec, cap, pin); | 1067 | int idx = get_connection_index(codec, cap, pin); |
1064 | if (idx >= 0) { | 1068 | if (idx >= 0) { |
1065 | imux->items[i].index = idx; | 1069 | imux->items[i].index = idx; |
@@ -1969,10 +1973,8 @@ static int alc_build_controls(struct hda_codec *codec) | |||
1969 | if (!kctl) | 1973 | if (!kctl) |
1970 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); | 1974 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); |
1971 | for (i = 0; kctl && i < kctl->count; i++) { | 1975 | for (i = 0; kctl && i < kctl->count; i++) { |
1972 | const hda_nid_t *nids = spec->capsrc_nids; | 1976 | err = snd_hda_add_nid(codec, kctl, i, |
1973 | if (!nids) | 1977 | get_capsrc(spec, i)); |
1974 | nids = spec->adc_nids; | ||
1975 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); | ||
1976 | if (err < 0) | 1978 | if (err < 0) |
1977 | return err; | 1979 | return err; |
1978 | } | 1980 | } |
@@ -2759,8 +2761,7 @@ static int alc_auto_create_input_ctls(struct hda_codec *codec) | |||
2759 | } | 2761 | } |
2760 | 2762 | ||
2761 | for (c = 0; c < num_adcs; c++) { | 2763 | for (c = 0; c < num_adcs; c++) { |
2762 | hda_nid_t cap = spec->capsrc_nids ? | 2764 | hda_nid_t cap = get_capsrc(spec, c); |
2763 | spec->capsrc_nids[c] : spec->adc_nids[c]; | ||
2764 | idx = get_connection_index(codec, cap, pin); | 2765 | idx = get_connection_index(codec, cap, pin); |
2765 | if (idx >= 0) { | 2766 | if (idx >= 0) { |
2766 | spec->imux_pins[imux->num_items] = pin; | 2767 | spec->imux_pins[imux->num_items] = pin; |
@@ -3706,8 +3707,7 @@ static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin) | |||
3706 | if (!pin) | 3707 | if (!pin) |
3707 | return 0; | 3708 | return 0; |
3708 | for (i = 0; i < spec->num_adc_nids; i++) { | 3709 | for (i = 0; i < spec->num_adc_nids; i++) { |
3709 | hda_nid_t cap = spec->capsrc_nids ? | 3710 | hda_nid_t cap = get_capsrc(spec, i); |
3710 | spec->capsrc_nids[i] : spec->adc_nids[i]; | ||
3711 | int idx; | 3711 | int idx; |
3712 | 3712 | ||
3713 | idx = get_connection_index(codec, cap, pin); | 3713 | idx = get_connection_index(codec, cap, pin); |