aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Jarzmik <robert.jarzmik@free.fr>2008-08-01 19:14:50 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-08-06 05:57:32 -0400
commit2e521061db61a35dd64ea85a1642f9a9dfde2872 (patch)
tree30fb02b0f57d19c566e6439ec3599613402727fd
parent01c1e4ca8ec39d21be0cd9d1b300d479de97298a (diff)
V4L/DVB (8610): Add suspend/resume capabilities to soc_camera.
Add suspend/resume hooks to call soc operation specific suspend and resume functions. This ensures the camera chip has been previously resumed, as well as the camera bus. These hooks in camera chip drivers should save/restore chip context between suspend and resume time. Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/video/soc_camera.c26
-rw-r--r--include/media/soc_camera.h5
2 files changed, 31 insertions, 0 deletions
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c
index b6be5ee678b6..66ebe5956a87 100644
--- a/drivers/media/video/soc_camera.c
+++ b/drivers/media/video/soc_camera.c
@@ -732,10 +732,36 @@ static int soc_camera_remove(struct device *dev)
732 return 0; 732 return 0;
733} 733}
734 734
735static int soc_camera_suspend(struct device *dev, pm_message_t state)
736{
737 struct soc_camera_device *icd = to_soc_camera_dev(dev);
738 struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
739 int ret = 0;
740
741 if (ici->ops->suspend)
742 ret = ici->ops->suspend(icd, state);
743
744 return ret;
745}
746
747static int soc_camera_resume(struct device *dev)
748{
749 struct soc_camera_device *icd = to_soc_camera_dev(dev);
750 struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
751 int ret = 0;
752
753 if (ici->ops->resume)
754 ret = ici->ops->resume(icd);
755
756 return ret;
757}
758
735static struct bus_type soc_camera_bus_type = { 759static struct bus_type soc_camera_bus_type = {
736 .name = "soc-camera", 760 .name = "soc-camera",
737 .probe = soc_camera_probe, 761 .probe = soc_camera_probe,
738 .remove = soc_camera_remove, 762 .remove = soc_camera_remove,
763 .suspend = soc_camera_suspend,
764 .resume = soc_camera_resume,
739}; 765};
740 766
741static struct device_driver ic_drv = { 767static struct device_driver ic_drv = {
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index 1de98f150e99..d548de326722 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -14,6 +14,7 @@
14 14
15#include <linux/videodev2.h> 15#include <linux/videodev2.h>
16#include <media/videobuf-core.h> 16#include <media/videobuf-core.h>
17#include <linux/pm.h>
17 18
18struct soc_camera_device { 19struct soc_camera_device {
19 struct list_head list; 20 struct list_head list;
@@ -63,6 +64,8 @@ struct soc_camera_host_ops {
63 struct module *owner; 64 struct module *owner;
64 int (*add)(struct soc_camera_device *); 65 int (*add)(struct soc_camera_device *);
65 void (*remove)(struct soc_camera_device *); 66 void (*remove)(struct soc_camera_device *);
67 int (*suspend)(struct soc_camera_device *, pm_message_t state);
68 int (*resume)(struct soc_camera_device *);
66 int (*set_fmt_cap)(struct soc_camera_device *, __u32, 69 int (*set_fmt_cap)(struct soc_camera_device *, __u32,
67 struct v4l2_rect *); 70 struct v4l2_rect *);
68 int (*try_fmt_cap)(struct soc_camera_device *, struct v4l2_format *); 71 int (*try_fmt_cap)(struct soc_camera_device *, struct v4l2_format *);
@@ -111,6 +114,8 @@ struct soc_camera_ops {
111 struct module *owner; 114 struct module *owner;
112 int (*probe)(struct soc_camera_device *); 115 int (*probe)(struct soc_camera_device *);
113 void (*remove)(struct soc_camera_device *); 116 void (*remove)(struct soc_camera_device *);
117 int (*suspend)(struct soc_camera_device *, pm_message_t state);
118 int (*resume)(struct soc_camera_device *);
114 int (*init)(struct soc_camera_device *); 119 int (*init)(struct soc_camera_device *);
115 int (*release)(struct soc_camera_device *); 120 int (*release)(struct soc_camera_device *);
116 int (*start_capture)(struct soc_camera_device *); 121 int (*start_capture)(struct soc_camera_device *);