[media] media/video: vpif: fixed vpfe->vpif typo
[deliverable/linux.git] / drivers / media / video / davinci / vpif_capture.c
index 1d4427aa08a529a26f1591f1c4b23931e425eaee..266025e5d81d424b90ceedd4a1de6fe9c1d016e8 100644 (file)
@@ -810,7 +810,7 @@ static void vpif_config_addr(struct channel_obj *ch, int muxmode)
 }
 
 /**
- * vpfe_mmap : It is used to map kernel space buffers into user spaces
+ * vpif_mmap : It is used to map kernel space buffers into user spaces
  * @filep: file pointer
  * @vma: ptr to vm_area_struct
  */
@@ -919,7 +919,7 @@ static int vpif_open(struct file *filep)
  * vpif_release : function to clean up file close
  * @filep: file pointer
  *
- * This function deletes buffer queue, frees the buffers and the vpfe file
+ * This function deletes buffer queue, frees the buffers and the vpif file
  * handle
  */
 static int vpif_release(struct file *filep)
@@ -2312,26 +2312,70 @@ static int vpif_remove(struct platform_device *device)
        return 0;
 }
 
+#ifdef CONFIG_PM
 /**
  * vpif_suspend: vpif device suspend
- *
- * TODO: Add suspend code here
  */
-static int
-vpif_suspend(struct device *dev)
+static int vpif_suspend(struct device *dev)
 {
-       return -1;
+
+       struct common_obj *common;
+       struct channel_obj *ch;
+       int i;
+
+       for (i = 0; i < VPIF_CAPTURE_MAX_DEVICES; i++) {
+               /* Get the pointer to the channel object */
+               ch = vpif_obj.dev[i];
+               common = &ch->common[VPIF_VIDEO_INDEX];
+               mutex_lock(&common->lock);
+               if (ch->usrs && common->io_usrs) {
+                       /* Disable channel */
+                       if (ch->channel_id == VPIF_CHANNEL0_VIDEO) {
+                               enable_channel0(0);
+                               channel0_intr_enable(0);
+                       }
+                       if (ch->channel_id == VPIF_CHANNEL1_VIDEO ||
+                           common->started == 2) {
+                               enable_channel1(0);
+                               channel1_intr_enable(0);
+                       }
+               }
+               mutex_unlock(&common->lock);
+       }
+
+       return 0;
 }
 
-/**
+/*
  * vpif_resume: vpif device suspend
- *
- * TODO: Add resume code here
  */
-static int
-vpif_resume(struct device *dev)
+static int vpif_resume(struct device *dev)
 {
-       return -1;
+       struct common_obj *common;
+       struct channel_obj *ch;
+       int i;
+
+       for (i = 0; i < VPIF_CAPTURE_MAX_DEVICES; i++) {
+               /* Get the pointer to the channel object */
+               ch = vpif_obj.dev[i];
+               common = &ch->common[VPIF_VIDEO_INDEX];
+               mutex_lock(&common->lock);
+               if (ch->usrs && common->io_usrs) {
+                       /* Disable channel */
+                       if (ch->channel_id == VPIF_CHANNEL0_VIDEO) {
+                               enable_channel0(1);
+                               channel0_intr_enable(1);
+                       }
+                       if (ch->channel_id == VPIF_CHANNEL1_VIDEO ||
+                           common->started == 2) {
+                               enable_channel1(1);
+                               channel1_intr_enable(1);
+                       }
+               }
+               mutex_unlock(&common->lock);
+       }
+
+       return 0;
 }
 
 static const struct dev_pm_ops vpif_dev_pm_ops = {
@@ -2339,11 +2383,16 @@ static const struct dev_pm_ops vpif_dev_pm_ops = {
        .resume = vpif_resume,
 };
 
+#define vpif_pm_ops (&vpif_dev_pm_ops)
+#else
+#define vpif_pm_ops NULL
+#endif
+
 static __refdata struct platform_driver vpif_driver = {
        .driver = {
                .name   = "vpif_capture",
                .owner  = THIS_MODULE,
-               .pm = &vpif_dev_pm_ops,
+               .pm     = vpif_pm_ops,
        },
        .probe = vpif_probe,
        .remove = vpif_remove,
This page took 0.025397 seconds and 5 git commands to generate.