.. | .. |
---|
19 | 19 | #include <media/v4l2-ctrls.h> |
---|
20 | 20 | #include <media/v4l2-dev.h> |
---|
21 | 21 | #include <media/v4l2-device.h> |
---|
| 22 | +#include <media/v4l2-fwnode.h> |
---|
22 | 23 | #include <media/videobuf2-v4l2.h> |
---|
23 | 24 | |
---|
24 | 25 | /* Number of HW buffers */ |
---|
.. | .. |
---|
61 | 62 | }; |
---|
62 | 63 | |
---|
63 | 64 | /** |
---|
| 65 | + * enum rvin_buffer_type |
---|
| 66 | + * |
---|
| 67 | + * Describes how a buffer is given to the hardware. To be able |
---|
| 68 | + * to capture SEQ_TB/BT it's needed to capture to the same vb2 |
---|
| 69 | + * buffer twice so the type of buffer needs to be kept. |
---|
| 70 | + * |
---|
| 71 | + * FULL - One capture fills the whole vb2 buffer |
---|
| 72 | + * HALF_TOP - One capture fills the top half of the vb2 buffer |
---|
| 73 | + * HALF_BOTTOM - One capture fills the bottom half of the vb2 buffer |
---|
| 74 | + */ |
---|
| 75 | +enum rvin_buffer_type { |
---|
| 76 | + FULL, |
---|
| 77 | + HALF_TOP, |
---|
| 78 | + HALF_BOTTOM, |
---|
| 79 | +}; |
---|
| 80 | + |
---|
| 81 | +/** |
---|
64 | 82 | * struct rvin_video_format - Data format stored in memory |
---|
65 | 83 | * @fourcc: Pixelformat |
---|
66 | 84 | * @bpp: Bytes per pixel |
---|
.. | .. |
---|
75 | 93 | * @asd: sub-device descriptor for async framework |
---|
76 | 94 | * @subdev: subdevice matched using async framework |
---|
77 | 95 | * @mbus_type: media bus type |
---|
78 | | - * @mbus_flags: media bus configuration flags |
---|
| 96 | + * @bus: media bus parallel configuration |
---|
79 | 97 | * @source_pad: source pad of remote subdevice |
---|
80 | 98 | * @sink_pad: sink pad of remote subdevice |
---|
81 | 99 | * |
---|
.. | .. |
---|
85 | 103 | struct v4l2_subdev *subdev; |
---|
86 | 104 | |
---|
87 | 105 | enum v4l2_mbus_type mbus_type; |
---|
88 | | - unsigned int mbus_flags; |
---|
| 106 | + struct v4l2_fwnode_bus_parallel bus; |
---|
89 | 107 | |
---|
90 | 108 | unsigned int source_pad; |
---|
91 | 109 | unsigned int sink_pad; |
---|
.. | .. |
---|
126 | 144 | * struct rvin_info - Information about the particular VIN implementation |
---|
127 | 145 | * @model: VIN model |
---|
128 | 146 | * @use_mc: use media controller instead of controlling subdevice |
---|
| 147 | + * @nv12: support outputing NV12 pixel format |
---|
129 | 148 | * @max_width: max input width the VIN supports |
---|
130 | 149 | * @max_height: max input height the VIN supports |
---|
131 | 150 | * @routes: list of possible routes from the CSI-2 recivers to |
---|
.. | .. |
---|
134 | 153 | struct rvin_info { |
---|
135 | 154 | enum model_id model; |
---|
136 | 155 | bool use_mc; |
---|
| 156 | + bool nv12; |
---|
137 | 157 | |
---|
138 | 158 | unsigned int max_width; |
---|
139 | 159 | unsigned int max_height; |
---|
.. | .. |
---|
162 | 182 | * @scratch: cpu address for scratch buffer |
---|
163 | 183 | * @scratch_phys: physical address of the scratch buffer |
---|
164 | 184 | * |
---|
165 | | - * @qlock: protects @queue_buf, @buf_list, @sequence |
---|
166 | | - * @state |
---|
167 | | - * @queue_buf: Keeps track of buffers given to HW slot |
---|
| 185 | + * @qlock: protects @buf_hw, @buf_list, @sequence and @state |
---|
| 186 | + * @buf_hw: Keeps track of buffers given to HW slot |
---|
168 | 187 | * @buf_list: list of queued buffers |
---|
169 | 188 | * @sequence: V4L2 buffers sequence number |
---|
170 | 189 | * @state: keeps track of operation state |
---|
.. | .. |
---|
176 | 195 | * |
---|
177 | 196 | * @crop: active cropping |
---|
178 | 197 | * @compose: active composing |
---|
179 | | - * @source: active size of the video source |
---|
| 198 | + * @src_rect: active size of the video source |
---|
180 | 199 | * @std: active video standard of the video source |
---|
| 200 | + * |
---|
| 201 | + * @alpha: Alpha component to fill in for supported pixel formats |
---|
181 | 202 | */ |
---|
182 | 203 | struct rvin_dev { |
---|
183 | 204 | struct device *dev; |
---|
.. | .. |
---|
201 | 222 | dma_addr_t scratch_phys; |
---|
202 | 223 | |
---|
203 | 224 | spinlock_t qlock; |
---|
204 | | - struct vb2_v4l2_buffer *queue_buf[HW_BUFFER_NUM]; |
---|
| 225 | + struct { |
---|
| 226 | + struct vb2_v4l2_buffer *buffer; |
---|
| 227 | + enum rvin_buffer_type type; |
---|
| 228 | + dma_addr_t phys; |
---|
| 229 | + } buf_hw[HW_BUFFER_NUM]; |
---|
205 | 230 | struct list_head buf_list; |
---|
206 | 231 | unsigned int sequence; |
---|
207 | 232 | enum rvin_dma_state state; |
---|
.. | .. |
---|
213 | 238 | |
---|
214 | 239 | struct v4l2_rect crop; |
---|
215 | 240 | struct v4l2_rect compose; |
---|
216 | | - struct v4l2_rect source; |
---|
| 241 | + struct v4l2_rect src_rect; |
---|
217 | 242 | v4l2_std_id std; |
---|
| 243 | + |
---|
| 244 | + unsigned int alpha; |
---|
218 | 245 | }; |
---|
219 | 246 | |
---|
220 | 247 | #define vin_to_source(vin) ((vin)->parallel->subdev) |
---|
.. | .. |
---|
260 | 287 | int rvin_v4l2_register(struct rvin_dev *vin); |
---|
261 | 288 | void rvin_v4l2_unregister(struct rvin_dev *vin); |
---|
262 | 289 | |
---|
263 | | -const struct rvin_video_format *rvin_format_from_pixel(u32 pixelformat); |
---|
| 290 | +const struct rvin_video_format *rvin_format_from_pixel(struct rvin_dev *vin, |
---|
| 291 | + u32 pixelformat); |
---|
| 292 | + |
---|
264 | 293 | |
---|
265 | 294 | /* Cropping, composing and scaling */ |
---|
266 | 295 | void rvin_crop_scale_comp(struct rvin_dev *vin); |
---|
267 | 296 | |
---|
268 | 297 | int rvin_set_channel_routing(struct rvin_dev *vin, u8 chsel); |
---|
| 298 | +void rvin_set_alpha(struct rvin_dev *vin, unsigned int alpha); |
---|
269 | 299 | |
---|
270 | 300 | #endif |
---|