ALSA: hda: Cancel delayed work during suspend
Rahul Mittal [Tue, 9 Apr 2013 14:17:21 +0000 (19:17 +0530)]
Register hda codec suspend callback which does
cancel_delayed_work_sync() during suspend

Bug 1266206

Reviewed-on: http://git-master/r/217860
(cherry picked from commit 529d36f0d90d38f3cf788c250a7d66c9c68603a2)

Change-Id: I0ac6048e288aedf4df2118ddae2ecba4339d299b
Signed-off-by: Rahul Mittal <rmittal@nvidia.com>
Reviewed-on: http://git-master/r/218847
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sumit Bhattacharya <sumitb@nvidia.com>
Reviewed-by: Scott Peterson <speterson@nvidia.com>

sound/pci/hda/patch_hdmi.c

index 9babdc6..5ab5eee 100644 (file)
@@ -1891,9 +1891,26 @@ static void generic_hdmi_free(struct hda_codec *codec)
        kfree(spec);
 }
 
+static int generic_hdmi_suspend(struct hda_codec *codec, pm_message_t state)
+{
+       struct hdmi_spec *spec = codec->spec;
+       int pin_idx;
+
+       for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) {
+               struct hdmi_spec_per_pin *per_pin = &spec->pins[pin_idx];
+               struct hdmi_eld *eld = &per_pin->sink_eld;
+
+               cancel_delayed_work_sync(&per_pin->work);
+               snd_hda_eld_proc_free(codec, eld);
+       }
+
+       return 0;
+}
+
 static const struct hda_codec_ops generic_hdmi_patch_ops = {
        .init                   = generic_hdmi_init,
        .free                   = generic_hdmi_free,
+       .suspend                = generic_hdmi_suspend,
        .build_pcms             = generic_hdmi_build_pcms,
        .build_controls         = generic_hdmi_build_controls,
        .unsol_event            = hdmi_unsol_event,