aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_realtek.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-02-20 08:13:06 -0500
committerTakashi Iwai <tiwai@suse.de>2009-02-20 10:48:38 -0500
commit0e8a21b59d48a63f45b3e6d2aca7fb91c5aec882 (patch)
treebd0f2935af7dc6654efc38ecf953f0f093028063 /sound/pci/hda/patch_realtek.c
parent3be141494a080a9189b51fa78154c975ad8d9806 (diff)
ALSA: hda - Remove realtek codec-specific pin save/restore functions
Now it's done in the common code. Also use the common access functions for pin defaults. 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.c78
1 files changed, 3 insertions, 75 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 169b3837af52..d7f255e3b916 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -329,13 +329,6 @@ struct alc_spec {
329 /* for PLL fix */ 329 /* for PLL fix */
330 hda_nid_t pll_nid; 330 hda_nid_t pll_nid;
331 unsigned int pll_coef_idx, pll_coef_bit; 331 unsigned int pll_coef_idx, pll_coef_bit;
332
333#ifdef SND_HDA_NEEDS_RESUME
334#define ALC_MAX_PINS 16
335 unsigned int num_pins;
336 hda_nid_t pin_nids[ALC_MAX_PINS];
337 unsigned int pin_cfgs[ALC_MAX_PINS];
338#endif
339}; 332};
340 333
341/* 334/*
@@ -1009,8 +1002,7 @@ static void alc_subsystem_id(struct hda_codec *codec,
1009 nid = 0x1d; 1002 nid = 0x1d;
1010 if (codec->vendor_id == 0x10ec0260) 1003 if (codec->vendor_id == 0x10ec0260)
1011 nid = 0x17; 1004 nid = 0x17;
1012 ass = snd_hda_codec_read(codec, nid, 0, 1005 ass = snd_hda_codec_get_pincfg(codec, nid);
1013 AC_VERB_GET_CONFIG_DEFAULT, 0);
1014 if (!(ass & 1) && !(ass & 0x100000)) 1006 if (!(ass & 1) && !(ass & 0x100000))
1015 return; 1007 return;
1016 if ((ass >> 30) != 1) /* no physical connection */ 1008 if ((ass >> 30) != 1) /* no physical connection */
@@ -1184,16 +1176,8 @@ static void alc_fix_pincfg(struct hda_codec *codec,
1184 return; 1176 return;
1185 1177
1186 cfg = pinfix[quirk->value]; 1178 cfg = pinfix[quirk->value];
1187 for (; cfg->nid; cfg++) { 1179 for (; cfg->nid; cfg++)
1188 int i; 1180 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1189 u32 val = cfg->val;
1190 for (i = 0; i < 4; i++) {
1191 snd_hda_codec_write(codec, cfg->nid, 0,
1192 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
1193 val & 0xff);
1194 val >>= 8;
1195 }
1196 }
1197} 1181}
1198 1182
1199/* 1183/*
@@ -3215,61 +3199,13 @@ static void alc_free(struct hda_codec *codec)
3215} 3199}
3216 3200
3217#ifdef SND_HDA_NEEDS_RESUME 3201#ifdef SND_HDA_NEEDS_RESUME
3218static void store_pin_configs(struct hda_codec *codec)
3219{
3220 struct alc_spec *spec = codec->spec;
3221 hda_nid_t nid, end_nid;
3222
3223 end_nid = codec->start_nid + codec->num_nodes;
3224 for (nid = codec->start_nid; nid < end_nid; nid++) {
3225 unsigned int wid_caps = get_wcaps(codec, nid);
3226 unsigned int wid_type =
3227 (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
3228 if (wid_type != AC_WID_PIN)
3229 continue;
3230 if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids))
3231 break;
3232 spec->pin_nids[spec->num_pins] = nid;
3233 spec->pin_cfgs[spec->num_pins] =
3234 snd_hda_codec_read(codec, nid, 0,
3235 AC_VERB_GET_CONFIG_DEFAULT, 0);
3236 spec->num_pins++;
3237 }
3238}
3239
3240static void resume_pin_configs(struct hda_codec *codec)
3241{
3242 struct alc_spec *spec = codec->spec;
3243 int i;
3244
3245 for (i = 0; i < spec->num_pins; i++) {
3246 hda_nid_t pin_nid = spec->pin_nids[i];
3247 unsigned int pin_config = spec->pin_cfgs[i];
3248 snd_hda_codec_write(codec, pin_nid, 0,
3249 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
3250 pin_config & 0x000000ff);
3251 snd_hda_codec_write(codec, pin_nid, 0,
3252 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
3253 (pin_config & 0x0000ff00) >> 8);
3254 snd_hda_codec_write(codec, pin_nid, 0,
3255 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
3256 (pin_config & 0x00ff0000) >> 16);
3257 snd_hda_codec_write(codec, pin_nid, 0,
3258 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
3259 pin_config >> 24);
3260 }
3261}
3262
3263static int alc_resume(struct hda_codec *codec) 3202static int alc_resume(struct hda_codec *codec)
3264{ 3203{
3265 resume_pin_configs(codec);
3266 codec->patch_ops.init(codec); 3204 codec->patch_ops.init(codec);
3267 snd_hda_codec_resume_amp(codec); 3205 snd_hda_codec_resume_amp(codec);
3268 snd_hda_codec_resume_cache(codec); 3206 snd_hda_codec_resume_cache(codec);
3269 return 0; 3207 return 0;
3270} 3208}
3271#else
3272#define store_pin_configs(codec)
3273#endif 3209#endif
3274 3210
3275/* 3211/*
@@ -4329,7 +4265,6 @@ static int alc880_parse_auto_config(struct hda_codec *codec)
4329 spec->num_mux_defs = 1; 4265 spec->num_mux_defs = 1;
4330 spec->input_mux = &spec->private_imux[0]; 4266 spec->input_mux = &spec->private_imux[0];
4331 4267
4332 store_pin_configs(codec);
4333 return 1; 4268 return 1;
4334} 4269}
4335 4270
@@ -5693,7 +5628,6 @@ static int alc260_parse_auto_config(struct hda_codec *codec)
5693 spec->num_mux_defs = 1; 5628 spec->num_mux_defs = 1;
5694 spec->input_mux = &spec->private_imux[0]; 5629 spec->input_mux = &spec->private_imux[0];
5695 5630
5696 store_pin_configs(codec);
5697 return 1; 5631 return 1;
5698} 5632}
5699 5633
@@ -10688,7 +10622,6 @@ static int alc262_parse_auto_config(struct hda_codec *codec)
10688 if (err < 0) 10622 if (err < 0)
10689 return err; 10623 return err;
10690 10624
10691 store_pin_configs(codec);
10692 return 1; 10625 return 1;
10693} 10626}
10694 10627
@@ -11861,7 +11794,6 @@ static int alc268_parse_auto_config(struct hda_codec *codec)
11861 if (err < 0) 11794 if (err < 0)
11862 return err; 11795 return err;
11863 11796
11864 store_pin_configs(codec);
11865 return 1; 11797 return 1;
11866} 11798}
11867 11799
@@ -12774,7 +12706,6 @@ static int alc269_parse_auto_config(struct hda_codec *codec)
12774 if (!spec->cap_mixer && !spec->no_analog) 12706 if (!spec->cap_mixer && !spec->no_analog)
12775 set_capture_mixer(spec); 12707 set_capture_mixer(spec);
12776 12708
12777 store_pin_configs(codec);
12778 return 1; 12709 return 1;
12779} 12710}
12780 12711
@@ -13825,7 +13756,6 @@ static int alc861_parse_auto_config(struct hda_codec *codec)
13825 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); 13756 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
13826 set_capture_mixer(spec); 13757 set_capture_mixer(spec);
13827 13758
13828 store_pin_configs(codec);
13829 return 1; 13759 return 1;
13830} 13760}
13831 13761
@@ -14927,7 +14857,6 @@ static int alc861vd_parse_auto_config(struct hda_codec *codec)
14927 if (err < 0) 14857 if (err < 0)
14928 return err; 14858 return err;
14929 14859
14930 store_pin_configs(codec);
14931 return 1; 14860 return 1;
14932} 14861}
14933 14862
@@ -16737,7 +16666,6 @@ static int alc662_parse_auto_config(struct hda_codec *codec)
16737 if (err < 0) 16666 if (err < 0)
16738 return err; 16667 return err;
16739 16668
16740 store_pin_configs(codec);
16741 return 1; 16669 return 1;
16742} 16670}
16743 16671