ALSA: hda: cs35l41: Support Hibernation during Suspend
[linux-2.6-microblaze.git] / sound / pci / hda / patch_realtek.c
index 44744d5..7c21bc4 100644 (file)
@@ -4021,15 +4021,22 @@ static void alc5505_dsp_init(struct hda_codec *codec)
 static int alc269_suspend(struct hda_codec *codec)
 {
        struct alc_spec *spec = codec->spec;
+       int i;
 
        if (spec->has_alc5505_dsp)
                alc5505_dsp_suspend(codec);
+
+       for (i = 0; i < HDA_MAX_COMPONENTS; i++)
+               if (spec->comps[i].suspend_hook)
+                       spec->comps[i].suspend_hook(spec->comps[i].dev);
+
        return alc_suspend(codec);
 }
 
 static int alc269_resume(struct hda_codec *codec)
 {
        struct alc_spec *spec = codec->spec;
+       int i;
 
        if (spec->codec_variant == ALC269_TYPE_ALC269VB)
                alc269vb_toggle_power_output(codec, 0);
@@ -4060,6 +4067,10 @@ static int alc269_resume(struct hda_codec *codec)
        if (spec->has_alc5505_dsp)
                alc5505_dsp_resume(codec);
 
+       for (i = 0; i < HDA_MAX_COMPONENTS; i++)
+               if (spec->comps[i].resume_hook)
+                       spec->comps[i].resume_hook(spec->comps[i].dev);
+
        return 0;
 }
 #endif /* CONFIG_PM */
@@ -6610,8 +6621,20 @@ static int comp_bind(struct device *dev)
 {
        struct hda_codec *cdc = dev_to_hda_codec(dev);
        struct alc_spec *spec = cdc->spec;
+       int ret, i;
+
+       ret = component_bind_all(dev, spec->comps);
+       if (ret)
+               return ret;
 
-       return component_bind_all(dev, spec->comps);
+       if (snd_hdac_is_power_on(&cdc->core)) {
+               codec_dbg(cdc, "Resuming after bind.\n");
+               for (i = 0; i < HDA_MAX_COMPONENTS; i++)
+                       if (spec->comps[i].resume_hook)
+                               spec->comps[i].resume_hook(spec->comps[i].dev);
+       }
+
+       return 0;
 }
 
 static void comp_unbind(struct device *dev)