diff options
author | Takashi Iwai <tiwai@suse.de> | 2011-06-28 06:45:47 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-06-29 02:01:46 -0400 |
commit | 8d087c7600499463b7b8e3d4da4da40669cb8bfa (patch) | |
tree | 817ba350193d4c1cd77546dbd0bbe0d68ee14ecf /sound/pci/hda/patch_realtek.c | |
parent | 63f10d2ca78c17cdd612c1daee7daffacca8b7fb (diff) |
ALSA: hda - Create snd_hda_get_conn_index() helper function
Create snd_hda_get_conn_index() helper function for obtaining the
connection index of the widget. Replaced the similar codes used in
several codec-drivers with this common helper.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index cf383ede281d..7b96dcef2c62 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -1195,18 +1195,8 @@ static void alc_line_automute(struct hda_codec *codec) | |||
1195 | update_speakers(codec); | 1195 | update_speakers(codec); |
1196 | } | 1196 | } |
1197 | 1197 | ||
1198 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, | 1198 | #define get_connection_index(codec, mux, nid) \ |
1199 | hda_nid_t nid) | 1199 | snd_hda_get_conn_index(codec, mux, nid, 0) |
1200 | { | ||
1201 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; | ||
1202 | int i, nums; | ||
1203 | |||
1204 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); | ||
1205 | for (i = 0; i < nums; i++) | ||
1206 | if (conn[i] == nid) | ||
1207 | return i; | ||
1208 | return -1; | ||
1209 | } | ||
1210 | 1200 | ||
1211 | /* switch the current ADC according to the jack state */ | 1201 | /* switch the current ADC according to the jack state */ |
1212 | static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec) | 1202 | static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec) |