aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_sigmatel.c
diff options
context:
space:
mode:
authorMatthew Ranostay <mranostay@embeddedalley.com>2008-02-06 08:49:44 -0500
committerTakashi Iwai <tiwai@suse.de>2008-04-24 06:00:08 -0400
commitb76c850fbc280d6c0ff786653915f3a9700b5912 (patch)
treeeaa06927fd12eba1c13f2506bf026c46144a4edd /sound/pci/hda/patch_sigmatel.c
parentd043143d803ad9a9f4a66d6a833876735fb7b869 (diff)
[ALSA] hda: STAC927x power down inactive DACs
On several laptops that have STAC9228 codecs have unused DACs, this powers them down to a D3 state. Signed-off-by: Matthew Ranostay <mranostay@embeddedalley.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_sigmatel.c')
-rw-r--r--sound/pci/hda/patch_sigmatel.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index f693011d25a0..7f506ef0accb 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -136,6 +136,7 @@ struct sigmatel_spec {
136 /* power management */ 136 /* power management */
137 unsigned int num_pwrs; 137 unsigned int num_pwrs;
138 hda_nid_t *pwr_nids; 138 hda_nid_t *pwr_nids;
139 hda_nid_t *dac_list;
139 140
140 /* playback */ 141 /* playback */
141 struct hda_input_mux *mono_mux; 142 struct hda_input_mux *mono_mux;
@@ -291,6 +292,10 @@ static hda_nid_t stac927x_mux_nids[3] = {
291 0x15, 0x16, 0x17 292 0x15, 0x16, 0x17
292}; 293};
293 294
295static hda_nid_t stac927x_dac_nids[6] = {
296 0x02, 0x03, 0x04, 0x05, 0x06, 0
297};
298
294static hda_nid_t stac927x_dmux_nids[1] = { 299static hda_nid_t stac927x_dmux_nids[1] = {
295 0x1b, 300 0x1b,
296}; 301};
@@ -2877,6 +2882,18 @@ static int is_nid_hp_pin(struct auto_pin_cfg *cfg, hda_nid_t nid)
2877 return 0; /* nid is not a HP-Out */ 2882 return 0; /* nid is not a HP-Out */
2878}; 2883};
2879 2884
2885static void stac92xx_power_down(struct hda_codec *codec)
2886{
2887 struct sigmatel_spec *spec = codec->spec;
2888
2889 /* power down inactive DACs */
2890 hda_nid_t *dac;
2891 for (dac = spec->dac_list; *dac; dac++)
2892 if (!is_in_dac_nids(spec, *dac))
2893 snd_hda_codec_write_cache(codec, *dac, 0,
2894 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
2895}
2896
2880static int stac92xx_init(struct hda_codec *codec) 2897static int stac92xx_init(struct hda_codec *codec)
2881{ 2898{
2882 struct sigmatel_spec *spec = codec->spec; 2899 struct sigmatel_spec *spec = codec->spec;
@@ -2929,7 +2946,8 @@ static int stac92xx_init(struct hda_codec *codec)
2929 enable_pin_detect(codec, spec->pwr_nids[i], event | i); 2946 enable_pin_detect(codec, spec->pwr_nids[i], event | i);
2930 codec->patch_ops.unsol_event(codec, (event | i) << 26); 2947 codec->patch_ops.unsol_event(codec, (event | i) << 26);
2931 } 2948 }
2932 2949 if (spec->dac_list)
2950 stac92xx_power_down(codec);
2933 if (cfg->dig_out_pin) 2951 if (cfg->dig_out_pin)
2934 stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin, 2952 stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin,
2935 AC_PINCTL_OUT_EN); 2953 AC_PINCTL_OUT_EN);
@@ -3102,6 +3120,9 @@ static int stac92xx_resume(struct hda_codec *codec)
3102 spec->gpio_dir, spec->gpio_data); 3120 spec->gpio_dir, spec->gpio_data);
3103 snd_hda_codec_resume_amp(codec); 3121 snd_hda_codec_resume_amp(codec);
3104 snd_hda_codec_resume_cache(codec); 3122 snd_hda_codec_resume_cache(codec);
3123 /* power down inactive DACs */
3124 if (spec->dac_list)
3125 stac92xx_power_down(codec);
3105 /* invoke unsolicited event to reset the HP state */ 3126 /* invoke unsolicited event to reset the HP state */
3106 if (spec->hp_detect) 3127 if (spec->hp_detect)
3107 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26); 3128 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);
@@ -3589,6 +3610,7 @@ static int patch_stac927x(struct hda_codec *codec)
3589 spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids); 3610 spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids);
3590 spec->mux_nids = stac927x_mux_nids; 3611 spec->mux_nids = stac927x_mux_nids;
3591 spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids); 3612 spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids);
3613 spec->dac_list = stac927x_dac_nids;
3592 spec->multiout.dac_nids = spec->dac_nids; 3614 spec->multiout.dac_nids = spec->dac_nids;
3593 3615
3594 switch (spec->board_config) { 3616 switch (spec->board_config) {