This source file includes following definitions.
- v4l2_fill_pix_format
- v4l2_fill_mbus_format
- v4l2_fill_pix_format_mplane
- v4l2_fill_mbus_format_mplane
1
2
3
4
5
6
7
8 #ifndef V4L2_MEDIABUS_H
9 #define V4L2_MEDIABUS_H
10
11 #include <linux/v4l2-mediabus.h>
12 #include <linux/bitops.h>
13
14
15
16
17
18
19
20
21 #define V4L2_MBUS_MASTER BIT(0)
22 #define V4L2_MBUS_SLAVE BIT(1)
23
24
25
26
27
28
29 #define V4L2_MBUS_HSYNC_ACTIVE_HIGH BIT(2)
30 #define V4L2_MBUS_HSYNC_ACTIVE_LOW BIT(3)
31 #define V4L2_MBUS_VSYNC_ACTIVE_HIGH BIT(4)
32 #define V4L2_MBUS_VSYNC_ACTIVE_LOW BIT(5)
33 #define V4L2_MBUS_PCLK_SAMPLE_RISING BIT(6)
34 #define V4L2_MBUS_PCLK_SAMPLE_FALLING BIT(7)
35 #define V4L2_MBUS_DATA_ACTIVE_HIGH BIT(8)
36 #define V4L2_MBUS_DATA_ACTIVE_LOW BIT(9)
37
38 #define V4L2_MBUS_FIELD_EVEN_HIGH BIT(10)
39
40 #define V4L2_MBUS_FIELD_EVEN_LOW BIT(11)
41
42 #define V4L2_MBUS_VIDEO_SOG_ACTIVE_HIGH BIT(12)
43 #define V4L2_MBUS_VIDEO_SOG_ACTIVE_LOW BIT(13)
44 #define V4L2_MBUS_DATA_ENABLE_HIGH BIT(14)
45 #define V4L2_MBUS_DATA_ENABLE_LOW BIT(15)
46
47
48
49 #define V4L2_MBUS_CSI2_1_LANE BIT(0)
50 #define V4L2_MBUS_CSI2_2_LANE BIT(1)
51 #define V4L2_MBUS_CSI2_3_LANE BIT(2)
52 #define V4L2_MBUS_CSI2_4_LANE BIT(3)
53
54 #define V4L2_MBUS_CSI2_CHANNEL_0 BIT(4)
55 #define V4L2_MBUS_CSI2_CHANNEL_1 BIT(5)
56 #define V4L2_MBUS_CSI2_CHANNEL_2 BIT(6)
57 #define V4L2_MBUS_CSI2_CHANNEL_3 BIT(7)
58
59 #define V4L2_MBUS_CSI2_CONTINUOUS_CLOCK BIT(8)
60 #define V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK BIT(9)
61
62 #define V4L2_MBUS_CSI2_LANES (V4L2_MBUS_CSI2_1_LANE | \
63 V4L2_MBUS_CSI2_2_LANE | \
64 V4L2_MBUS_CSI2_3_LANE | \
65 V4L2_MBUS_CSI2_4_LANE)
66 #define V4L2_MBUS_CSI2_CHANNELS (V4L2_MBUS_CSI2_CHANNEL_0 | \
67 V4L2_MBUS_CSI2_CHANNEL_1 | \
68 V4L2_MBUS_CSI2_CHANNEL_2 | \
69 V4L2_MBUS_CSI2_CHANNEL_3)
70
71
72
73
74
75
76
77
78
79
80
81
82 enum v4l2_mbus_type {
83 V4L2_MBUS_UNKNOWN,
84 V4L2_MBUS_PARALLEL,
85 V4L2_MBUS_BT656,
86 V4L2_MBUS_CSI1,
87 V4L2_MBUS_CCP2,
88 V4L2_MBUS_CSI2_DPHY,
89 V4L2_MBUS_CSI2_CPHY,
90 };
91
92
93
94
95
96
97 struct v4l2_mbus_config {
98 enum v4l2_mbus_type type;
99 unsigned int flags;
100 };
101
102
103
104
105
106
107
108
109 static inline void
110 v4l2_fill_pix_format(struct v4l2_pix_format *pix_fmt,
111 const struct v4l2_mbus_framefmt *mbus_fmt)
112 {
113 pix_fmt->width = mbus_fmt->width;
114 pix_fmt->height = mbus_fmt->height;
115 pix_fmt->field = mbus_fmt->field;
116 pix_fmt->colorspace = mbus_fmt->colorspace;
117 pix_fmt->ycbcr_enc = mbus_fmt->ycbcr_enc;
118 pix_fmt->quantization = mbus_fmt->quantization;
119 pix_fmt->xfer_func = mbus_fmt->xfer_func;
120 }
121
122
123
124
125
126
127
128
129
130
131 static inline void v4l2_fill_mbus_format(struct v4l2_mbus_framefmt *mbus_fmt,
132 const struct v4l2_pix_format *pix_fmt,
133 u32 code)
134 {
135 mbus_fmt->width = pix_fmt->width;
136 mbus_fmt->height = pix_fmt->height;
137 mbus_fmt->field = pix_fmt->field;
138 mbus_fmt->colorspace = pix_fmt->colorspace;
139 mbus_fmt->ycbcr_enc = pix_fmt->ycbcr_enc;
140 mbus_fmt->quantization = pix_fmt->quantization;
141 mbus_fmt->xfer_func = pix_fmt->xfer_func;
142 mbus_fmt->code = code;
143 }
144
145
146
147
148
149
150
151
152 static inline void
153 v4l2_fill_pix_format_mplane(struct v4l2_pix_format_mplane *pix_mp_fmt,
154 const struct v4l2_mbus_framefmt *mbus_fmt)
155 {
156 pix_mp_fmt->width = mbus_fmt->width;
157 pix_mp_fmt->height = mbus_fmt->height;
158 pix_mp_fmt->field = mbus_fmt->field;
159 pix_mp_fmt->colorspace = mbus_fmt->colorspace;
160 pix_mp_fmt->ycbcr_enc = mbus_fmt->ycbcr_enc;
161 pix_mp_fmt->quantization = mbus_fmt->quantization;
162 pix_mp_fmt->xfer_func = mbus_fmt->xfer_func;
163 }
164
165
166
167
168
169
170
171
172 static inline void
173 v4l2_fill_mbus_format_mplane(struct v4l2_mbus_framefmt *mbus_fmt,
174 const struct v4l2_pix_format_mplane *pix_mp_fmt)
175 {
176 mbus_fmt->width = pix_mp_fmt->width;
177 mbus_fmt->height = pix_mp_fmt->height;
178 mbus_fmt->field = pix_mp_fmt->field;
179 mbus_fmt->colorspace = pix_mp_fmt->colorspace;
180 mbus_fmt->ycbcr_enc = pix_mp_fmt->ycbcr_enc;
181 mbus_fmt->quantization = pix_mp_fmt->quantization;
182 mbus_fmt->xfer_func = pix_mp_fmt->xfer_func;
183 }
184
185 #endif