aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2011-07-01 13:31:17 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-07-27 16:56:08 -0400
commit91c7953005247c9563408bbdbf35e27de33e6ec3 (patch)
tree88769a0554da080023fc567bc6e41f9bc89c59c1 /include
parent7a05dfeddee9ffc2405230759ef32ecb603e3f48 (diff)
[media] V4L: add media bus configuration subdev operations
Add media bus configuration types and two subdev operations to get supported mediabus configurations and to set a specific configuration. Subdevs can support several configurations, e.g., they can send video data on 1 or several lanes, can be configured to use a specific CSI-2 channel, in such cases subdevice drivers return bitmasks with all respective bits set. When a set-configuration operation is called, it has to specify a non-ambiguous configuration. Signed-off-by: Stanimir Varbanov <svarbanov@mm-sol.com> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/media/v4l2-mediabus.h63
-rw-r--r--include/media/v4l2-subdev.h10
2 files changed, 73 insertions, 0 deletions
diff --git a/include/media/v4l2-mediabus.h b/include/media/v4l2-mediabus.h
index 971c7fa29614..6114007c8c74 100644
--- a/include/media/v4l2-mediabus.h
+++ b/include/media/v4l2-mediabus.h
@@ -13,6 +13,69 @@
13 13
14#include <linux/v4l2-mediabus.h> 14#include <linux/v4l2-mediabus.h>
15 15
16/* Parallel flags */
17/*
18 * Can the client run in master or in slave mode. By "Master mode" an operation
19 * mode is meant, when the client (e.g., a camera sensor) is producing
20 * horizontal and vertical synchronisation. In "Slave mode" the host is
21 * providing these signals to the slave.
22 */
23#define V4L2_MBUS_MASTER (1 << 0)
24#define V4L2_MBUS_SLAVE (1 << 1)
25/* Which signal polarities it supports */
26/* Note: in BT.656 mode HSYNC and VSYNC are unused */
27#define V4L2_MBUS_HSYNC_ACTIVE_HIGH (1 << 2)
28#define V4L2_MBUS_HSYNC_ACTIVE_LOW (1 << 3)
29#define V4L2_MBUS_VSYNC_ACTIVE_HIGH (1 << 4)
30#define V4L2_MBUS_VSYNC_ACTIVE_LOW (1 << 5)
31#define V4L2_MBUS_PCLK_SAMPLE_RISING (1 << 6)
32#define V4L2_MBUS_PCLK_SAMPLE_FALLING (1 << 7)
33#define V4L2_MBUS_DATA_ACTIVE_HIGH (1 << 8)
34#define V4L2_MBUS_DATA_ACTIVE_LOW (1 << 9)
35
36/* Serial flags */
37/* How many lanes the client can use */
38#define V4L2_MBUS_CSI2_1_LANE (1 << 0)
39#define V4L2_MBUS_CSI2_2_LANE (1 << 1)
40#define V4L2_MBUS_CSI2_3_LANE (1 << 2)
41#define V4L2_MBUS_CSI2_4_LANE (1 << 3)
42/* On which channels it can send video data */
43#define V4L2_MBUS_CSI2_CHANNEL_0 (1 << 4)
44#define V4L2_MBUS_CSI2_CHANNEL_1 (1 << 5)
45#define V4L2_MBUS_CSI2_CHANNEL_2 (1 << 6)
46#define V4L2_MBUS_CSI2_CHANNEL_3 (1 << 7)
47/* Does it support only continuous or also non-continuous clock mode */
48#define V4L2_MBUS_CSI2_CONTINUOUS_CLOCK (1 << 8)
49#define V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK (1 << 9)
50
51#define V4L2_MBUS_CSI2_LANES (V4L2_MBUS_CSI2_1_LANE | V4L2_MBUS_CSI2_2_LANE | \
52 V4L2_MBUS_CSI2_3_LANE | V4L2_MBUS_CSI2_4_LANE)
53#define V4L2_MBUS_CSI2_CHANNELS (V4L2_MBUS_CSI2_CHANNEL_0 | V4L2_MBUS_CSI2_CHANNEL_1 | \
54 V4L2_MBUS_CSI2_CHANNEL_2 | V4L2_MBUS_CSI2_CHANNEL_3)
55
56/**
57 * v4l2_mbus_type - media bus type
58 * @V4L2_MBUS_PARALLEL: parallel interface with hsync and vsync
59 * @V4L2_MBUS_BT656: parallel interface with embedded synchronisation, can
60 * also be used for BT.1120
61 * @V4L2_MBUS_CSI2: MIPI CSI-2 serial interface
62 */
63enum v4l2_mbus_type {
64 V4L2_MBUS_PARALLEL,
65 V4L2_MBUS_BT656,
66 V4L2_MBUS_CSI2,
67};
68
69/**
70 * v4l2_mbus_config - media bus configuration
71 * @type: in: interface type
72 * @flags: in / out: configuration flags, depending on @type
73 */
74struct v4l2_mbus_config {
75 enum v4l2_mbus_type type;
76 unsigned int flags;
77};
78
16static inline void v4l2_fill_pix_format(struct v4l2_pix_format *pix_fmt, 79static inline void v4l2_fill_pix_format(struct v4l2_pix_format *pix_fmt,
17 const struct v4l2_mbus_framefmt *mbus_fmt) 80 const struct v4l2_mbus_framefmt *mbus_fmt)
18{ 81{
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 9ff0ab9069d7..257da1a30f66 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -267,6 +267,12 @@ struct v4l2_subdev_audio_ops {
267 try_mbus_fmt: try to set a pixel format on a video data source 267 try_mbus_fmt: try to set a pixel format on a video data source
268 268
269 s_mbus_fmt: set a pixel format on a video data source 269 s_mbus_fmt: set a pixel format on a video data source
270
271 g_mbus_config: get supported mediabus configurations
272
273 s_mbus_config: set a certain mediabus configuration. This operation is added
274 for compatibility with soc-camera drivers and should not be used by new
275 software.
270 */ 276 */
271struct v4l2_subdev_video_ops { 277struct v4l2_subdev_video_ops {
272 int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config); 278 int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config);
@@ -310,6 +316,10 @@ struct v4l2_subdev_video_ops {
310 struct v4l2_mbus_framefmt *fmt); 316 struct v4l2_mbus_framefmt *fmt);
311 int (*s_mbus_fmt)(struct v4l2_subdev *sd, 317 int (*s_mbus_fmt)(struct v4l2_subdev *sd,
312 struct v4l2_mbus_framefmt *fmt); 318 struct v4l2_mbus_framefmt *fmt);
319 int (*g_mbus_config)(struct v4l2_subdev *sd,
320 struct v4l2_mbus_config *cfg);
321 int (*s_mbus_config)(struct v4l2_subdev *sd,
322 const struct v4l2_mbus_config *cfg);
313}; 323};
314 324
315/* 325/*