1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * V4L2 controls support header.
5 * Copyright (C) 2010 Hans Verkuil <hverkuil@xs4all.nl>
11 #include <linux/list.h>
12 #include <linux/mutex.h>
13 #include <linux/videodev2.h>
14 #include <media/media-request.h>
17 * Include the stateless codec compound control definitions.
18 * This will move to the public headers once this API is fully stable.
20 #include <media/mpeg2-ctrls.h>
21 #include <media/fwht-ctrls.h>
22 #include <media/h264-ctrls.h>
23 #include <media/vp8-ctrls.h>
24 #include <media/hevc-ctrls.h>
26 /* forward references */
28 struct v4l2_ctrl_handler;
29 struct v4l2_ctrl_helper;
33 struct v4l2_subscribed_event;
35 struct poll_table_struct;
38 * union v4l2_ctrl_ptr - A pointer to a control value.
39 * @p_s32: Pointer to a 32-bit signed value.
40 * @p_s64: Pointer to a 64-bit signed value.
41 * @p_u8: Pointer to a 8-bit unsigned value.
42 * @p_u16: Pointer to a 16-bit unsigned value.
43 * @p_u32: Pointer to a 32-bit unsigned value.
44 * @p_char: Pointer to a string.
45 * @p_mpeg2_slice_params: Pointer to a MPEG2 slice parameters structure.
46 * @p_mpeg2_quantization: Pointer to a MPEG2 quantization data structure.
47 * @p_fwht_params: Pointer to a FWHT stateless parameters structure.
48 * @p_h264_sps: Pointer to a struct v4l2_ctrl_h264_sps.
49 * @p_h264_pps: Pointer to a struct v4l2_ctrl_h264_pps.
50 * @p_h264_scaling_matrix: Pointer to a struct v4l2_ctrl_h264_scaling_matrix.
51 * @p_h264_slice_params: Pointer to a struct v4l2_ctrl_h264_slice_params.
52 * @p_h264_decode_params: Pointer to a struct v4l2_ctrl_h264_decode_params.
53 * @p_vp8_frame_header: Pointer to a VP8 frame header structure.
54 * @p_hevc_sps: Pointer to an HEVC sequence parameter set structure.
55 * @p_hevc_pps: Pointer to an HEVC picture parameter set structure.
56 * @p_hevc_slice_params: Pointer to an HEVC slice parameters structure.
57 * @p_area: Pointer to an area.
58 * @p: Pointer to a compound value.
59 * @p_const: Pointer to a constant compound value.
68 struct v4l2_ctrl_mpeg2_slice_params *p_mpeg2_slice_params;
69 struct v4l2_ctrl_mpeg2_quantization *p_mpeg2_quantization;
70 struct v4l2_ctrl_fwht_params *p_fwht_params;
71 struct v4l2_ctrl_h264_sps *p_h264_sps;
72 struct v4l2_ctrl_h264_pps *p_h264_pps;
73 struct v4l2_ctrl_h264_scaling_matrix *p_h264_scaling_matrix;
74 struct v4l2_ctrl_h264_slice_params *p_h264_slice_params;
75 struct v4l2_ctrl_h264_decode_params *p_h264_decode_params;
76 struct v4l2_ctrl_vp8_frame_header *p_vp8_frame_header;
77 struct v4l2_ctrl_hevc_sps *p_hevc_sps;
78 struct v4l2_ctrl_hevc_pps *p_hevc_pps;
79 struct v4l2_ctrl_hevc_slice_params *p_hevc_slice_params;
80 struct v4l2_area *p_area;
86 * v4l2_ctrl_ptr_create() - Helper function to return a v4l2_ctrl_ptr from a
88 * @ptr: The void pointer
90 static inline union v4l2_ctrl_ptr v4l2_ctrl_ptr_create(void *ptr)
92 union v4l2_ctrl_ptr p = { .p = ptr };
98 * struct v4l2_ctrl_ops - The control operations that the driver has to provide.
100 * @g_volatile_ctrl: Get a new value for this control. Generally only relevant
101 * for volatile (and usually read-only) controls such as a control
102 * that returns the current signal strength which changes
104 * If not set, then the currently cached value will be returned.
105 * @try_ctrl: Test whether the control's value is valid. Only relevant when
106 * the usual min/max/step checks are not sufficient.
107 * @s_ctrl: Actually set the new control value. s_ctrl is compulsory. The
108 * ctrl->handler->lock is held when these ops are called, so no
109 * one else can access controls owned by that handler.
111 struct v4l2_ctrl_ops {
112 int (*g_volatile_ctrl)(struct v4l2_ctrl *ctrl);
113 int (*try_ctrl)(struct v4l2_ctrl *ctrl);
114 int (*s_ctrl)(struct v4l2_ctrl *ctrl);
118 * struct v4l2_ctrl_type_ops - The control type operations that the driver
121 * @equal: return true if both values are equal.
122 * @init: initialize the value.
123 * @log: log the value.
124 * @validate: validate the value. Return 0 on success and a negative value
127 struct v4l2_ctrl_type_ops {
128 bool (*equal)(const struct v4l2_ctrl *ctrl, u32 idx,
129 union v4l2_ctrl_ptr ptr1,
130 union v4l2_ctrl_ptr ptr2);
131 void (*init)(const struct v4l2_ctrl *ctrl, u32 idx,
132 union v4l2_ctrl_ptr ptr);
133 void (*log)(const struct v4l2_ctrl *ctrl);
134 int (*validate)(const struct v4l2_ctrl *ctrl, u32 idx,
135 union v4l2_ctrl_ptr ptr);
139 * typedef v4l2_ctrl_notify_fnc - typedef for a notify argument with a function
140 * that should be called when a control value has changed.
142 * @ctrl: pointer to struct &v4l2_ctrl
143 * @priv: control private data
145 * This typedef definition is used as an argument to v4l2_ctrl_notify()
146 * and as an argument at struct &v4l2_ctrl_handler.
148 typedef void (*v4l2_ctrl_notify_fnc)(struct v4l2_ctrl *ctrl, void *priv);
151 * struct v4l2_ctrl - The control structure.
153 * @node: The list node.
154 * @ev_subs: The list of control event subscriptions.
155 * @handler: The handler that owns the control.
156 * @cluster: Point to start of cluster array.
157 * @ncontrols: Number of controls in cluster array.
158 * @done: Internal flag: set for each processed control.
159 * @is_new: Set when the user specified a new value for this control. It
160 * is also set when called from v4l2_ctrl_handler_setup(). Drivers
161 * should never set this flag.
162 * @has_changed: Set when the current value differs from the new value. Drivers
163 * should never use this flag.
164 * @is_private: If set, then this control is private to its handler and it
165 * will not be added to any other handlers. Drivers can set
167 * @is_auto: If set, then this control selects whether the other cluster
168 * members are in 'automatic' mode or 'manual' mode. This is
169 * used for autogain/gain type clusters. Drivers should never
170 * set this flag directly.
171 * @is_int: If set, then this control has a simple integer value (i.e. it
173 * @is_string: If set, then this control has type %V4L2_CTRL_TYPE_STRING.
174 * @is_ptr: If set, then this control is an array and/or has type >=
175 * %V4L2_CTRL_COMPOUND_TYPES
176 * and/or has type %V4L2_CTRL_TYPE_STRING. In other words, &struct
177 * v4l2_ext_control uses field p to point to the data.
178 * @is_array: If set, then this control contains an N-dimensional array.
179 * @has_volatiles: If set, then one or more members of the cluster are volatile.
180 * Drivers should never touch this flag.
181 * @call_notify: If set, then call the handler's notify function whenever the
182 * control's value changes.
183 * @manual_mode_value: If the is_auto flag is set, then this is the value
184 * of the auto control that determines if that control is in
185 * manual mode. So if the value of the auto control equals this
186 * value, then the whole cluster is in manual mode. Drivers should
187 * never set this flag directly.
188 * @ops: The control ops.
189 * @type_ops: The control type ops.
190 * @id: The control ID.
191 * @name: The control name.
192 * @type: The control type.
193 * @minimum: The control's minimum value.
194 * @maximum: The control's maximum value.
195 * @default_value: The control's default value.
196 * @step: The control's step value for non-menu controls.
197 * @elems: The number of elements in the N-dimensional array.
198 * @elem_size: The size in bytes of the control.
199 * @dims: The size of each dimension.
200 * @nr_of_dims:The number of dimensions in @dims.
201 * @menu_skip_mask: The control's skip mask for menu controls. This makes it
202 * easy to skip menu items that are not valid. If bit X is set,
203 * then menu item X is skipped. Of course, this only works for
204 * menus with <= 32 menu items. There are no menus that come
205 * close to that number, so this is OK. Should we ever need more,
206 * then this will have to be extended to a u64 or a bit array.
207 * @qmenu: A const char * array for all menu items. Array entries that are
208 * empty strings ("") correspond to non-existing menu items (this
209 * is in addition to the menu_skip_mask above). The last entry
211 * Used only if the @type is %V4L2_CTRL_TYPE_MENU.
212 * @qmenu_int: A 64-bit integer array for with integer menu items.
213 * The size of array must be equal to the menu size, e. g.:
214 * :math:`ceil(\frac{maximum - minimum}{step}) + 1`.
215 * Used only if the @type is %V4L2_CTRL_TYPE_INTEGER_MENU.
216 * @flags: The control's flags.
217 * @cur: Structure to store the current value.
218 * @cur.val: The control's current value, if the @type is represented via
219 * a u32 integer (see &enum v4l2_ctrl_type).
220 * @val: The control's new s32 value.
221 * @priv: The control's private pointer. For use by the driver. It is
222 * untouched by the control framework. Note that this pointer is
223 * not freed when the control is deleted. Should this be needed
224 * then a new internal bitfield can be added to tell the framework
225 * to free this pointer.
226 * @p_def: The control's default value represented via a union which
227 * provides a standard way of accessing control types
228 * through a pointer (for compound controls only).
229 * @p_cur: The control's current value represented via a union which
230 * provides a standard way of accessing control types
232 * @p_new: The control's new value represented via a union which provides
233 * a standard way of accessing control types
237 /* Administrative fields */
238 struct list_head node;
239 struct list_head ev_subs;
240 struct v4l2_ctrl_handler *handler;
241 struct v4l2_ctrl **cluster;
242 unsigned int ncontrols;
246 unsigned int is_new:1;
247 unsigned int has_changed:1;
248 unsigned int is_private:1;
249 unsigned int is_auto:1;
250 unsigned int is_int:1;
251 unsigned int is_string:1;
252 unsigned int is_ptr:1;
253 unsigned int is_array:1;
254 unsigned int has_volatiles:1;
255 unsigned int call_notify:1;
256 unsigned int manual_mode_value:8;
258 const struct v4l2_ctrl_ops *ops;
259 const struct v4l2_ctrl_type_ops *type_ops;
262 enum v4l2_ctrl_type type;
263 s64 minimum, maximum, default_value;
266 u32 dims[V4L2_CTRL_MAX_DIMS];
273 const char * const *qmenu;
274 const s64 *qmenu_int;
283 union v4l2_ctrl_ptr p_def;
284 union v4l2_ctrl_ptr p_new;
285 union v4l2_ctrl_ptr p_cur;
289 * struct v4l2_ctrl_ref - The control reference.
291 * @node: List node for the sorted list.
292 * @next: Single-link list node for the hash.
293 * @ctrl: The actual control information.
294 * @helper: Pointer to helper struct. Used internally in
295 * ``prepare_ext_ctrls`` function at ``v4l2-ctrl.c``.
296 * @from_other_dev: If true, then @ctrl was defined in another
297 * device than the &struct v4l2_ctrl_handler.
298 * @req_done: Internal flag: if the control handler containing this control
299 * reference is bound to a media request, then this is set when
300 * the control has been applied. This prevents applying controls
301 * from a cluster with multiple controls twice (when the first
302 * control of a cluster is applied, they all are).
303 * @req: If set, this refers to another request that sets this control.
304 * @p_req: If the control handler containing this control reference
305 * is bound to a media request, then this points to the
306 * value of the control that should be applied when the request
307 * is executed, or to the value of the control at the time
308 * that the request was completed.
310 * Each control handler has a list of these refs. The list_head is used to
311 * keep a sorted-by-control-ID list of all controls, while the next pointer
312 * is used to link the control in the hash's bucket.
314 struct v4l2_ctrl_ref {
315 struct list_head node;
316 struct v4l2_ctrl_ref *next;
317 struct v4l2_ctrl *ctrl;
318 struct v4l2_ctrl_helper *helper;
321 struct v4l2_ctrl_ref *req;
322 union v4l2_ctrl_ptr p_req;
326 * struct v4l2_ctrl_handler - The control handler keeps track of all the
327 * controls: both the controls owned by the handler and those inherited
328 * from other handlers.
330 * @_lock: Default for "lock".
331 * @lock: Lock to control access to this handler and its controls.
332 * May be replaced by the user right after init.
333 * @ctrls: The list of controls owned by this handler.
334 * @ctrl_refs: The list of control references.
335 * @cached: The last found control reference. It is common that the same
336 * control is needed multiple times, so this is a simple
338 * @buckets: Buckets for the hashing. Allows for quick control lookup.
339 * @notify: A notify callback that is called whenever the control changes
341 * Note that the handler's lock is held when the notify function
343 * @notify_priv: Passed as argument to the v4l2_ctrl notify callback.
344 * @nr_of_buckets: Total number of buckets in the array.
345 * @error: The error code of the first failed control addition.
346 * @request_is_queued: True if the request was queued.
347 * @requests: List to keep track of open control handler request objects.
348 * For the parent control handler (@req_obj.req == NULL) this
349 * is the list header. When the parent control handler is
350 * removed, it has to unbind and put all these requests since
351 * they refer to the parent.
352 * @requests_queued: List of the queued requests. This determines the order
353 * in which these controls are applied. Once the request is
354 * completed it is removed from this list.
355 * @req_obj: The &struct media_request_object, used to link into a
356 * &struct media_request. This request object has a refcount.
358 struct v4l2_ctrl_handler {
361 struct list_head ctrls;
362 struct list_head ctrl_refs;
363 struct v4l2_ctrl_ref *cached;
364 struct v4l2_ctrl_ref **buckets;
365 v4l2_ctrl_notify_fnc notify;
369 bool request_is_queued;
370 struct list_head requests;
371 struct list_head requests_queued;
372 struct media_request_object req_obj;
376 * struct v4l2_ctrl_config - Control configuration structure.
378 * @ops: The control ops.
379 * @type_ops: The control type ops. Only needed for compound controls.
380 * @id: The control ID.
381 * @name: The control name.
382 * @type: The control type.
383 * @min: The control's minimum value.
384 * @max: The control's maximum value.
385 * @step: The control's step value for non-menu controls.
386 * @def: The control's default value.
387 * @p_def: The control's default value for compound controls.
388 * @dims: The size of each dimension.
389 * @elem_size: The size in bytes of the control.
390 * @flags: The control's flags.
391 * @menu_skip_mask: The control's skip mask for menu controls. This makes it
392 * easy to skip menu items that are not valid. If bit X is set,
393 * then menu item X is skipped. Of course, this only works for
394 * menus with <= 64 menu items. There are no menus that come
395 * close to that number, so this is OK. Should we ever need more,
396 * then this will have to be extended to a bit array.
397 * @qmenu: A const char * array for all menu items. Array entries that are
398 * empty strings ("") correspond to non-existing menu items (this
399 * is in addition to the menu_skip_mask above). The last entry
401 * @qmenu_int: A const s64 integer array for all menu items of the type
402 * V4L2_CTRL_TYPE_INTEGER_MENU.
403 * @is_private: If set, then this control is private to its handler and it
404 * will not be added to any other handlers.
406 struct v4l2_ctrl_config {
407 const struct v4l2_ctrl_ops *ops;
408 const struct v4l2_ctrl_type_ops *type_ops;
411 enum v4l2_ctrl_type type;
416 union v4l2_ctrl_ptr p_def;
417 u32 dims[V4L2_CTRL_MAX_DIMS];
421 const char * const *qmenu;
422 const s64 *qmenu_int;
423 unsigned int is_private:1;
427 * v4l2_ctrl_fill - Fill in the control fields based on the control ID.
429 * @id: ID of the control
430 * @name: pointer to be filled with a string with the name of the control
431 * @type: pointer for storing the type of the control
432 * @min: pointer for storing the minimum value for the control
433 * @max: pointer for storing the maximum value for the control
434 * @step: pointer for storing the control step
435 * @def: pointer for storing the default value for the control
436 * @flags: pointer for storing the flags to be used on the control
438 * This works for all standard V4L2 controls.
439 * For non-standard controls it will only fill in the given arguments
440 * and @name content will be set to %NULL.
442 * This function will overwrite the contents of @name, @type and @flags.
443 * The contents of @min, @max, @step and @def may be modified depending on
448 * Do not use in drivers! It is used internally for backwards compatibility
449 * control handling only. Once all drivers are converted to use the new
450 * control framework this function will no longer be exported.
452 void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
453 s64 *min, s64 *max, u64 *step, s64 *def, u32 *flags);
457 * v4l2_ctrl_handler_init_class() - Initialize the control handler.
458 * @hdl: The control handler.
459 * @nr_of_controls_hint: A hint of how many controls this handler is
460 * expected to refer to. This is the total number, so including
461 * any inherited controls. It doesn't have to be precise, but if
462 * it is way off, then you either waste memory (too many buckets
463 * are allocated) or the control lookup becomes slower (not enough
464 * buckets are allocated, so there are more slow list lookups).
465 * It will always work, though.
466 * @key: Used by the lock validator if CONFIG_LOCKDEP is set.
467 * @name: Used by the lock validator if CONFIG_LOCKDEP is set.
471 * Never use this call directly, always use the v4l2_ctrl_handler_init()
472 * macro that hides the @key and @name arguments.
474 * Return: returns an error if the buckets could not be allocated. This
475 * error will also be stored in @hdl->error.
477 int v4l2_ctrl_handler_init_class(struct v4l2_ctrl_handler *hdl,
478 unsigned int nr_of_controls_hint,
479 struct lock_class_key *key, const char *name);
481 #ifdef CONFIG_LOCKDEP
484 * v4l2_ctrl_handler_init - helper function to create a static struct
485 * &lock_class_key and calls v4l2_ctrl_handler_init_class()
487 * @hdl: The control handler.
488 * @nr_of_controls_hint: A hint of how many controls this handler is
489 * expected to refer to. This is the total number, so including
490 * any inherited controls. It doesn't have to be precise, but if
491 * it is way off, then you either waste memory (too many buckets
492 * are allocated) or the control lookup becomes slower (not enough
493 * buckets are allocated, so there are more slow list lookups).
494 * It will always work, though.
496 * This helper function creates a static struct &lock_class_key and
497 * calls v4l2_ctrl_handler_init_class(), providing a proper name for the lock
500 * Use this helper function to initialize a control handler.
502 #define v4l2_ctrl_handler_init(hdl, nr_of_controls_hint) \
505 static struct lock_class_key _key; \
506 v4l2_ctrl_handler_init_class(hdl, nr_of_controls_hint, \
508 KBUILD_BASENAME ":" \
509 __stringify(__LINE__) ":" \
510 "(" #hdl ")->_lock"); \
514 #define v4l2_ctrl_handler_init(hdl, nr_of_controls_hint) \
515 v4l2_ctrl_handler_init_class(hdl, nr_of_controls_hint, NULL, NULL)
519 * v4l2_ctrl_handler_free() - Free all controls owned by the handler and free
521 * @hdl: The control handler.
523 * Does nothing if @hdl == NULL.
525 void v4l2_ctrl_handler_free(struct v4l2_ctrl_handler *hdl);
528 * v4l2_ctrl_lock() - Helper function to lock the handler
529 * associated with the control.
530 * @ctrl: The control to lock.
532 static inline void v4l2_ctrl_lock(struct v4l2_ctrl *ctrl)
534 mutex_lock(ctrl->handler->lock);
538 * v4l2_ctrl_unlock() - Helper function to unlock the handler
539 * associated with the control.
540 * @ctrl: The control to unlock.
542 static inline void v4l2_ctrl_unlock(struct v4l2_ctrl *ctrl)
544 mutex_unlock(ctrl->handler->lock);
548 * __v4l2_ctrl_handler_setup() - Call the s_ctrl op for all controls belonging
549 * to the handler to initialize the hardware to the current control values. The
550 * caller is responsible for acquiring the control handler mutex on behalf of
551 * __v4l2_ctrl_handler_setup().
552 * @hdl: The control handler.
554 * Button controls will be skipped, as are read-only controls.
556 * If @hdl == NULL, then this just returns 0.
558 int __v4l2_ctrl_handler_setup(struct v4l2_ctrl_handler *hdl);
561 * v4l2_ctrl_handler_setup() - Call the s_ctrl op for all controls belonging
562 * to the handler to initialize the hardware to the current control values.
563 * @hdl: The control handler.
565 * Button controls will be skipped, as are read-only controls.
567 * If @hdl == NULL, then this just returns 0.
569 int v4l2_ctrl_handler_setup(struct v4l2_ctrl_handler *hdl);
572 * v4l2_ctrl_handler_log_status() - Log all controls owned by the handler.
573 * @hdl: The control handler.
574 * @prefix: The prefix to use when logging the control values. If the
575 * prefix does not end with a space, then ": " will be added
576 * after the prefix. If @prefix == NULL, then no prefix will be
579 * For use with VIDIOC_LOG_STATUS.
581 * Does nothing if @hdl == NULL.
583 void v4l2_ctrl_handler_log_status(struct v4l2_ctrl_handler *hdl,
587 * v4l2_ctrl_new_custom() - Allocate and initialize a new custom V4L2
590 * @hdl: The control handler.
591 * @cfg: The control's configuration data.
592 * @priv: The control's driver-specific private data.
594 * If the &v4l2_ctrl struct could not be allocated then NULL is returned
595 * and @hdl->error is set to the error code (if it wasn't set already).
597 struct v4l2_ctrl *v4l2_ctrl_new_custom(struct v4l2_ctrl_handler *hdl,
598 const struct v4l2_ctrl_config *cfg,
602 * v4l2_ctrl_new_std() - Allocate and initialize a new standard V4L2 non-menu
605 * @hdl: The control handler.
606 * @ops: The control ops.
607 * @id: The control ID.
608 * @min: The control's minimum value.
609 * @max: The control's maximum value.
610 * @step: The control's step value
611 * @def: The control's default value.
613 * If the &v4l2_ctrl struct could not be allocated, or the control
614 * ID is not known, then NULL is returned and @hdl->error is set to the
615 * appropriate error code (if it wasn't set already).
617 * If @id refers to a menu control, then this function will return NULL.
619 * Use v4l2_ctrl_new_std_menu() when adding menu controls.
621 struct v4l2_ctrl *v4l2_ctrl_new_std(struct v4l2_ctrl_handler *hdl,
622 const struct v4l2_ctrl_ops *ops,
623 u32 id, s64 min, s64 max, u64 step,
627 * v4l2_ctrl_new_std_menu() - Allocate and initialize a new standard V4L2
630 * @hdl: The control handler.
631 * @ops: The control ops.
632 * @id: The control ID.
633 * @max: The control's maximum value.
634 * @mask: The control's skip mask for menu controls. This makes it
635 * easy to skip menu items that are not valid. If bit X is set,
636 * then menu item X is skipped. Of course, this only works for
637 * menus with <= 64 menu items. There are no menus that come
638 * close to that number, so this is OK. Should we ever need more,
639 * then this will have to be extended to a bit array.
640 * @def: The control's default value.
642 * Same as v4l2_ctrl_new_std(), but @min is set to 0 and the @mask value
643 * determines which menu items are to be skipped.
645 * If @id refers to a non-menu control, then this function will return NULL.
647 struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl,
648 const struct v4l2_ctrl_ops *ops,
649 u32 id, u8 max, u64 mask, u8 def);
652 * v4l2_ctrl_new_std_menu_items() - Create a new standard V4L2 menu control
653 * with driver specific menu.
655 * @hdl: The control handler.
656 * @ops: The control ops.
657 * @id: The control ID.
658 * @max: The control's maximum value.
659 * @mask: The control's skip mask for menu controls. This makes it
660 * easy to skip menu items that are not valid. If bit X is set,
661 * then menu item X is skipped. Of course, this only works for
662 * menus with <= 64 menu items. There are no menus that come
663 * close to that number, so this is OK. Should we ever need more,
664 * then this will have to be extended to a bit array.
665 * @def: The control's default value.
666 * @qmenu: The new menu.
668 * Same as v4l2_ctrl_new_std_menu(), but @qmenu will be the driver specific
669 * menu of this control.
672 struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items(struct v4l2_ctrl_handler *hdl,
673 const struct v4l2_ctrl_ops *ops,
676 const char * const *qmenu);
679 * v4l2_ctrl_new_std_compound() - Allocate and initialize a new standard V4L2
682 * @hdl: The control handler.
683 * @ops: The control ops.
684 * @id: The control ID.
685 * @p_def: The control's default value.
687 * Sames as v4l2_ctrl_new_std(), but with support to compound controls, thanks
688 * to the @p_def field.
691 struct v4l2_ctrl *v4l2_ctrl_new_std_compound(struct v4l2_ctrl_handler *hdl,
692 const struct v4l2_ctrl_ops *ops,
694 const union v4l2_ctrl_ptr p_def);
697 * v4l2_ctrl_new_int_menu() - Create a new standard V4L2 integer menu control.
699 * @hdl: The control handler.
700 * @ops: The control ops.
701 * @id: The control ID.
702 * @max: The control's maximum value.
703 * @def: The control's default value.
704 * @qmenu_int: The control's menu entries.
706 * Same as v4l2_ctrl_new_std_menu(), but @mask is set to 0 and it additionally
707 * takes as an argument an array of integers determining the menu items.
709 * If @id refers to a non-integer-menu control, then this function will
712 struct v4l2_ctrl *v4l2_ctrl_new_int_menu(struct v4l2_ctrl_handler *hdl,
713 const struct v4l2_ctrl_ops *ops,
714 u32 id, u8 max, u8 def,
715 const s64 *qmenu_int);
718 * typedef v4l2_ctrl_filter - Typedef to define the filter function to be
719 * used when adding a control handler.
721 * @ctrl: pointer to struct &v4l2_ctrl.
724 typedef bool (*v4l2_ctrl_filter)(const struct v4l2_ctrl *ctrl);
727 * v4l2_ctrl_add_handler() - Add all controls from handler @add to
730 * @hdl: The control handler.
731 * @add: The control handler whose controls you want to add to
732 * the @hdl control handler.
733 * @filter: This function will filter which controls should be added.
734 * @from_other_dev: If true, then the controls in @add were defined in another
737 * Does nothing if either of the two handlers is a NULL pointer.
738 * If @filter is NULL, then all controls are added. Otherwise only those
739 * controls for which @filter returns true will be added.
740 * In case of an error @hdl->error will be set to the error code (if it
741 * wasn't set already).
743 int v4l2_ctrl_add_handler(struct v4l2_ctrl_handler *hdl,
744 struct v4l2_ctrl_handler *add,
745 v4l2_ctrl_filter filter,
746 bool from_other_dev);
749 * v4l2_ctrl_radio_filter() - Standard filter for radio controls.
751 * @ctrl: The control that is filtered.
753 * This will return true for any controls that are valid for radio device
754 * nodes. Those are all of the V4L2_CID_AUDIO_* user controls and all FM
755 * transmitter class controls.
757 * This function is to be used with v4l2_ctrl_add_handler().
759 bool v4l2_ctrl_radio_filter(const struct v4l2_ctrl *ctrl);
762 * v4l2_ctrl_cluster() - Mark all controls in the cluster as belonging
765 * @ncontrols: The number of controls in this cluster.
766 * @controls: The cluster control array of size @ncontrols.
768 void v4l2_ctrl_cluster(unsigned int ncontrols, struct v4l2_ctrl **controls);
772 * v4l2_ctrl_auto_cluster() - Mark all controls in the cluster as belonging
773 * to that cluster and set it up for autofoo/foo-type handling.
775 * @ncontrols: The number of controls in this cluster.
776 * @controls: The cluster control array of size @ncontrols. The first control
777 * must be the 'auto' control (e.g. autogain, autoexposure, etc.)
778 * @manual_val: The value for the first control in the cluster that equals the
780 * @set_volatile: If true, then all controls except the first auto control will
783 * Use for control groups where one control selects some automatic feature and
784 * the other controls are only active whenever the automatic feature is turned
785 * off (manual mode). Typical examples: autogain vs gain, auto-whitebalance vs
786 * red and blue balance, etc.
788 * The behavior of such controls is as follows:
790 * When the autofoo control is set to automatic, then any manual controls
791 * are set to inactive and any reads will call g_volatile_ctrl (if the control
792 * was marked volatile).
794 * When the autofoo control is set to manual, then any manual controls will
795 * be marked active, and any reads will just return the current value without
796 * going through g_volatile_ctrl.
798 * In addition, this function will set the %V4L2_CTRL_FLAG_UPDATE flag
799 * on the autofoo control and %V4L2_CTRL_FLAG_INACTIVE on the foo control(s)
800 * if autofoo is in auto mode.
802 void v4l2_ctrl_auto_cluster(unsigned int ncontrols,
803 struct v4l2_ctrl **controls,
804 u8 manual_val, bool set_volatile);
808 * v4l2_ctrl_find() - Find a control with the given ID.
810 * @hdl: The control handler.
811 * @id: The control ID to find.
813 * If @hdl == NULL this will return NULL as well. Will lock the handler so
814 * do not use from inside &v4l2_ctrl_ops.
816 struct v4l2_ctrl *v4l2_ctrl_find(struct v4l2_ctrl_handler *hdl, u32 id);
819 * v4l2_ctrl_activate() - Make the control active or inactive.
820 * @ctrl: The control to (de)activate.
821 * @active: True if the control should become active.
823 * This sets or clears the V4L2_CTRL_FLAG_INACTIVE flag atomically.
824 * Does nothing if @ctrl == NULL.
825 * This will usually be called from within the s_ctrl op.
826 * The V4L2_EVENT_CTRL event will be generated afterwards.
828 * This function assumes that the control handler is locked.
830 void v4l2_ctrl_activate(struct v4l2_ctrl *ctrl, bool active);
833 * __v4l2_ctrl_grab() - Unlocked variant of v4l2_ctrl_grab.
835 * @ctrl: The control to (de)activate.
836 * @grabbed: True if the control should become grabbed.
838 * This sets or clears the V4L2_CTRL_FLAG_GRABBED flag atomically.
839 * Does nothing if @ctrl == NULL.
840 * The V4L2_EVENT_CTRL event will be generated afterwards.
841 * This will usually be called when starting or stopping streaming in the
844 * This function assumes that the control handler is locked by the caller.
846 void __v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed);
849 * v4l2_ctrl_grab() - Mark the control as grabbed or not grabbed.
851 * @ctrl: The control to (de)activate.
852 * @grabbed: True if the control should become grabbed.
854 * This sets or clears the V4L2_CTRL_FLAG_GRABBED flag atomically.
855 * Does nothing if @ctrl == NULL.
856 * The V4L2_EVENT_CTRL event will be generated afterwards.
857 * This will usually be called when starting or stopping streaming in the
860 * This function assumes that the control handler is not locked and will
861 * take the lock itself.
863 static inline void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed)
868 v4l2_ctrl_lock(ctrl);
869 __v4l2_ctrl_grab(ctrl, grabbed);
870 v4l2_ctrl_unlock(ctrl);
874 *__v4l2_ctrl_modify_range() - Unlocked variant of v4l2_ctrl_modify_range()
876 * @ctrl: The control to update.
877 * @min: The control's minimum value.
878 * @max: The control's maximum value.
879 * @step: The control's step value
880 * @def: The control's default value.
882 * Update the range of a control on the fly. This works for control types
883 * INTEGER, BOOLEAN, MENU, INTEGER MENU and BITMASK. For menu controls the
884 * @step value is interpreted as a menu_skip_mask.
886 * An error is returned if one of the range arguments is invalid for this
889 * The caller is responsible for acquiring the control handler mutex on behalf
890 * of __v4l2_ctrl_modify_range().
892 int __v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl,
893 s64 min, s64 max, u64 step, s64 def);
896 * v4l2_ctrl_modify_range() - Update the range of a control.
898 * @ctrl: The control to update.
899 * @min: The control's minimum value.
900 * @max: The control's maximum value.
901 * @step: The control's step value
902 * @def: The control's default value.
904 * Update the range of a control on the fly. This works for control types
905 * INTEGER, BOOLEAN, MENU, INTEGER MENU and BITMASK. For menu controls the
906 * @step value is interpreted as a menu_skip_mask.
908 * An error is returned if one of the range arguments is invalid for this
911 * This function assumes that the control handler is not locked and will
912 * take the lock itself.
914 static inline int v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl,
915 s64 min, s64 max, u64 step, s64 def)
919 v4l2_ctrl_lock(ctrl);
920 rval = __v4l2_ctrl_modify_range(ctrl, min, max, step, def);
921 v4l2_ctrl_unlock(ctrl);
927 * v4l2_ctrl_notify() - Function to set a notify callback for a control.
929 * @ctrl: The control.
930 * @notify: The callback function.
931 * @priv: The callback private handle, passed as argument to the callback.
933 * This function sets a callback function for the control. If @ctrl is NULL,
934 * then it will do nothing. If @notify is NULL, then the notify callback will
937 * There can be only one notify. If another already exists, then a WARN_ON
938 * will be issued and the function will do nothing.
940 void v4l2_ctrl_notify(struct v4l2_ctrl *ctrl, v4l2_ctrl_notify_fnc notify,
944 * v4l2_ctrl_get_name() - Get the name of the control
946 * @id: The control ID.
948 * This function returns the name of the given control ID or NULL if it isn't
951 const char *v4l2_ctrl_get_name(u32 id);
954 * v4l2_ctrl_get_menu() - Get the menu string array of the control
956 * @id: The control ID.
958 * This function returns the NULL-terminated menu string array name of the
959 * given control ID or NULL if it isn't a known menu control.
961 const char * const *v4l2_ctrl_get_menu(u32 id);
964 * v4l2_ctrl_get_int_menu() - Get the integer menu array of the control
966 * @id: The control ID.
967 * @len: The size of the integer array.
969 * This function returns the integer array of the given control ID or NULL if it
970 * if it isn't a known integer menu control.
972 const s64 *v4l2_ctrl_get_int_menu(u32 id, u32 *len);
975 * v4l2_ctrl_g_ctrl() - Helper function to get the control's value from
978 * @ctrl: The control.
980 * This returns the control's value safely by going through the control
981 * framework. This function will lock the control's handler, so it cannot be
982 * used from within the &v4l2_ctrl_ops functions.
984 * This function is for integer type controls only.
986 s32 v4l2_ctrl_g_ctrl(struct v4l2_ctrl *ctrl);
989 * __v4l2_ctrl_s_ctrl() - Unlocked variant of v4l2_ctrl_s_ctrl().
991 * @ctrl: The control.
992 * @val: The new value.
994 * This sets the control's new value safely by going through the control
995 * framework. This function assumes the control's handler is already locked,
996 * allowing it to be used from within the &v4l2_ctrl_ops functions.
998 * This function is for integer type controls only.
1000 int __v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val);
1003 * v4l2_ctrl_s_ctrl() - Helper function to set the control's value from
1005 * @ctrl: The control.
1006 * @val: The new value.
1008 * This sets the control's new value safely by going through the control
1009 * framework. This function will lock the control's handler, so it cannot be
1010 * used from within the &v4l2_ctrl_ops functions.
1012 * This function is for integer type controls only.
1014 static inline int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val)
1018 v4l2_ctrl_lock(ctrl);
1019 rval = __v4l2_ctrl_s_ctrl(ctrl, val);
1020 v4l2_ctrl_unlock(ctrl);
1026 * v4l2_ctrl_g_ctrl_int64() - Helper function to get a 64-bit control's value
1027 * from within a driver.
1029 * @ctrl: The control.
1031 * This returns the control's value safely by going through the control
1032 * framework. This function will lock the control's handler, so it cannot be
1033 * used from within the &v4l2_ctrl_ops functions.
1035 * This function is for 64-bit integer type controls only.
1037 s64 v4l2_ctrl_g_ctrl_int64(struct v4l2_ctrl *ctrl);
1040 * __v4l2_ctrl_s_ctrl_int64() - Unlocked variant of v4l2_ctrl_s_ctrl_int64().
1042 * @ctrl: The control.
1043 * @val: The new value.
1045 * This sets the control's new value safely by going through the control
1046 * framework. This function assumes the control's handler is already locked,
1047 * allowing it to be used from within the &v4l2_ctrl_ops functions.
1049 * This function is for 64-bit integer type controls only.
1051 int __v4l2_ctrl_s_ctrl_int64(struct v4l2_ctrl *ctrl, s64 val);
1054 * v4l2_ctrl_s_ctrl_int64() - Helper function to set a 64-bit control's value
1055 * from within a driver.
1057 * @ctrl: The control.
1058 * @val: The new value.
1060 * This sets the control's new value safely by going through the control
1061 * framework. This function will lock the control's handler, so it cannot be
1062 * used from within the &v4l2_ctrl_ops functions.
1064 * This function is for 64-bit integer type controls only.
1066 static inline int v4l2_ctrl_s_ctrl_int64(struct v4l2_ctrl *ctrl, s64 val)
1070 v4l2_ctrl_lock(ctrl);
1071 rval = __v4l2_ctrl_s_ctrl_int64(ctrl, val);
1072 v4l2_ctrl_unlock(ctrl);
1078 * __v4l2_ctrl_s_ctrl_string() - Unlocked variant of v4l2_ctrl_s_ctrl_string().
1080 * @ctrl: The control.
1081 * @s: The new string.
1083 * This sets the control's new string safely by going through the control
1084 * framework. This function assumes the control's handler is already locked,
1085 * allowing it to be used from within the &v4l2_ctrl_ops functions.
1087 * This function is for string type controls only.
1089 int __v4l2_ctrl_s_ctrl_string(struct v4l2_ctrl *ctrl, const char *s);
1092 * v4l2_ctrl_s_ctrl_string() - Helper function to set a control's string value
1093 * from within a driver.
1095 * @ctrl: The control.
1096 * @s: The new string.
1098 * This sets the control's new string safely by going through the control
1099 * framework. This function will lock the control's handler, so it cannot be
1100 * used from within the &v4l2_ctrl_ops functions.
1102 * This function is for string type controls only.
1104 static inline int v4l2_ctrl_s_ctrl_string(struct v4l2_ctrl *ctrl, const char *s)
1108 v4l2_ctrl_lock(ctrl);
1109 rval = __v4l2_ctrl_s_ctrl_string(ctrl, s);
1110 v4l2_ctrl_unlock(ctrl);
1116 * __v4l2_ctrl_s_ctrl_area() - Unlocked variant of v4l2_ctrl_s_ctrl_area().
1118 * @ctrl: The control.
1119 * @area: The new area.
1121 * This sets the control's new area safely by going through the control
1122 * framework. This function assumes the control's handler is already locked,
1123 * allowing it to be used from within the &v4l2_ctrl_ops functions.
1125 * This function is for area type controls only.
1127 int __v4l2_ctrl_s_ctrl_area(struct v4l2_ctrl *ctrl,
1128 const struct v4l2_area *area);
1131 * v4l2_ctrl_s_ctrl_area() - Helper function to set a control's area value
1132 * from within a driver.
1134 * @ctrl: The control.
1135 * @area: The new area.
1137 * This sets the control's new area safely by going through the control
1138 * framework. This function will lock the control's handler, so it cannot be
1139 * used from within the &v4l2_ctrl_ops functions.
1141 * This function is for area type controls only.
1143 static inline int v4l2_ctrl_s_ctrl_area(struct v4l2_ctrl *ctrl,
1144 const struct v4l2_area *area)
1148 v4l2_ctrl_lock(ctrl);
1149 rval = __v4l2_ctrl_s_ctrl_area(ctrl, area);
1150 v4l2_ctrl_unlock(ctrl);
1155 /* Internal helper functions that deal with control events. */
1156 extern const struct v4l2_subscribed_event_ops v4l2_ctrl_sub_ev_ops;
1159 * v4l2_ctrl_replace - Function to be used as a callback to
1160 * &struct v4l2_subscribed_event_ops replace\(\)
1162 * @old: pointer to struct &v4l2_event with the reported
1164 * @new: pointer to struct &v4l2_event with the modified
1167 void v4l2_ctrl_replace(struct v4l2_event *old, const struct v4l2_event *new);
1170 * v4l2_ctrl_merge - Function to be used as a callback to
1171 * &struct v4l2_subscribed_event_ops merge(\)
1173 * @old: pointer to struct &v4l2_event with the reported
1175 * @new: pointer to struct &v4l2_event with the merged
1178 void v4l2_ctrl_merge(const struct v4l2_event *old, struct v4l2_event *new);
1181 * v4l2_ctrl_log_status - helper function to implement %VIDIOC_LOG_STATUS ioctl
1183 * @file: pointer to struct file
1184 * @fh: unused. Kept just to be compatible to the arguments expected by
1185 * &struct v4l2_ioctl_ops.vidioc_log_status.
1187 * Can be used as a vidioc_log_status function that just dumps all controls
1188 * associated with the filehandle.
1190 int v4l2_ctrl_log_status(struct file *file, void *fh);
1193 * v4l2_ctrl_subscribe_event - Subscribes to an event
1196 * @fh: pointer to struct v4l2_fh
1197 * @sub: pointer to &struct v4l2_event_subscription
1199 * Can be used as a vidioc_subscribe_event function that just subscribes
1202 int v4l2_ctrl_subscribe_event(struct v4l2_fh *fh,
1203 const struct v4l2_event_subscription *sub);
1206 * v4l2_ctrl_poll - function to be used as a callback to the poll()
1207 * That just polls for control events.
1209 * @file: pointer to struct file
1210 * @wait: pointer to struct poll_table_struct
1212 __poll_t v4l2_ctrl_poll(struct file *file, struct poll_table_struct *wait);
1215 * v4l2_ctrl_request_setup - helper function to apply control values in a request
1218 * @parent: The parent control handler ('priv' in media_request_object_find())
1220 * This is a helper function to call the control handler's s_ctrl callback with
1221 * the control values contained in the request. Do note that this approach of
1222 * applying control values in a request is only applicable to memory-to-memory
1225 int v4l2_ctrl_request_setup(struct media_request *req,
1226 struct v4l2_ctrl_handler *parent);
1229 * v4l2_ctrl_request_complete - Complete a control handler request object
1232 * @parent: The parent control handler ('priv' in media_request_object_find())
1234 * This function is to be called on each control handler that may have had a
1235 * request object associated with it, i.e. control handlers of a driver that
1236 * supports requests.
1238 * The function first obtains the values of any volatile controls in the control
1239 * handler and attach them to the request. Then, the function completes the
1242 void v4l2_ctrl_request_complete(struct media_request *req,
1243 struct v4l2_ctrl_handler *parent);
1246 * v4l2_ctrl_request_hdl_find - Find the control handler in the request
1249 * @parent: The parent control handler ('priv' in media_request_object_find())
1251 * This function finds the control handler in the request. It may return
1252 * NULL if not found. When done, you must call v4l2_ctrl_request_put_hdl()
1253 * with the returned handler pointer.
1255 * If the request is not in state VALIDATING or QUEUED, then this function
1256 * will always return NULL.
1258 * Note that in state VALIDATING the req_queue_mutex is held, so
1259 * no objects can be added or deleted from the request.
1261 * In state QUEUED it is the driver that will have to ensure this.
1263 struct v4l2_ctrl_handler *v4l2_ctrl_request_hdl_find(struct media_request *req,
1264 struct v4l2_ctrl_handler *parent);
1267 * v4l2_ctrl_request_hdl_put - Put the control handler
1269 * @hdl: Put this control handler
1271 * This function released the control handler previously obtained from'
1272 * v4l2_ctrl_request_hdl_find().
1274 static inline void v4l2_ctrl_request_hdl_put(struct v4l2_ctrl_handler *hdl)
1277 media_request_object_put(&hdl->req_obj);
1281 * v4l2_ctrl_request_ctrl_find() - Find a control with the given ID.
1283 * @hdl: The control handler from the request.
1284 * @id: The ID of the control to find.
1286 * This function returns a pointer to the control if this control is
1287 * part of the request or NULL otherwise.
1290 v4l2_ctrl_request_hdl_ctrl_find(struct v4l2_ctrl_handler *hdl, u32 id);
1292 /* Helpers for ioctl_ops */
1295 * v4l2_queryctrl - Helper function to implement
1296 * :ref:`VIDIOC_QUERYCTRL <vidioc_queryctrl>` ioctl
1298 * @hdl: pointer to &struct v4l2_ctrl_handler
1299 * @qc: pointer to &struct v4l2_queryctrl
1301 * If hdl == NULL then they will all return -EINVAL.
1303 int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc);
1306 * v4l2_query_ext_ctrl - Helper function to implement
1307 * :ref:`VIDIOC_QUERY_EXT_CTRL <vidioc_queryctrl>` ioctl
1309 * @hdl: pointer to &struct v4l2_ctrl_handler
1310 * @qc: pointer to &struct v4l2_query_ext_ctrl
1312 * If hdl == NULL then they will all return -EINVAL.
1314 int v4l2_query_ext_ctrl(struct v4l2_ctrl_handler *hdl,
1315 struct v4l2_query_ext_ctrl *qc);
1318 * v4l2_querymenu - Helper function to implement
1319 * :ref:`VIDIOC_QUERYMENU <vidioc_queryctrl>` ioctl
1321 * @hdl: pointer to &struct v4l2_ctrl_handler
1322 * @qm: pointer to &struct v4l2_querymenu
1324 * If hdl == NULL then they will all return -EINVAL.
1326 int v4l2_querymenu(struct v4l2_ctrl_handler *hdl, struct v4l2_querymenu *qm);
1329 * v4l2_g_ctrl - Helper function to implement
1330 * :ref:`VIDIOC_G_CTRL <vidioc_g_ctrl>` ioctl
1332 * @hdl: pointer to &struct v4l2_ctrl_handler
1333 * @ctrl: pointer to &struct v4l2_control
1335 * If hdl == NULL then they will all return -EINVAL.
1337 int v4l2_g_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_control *ctrl);
1340 * v4l2_s_ctrl - Helper function to implement
1341 * :ref:`VIDIOC_S_CTRL <vidioc_g_ctrl>` ioctl
1343 * @fh: pointer to &struct v4l2_fh
1344 * @hdl: pointer to &struct v4l2_ctrl_handler
1346 * @ctrl: pointer to &struct v4l2_control
1348 * If hdl == NULL then they will all return -EINVAL.
1350 int v4l2_s_ctrl(struct v4l2_fh *fh, struct v4l2_ctrl_handler *hdl,
1351 struct v4l2_control *ctrl);
1354 * v4l2_g_ext_ctrls - Helper function to implement
1355 * :ref:`VIDIOC_G_EXT_CTRLS <vidioc_g_ext_ctrls>` ioctl
1357 * @hdl: pointer to &struct v4l2_ctrl_handler
1358 * @vdev: pointer to &struct video_device
1359 * @mdev: pointer to &struct media_device
1360 * @c: pointer to &struct v4l2_ext_controls
1362 * If hdl == NULL then they will all return -EINVAL.
1364 int v4l2_g_ext_ctrls(struct v4l2_ctrl_handler *hdl, struct video_device *vdev,
1365 struct media_device *mdev, struct v4l2_ext_controls *c);
1368 * v4l2_try_ext_ctrls - Helper function to implement
1369 * :ref:`VIDIOC_TRY_EXT_CTRLS <vidioc_g_ext_ctrls>` ioctl
1371 * @hdl: pointer to &struct v4l2_ctrl_handler
1372 * @vdev: pointer to &struct video_device
1373 * @mdev: pointer to &struct media_device
1374 * @c: pointer to &struct v4l2_ext_controls
1376 * If hdl == NULL then they will all return -EINVAL.
1378 int v4l2_try_ext_ctrls(struct v4l2_ctrl_handler *hdl,
1379 struct video_device *vdev,
1380 struct media_device *mdev,
1381 struct v4l2_ext_controls *c);
1384 * v4l2_s_ext_ctrls - Helper function to implement
1385 * :ref:`VIDIOC_S_EXT_CTRLS <vidioc_g_ext_ctrls>` ioctl
1387 * @fh: pointer to &struct v4l2_fh
1388 * @hdl: pointer to &struct v4l2_ctrl_handler
1389 * @vdev: pointer to &struct video_device
1390 * @mdev: pointer to &struct media_device
1391 * @c: pointer to &struct v4l2_ext_controls
1393 * If hdl == NULL then they will all return -EINVAL.
1395 int v4l2_s_ext_ctrls(struct v4l2_fh *fh, struct v4l2_ctrl_handler *hdl,
1396 struct video_device *vdev,
1397 struct media_device *mdev,
1398 struct v4l2_ext_controls *c);
1401 * v4l2_ctrl_subdev_subscribe_event - Helper function to implement
1402 * as a &struct v4l2_subdev_core_ops subscribe_event function
1403 * that just subscribes control events.
1405 * @sd: pointer to &struct v4l2_subdev
1406 * @fh: pointer to &struct v4l2_fh
1407 * @sub: pointer to &struct v4l2_event_subscription
1409 int v4l2_ctrl_subdev_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,
1410 struct v4l2_event_subscription *sub);
1413 * v4l2_ctrl_subdev_log_status - Log all controls owned by subdev's control
1416 * @sd: pointer to &struct v4l2_subdev
1418 int v4l2_ctrl_subdev_log_status(struct v4l2_subdev *sd);