The patch number 8612 was added via Mauro Carvalho Chehab <[EMAIL PROTECTED]>
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
        [EMAIL PROTECTED]

------

From: Mauro Carvalho Chehab  <[EMAIL PROTECTED]>
merge: http://linuxtv.org/hg/~gliakhovetski/v4l-dvb




Signed-off-by: Mauro Carvalho Chehab <[EMAIL PROTECTED]>


---

 linux/drivers/media/video/pxa_camera.c           |   58 ++++++++++++++-
 linux/drivers/media/video/sh_mobile_ceu_camera.c |    2 
 linux/drivers/media/video/soc_camera.c           |   26 ++++++
 linux/drivers/media/video/soc_camera_platform.c  |    2 
 linux/include/media/soc_camera.h                 |    5 +
 5 files changed, 90 insertions(+), 3 deletions(-)

diff -r 5780c3456ac8 -r a0a6791ae0f1 linux/drivers/media/video/pxa_camera.c
--- a/linux/drivers/media/video/pxa_camera.c    Mon Aug 04 09:13:13 2008 -0300
+++ b/linux/drivers/media/video/pxa_camera.c    Mon Aug 04 09:24:37 2008 -0300
@@ -128,6 +128,8 @@ struct pxa_camera_dev {
 
        struct pxa_buffer       *active;
        struct pxa_dma_desc     *sg_tail[3];
+
+       u32                     save_cicr[5];
 };
 
 static const char *pxa_cam_driver_description = "PXA_Camera";
@@ -997,10 +999,64 @@ static int pxa_camera_querycap(struct so
        return 0;
 }
 
+static int pxa_camera_suspend(struct soc_camera_device *icd, pm_message_t 
state)
+{
+       struct soc_camera_host *ici =
+               to_soc_camera_host(icd->dev.parent);
+       struct pxa_camera_dev *pcdev = ici->priv;
+       int i = 0, ret = 0;
+
+       pcdev->save_cicr[i++] = CICR0;
+       pcdev->save_cicr[i++] = CICR1;
+       pcdev->save_cicr[i++] = CICR2;
+       pcdev->save_cicr[i++] = CICR3;
+       pcdev->save_cicr[i++] = CICR4;
+
+       if ((pcdev->icd) && (pcdev->icd->ops->suspend))
+               ret = pcdev->icd->ops->suspend(pcdev->icd, state);
+
+       return ret;
+}
+
+static int pxa_camera_resume(struct soc_camera_device *icd)
+{
+       struct soc_camera_host *ici =
+               to_soc_camera_host(icd->dev.parent);
+       struct pxa_camera_dev *pcdev = ici->priv;
+       int i = 0, ret = 0;
+
+       DRCMR68 = pcdev->dma_chans[0] | DRCMR_MAPVLD;
+       DRCMR69 = pcdev->dma_chans[1] | DRCMR_MAPVLD;
+       DRCMR70 = pcdev->dma_chans[2] | DRCMR_MAPVLD;
+
+       CICR0 = pcdev->save_cicr[i++] & ~CICR0_ENB;
+       CICR1 = pcdev->save_cicr[i++];
+       CICR2 = pcdev->save_cicr[i++];
+       CICR3 = pcdev->save_cicr[i++];
+       CICR4 = pcdev->save_cicr[i++];
+
+       if ((pcdev->icd) && (pcdev->icd->ops->resume))
+               ret = pcdev->icd->ops->resume(pcdev->icd);
+
+       /* Restart frame capture if active buffer exists */
+       if (!ret && pcdev->active) {
+               /* Reset the FIFOs */
+               CIFR |= CIFR_RESET_F;
+               /* Enable End-Of-Frame Interrupt */
+               CICR0 &= ~CICR0_EOFM;
+               /* Restart the Capture Interface */
+               CICR0 |= CICR0_ENB;
+       }
+
+       return ret;
+}
+
 static struct soc_camera_host_ops pxa_soc_camera_host_ops = {
        .owner          = THIS_MODULE,
        .add            = pxa_camera_add_device,
        .remove         = pxa_camera_remove_device,
+       .suspend        = pxa_camera_suspend,
+       .resume         = pxa_camera_resume,
        .set_fmt_cap    = pxa_camera_set_fmt_cap,
        .try_fmt_cap    = pxa_camera_try_fmt_cap,
        .init_videobuf  = pxa_camera_init_videobuf,
@@ -1198,7 +1254,7 @@ static int __devinit pxa_camera_init(voi
 
 static void __exit pxa_camera_exit(void)
 {
-       return platform_driver_unregister(&pxa_camera_driver);
+       platform_driver_unregister(&pxa_camera_driver);
 }
 
 module_init(pxa_camera_init);
diff -r 5780c3456ac8 -r a0a6791ae0f1 
linux/drivers/media/video/sh_mobile_ceu_camera.c
--- a/linux/drivers/media/video/sh_mobile_ceu_camera.c  Mon Aug 04 09:13:13 
2008 -0300
+++ b/linux/drivers/media/video/sh_mobile_ceu_camera.c  Mon Aug 04 09:24:37 
2008 -0300
@@ -647,7 +647,7 @@ static int __init sh_mobile_ceu_init(voi
 
 static void __exit sh_mobile_ceu_exit(void)
 {
-       return platform_driver_unregister(&sh_mobile_ceu_driver);
+       platform_driver_unregister(&sh_mobile_ceu_driver);
 }
 
 module_init(sh_mobile_ceu_init);
diff -r 5780c3456ac8 -r a0a6791ae0f1 linux/drivers/media/video/soc_camera.c
--- a/linux/drivers/media/video/soc_camera.c    Mon Aug 04 09:13:13 2008 -0300
+++ b/linux/drivers/media/video/soc_camera.c    Mon Aug 04 09:24:37 2008 -0300
@@ -732,10 +732,36 @@ static int soc_camera_remove(struct devi
        return 0;
 }
 
+static int soc_camera_suspend(struct device *dev, pm_message_t state)
+{
+       struct soc_camera_device *icd = to_soc_camera_dev(dev);
+       struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
+       int ret = 0;
+
+       if (ici->ops->suspend)
+               ret = ici->ops->suspend(icd, state);
+
+       return ret;
+}
+
+static int soc_camera_resume(struct device *dev)
+{
+       struct soc_camera_device *icd = to_soc_camera_dev(dev);
+       struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
+       int ret = 0;
+
+       if (ici->ops->resume)
+               ret = ici->ops->resume(icd);
+
+       return ret;
+}
+
 static struct bus_type soc_camera_bus_type = {
        .name           = "soc-camera",
        .probe          = soc_camera_probe,
        .remove         = soc_camera_remove,
+       .suspend        = soc_camera_suspend,
+       .resume         = soc_camera_resume,
 };
 
 static struct device_driver ic_drv = {
diff -r 5780c3456ac8 -r a0a6791ae0f1 
linux/drivers/media/video/soc_camera_platform.c
--- a/linux/drivers/media/video/soc_camera_platform.c   Mon Aug 04 09:13:13 
2008 -0300
+++ b/linux/drivers/media/video/soc_camera_platform.c   Mon Aug 04 09:24:37 
2008 -0300
@@ -187,7 +187,7 @@ static int __init soc_camera_platform_mo
 
 static void __exit soc_camera_platform_module_exit(void)
 {
-       return platform_driver_unregister(&soc_camera_platform_driver);
+       platform_driver_unregister(&soc_camera_platform_driver);
 }
 
 module_init(soc_camera_platform_module_init);
diff -r 5780c3456ac8 -r a0a6791ae0f1 linux/include/media/soc_camera.h
--- a/linux/include/media/soc_camera.h  Mon Aug 04 09:13:13 2008 -0300
+++ b/linux/include/media/soc_camera.h  Mon Aug 04 09:24:37 2008 -0300
@@ -14,6 +14,7 @@
 
 #include <linux/videodev2.h>
 #include <media/videobuf-core.h>
+#include <linux/pm.h>
 
 struct soc_camera_device {
        struct list_head list;
@@ -63,6 +64,8 @@ struct soc_camera_host_ops {
        struct module *owner;
        int (*add)(struct soc_camera_device *);
        void (*remove)(struct soc_camera_device *);
+       int (*suspend)(struct soc_camera_device *, pm_message_t state);
+       int (*resume)(struct soc_camera_device *);
        int (*set_fmt_cap)(struct soc_camera_device *, __u32,
                           struct v4l2_rect *);
        int (*try_fmt_cap)(struct soc_camera_device *, struct v4l2_format *);
@@ -111,6 +114,8 @@ struct soc_camera_ops {
        struct module *owner;
        int (*probe)(struct soc_camera_device *);
        void (*remove)(struct soc_camera_device *);
+       int (*suspend)(struct soc_camera_device *, pm_message_t state);
+       int (*resume)(struct soc_camera_device *);
        int (*init)(struct soc_camera_device *);
        int (*release)(struct soc_camera_device *);
        int (*start_capture)(struct soc_camera_device *);


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/a0a6791ae0f12bf5b10d955f95b6964c7e3cbed3

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to