hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/media/platform/rcar-vin/rcar-vin.h
....@@ -19,6 +19,7 @@
1919 #include <media/v4l2-ctrls.h>
2020 #include <media/v4l2-dev.h>
2121 #include <media/v4l2-device.h>
22
+#include <media/v4l2-fwnode.h>
2223 #include <media/videobuf2-v4l2.h>
2324
2425 /* Number of HW buffers */
....@@ -61,6 +62,23 @@
6162 };
6263
6364 /**
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
+/**
6482 * struct rvin_video_format - Data format stored in memory
6583 * @fourcc: Pixelformat
6684 * @bpp: Bytes per pixel
....@@ -75,7 +93,7 @@
7593 * @asd: sub-device descriptor for async framework
7694 * @subdev: subdevice matched using async framework
7795 * @mbus_type: media bus type
78
- * @mbus_flags: media bus configuration flags
96
+ * @bus: media bus parallel configuration
7997 * @source_pad: source pad of remote subdevice
8098 * @sink_pad: sink pad of remote subdevice
8199 *
....@@ -85,7 +103,7 @@
85103 struct v4l2_subdev *subdev;
86104
87105 enum v4l2_mbus_type mbus_type;
88
- unsigned int mbus_flags;
106
+ struct v4l2_fwnode_bus_parallel bus;
89107
90108 unsigned int source_pad;
91109 unsigned int sink_pad;
....@@ -126,6 +144,7 @@
126144 * struct rvin_info - Information about the particular VIN implementation
127145 * @model: VIN model
128146 * @use_mc: use media controller instead of controlling subdevice
147
+ * @nv12: support outputing NV12 pixel format
129148 * @max_width: max input width the VIN supports
130149 * @max_height: max input height the VIN supports
131150 * @routes: list of possible routes from the CSI-2 recivers to
....@@ -134,6 +153,7 @@
134153 struct rvin_info {
135154 enum model_id model;
136155 bool use_mc;
156
+ bool nv12;
137157
138158 unsigned int max_width;
139159 unsigned int max_height;
....@@ -162,9 +182,8 @@
162182 * @scratch: cpu address for scratch buffer
163183 * @scratch_phys: physical address of the scratch buffer
164184 *
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
168187 * @buf_list: list of queued buffers
169188 * @sequence: V4L2 buffers sequence number
170189 * @state: keeps track of operation state
....@@ -176,8 +195,10 @@
176195 *
177196 * @crop: active cropping
178197 * @compose: active composing
179
- * @source: active size of the video source
198
+ * @src_rect: active size of the video source
180199 * @std: active video standard of the video source
200
+ *
201
+ * @alpha: Alpha component to fill in for supported pixel formats
181202 */
182203 struct rvin_dev {
183204 struct device *dev;
....@@ -201,7 +222,11 @@
201222 dma_addr_t scratch_phys;
202223
203224 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];
205230 struct list_head buf_list;
206231 unsigned int sequence;
207232 enum rvin_dma_state state;
....@@ -213,8 +238,10 @@
213238
214239 struct v4l2_rect crop;
215240 struct v4l2_rect compose;
216
- struct v4l2_rect source;
241
+ struct v4l2_rect src_rect;
217242 v4l2_std_id std;
243
+
244
+ unsigned int alpha;
218245 };
219246
220247 #define vin_to_source(vin) ((vin)->parallel->subdev)
....@@ -260,11 +287,14 @@
260287 int rvin_v4l2_register(struct rvin_dev *vin);
261288 void rvin_v4l2_unregister(struct rvin_dev *vin);
262289
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
+
264293
265294 /* Cropping, composing and scaling */
266295 void rvin_crop_scale_comp(struct rvin_dev *vin);
267296
268297 int rvin_set_channel_routing(struct rvin_dev *vin, u8 chsel);
298
+void rvin_set_alpha(struct rvin_dev *vin, unsigned int alpha);
269299
270300 #endif