ALSA: hda/realtek - Selectively call snd_hda_shutup_pins()
[linux-2.6-block.git] / sound / pci / hda / patch_realtek.c
index 14ac9b0e740c2a40e816b36ee7bbdf04601135eb..dbd59dfc746eaa6b5ec6b7a67e320373f491c644 100644 (file)
@@ -37,6 +37,9 @@
 #include "hda_jack.h"
 #include "hda_generic.h"
 
+/* keep halting ALC5505 DSP, for power saving */
+#define HALT_REALTEK_ALC5505
+
 /* unsol event tags */
 #define ALC_DCVOL_EVENT                0x08
 
@@ -279,6 +282,7 @@ static void alc_eapd_shutup(struct hda_codec *codec)
 {
        alc_auto_setup_eapd(codec, false);
        msleep(200);
+       snd_hda_shutup_pins(codec);
 }
 
 /* generic EAPD initialization */
@@ -823,7 +827,8 @@ static inline void alc_shutup(struct hda_codec *codec)
 
        if (spec && spec->shutup)
                spec->shutup(codec);
-       snd_hda_shutup_pins(codec);
+       else
+               snd_hda_shutup_pins(codec);
 }
 
 #define alc_free       snd_hda_gen_free
@@ -2570,15 +2575,13 @@ static void alc269_shutup(struct hda_codec *codec)
 {
        struct alc_spec *spec = codec->spec;
 
-       if (spec->codec_variant != ALC269_TYPE_ALC269VB)
-               return;
-
        if (spec->codec_variant == ALC269_TYPE_ALC269VB)
                alc269vb_toggle_power_output(codec, 0);
        if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
                        (alc_get_coef0(codec) & 0x00ff) == 0x018) {
                msleep(150);
        }
+       snd_hda_shutup_pins(codec);
 }
 
 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
@@ -2659,15 +2662,27 @@ static void alc5505_dsp_init(struct hda_codec *codec)
        alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
        alc5505_coef_set(codec, 0x880c, 0x00000003);
        alc5505_coef_set(codec, 0x880c, 0x00000010);
+
+#ifdef HALT_REALTEK_ALC5505
+       alc5505_dsp_halt(codec);
+#endif
 }
 
+#ifdef HALT_REALTEK_ALC5505
+#define alc5505_dsp_suspend(codec)     /* NOP */
+#define alc5505_dsp_resume(codec)      /* NOP */
+#else
+#define alc5505_dsp_suspend(codec)     alc5505_dsp_halt(codec)
+#define alc5505_dsp_resume(codec)      alc5505_dsp_back_from_halt(codec)
+#endif
+
 #ifdef CONFIG_PM
 static int alc269_suspend(struct hda_codec *codec)
 {
        struct alc_spec *spec = codec->spec;
 
        if (spec->has_alc5505_dsp)
-               alc5505_dsp_halt(codec);
+               alc5505_dsp_suspend(codec);
        return alc_suspend(codec);
 }
 
@@ -2696,7 +2711,7 @@ static int alc269_resume(struct hda_codec *codec)
        alc_inv_dmic_sync(codec, true);
        hda_call_check_power_status(codec, 0x01);
        if (spec->has_alc5505_dsp)
-               alc5505_dsp_back_from_halt(codec);
+               alc5505_dsp_resume(codec);
        return 0;
 }
 #endif /* CONFIG_PM */