hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/include/media/v4l2-ctrls.h
....@@ -1,17 +1,8 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /*
23 * V4L2 controls support header.
34 *
45 * Copyright (C) 2010 Hans Verkuil <hverkuil@xs4all.nl>
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
156 */
167
178 #ifndef _V4L2_CTRLS_H
....@@ -20,27 +11,57 @@
2011 #include <linux/list.h>
2112 #include <linux/mutex.h>
2213 #include <linux/videodev2.h>
14
+#include <linux/android_kabi.h>
15
+#include <media/media-request.h>
16
+
17
+/*
18
+ * Include the stateless codec compound control definitions.
19
+ * This will move to the public headers once this API is fully stable.
20
+ */
21
+#include <media/mpeg2-ctrls.h>
22
+#include <media/fwht-ctrls.h>
23
+#include <media/h264-ctrls.h>
24
+#include <media/vp8-ctrls.h>
25
+#include <media/hevc-ctrls.h>
2326
2427 /* forward references */
2528 struct file;
29
+struct poll_table_struct;
30
+struct v4l2_ctrl;
2631 struct v4l2_ctrl_handler;
2732 struct v4l2_ctrl_helper;
28
-struct v4l2_ctrl;
29
-struct video_device;
33
+struct v4l2_fh;
34
+struct v4l2_fwnode_device_properties;
3035 struct v4l2_subdev;
3136 struct v4l2_subscribed_event;
32
-struct v4l2_fh;
33
-struct poll_table_struct;
37
+struct video_device;
3438
3539 /**
3640 * union v4l2_ctrl_ptr - A pointer to a control value.
37
- * @p_s32: Pointer to a 32-bit signed value.
38
- * @p_s64: Pointer to a 64-bit signed value.
39
- * @p_u8: Pointer to a 8-bit unsigned value.
40
- * @p_u16: Pointer to a 16-bit unsigned value.
41
- * @p_u32: Pointer to a 32-bit unsigned value.
42
- * @p_char: Pointer to a string.
43
- * @p: Pointer to a compound value.
41
+ * @p_s32: Pointer to a 32-bit signed value.
42
+ * @p_s64: Pointer to a 64-bit signed value.
43
+ * @p_u8: Pointer to a 8-bit unsigned value.
44
+ * @p_u16: Pointer to a 16-bit unsigned value.
45
+ * @p_u32: Pointer to a 32-bit unsigned value.
46
+ * @p_char: Pointer to a string.
47
+ * @p_mpeg2_slice_params: Pointer to a MPEG2 slice parameters structure.
48
+ * @p_mpeg2_quantization: Pointer to a MPEG2 quantization data structure.
49
+ * @p_fwht_params: Pointer to a FWHT stateless parameters structure.
50
+ * @p_h264_sps: Pointer to a struct v4l2_ctrl_h264_sps.
51
+ * @p_h264_pps: Pointer to a struct v4l2_ctrl_h264_pps.
52
+ * @p_h264_scaling_matrix: Pointer to a struct v4l2_ctrl_h264_scaling_matrix.
53
+ * @p_h264_slice_params: Pointer to a struct v4l2_ctrl_h264_slice_params.
54
+ * @p_h264_decode_params: Pointer to a struct v4l2_ctrl_h264_decode_params.
55
+ * @p_h264_pred_weights: Pointer to a struct v4l2_ctrl_h264_pred_weights.
56
+ * @p_vp8_frame_header: Pointer to a VP8 frame header structure.
57
+ * @p_hevc_sps: Pointer to an HEVC sequence parameter set structure.
58
+ * @p_hevc_pps: Pointer to an HEVC picture parameter set structure.
59
+ * @p_hevc_slice_params: Pointer to an HEVC slice parameters structure.
60
+ * @p_hdr10_cll: Pointer to an HDR10 Content Light Level structure.
61
+ * @p_hdr10_mastering: Pointer to an HDR10 Mastering Display structure.
62
+ * @p_area: Pointer to an area.
63
+ * @p: Pointer to a compound value.
64
+ * @p_const: Pointer to a constant compound value.
4465 */
4566 union v4l2_ctrl_ptr {
4667 s32 *p_s32;
....@@ -49,8 +70,40 @@
4970 u16 *p_u16;
5071 u32 *p_u32;
5172 char *p_char;
73
+ struct v4l2_ctrl_mpeg2_slice_params *p_mpeg2_slice_params;
74
+ struct v4l2_ctrl_mpeg2_quantization *p_mpeg2_quantization;
75
+ struct v4l2_ctrl_fwht_params *p_fwht_params;
76
+ struct v4l2_ctrl_h264_sps *p_h264_sps;
77
+ struct v4l2_ctrl_h264_pps *p_h264_pps;
78
+ struct v4l2_ctrl_h264_scaling_matrix *p_h264_scaling_matrix;
79
+ struct v4l2_ctrl_h264_slice_params *p_h264_slice_params;
80
+ struct v4l2_ctrl_h264_decode_params *p_h264_decode_params;
81
+ struct v4l2_ctrl_h264_pred_weights *p_h264_pred_weights;
82
+ struct v4l2_ctrl_vp8_frame_header *p_vp8_frame_header;
83
+ struct v4l2_ctrl_hevc_sps *p_hevc_sps;
84
+ struct v4l2_ctrl_hevc_pps *p_hevc_pps;
85
+ struct v4l2_ctrl_hevc_slice_params *p_hevc_slice_params;
86
+ struct v4l2_ctrl_hdr10_cll_info *p_hdr10_cll;
87
+ struct v4l2_ctrl_hdr10_mastering_display *p_hdr10_mastering;
88
+ struct v4l2_area *p_area;
5289 void *p;
90
+ const void *p_const;
91
+
92
+ ANDROID_KABI_RESERVE(1);
93
+ ANDROID_KABI_RESERVE(2);
5394 };
95
+
96
+/**
97
+ * v4l2_ctrl_ptr_create() - Helper function to return a v4l2_ctrl_ptr from a
98
+ * void pointer
99
+ * @ptr: The void pointer
100
+ */
101
+static inline union v4l2_ctrl_ptr v4l2_ctrl_ptr_create(void *ptr)
102
+{
103
+ union v4l2_ctrl_ptr p = { .p = ptr };
104
+
105
+ return p;
106
+}
54107
55108 /**
56109 * struct v4l2_ctrl_ops - The control operations that the driver has to provide.
....@@ -70,6 +123,8 @@
70123 int (*g_volatile_ctrl)(struct v4l2_ctrl *ctrl);
71124 int (*try_ctrl)(struct v4l2_ctrl *ctrl);
72125 int (*s_ctrl)(struct v4l2_ctrl *ctrl);
126
+
127
+ ANDROID_KABI_RESERVE(1);
73128 };
74129
75130 /**
....@@ -91,6 +146,8 @@
91146 void (*log)(const struct v4l2_ctrl *ctrl);
92147 int (*validate)(const struct v4l2_ctrl *ctrl, u32 idx,
93148 union v4l2_ctrl_ptr ptr);
149
+
150
+ ANDROID_KABI_RESERVE(1);
94151 };
95152
96153 /**
....@@ -181,6 +238,9 @@
181238 * not freed when the control is deleted. Should this be needed
182239 * then a new internal bitfield can be added to tell the framework
183240 * to free this pointer.
241
+ * @p_def: The control's default value represented via a union which
242
+ * provides a standard way of accessing control types
243
+ * through a pointer (for compound controls only).
184244 * @p_cur: The control's current value represented via a union which
185245 * provides a standard way of accessing control types
186246 * through a pointer.
....@@ -235,8 +295,11 @@
235295 s32 val;
236296 } cur;
237297
298
+ union v4l2_ctrl_ptr p_def;
238299 union v4l2_ctrl_ptr p_new;
239300 union v4l2_ctrl_ptr p_cur;
301
+
302
+ ANDROID_KABI_RESERVE(1);
240303 };
241304
242305 /**
....@@ -247,6 +310,21 @@
247310 * @ctrl: The actual control information.
248311 * @helper: Pointer to helper struct. Used internally in
249312 * ``prepare_ext_ctrls`` function at ``v4l2-ctrl.c``.
313
+ * @from_other_dev: If true, then @ctrl was defined in another
314
+ * device than the &struct v4l2_ctrl_handler.
315
+ * @req_done: Internal flag: if the control handler containing this control
316
+ * reference is bound to a media request, then this is set when
317
+ * the control has been applied. This prevents applying controls
318
+ * from a cluster with multiple controls twice (when the first
319
+ * control of a cluster is applied, they all are).
320
+ * @valid_p_req: If set, then p_req contains the control value for the request.
321
+ * @p_req: If the control handler containing this control reference
322
+ * is bound to a media request, then this points to the
323
+ * value of the control that must be applied when the request
324
+ * is executed, or to the value of the control at the time
325
+ * that the request was completed. If @valid_p_req is false,
326
+ * then this control was never set for this request and the
327
+ * control will not be updated when this request is applied.
250328 *
251329 * Each control handler has a list of these refs. The list_head is used to
252330 * keep a sorted-by-control-ID list of all controls, while the next pointer
....@@ -257,6 +335,12 @@
257335 struct v4l2_ctrl_ref *next;
258336 struct v4l2_ctrl *ctrl;
259337 struct v4l2_ctrl_helper *helper;
338
+ bool from_other_dev;
339
+ bool req_done;
340
+ bool valid_p_req;
341
+ union v4l2_ctrl_ptr p_req;
342
+
343
+ ANDROID_KABI_RESERVE(1);
260344 };
261345
262346 /**
....@@ -280,6 +364,17 @@
280364 * @notify_priv: Passed as argument to the v4l2_ctrl notify callback.
281365 * @nr_of_buckets: Total number of buckets in the array.
282366 * @error: The error code of the first failed control addition.
367
+ * @request_is_queued: True if the request was queued.
368
+ * @requests: List to keep track of open control handler request objects.
369
+ * For the parent control handler (@req_obj.ops == NULL) this
370
+ * is the list header. When the parent control handler is
371
+ * removed, it has to unbind and put all these requests since
372
+ * they refer to the parent.
373
+ * @requests_queued: List of the queued requests. This determines the order
374
+ * in which these controls are applied. Once the request is
375
+ * completed it is removed from this list.
376
+ * @req_obj: The &struct media_request_object, used to link into a
377
+ * &struct media_request. This request object has a refcount.
283378 */
284379 struct v4l2_ctrl_handler {
285380 struct mutex _lock;
....@@ -292,6 +387,12 @@
292387 void *notify_priv;
293388 u16 nr_of_buckets;
294389 int error;
390
+ bool request_is_queued;
391
+ struct list_head requests;
392
+ struct list_head requests_queued;
393
+ struct media_request_object req_obj;
394
+
395
+ ANDROID_KABI_RESERVE(1);
295396 };
296397
297398 /**
....@@ -306,6 +407,7 @@
306407 * @max: The control's maximum value.
307408 * @step: The control's step value for non-menu controls.
308409 * @def: The control's default value.
410
+ * @p_def: The control's default value for compound controls.
309411 * @dims: The size of each dimension.
310412 * @elem_size: The size in bytes of the control.
311413 * @flags: The control's flags.
....@@ -334,6 +436,7 @@
334436 s64 max;
335437 u64 step;
336438 s64 def;
439
+ union v4l2_ctrl_ptr p_def;
337440 u32 dims[V4L2_CTRL_MAX_DIMS];
338441 u32 elem_size;
339442 u32 flags;
....@@ -341,6 +444,8 @@
341444 const char * const *qmenu;
342445 const s64 *qmenu_int;
343446 unsigned int is_private:1;
447
+
448
+ ANDROID_KABI_RESERVE(1);
344449 };
345450
346451 /**
....@@ -596,6 +701,26 @@
596701 const char * const *qmenu);
597702
598703 /**
704
+ * v4l2_ctrl_new_std_compound() - Allocate and initialize a new standard V4L2
705
+ * compound control.
706
+ *
707
+ * @hdl: The control handler.
708
+ * @ops: The control ops.
709
+ * @id: The control ID.
710
+ * @p_def: The control's default value.
711
+ *
712
+ * Sames as v4l2_ctrl_new_std(), but with support to compound controls, thanks
713
+ * to the @p_def field. Use v4l2_ctrl_ptr_create() to create @p_def from a
714
+ * pointer. Use v4l2_ctrl_ptr_create(NULL) if the default value of the
715
+ * compound control should be all zeroes.
716
+ *
717
+ */
718
+struct v4l2_ctrl *v4l2_ctrl_new_std_compound(struct v4l2_ctrl_handler *hdl,
719
+ const struct v4l2_ctrl_ops *ops,
720
+ u32 id,
721
+ const union v4l2_ctrl_ptr p_def);
722
+
723
+/**
599724 * v4l2_ctrl_new_int_menu() - Create a new standard V4L2 integer menu control.
600725 *
601726 * @hdl: The control handler.
....@@ -605,7 +730,7 @@
605730 * @def: The control's default value.
606731 * @qmenu_int: The control's menu entries.
607732 *
608
- * Same as v4l2_ctrl_new_std_menu(), but @mask is set to 0 and it additionaly
733
+ * Same as v4l2_ctrl_new_std_menu(), but @mask is set to 0 and it additionally
609734 * takes as an argument an array of integers determining the menu items.
610735 *
611736 * If @id refers to a non-integer-menu control, then this function will
....@@ -633,6 +758,8 @@
633758 * @add: The control handler whose controls you want to add to
634759 * the @hdl control handler.
635760 * @filter: This function will filter which controls should be added.
761
+ * @from_other_dev: If true, then the controls in @add were defined in another
762
+ * device than @hdl.
636763 *
637764 * Does nothing if either of the two handlers is a NULL pointer.
638765 * If @filter is NULL, then all controls are added. Otherwise only those
....@@ -642,7 +769,8 @@
642769 */
643770 int v4l2_ctrl_add_handler(struct v4l2_ctrl_handler *hdl,
644771 struct v4l2_ctrl_handler *add,
645
- v4l2_ctrl_filter filter);
772
+ v4l2_ctrl_filter filter,
773
+ bool from_other_dev);
646774
647775 /**
648776 * v4l2_ctrl_radio_filter() - Standard filter for radio controls.
....@@ -729,6 +857,22 @@
729857 void v4l2_ctrl_activate(struct v4l2_ctrl *ctrl, bool active);
730858
731859 /**
860
+ * __v4l2_ctrl_grab() - Unlocked variant of v4l2_ctrl_grab.
861
+ *
862
+ * @ctrl: The control to (de)activate.
863
+ * @grabbed: True if the control should become grabbed.
864
+ *
865
+ * This sets or clears the V4L2_CTRL_FLAG_GRABBED flag atomically.
866
+ * Does nothing if @ctrl == NULL.
867
+ * The V4L2_EVENT_CTRL event will be generated afterwards.
868
+ * This will usually be called when starting or stopping streaming in the
869
+ * driver.
870
+ *
871
+ * This function assumes that the control handler is locked by the caller.
872
+ */
873
+void __v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed);
874
+
875
+/**
732876 * v4l2_ctrl_grab() - Mark the control as grabbed or not grabbed.
733877 *
734878 * @ctrl: The control to (de)activate.
....@@ -743,7 +887,15 @@
743887 * This function assumes that the control handler is not locked and will
744888 * take the lock itself.
745889 */
746
-void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed);
890
+static inline void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed)
891
+{
892
+ if (!ctrl)
893
+ return;
894
+
895
+ v4l2_ctrl_lock(ctrl);
896
+ __v4l2_ctrl_grab(ctrl, grabbed);
897
+ v4l2_ctrl_unlock(ctrl);
898
+}
747899
748900 /**
749901 *__v4l2_ctrl_modify_range() - Unlocked variant of v4l2_ctrl_modify_range()
....@@ -864,7 +1016,7 @@
8641016 * __v4l2_ctrl_s_ctrl() - Unlocked variant of v4l2_ctrl_s_ctrl().
8651017 *
8661018 * @ctrl: The control.
867
- * @val: TheControls name new value.
1019
+ * @val: The new value.
8681020 *
8691021 * This sets the control's new value safely by going through the control
8701022 * framework. This function assumes the control's handler is already locked,
....@@ -969,7 +1121,7 @@
9691121 *
9701122 * @ctrl: The control.
9711123 * @s: The new string.
972
- *Controls name
1124
+ *
9731125 * This sets the control's new string safely by going through the control
9741126 * framework. This function will lock the control's handler, so it cannot be
9751127 * used from within the &v4l2_ctrl_ops functions.
....@@ -986,6 +1138,55 @@
9861138
9871139 return rval;
9881140 }
1141
+
1142
+/**
1143
+ * __v4l2_ctrl_s_ctrl_compound() - Unlocked variant to set a compound control
1144
+ *
1145
+ * @ctrl: The control.
1146
+ * @type: The type of the data.
1147
+ * @p: The new compound payload.
1148
+ *
1149
+ * This sets the control's new compound payload safely by going through the
1150
+ * control framework. This function assumes the control's handler is already
1151
+ * locked, allowing it to be used from within the &v4l2_ctrl_ops functions.
1152
+ *
1153
+ * This function is for compound type controls only.
1154
+ */
1155
+int __v4l2_ctrl_s_ctrl_compound(struct v4l2_ctrl *ctrl,
1156
+ enum v4l2_ctrl_type type, const void *p);
1157
+
1158
+/**
1159
+ * v4l2_ctrl_s_ctrl_compound() - Helper function to set a compound control
1160
+ * from within a driver.
1161
+ *
1162
+ * @ctrl: The control.
1163
+ * @type: The type of the data.
1164
+ * @p: The new compound payload.
1165
+ *
1166
+ * This sets the control's new compound payload safely by going through the
1167
+ * control framework. This function will lock the control's handler, so it
1168
+ * cannot be used from within the &v4l2_ctrl_ops functions.
1169
+ *
1170
+ * This function is for compound type controls only.
1171
+ */
1172
+static inline int v4l2_ctrl_s_ctrl_compound(struct v4l2_ctrl *ctrl,
1173
+ enum v4l2_ctrl_type type,
1174
+ const void *p)
1175
+{
1176
+ int rval;
1177
+
1178
+ v4l2_ctrl_lock(ctrl);
1179
+ rval = __v4l2_ctrl_s_ctrl_compound(ctrl, type, p);
1180
+ v4l2_ctrl_unlock(ctrl);
1181
+
1182
+ return rval;
1183
+}
1184
+
1185
+/* Helper defines for area type controls */
1186
+#define __v4l2_ctrl_s_ctrl_area(ctrl, area) \
1187
+ __v4l2_ctrl_s_ctrl_compound((ctrl), V4L2_CTRL_TYPE_AREA, (area))
1188
+#define v4l2_ctrl_s_ctrl_area(ctrl, area) \
1189
+ v4l2_ctrl_s_ctrl_compound((ctrl), V4L2_CTRL_TYPE_AREA, (area))
9891190
9901191 /* Internal helper functions that deal with control events. */
9911192 extern const struct v4l2_subscribed_event_ops v4l2_ctrl_sub_ev_ops;
....@@ -1045,6 +1246,84 @@
10451246 * @wait: pointer to struct poll_table_struct
10461247 */
10471248 __poll_t v4l2_ctrl_poll(struct file *file, struct poll_table_struct *wait);
1249
+
1250
+/**
1251
+ * v4l2_ctrl_request_setup - helper function to apply control values in a request
1252
+ *
1253
+ * @req: The request
1254
+ * @parent: The parent control handler ('priv' in media_request_object_find())
1255
+ *
1256
+ * This is a helper function to call the control handler's s_ctrl callback with
1257
+ * the control values contained in the request. Do note that this approach of
1258
+ * applying control values in a request is only applicable to memory-to-memory
1259
+ * devices.
1260
+ */
1261
+int v4l2_ctrl_request_setup(struct media_request *req,
1262
+ struct v4l2_ctrl_handler *parent);
1263
+
1264
+/**
1265
+ * v4l2_ctrl_request_complete - Complete a control handler request object
1266
+ *
1267
+ * @req: The request
1268
+ * @parent: The parent control handler ('priv' in media_request_object_find())
1269
+ *
1270
+ * This function is to be called on each control handler that may have had a
1271
+ * request object associated with it, i.e. control handlers of a driver that
1272
+ * supports requests.
1273
+ *
1274
+ * The function first obtains the values of any volatile controls in the control
1275
+ * handler and attach them to the request. Then, the function completes the
1276
+ * request object.
1277
+ */
1278
+void v4l2_ctrl_request_complete(struct media_request *req,
1279
+ struct v4l2_ctrl_handler *parent);
1280
+
1281
+/**
1282
+ * v4l2_ctrl_request_hdl_find - Find the control handler in the request
1283
+ *
1284
+ * @req: The request
1285
+ * @parent: The parent control handler ('priv' in media_request_object_find())
1286
+ *
1287
+ * This function finds the control handler in the request. It may return
1288
+ * NULL if not found. When done, you must call v4l2_ctrl_request_put_hdl()
1289
+ * with the returned handler pointer.
1290
+ *
1291
+ * If the request is not in state VALIDATING or QUEUED, then this function
1292
+ * will always return NULL.
1293
+ *
1294
+ * Note that in state VALIDATING the req_queue_mutex is held, so
1295
+ * no objects can be added or deleted from the request.
1296
+ *
1297
+ * In state QUEUED it is the driver that will have to ensure this.
1298
+ */
1299
+struct v4l2_ctrl_handler *v4l2_ctrl_request_hdl_find(struct media_request *req,
1300
+ struct v4l2_ctrl_handler *parent);
1301
+
1302
+/**
1303
+ * v4l2_ctrl_request_hdl_put - Put the control handler
1304
+ *
1305
+ * @hdl: Put this control handler
1306
+ *
1307
+ * This function released the control handler previously obtained from'
1308
+ * v4l2_ctrl_request_hdl_find().
1309
+ */
1310
+static inline void v4l2_ctrl_request_hdl_put(struct v4l2_ctrl_handler *hdl)
1311
+{
1312
+ if (hdl)
1313
+ media_request_object_put(&hdl->req_obj);
1314
+}
1315
+
1316
+/**
1317
+ * v4l2_ctrl_request_ctrl_find() - Find a control with the given ID.
1318
+ *
1319
+ * @hdl: The control handler from the request.
1320
+ * @id: The ID of the control to find.
1321
+ *
1322
+ * This function returns a pointer to the control if this control is
1323
+ * part of the request or NULL otherwise.
1324
+ */
1325
+struct v4l2_ctrl *
1326
+v4l2_ctrl_request_hdl_ctrl_find(struct v4l2_ctrl_handler *hdl, u32 id);
10481327
10491328 /* Helpers for ioctl_ops */
10501329
....@@ -1112,23 +1391,29 @@
11121391 * :ref:`VIDIOC_G_EXT_CTRLS <vidioc_g_ext_ctrls>` ioctl
11131392 *
11141393 * @hdl: pointer to &struct v4l2_ctrl_handler
1394
+ * @vdev: pointer to &struct video_device
1395
+ * @mdev: pointer to &struct media_device
11151396 * @c: pointer to &struct v4l2_ext_controls
11161397 *
11171398 * If hdl == NULL then they will all return -EINVAL.
11181399 */
1119
-int v4l2_g_ext_ctrls(struct v4l2_ctrl_handler *hdl,
1120
- struct v4l2_ext_controls *c);
1400
+int v4l2_g_ext_ctrls(struct v4l2_ctrl_handler *hdl, struct video_device *vdev,
1401
+ struct media_device *mdev, struct v4l2_ext_controls *c);
11211402
11221403 /**
11231404 * v4l2_try_ext_ctrls - Helper function to implement
11241405 * :ref:`VIDIOC_TRY_EXT_CTRLS <vidioc_g_ext_ctrls>` ioctl
11251406 *
11261407 * @hdl: pointer to &struct v4l2_ctrl_handler
1408
+ * @vdev: pointer to &struct video_device
1409
+ * @mdev: pointer to &struct media_device
11271410 * @c: pointer to &struct v4l2_ext_controls
11281411 *
11291412 * If hdl == NULL then they will all return -EINVAL.
11301413 */
11311414 int v4l2_try_ext_ctrls(struct v4l2_ctrl_handler *hdl,
1415
+ struct video_device *vdev,
1416
+ struct media_device *mdev,
11321417 struct v4l2_ext_controls *c);
11331418
11341419 /**
....@@ -1137,11 +1422,15 @@
11371422 *
11381423 * @fh: pointer to &struct v4l2_fh
11391424 * @hdl: pointer to &struct v4l2_ctrl_handler
1425
+ * @vdev: pointer to &struct video_device
1426
+ * @mdev: pointer to &struct media_device
11401427 * @c: pointer to &struct v4l2_ext_controls
11411428 *
11421429 * If hdl == NULL then they will all return -EINVAL.
11431430 */
11441431 int v4l2_s_ext_ctrls(struct v4l2_fh *fh, struct v4l2_ctrl_handler *hdl,
1432
+ struct video_device *vdev,
1433
+ struct media_device *mdev,
11451434 struct v4l2_ext_controls *c);
11461435
11471436 /**
....@@ -1164,4 +1453,29 @@
11641453 */
11651454 int v4l2_ctrl_subdev_log_status(struct v4l2_subdev *sd);
11661455
1456
+/**
1457
+ * v4l2_ctrl_new_fwnode_properties() - Register controls for the device
1458
+ * properties
1459
+ *
1460
+ * @hdl: pointer to &struct v4l2_ctrl_handler to register controls on
1461
+ * @ctrl_ops: pointer to &struct v4l2_ctrl_ops to register controls with
1462
+ * @p: pointer to &struct v4l2_fwnode_device_properties
1463
+ *
1464
+ * This function registers controls associated to device properties, using the
1465
+ * property values contained in @p parameter, if the property has been set to
1466
+ * a value.
1467
+ *
1468
+ * Currently the following v4l2 controls are parsed and registered:
1469
+ * - V4L2_CID_CAMERA_ORIENTATION
1470
+ * - V4L2_CID_CAMERA_SENSOR_ROTATION;
1471
+ *
1472
+ * Controls already registered by the caller with the @hdl control handler are
1473
+ * not overwritten. Callers should register the controls they want to handle
1474
+ * themselves before calling this function.
1475
+ *
1476
+ * Return: 0 on success, a negative error code on failure.
1477
+ */
1478
+int v4l2_ctrl_new_fwnode_properties(struct v4l2_ctrl_handler *hdl,
1479
+ const struct v4l2_ctrl_ops *ctrl_ops,
1480
+ const struct v4l2_fwnode_device_properties *p);
11671481 #endif