aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2011-07-06 11:39:59 -0400
committerTakashi Iwai <tiwai@suse.de>2011-07-07 03:35:14 -0400
commitf970de2555636c563935cdc2abc5684da2adacc4 (patch)
treed1b041fa3cb5a4da2318fe1cfd622031f1f08722 /sound
parentd6cc9fabd58f33e829a3182aa856db0d57c726ef (diff)
ALSA: hda - Unify alc*_auto_init_input_src() in patch_realtek.c
The only different implmentation was alc880_auto_init_input_src(), and now it covers this variant, and we can use the single function for all codecs. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/patch_realtek.c62
1 files changed, 17 insertions, 45 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index cdd8561f5f4b..b960020956c8 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -5553,31 +5553,10 @@ static void alc_auto_init_analog_input(struct hda_codec *codec)
5553 } 5553 }
5554} 5554}
5555 5555
5556static void alc880_auto_init_input_src(struct hda_codec *codec)
5557{
5558 struct alc_spec *spec = codec->spec;
5559 int c;
5560
5561 for (c = 0; c < spec->num_adc_nids; c++) {
5562 unsigned int mux_idx;
5563 const struct hda_input_mux *imux;
5564 mux_idx = c >= spec->num_mux_defs ? 0 : c;
5565 imux = &spec->input_mux[mux_idx];
5566 if (!imux->num_items && mux_idx > 0)
5567 imux = &spec->input_mux[0];
5568 if (imux)
5569 snd_hda_codec_write(codec, spec->adc_nids[c], 0,
5570 AC_VERB_SET_CONNECT_SEL,
5571 imux->items[0].index);
5572 snd_hda_codec_write(codec, spec->adc_nids[c], 0,
5573 AC_VERB_SET_AMP_GAIN_MUTE,
5574 AMP_IN_MUTE(0));
5575 }
5576}
5577
5578static int alc_auto_add_multi_channel_mode(struct hda_codec *codec, 5556static int alc_auto_add_multi_channel_mode(struct hda_codec *codec,
5579 int (*fill_dac)(struct hda_codec *)); 5557 int (*fill_dac)(struct hda_codec *));
5580static void alc_remove_invalid_adc_nids(struct hda_codec *codec); 5558static void alc_remove_invalid_adc_nids(struct hda_codec *codec);
5559static void alc_auto_init_input_src(struct hda_codec *codec);
5581 5560
5582/* parse the BIOS configuration and set up the alc_spec */ 5561/* parse the BIOS configuration and set up the alc_spec */
5583/* return 1 if successful, 0 if the proper config is not found, 5562/* return 1 if successful, 0 if the proper config is not found,
@@ -5640,7 +5619,7 @@ static void alc880_auto_init(struct hda_codec *codec)
5640 alc_auto_init_multi_out(codec); 5619 alc_auto_init_multi_out(codec);
5641 alc_auto_init_extra_out(codec); 5620 alc_auto_init_extra_out(codec);
5642 alc_auto_init_analog_input(codec); 5621 alc_auto_init_analog_input(codec);
5643 alc880_auto_init_input_src(codec); 5622 alc_auto_init_input_src(codec);
5644 alc_auto_init_digital(codec); 5623 alc_auto_init_digital(codec);
5645 if (spec->unsol_event) 5624 if (spec->unsol_event)
5646 alc_inithook(codec); 5625 alc_inithook(codec);
@@ -7156,8 +7135,6 @@ static void alc260_auto_init_multi_out(struct hda_codec *codec)
7156 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); 7135 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
7157} 7136}
7158 7137
7159#define alc260_auto_init_input_src alc880_auto_init_input_src
7160
7161static int alc260_parse_auto_config(struct hda_codec *codec) 7138static int alc260_parse_auto_config(struct hda_codec *codec)
7162{ 7139{
7163 struct alc_spec *spec = codec->spec; 7140 struct alc_spec *spec = codec->spec;
@@ -7201,7 +7178,7 @@ static void alc260_auto_init(struct hda_codec *codec)
7201 struct alc_spec *spec = codec->spec; 7178 struct alc_spec *spec = codec->spec;
7202 alc260_auto_init_multi_out(codec); 7179 alc260_auto_init_multi_out(codec);
7203 alc_auto_init_analog_input(codec); 7180 alc_auto_init_analog_input(codec);
7204 alc260_auto_init_input_src(codec); 7181 alc_auto_init_input_src(codec);
7205 alc_auto_init_digital(codec); 7182 alc_auto_init_digital(codec);
7206 if (spec->unsol_event) 7183 if (spec->unsol_event)
7207 alc_inithook(codec); 7184 alc_inithook(codec);
@@ -10817,18 +10794,23 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
10817/* 10794/*
10818 * BIOS auto configuration 10795 * BIOS auto configuration
10819 */ 10796 */
10820static void alc882_auto_init_input_src(struct hda_codec *codec) 10797static void alc_auto_init_input_src(struct hda_codec *codec)
10821{ 10798{
10822 struct alc_spec *spec = codec->spec; 10799 struct alc_spec *spec = codec->spec;
10823 int c; 10800 int c;
10824 10801
10802 if (spec->dual_adc_switch)
10803 return;
10804
10825 for (c = 0; c < spec->num_adc_nids; c++) { 10805 for (c = 0; c < spec->num_adc_nids; c++) {
10826 hda_nid_t nid = spec->capsrc_nids[c]; 10806 hda_nid_t nid;
10827 unsigned int mux_idx; 10807 unsigned int mux_idx;
10828 const struct hda_input_mux *imux; 10808 const struct hda_input_mux *imux;
10829 int conns, mute, idx, item; 10809 int conns, mute, idx, item;
10830 unsigned int wid_type; 10810 unsigned int wid_type;
10831 10811
10812 nid = spec->capsrc_nids ?
10813 spec->capsrc_nids[c] : spec->adc_nids[c];
10832 /* mute ADC */ 10814 /* mute ADC */
10833 if (query_amp_caps(codec, spec->adc_nids[c], HDA_INPUT) & 10815 if (query_amp_caps(codec, spec->adc_nids[c], HDA_INPUT) &
10834 AC_AMPCAP_MUTE) 10816 AC_AMPCAP_MUTE)
@@ -10974,7 +10956,7 @@ static void alc882_auto_init(struct hda_codec *codec)
10974 alc_auto_init_multi_out(codec); 10956 alc_auto_init_multi_out(codec);
10975 alc_auto_init_extra_out(codec); 10957 alc_auto_init_extra_out(codec);
10976 alc_auto_init_analog_input(codec); 10958 alc_auto_init_analog_input(codec);
10977 alc882_auto_init_input_src(codec); 10959 alc_auto_init_input_src(codec);
10978 alc_auto_init_digital(codec); 10960 alc_auto_init_digital(codec);
10979 if (spec->unsol_event) 10961 if (spec->unsol_event)
10980 alc_inithook(codec); 10962 alc_inithook(codec);
@@ -12305,8 +12287,6 @@ static int alc262_parse_auto_config(struct hda_codec *codec)
12305 return 1; 12287 return 1;
12306} 12288}
12307 12289
12308#define alc262_auto_init_input_src alc882_auto_init_input_src
12309
12310 12290
12311/* init callback for auto-configuration model -- overriding the default init */ 12291/* init callback for auto-configuration model -- overriding the default init */
12312static void alc262_auto_init(struct hda_codec *codec) 12292static void alc262_auto_init(struct hda_codec *codec)
@@ -12315,7 +12295,7 @@ static void alc262_auto_init(struct hda_codec *codec)
12315 alc_auto_init_multi_out(codec); 12295 alc_auto_init_multi_out(codec);
12316 alc_auto_init_extra_out(codec); 12296 alc_auto_init_extra_out(codec);
12317 alc_auto_init_analog_input(codec); 12297 alc_auto_init_analog_input(codec);
12318 alc262_auto_init_input_src(codec); 12298 alc_auto_init_input_src(codec);
12319 alc_auto_init_digital(codec); 12299 alc_auto_init_digital(codec);
12320 if (spec->unsol_event) 12300 if (spec->unsol_event)
12321 alc_inithook(codec); 12301 alc_inithook(codec);
@@ -13419,7 +13399,7 @@ static int alc268_parse_auto_config(struct hda_codec *codec)
13419 add_verb(spec, alc268_beep_init_verbs); 13399 add_verb(spec, alc268_beep_init_verbs);
13420 } 13400 }
13421 13401
13422 spec->num_mux_defs = 2; 13402 spec->num_mux_defs = 1;
13423 spec->input_mux = &spec->private_imux[0]; 13403 spec->input_mux = &spec->private_imux[0];
13424 13404
13425 if (!spec->dual_adc_switch) 13405 if (!spec->dual_adc_switch)
@@ -13434,8 +13414,6 @@ static int alc268_parse_auto_config(struct hda_codec *codec)
13434 return 1; 13414 return 1;
13435} 13415}
13436 13416
13437#define alc268_auto_init_input_src alc882_auto_init_input_src
13438
13439/* init callback for auto-configuration model -- overriding the default init */ 13417/* init callback for auto-configuration model -- overriding the default init */
13440static void alc268_auto_init(struct hda_codec *codec) 13418static void alc268_auto_init(struct hda_codec *codec)
13441{ 13419{
@@ -13444,7 +13422,7 @@ static void alc268_auto_init(struct hda_codec *codec)
13444 alc268_auto_init_hp_out(codec); 13422 alc268_auto_init_hp_out(codec);
13445 alc268_auto_init_mono_speaker_out(codec); 13423 alc268_auto_init_mono_speaker_out(codec);
13446 alc_auto_init_analog_input(codec); 13424 alc_auto_init_analog_input(codec);
13447 alc268_auto_init_input_src(codec); 13425 alc_auto_init_input_src(codec);
13448 alc_auto_init_digital(codec); 13426 alc_auto_init_digital(codec);
13449 if (spec->unsol_event) 13427 if (spec->unsol_event)
13450 alc_inithook(codec); 13428 alc_inithook(codec);
@@ -14381,7 +14359,6 @@ static int alc269_parse_auto_config(struct hda_codec *codec)
14381 14359
14382#define alc269_auto_init_multi_out alc268_auto_init_multi_out 14360#define alc269_auto_init_multi_out alc268_auto_init_multi_out
14383#define alc269_auto_init_hp_out alc268_auto_init_hp_out 14361#define alc269_auto_init_hp_out alc268_auto_init_hp_out
14384#define alc269_auto_init_input_src alc882_auto_init_input_src
14385 14362
14386 14363
14387/* init callback for auto-configuration model -- overriding the default init */ 14364/* init callback for auto-configuration model -- overriding the default init */
@@ -14391,8 +14368,7 @@ static void alc269_auto_init(struct hda_codec *codec)
14391 alc269_auto_init_multi_out(codec); 14368 alc269_auto_init_multi_out(codec);
14392 alc269_auto_init_hp_out(codec); 14369 alc269_auto_init_hp_out(codec);
14393 alc_auto_init_analog_input(codec); 14370 alc_auto_init_analog_input(codec);
14394 if (!spec->dual_adc_switch) 14371 alc_auto_init_input_src(codec);
14395 alc269_auto_init_input_src(codec);
14396 alc_auto_init_digital(codec); 14372 alc_auto_init_digital(codec);
14397 if (spec->unsol_event) 14373 if (spec->unsol_event)
14398 alc_inithook(codec); 14374 alc_inithook(codec);
@@ -16604,8 +16580,6 @@ static const struct alc_config_preset alc861vd_presets[] = {
16604/* 16580/*
16605 * BIOS auto configuration 16581 * BIOS auto configuration
16606 */ 16582 */
16607#define alc861vd_auto_init_input_src alc882_auto_init_input_src
16608
16609#define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) 16583#define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
16610#define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) 16584#define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
16611 16585
@@ -16793,7 +16767,7 @@ static void alc861vd_auto_init(struct hda_codec *codec)
16793 alc_auto_init_multi_out(codec); 16767 alc_auto_init_multi_out(codec);
16794 alc_auto_init_extra_out(codec); 16768 alc_auto_init_extra_out(codec);
16795 alc_auto_init_analog_input(codec); 16769 alc_auto_init_analog_input(codec);
16796 alc861vd_auto_init_input_src(codec); 16770 alc_auto_init_input_src(codec);
16797 alc_auto_init_digital(codec); 16771 alc_auto_init_digital(codec);
16798 if (spec->unsol_event) 16772 if (spec->unsol_event)
16799 alc_inithook(codec); 16773 alc_inithook(codec);
@@ -18687,8 +18661,6 @@ static void alc_auto_init_extra_out(struct hda_codec *codec)
18687 spec->multiout.extra_out_nid[0]); 18661 spec->multiout.extra_out_nid[0]);
18688} 18662}
18689 18663
18690#define alc662_auto_init_input_src alc882_auto_init_input_src
18691
18692/* 18664/*
18693 * multi-io helper 18665 * multi-io helper
18694 */ 18666 */
@@ -18926,7 +18898,7 @@ static void alc662_auto_init(struct hda_codec *codec)
18926 alc_auto_init_multi_out(codec); 18898 alc_auto_init_multi_out(codec);
18927 alc_auto_init_extra_out(codec); 18899 alc_auto_init_extra_out(codec);
18928 alc_auto_init_analog_input(codec); 18900 alc_auto_init_analog_input(codec);
18929 alc662_auto_init_input_src(codec); 18901 alc_auto_init_input_src(codec);
18930 alc_auto_init_digital(codec); 18902 alc_auto_init_digital(codec);
18931 if (spec->unsol_event) 18903 if (spec->unsol_event)
18932 alc_inithook(codec); 18904 alc_inithook(codec);