aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-07-22 06:39:24 -0400
committerTakashi Iwai <tiwai@suse.de>2009-07-22 06:39:24 -0400
commit05ff7e11b78f18ff6819d2c260b7bcc7da0c8f46 (patch)
treed19b9ea9530321a0513863ccd32cf5f3f3f3e343 /sound/pci
parent05e870d29aef0bf43124b2bd424103987fadd5b5 (diff)
ALSA: hda - Reduce click noise at power-saving
Add some tricks to reduce the click noise at powering down to D3 in the power saving mode on STAC/IDT codecs. The key seems to be to reset PINs before the power-down, and some delay before entering D3. The needed delay is significantly long, but I don't know why. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/hda_codec.c9
-rw-r--r--sound/pci/hda/patch_sigmatel.c14
2 files changed, 21 insertions, 2 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index d686f4fcd780..3ecb45ddadf7 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -2367,9 +2367,14 @@ static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg,
2367 hda_nid_t nid; 2367 hda_nid_t nid;
2368 int i; 2368 int i;
2369 2369
2370 snd_hda_codec_write(codec, fg, 0, AC_VERB_SET_POWER_STATE, 2370 /* this delay seems necessary to avoid click noise at power-down */
2371 if (power_state == AC_PWRST_D3)
2372 msleep(100);
2373 snd_hda_codec_read(codec, fg, 0, AC_VERB_SET_POWER_STATE,
2371 power_state); 2374 power_state);
2372 msleep(10); /* partial workaround for "azx_get_response timeout" */ 2375 /* partial workaround for "azx_get_response timeout" */
2376 if (power_state == AC_PWRST_D0)
2377 msleep(10);
2373 2378
2374 nid = codec->start_nid; 2379 nid = codec->start_nid;
2375 for (i = 0; i < codec->num_nodes; i++, nid++) { 2380 for (i = 0; i < codec->num_nodes; i++, nid++) {
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 41b5b3a18c1e..00c702df721c 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -4745,6 +4745,20 @@ static int stac92xx_hp_check_power_status(struct hda_codec *codec,
4745static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state) 4745static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state)
4746{ 4746{
4747 struct sigmatel_spec *spec = codec->spec; 4747 struct sigmatel_spec *spec = codec->spec;
4748 int i;
4749 hda_nid_t nid;
4750
4751 /* reset each pin before powering down DAC/ADC to avoid click noise */
4752 nid = codec->start_nid;
4753 for (i = 0; i < codec->num_nodes; i++, nid++) {
4754 unsigned int wcaps = get_wcaps(codec, nid);
4755 unsigned int wid_type = (wcaps & AC_WCAP_TYPE) >>
4756 AC_WCAP_TYPE_SHIFT;
4757 if (wid_type == AC_WID_PIN)
4758 snd_hda_codec_read(codec, nid, 0,
4759 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
4760 }
4761
4748 if (spec->eapd_mask) 4762 if (spec->eapd_mask)
4749 stac_gpio_set(codec, spec->gpio_mask, 4763 stac_gpio_set(codec, spec->gpio_mask,
4750 spec->gpio_dir, spec->gpio_data & 4764 spec->gpio_dir, spec->gpio_data &