diff options
| author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2012-12-26 10:44:11 -0500 |
|---|---|---|
| committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-06-21 15:34:17 -0400 |
| commit | e09da11da49c6fd625be52d8b60bbbbe225a9db6 (patch) | |
| tree | 80442f04ef06f338578c43e7eea26bca759c9104 /include/media | |
| parent | 9aea470b399d797e88be08985c489855759c6c60 (diff) | |
[media] soc-camera: add V4L2-async support
Add support for asynchronous subdevice probing, using the v4l2-async API.
The legacy synchronous mode is still supported too, which allows to
gradually update drivers and platforms. The selected approach adds a
notifier for each struct soc_camera_device instance, i.e. for each video
device node, even when there are multiple such instances registered with a
single soc-camera host simultaneously.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'include/media')
| -rw-r--r-- | include/media/soc_camera.h | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h index f582323fafb7..906ed98c6e95 100644 --- a/include/media/soc_camera.h +++ b/include/media/soc_camera.h | |||
| @@ -19,11 +19,13 @@ | |||
| 19 | #include <linux/videodev2.h> | 19 | #include <linux/videodev2.h> |
| 20 | #include <media/videobuf-core.h> | 20 | #include <media/videobuf-core.h> |
| 21 | #include <media/videobuf2-core.h> | 21 | #include <media/videobuf2-core.h> |
| 22 | #include <media/v4l2-async.h> | ||
| 22 | #include <media/v4l2-ctrls.h> | 23 | #include <media/v4l2-ctrls.h> |
| 23 | #include <media/v4l2-device.h> | 24 | #include <media/v4l2-device.h> |
| 24 | 25 | ||
| 25 | struct file; | 26 | struct file; |
| 26 | struct soc_camera_desc; | 27 | struct soc_camera_desc; |
| 28 | struct soc_camera_async_client; | ||
| 27 | 29 | ||
| 28 | struct soc_camera_device { | 30 | struct soc_camera_device { |
| 29 | struct list_head list; /* list of all registered devices */ | 31 | struct list_head list; /* list of all registered devices */ |
| @@ -50,6 +52,9 @@ struct soc_camera_device { | |||
| 50 | int use_count; | 52 | int use_count; |
| 51 | struct file *streamer; /* stream owner */ | 53 | struct file *streamer; /* stream owner */ |
| 52 | struct v4l2_clk *clk; | 54 | struct v4l2_clk *clk; |
| 55 | /* Asynchronous subdevice management */ | ||
| 56 | struct soc_camera_async_client *sasc; | ||
| 57 | /* video buffer queue */ | ||
| 53 | union { | 58 | union { |
| 54 | struct videobuf_queue vb_vidq; | 59 | struct videobuf_queue vb_vidq; |
| 55 | struct vb2_queue vb2_vidq; | 60 | struct vb2_queue vb2_vidq; |
| @@ -59,16 +64,30 @@ struct soc_camera_device { | |||
| 59 | /* Host supports programmable stride */ | 64 | /* Host supports programmable stride */ |
| 60 | #define SOCAM_HOST_CAP_STRIDE (1 << 0) | 65 | #define SOCAM_HOST_CAP_STRIDE (1 << 0) |
| 61 | 66 | ||
| 67 | enum soc_camera_subdev_role { | ||
| 68 | SOCAM_SUBDEV_DATA_SOURCE = 1, | ||
| 69 | SOCAM_SUBDEV_DATA_SINK, | ||
| 70 | SOCAM_SUBDEV_DATA_PROCESSOR, | ||
| 71 | }; | ||
| 72 | |||
| 73 | struct soc_camera_async_subdev { | ||
| 74 | struct v4l2_async_subdev asd; | ||
| 75 | enum soc_camera_subdev_role role; | ||
| 76 | }; | ||
| 77 | |||
| 62 | struct soc_camera_host { | 78 | struct soc_camera_host { |
| 63 | struct v4l2_device v4l2_dev; | 79 | struct v4l2_device v4l2_dev; |
| 64 | struct list_head list; | 80 | struct list_head list; |
| 65 | struct mutex host_lock; /* Protect pipeline modifications */ | 81 | struct mutex host_lock; /* Main synchronisation lock */ |
| 82 | struct mutex clk_lock; /* Protect pipeline modifications */ | ||
| 66 | unsigned char nr; /* Host number */ | 83 | unsigned char nr; /* Host number */ |
| 67 | u32 capabilities; | 84 | u32 capabilities; |
| 68 | struct soc_camera_device *icd; /* Currently attached client */ | 85 | struct soc_camera_device *icd; /* Currently attached client */ |
| 69 | void *priv; | 86 | void *priv; |
| 70 | const char *drv_name; | 87 | const char *drv_name; |
| 71 | struct soc_camera_host_ops *ops; | 88 | struct soc_camera_host_ops *ops; |
| 89 | struct v4l2_async_subdev **asd; /* Flat array, arranged in groups */ | ||
| 90 | int *asd_sizes; /* 0-terminated array of asd group sizes */ | ||
| 72 | }; | 91 | }; |
| 73 | 92 | ||
| 74 | struct soc_camera_host_ops { | 93 | struct soc_camera_host_ops { |
| @@ -161,6 +180,7 @@ struct soc_camera_host_desc { | |||
| 161 | }; | 180 | }; |
| 162 | 181 | ||
| 163 | /* | 182 | /* |
| 183 | * Platform data for "soc-camera-pdrv" | ||
| 164 | * This MUST be kept binary-identical to struct soc_camera_link below, until | 184 | * This MUST be kept binary-identical to struct soc_camera_link below, until |
| 165 | * it is completely replaced by this one, after which we can split it into its | 185 | * it is completely replaced by this one, after which we can split it into its |
| 166 | * two components. | 186 | * two components. |
| @@ -326,6 +346,7 @@ static inline void soc_camera_limit_side(int *start, int *length, | |||
| 326 | unsigned long soc_camera_apply_board_flags(struct soc_camera_subdev_desc *ssdd, | 346 | unsigned long soc_camera_apply_board_flags(struct soc_camera_subdev_desc *ssdd, |
| 327 | const struct v4l2_mbus_config *cfg); | 347 | const struct v4l2_mbus_config *cfg); |
| 328 | 348 | ||
| 349 | int soc_camera_power_init(struct device *dev, struct soc_camera_subdev_desc *ssdd); | ||
| 329 | int soc_camera_power_on(struct device *dev, struct soc_camera_subdev_desc *ssdd, | 350 | int soc_camera_power_on(struct device *dev, struct soc_camera_subdev_desc *ssdd, |
| 330 | struct v4l2_clk *clk); | 351 | struct v4l2_clk *clk); |
| 331 | int soc_camera_power_off(struct device *dev, struct soc_camera_subdev_desc *ssdd, | 352 | int soc_camera_power_off(struct device *dev, struct soc_camera_subdev_desc *ssdd, |
