upstream: [media] em28xx-audio: implement em28xx_ops: suspend/resume hooks
authorShuah Khan <shuah.kh@samsung.com>
Sat, 22 Feb 2014 00:50:14 +0000 (21:50 -0300)
committerChanho Park <chanho61.park@samsung.com>
Tue, 18 Nov 2014 02:54:47 +0000 (11:54 +0900)
Implement em28xx_ops: suspend/resume hooks. em28xx usb driver will
invoke em28xx_ops: suspend and resume hooks for all its extensions
from its suspend() and resume() interfaces.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/usb/em28xx/em28xx-audio.c

index eca2b9b..5b2a5e3 100644 (file)
@@ -978,11 +978,41 @@ static int em28xx_audio_fini(struct em28xx *dev)
        return 0;
 }
 
+static int em28xx_audio_suspend(struct em28xx *dev)
+{
+       if (dev == NULL)
+               return 0;
+
+       if (!dev->has_alsa_audio)
+               return 0;
+
+       em28xx_info("Suspending audio extension");
+       em28xx_deinit_isoc_audio(dev);
+       atomic_set(&dev->stream_started, 0);
+       return 0;
+}
+
+static int em28xx_audio_resume(struct em28xx *dev)
+{
+       if (dev == NULL)
+               return 0;
+
+       if (!dev->has_alsa_audio)
+               return 0;
+
+       em28xx_info("Resuming audio extension");
+       /* Nothing to do other than schedule_work() ?? */
+       schedule_work(&dev->wq_trigger);
+       return 0;
+}
+
 static struct em28xx_ops audio_ops = {
        .id   = EM28XX_AUDIO,
        .name = "Em28xx Audio Extension",
        .init = em28xx_audio_init,
        .fini = em28xx_audio_fini,
+       .suspend = em28xx_audio_suspend,
+       .resume = em28xx_audio_resume,
 };
 
 static int __init em28xx_alsa_register(void)