aboutsummaryrefslogtreecommitdiffstats
path: root/include/media
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2009-08-25 10:43:33 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-09-18 23:18:35 -0400
commit979ea1ddf80ac7383acdea03471355ca62702539 (patch)
tree2ee4c73eb672c1ee8167ed7e0906bac6f3b00e69 /include/media
parent0bab829de1ab60d8c3cbf7e402192bb9446840b7 (diff)
V4L/DVB (12510): soc-camera: (partially) convert to v4l2-(sub)dev API
Convert the soc-camera framework to use the v4l2-(sub)dev API. Start using v4l2-subdev operations. Only a part of the interface between the soc_camera core, soc_camera host drivers on one side and soc_camera device drivers on the other side is replaced so far. The rest of the interface will be replaced in incremental steps, and will require extensions and, possibly, modifications to the v4l2-subdev code. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'include/media')
-rw-r--r--include/media/soc_camera.h23
1 files changed, 6 insertions, 17 deletions
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index d8b4256126a4..3bc5b6b20f64 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -16,10 +16,12 @@
16#include <linux/pm.h> 16#include <linux/pm.h>
17#include <linux/videodev2.h> 17#include <linux/videodev2.h>
18#include <media/videobuf-core.h> 18#include <media/videobuf-core.h>
19#include <media/v4l2-device.h>
19 20
20struct soc_camera_device { 21struct soc_camera_device {
21 struct list_head list; 22 struct list_head list;
22 struct device dev; 23 struct device dev;
24 struct device *pdev; /* Platform device */
23 unsigned short width; /* Current window */ 25 unsigned short width; /* Current window */
24 unsigned short height; /* sizes */ 26 unsigned short height; /* sizes */
25 unsigned short x_min; /* Camera capabilities */ 27 unsigned short x_min; /* Camera capabilities */
@@ -45,7 +47,6 @@ struct soc_camera_device {
45 struct soc_camera_format_xlate *user_formats; 47 struct soc_camera_format_xlate *user_formats;
46 int num_user_formats; 48 int num_user_formats;
47 enum v4l2_field field; /* Preserve field over close() */ 49 enum v4l2_field field; /* Preserve field over close() */
48 struct module *owner;
49 void *host_priv; /* Per-device host private data */ 50 void *host_priv; /* Per-device host private data */
50 /* soc_camera.c private count. Only accessed with .video_lock held */ 51 /* soc_camera.c private count. Only accessed with .video_lock held */
51 int use_count; 52 int use_count;
@@ -58,8 +59,8 @@ struct soc_camera_file {
58}; 59};
59 60
60struct soc_camera_host { 61struct soc_camera_host {
62 struct v4l2_device v4l2_dev;
61 struct list_head list; 63 struct list_head list;
62 struct device *dev;
63 unsigned char nr; /* Host number */ 64 unsigned char nr; /* Host number */
64 void *priv; 65 void *priv;
65 const char *drv_name; 66 const char *drv_name;
@@ -127,7 +128,9 @@ static inline struct soc_camera_device *to_soc_camera_dev(struct device *dev)
127 128
128static inline struct soc_camera_host *to_soc_camera_host(struct device *dev) 129static inline struct soc_camera_host *to_soc_camera_host(struct device *dev)
129{ 130{
130 return dev_get_drvdata(dev); 131 struct v4l2_device *v4l2_dev = dev_get_drvdata(dev);
132
133 return container_of(v4l2_dev, struct soc_camera_host, v4l2_dev);
131} 134}
132 135
133static inline struct soc_camera_link *to_soc_camera_link(struct soc_camera_device *icd) 136static inline struct soc_camera_link *to_soc_camera_link(struct soc_camera_device *icd)
@@ -143,9 +146,6 @@ static inline struct device *to_soc_camera_control(struct soc_camera_device *icd
143int soc_camera_host_register(struct soc_camera_host *ici); 146int soc_camera_host_register(struct soc_camera_host *ici);
144void soc_camera_host_unregister(struct soc_camera_host *ici); 147void soc_camera_host_unregister(struct soc_camera_host *ici);
145 148
146int soc_camera_video_start(struct soc_camera_device *icd, struct device *dev);
147void soc_camera_video_stop(struct soc_camera_device *icd);
148
149const struct soc_camera_data_format *soc_camera_format_by_fourcc( 149const struct soc_camera_data_format *soc_camera_format_by_fourcc(
150 struct soc_camera_device *icd, unsigned int fourcc); 150 struct soc_camera_device *icd, unsigned int fourcc);
151const struct soc_camera_format_xlate *soc_camera_xlate_by_fourcc( 151const struct soc_camera_format_xlate *soc_camera_xlate_by_fourcc(
@@ -176,28 +176,17 @@ struct soc_camera_format_xlate {
176}; 176};
177 177
178struct soc_camera_ops { 178struct soc_camera_ops {
179 struct module *owner;
180 int (*suspend)(struct soc_camera_device *, pm_message_t state); 179 int (*suspend)(struct soc_camera_device *, pm_message_t state);
181 int (*resume)(struct soc_camera_device *); 180 int (*resume)(struct soc_camera_device *);
182 int (*init)(struct soc_camera_device *); 181 int (*init)(struct soc_camera_device *);
183 int (*release)(struct soc_camera_device *); 182 int (*release)(struct soc_camera_device *);
184 int (*start_capture)(struct soc_camera_device *);
185 int (*stop_capture)(struct soc_camera_device *);
186 int (*set_crop)(struct soc_camera_device *, struct v4l2_rect *); 183 int (*set_crop)(struct soc_camera_device *, struct v4l2_rect *);
187 int (*set_fmt)(struct soc_camera_device *, struct v4l2_format *);
188 int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *);
189 unsigned long (*query_bus_param)(struct soc_camera_device *); 184 unsigned long (*query_bus_param)(struct soc_camera_device *);
190 int (*set_bus_param)(struct soc_camera_device *, unsigned long); 185 int (*set_bus_param)(struct soc_camera_device *, unsigned long);
191 int (*get_chip_id)(struct soc_camera_device *, 186 int (*get_chip_id)(struct soc_camera_device *,
192 struct v4l2_dbg_chip_ident *); 187 struct v4l2_dbg_chip_ident *);
193 int (*set_std)(struct soc_camera_device *, v4l2_std_id *); 188 int (*set_std)(struct soc_camera_device *, v4l2_std_id *);
194 int (*enum_input)(struct soc_camera_device *, struct v4l2_input *); 189 int (*enum_input)(struct soc_camera_device *, struct v4l2_input *);
195#ifdef CONFIG_VIDEO_ADV_DEBUG
196 int (*get_register)(struct soc_camera_device *, struct v4l2_dbg_register *);
197 int (*set_register)(struct soc_camera_device *, struct v4l2_dbg_register *);
198#endif
199 int (*get_control)(struct soc_camera_device *, struct v4l2_control *);
200 int (*set_control)(struct soc_camera_device *, struct v4l2_control *);
201 const struct v4l2_queryctrl *controls; 190 const struct v4l2_queryctrl *controls;
202 int num_controls; 191 int num_controls;
203}; 192};