aboutsummaryrefslogtreecommitdiffstats
path: root/include/media/soc_camera.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/media/soc_camera.h')
-rw-r--r--include/media/soc_camera.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index 9386db829fb7..f80b5372baf3 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -17,6 +17,7 @@
17#include <linux/pm.h> 17#include <linux/pm.h>
18#include <linux/videodev2.h> 18#include <linux/videodev2.h>
19#include <media/videobuf-core.h> 19#include <media/videobuf-core.h>
20#include <media/videobuf2-core.h>
20#include <media/v4l2-device.h> 21#include <media/v4l2-device.h>
21 22
22extern struct bus_type soc_camera_bus_type; 23extern struct bus_type soc_camera_bus_type;
@@ -29,6 +30,8 @@ struct soc_camera_device {
29 struct device *pdev; /* Platform device */ 30 struct device *pdev; /* Platform device */
30 s32 user_width; 31 s32 user_width;
31 s32 user_height; 32 s32 user_height;
33 u32 bytesperline; /* for padding, zero if unused */
34 u32 sizeimage;
32 enum v4l2_colorspace colorspace; 35 enum v4l2_colorspace colorspace;
33 unsigned char iface; /* Host number */ 36 unsigned char iface; /* Host number */
34 unsigned char devnum; /* Device number per host */ 37 unsigned char devnum; /* Device number per host */
@@ -44,7 +47,10 @@ struct soc_camera_device {
44 int use_count; 47 int use_count;
45 struct mutex video_lock; /* Protects device data */ 48 struct mutex video_lock; /* Protects device data */
46 struct file *streamer; /* stream owner */ 49 struct file *streamer; /* stream owner */
47 struct videobuf_queue vb_vidq; 50 union {
51 struct videobuf_queue vb_vidq;
52 struct vb2_queue vb2_vidq;
53 };
48}; 54};
49 55
50struct soc_camera_host { 56struct soc_camera_host {
@@ -78,6 +84,8 @@ struct soc_camera_host_ops {
78 int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *); 84 int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *);
79 void (*init_videobuf)(struct videobuf_queue *, 85 void (*init_videobuf)(struct videobuf_queue *,
80 struct soc_camera_device *); 86 struct soc_camera_device *);
87 int (*init_videobuf2)(struct vb2_queue *,
88 struct soc_camera_device *);
81 int (*reqbufs)(struct soc_camera_device *, struct v4l2_requestbuffers *); 89 int (*reqbufs)(struct soc_camera_device *, struct v4l2_requestbuffers *);
82 int (*querycap)(struct soc_camera_host *, struct v4l2_capability *); 90 int (*querycap)(struct soc_camera_host *, struct v4l2_capability *);
83 int (*set_bus_param)(struct soc_camera_device *, __u32); 91 int (*set_bus_param)(struct soc_camera_device *, __u32);
@@ -85,6 +93,7 @@ struct soc_camera_host_ops {
85 int (*set_ctrl)(struct soc_camera_device *, struct v4l2_control *); 93 int (*set_ctrl)(struct soc_camera_device *, struct v4l2_control *);
86 int (*get_parm)(struct soc_camera_device *, struct v4l2_streamparm *); 94 int (*get_parm)(struct soc_camera_device *, struct v4l2_streamparm *);
87 int (*set_parm)(struct soc_camera_device *, struct v4l2_streamparm *); 95 int (*set_parm)(struct soc_camera_device *, struct v4l2_streamparm *);
96 int (*enum_fsizes)(struct soc_camera_device *, struct v4l2_frmsizeenum *);
88 unsigned int (*poll)(struct file *, poll_table *); 97 unsigned int (*poll)(struct file *, poll_table *);
89 const struct v4l2_queryctrl *controls; 98 const struct v4l2_queryctrl *controls;
90 int num_controls; 99 int num_controls;
@@ -299,4 +308,17 @@ static inline struct video_device *soc_camera_i2c_to_vdev(struct i2c_client *cli
299 return icd->vdev; 308 return icd->vdev;
300} 309}
301 310
311static inline struct soc_camera_device *soc_camera_from_vb2q(struct vb2_queue *vq)
312{
313 return container_of(vq, struct soc_camera_device, vb2_vidq);
314}
315
316static inline struct soc_camera_device *soc_camera_from_vbq(struct videobuf_queue *vq)
317{
318 return container_of(vq, struct soc_camera_device, vb_vidq);
319}
320
321void soc_camera_lock(struct vb2_queue *vq);
322void soc_camera_unlock(struct vb2_queue *vq);
323
302#endif 324#endif