Lines Matching +full:control +full:- +full:parent
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
14 #include <media/media-request.h>
17 * Include the stateless codec compound control definitions.
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>
39 * union v4l2_ctrl_ptr - A pointer to a control value.
40 * @p_s32: Pointer to a 32-bit signed value.
41 * @p_s64: Pointer to a 64-bit signed value.
42 * @p_u8: Pointer to a 8-bit unsigned value.
43 * @p_u16: Pointer to a 16-bit unsigned value.
44 * @p_u32: Pointer to a 32-bit unsigned value.
89 * v4l2_ctrl_ptr_create() - Helper function to return a v4l2_ctrl_ptr from a
101 * struct v4l2_ctrl_ops - The control operations that the driver has to provide.
103 * @g_volatile_ctrl: Get a new value for this control. Generally only relevant
104 * for volatile (and usually read-only) controls such as a control
108 * @try_ctrl: Test whether the control's value is valid. Only relevant when
110 * @s_ctrl: Actually set the new control value. s_ctrl is compulsory. The
111 * ctrl->handler->lock is held when these ops are called, so no
121 * struct v4l2_ctrl_type_ops - The control type operations that the driver
142 * typedef v4l2_ctrl_notify_fnc - typedef for a notify argument with a function
143 * that should be called when a control value has changed.
146 * @priv: control private data
154 * struct v4l2_ctrl - The control structure.
157 * @ev_subs: The list of control event subscriptions.
158 * @handler: The handler that owns the control.
161 * @done: Internal flag: set for each processed control.
162 * @is_new: Set when the user specified a new value for this control. It
167 * @is_private: If set, then this control is private to its handler and it
170 * @is_auto: If set, then this control selects whether the other cluster
174 * @is_int: If set, then this control has a simple integer value (i.e. it
175 * uses ctrl->val).
176 * @is_string: If set, then this control has type %V4L2_CTRL_TYPE_STRING.
177 * @is_ptr: If set, then this control is an array and/or has type >=
181 * @is_array: If set, then this control contains an N-dimensional array.
185 * control's value changes.
187 * of the auto control that determines if that control is in
188 * manual mode. So if the value of the auto control equals this
191 * @ops: The control ops.
192 * @type_ops: The control type ops.
193 * @id: The control ID.
194 * @name: The control name.
195 * @type: The control type.
196 * @minimum: The control's minimum value.
197 * @maximum: The control's maximum value.
198 * @default_value: The control's default value.
199 * @step: The control's step value for non-menu controls.
200 * @elems: The number of elements in the N-dimensional array.
201 * @elem_size: The size in bytes of the control.
204 * @menu_skip_mask: The control's skip mask for menu controls. This makes it
211 * empty strings ("") correspond to non-existing menu items (this
215 * @qmenu_int: A 64-bit integer array for with integer menu items.
217 * :math:`ceil(\frac{maximum - minimum}{step}) + 1`.
219 * @flags: The control's flags.
221 * @cur.val: The control's current value, if the @type is represented via
223 * @val: The control's new s32 value.
224 * @priv: The control's private pointer. For use by the driver. It is
225 * untouched by the control framework. Note that this pointer is
226 * not freed when the control is deleted. Should this be needed
229 * @p_def: The control's default value represented via a union which
230 * provides a standard way of accessing control types
232 * @p_cur: The control's current value represented via a union which
233 * provides a standard way of accessing control types
235 * @p_new: The control's new value represented via a union which provides
236 * a standard way of accessing control types
292 * struct v4l2_ctrl_ref - The control reference.
295 * @next: Single-link list node for the hash.
296 * @ctrl: The actual control information.
298 * ``prepare_ext_ctrls`` function at ``v4l2-ctrl.c``.
301 * @req_done: Internal flag: if the control handler containing this control
303 * the control has been applied. This prevents applying controls
305 * control of a cluster is applied, they all are).
306 * @valid_p_req: If set, then p_req contains the control value for the request.
307 * @p_req: If the control handler containing this control reference
309 * value of the control that must be applied when the request
310 * is executed, or to the value of the control at the time
312 * then this control was never set for this request and the
313 * control will not be updated when this request is applied.
315 * Each control handler has a list of these refs. The list_head is used to
316 * keep a sorted-by-control-ID list of all controls, while the next pointer
317 * is used to link the control in the hash's bucket.
331 * struct v4l2_ctrl_handler - The control handler keeps track of all the
336 * @lock: Lock to control access to this handler and its controls.
339 * @ctrl_refs: The list of control references.
340 * @cached: The last found control reference. It is common that the same
341 * control is needed multiple times, so this is a simple
343 * @buckets: Buckets for the hashing. Allows for quick control lookup.
344 * @notify: A notify callback that is called whenever the control changes
350 * @error: The error code of the first failed control addition.
352 * @requests: List to keep track of open control handler request objects.
353 * For the parent control handler (@req_obj.ops == NULL) this
354 * is the list header. When the parent control handler is
356 * they refer to the parent.
381 * struct v4l2_ctrl_config - Control configuration structure.
383 * @ops: The control ops.
384 * @type_ops: The control type ops. Only needed for compound controls.
385 * @id: The control ID.
386 * @name: The control name.
387 * @type: The control type.
388 * @min: The control's minimum value.
389 * @max: The control's maximum value.
390 * @step: The control's step value for non-menu controls.
391 * @def: The control's default value.
392 * @p_def: The control's default value for compound controls.
394 * @elem_size: The size in bytes of the control.
395 * @flags: The control's flags.
396 * @menu_skip_mask: The control's skip mask for menu controls. This makes it
403 * empty strings ("") correspond to non-existing menu items (this
408 * @is_private: If set, then this control is private to its handler and it
432 * v4l2_ctrl_fill - Fill in the control fields based on the control ID.
434 * @id: ID of the control
435 * @name: pointer to be filled with a string with the name of the control
436 * @type: pointer for storing the type of the control
437 * @min: pointer for storing the minimum value for the control
438 * @max: pointer for storing the maximum value for the control
439 * @step: pointer for storing the control step
440 * @def: pointer for storing the default value for the control
441 * @flags: pointer for storing the flags to be used on the control
444 * For non-standard controls it will only fill in the given arguments
454 * control handling only. Once all drivers are converted to use the new
455 * control framework this function will no longer be exported.
462 * v4l2_ctrl_handler_init_class() - Initialize the control handler.
463 * @hdl: The control handler.
468 * are allocated) or the control lookup becomes slower (not enough
480 * error will also be stored in @hdl->error.
489 * v4l2_ctrl_handler_init - helper function to create a static struct
492 * @hdl: The control handler.
497 * are allocated) or the control lookup becomes slower (not enough
505 * Use this helper function to initialize a control handler.
515 "(" #hdl ")->_lock"); \
524 * v4l2_ctrl_handler_free() - Free all controls owned by the handler and free
525 * the control list.
526 * @hdl: The control handler.
533 * v4l2_ctrl_lock() - Helper function to lock the handler
534 * associated with the control.
535 * @ctrl: The control to lock.
539 mutex_lock(ctrl->handler->lock); in v4l2_ctrl_lock()
543 * v4l2_ctrl_unlock() - Helper function to unlock the handler
544 * associated with the control.
545 * @ctrl: The control to unlock.
549 mutex_unlock(ctrl->handler->lock); in v4l2_ctrl_unlock()
553 * __v4l2_ctrl_handler_setup() - Call the s_ctrl op for all controls belonging
554 * to the handler to initialize the hardware to the current control values. The
555 * caller is responsible for acquiring the control handler mutex on behalf of
557 * @hdl: The control handler.
559 * Button controls will be skipped, as are read-only controls.
566 * v4l2_ctrl_handler_setup() - Call the s_ctrl op for all controls belonging
567 * to the handler to initialize the hardware to the current control values.
568 * @hdl: The control handler.
570 * Button controls will be skipped, as are read-only controls.
577 * v4l2_ctrl_handler_log_status() - Log all controls owned by the handler.
578 * @hdl: The control handler.
579 * @prefix: The prefix to use when logging the control values. If the
592 * v4l2_ctrl_new_custom() - Allocate and initialize a new custom V4L2
593 * control.
595 * @hdl: The control handler.
596 * @cfg: The control's configuration data.
597 * @priv: The control's driver-specific private data.
600 * and @hdl->error is set to the error code (if it wasn't set already).
607 * v4l2_ctrl_new_std() - Allocate and initialize a new standard V4L2 non-menu
608 * control.
610 * @hdl: The control handler.
611 * @ops: The control ops.
612 * @id: The control ID.
613 * @min: The control's minimum value.
614 * @max: The control's maximum value.
615 * @step: The control's step value
616 * @def: The control's default value.
618 * If the &v4l2_ctrl struct could not be allocated, or the control
619 * ID is not known, then NULL is returned and @hdl->error is set to the
622 * If @id refers to a menu control, then this function will return NULL.
632 * v4l2_ctrl_new_std_menu() - Allocate and initialize a new standard V4L2
633 * menu control.
635 * @hdl: The control handler.
636 * @ops: The control ops.
637 * @id: The control ID.
638 * @max: The control's maximum value.
639 * @mask: The control's skip mask for menu controls. This makes it
645 * @def: The control's default value.
650 * If @id refers to a non-menu control, then this function will return NULL.
657 * v4l2_ctrl_new_std_menu_items() - Create a new standard V4L2 menu control
660 * @hdl: The control handler.
661 * @ops: The control ops.
662 * @id: The control ID.
663 * @max: The control's maximum value.
664 * @mask: The control's skip mask for menu controls. This makes it
670 * @def: The control's default value.
674 * menu of this control.
684 * v4l2_ctrl_new_std_compound() - Allocate and initialize a new standard V4L2
685 * compound control.
687 * @hdl: The control handler.
688 * @ops: The control ops.
689 * @id: The control ID.
690 * @p_def: The control's default value.
695 * compound control should be all zeroes.
704 * v4l2_ctrl_new_int_menu() - Create a new standard V4L2 integer menu control.
706 * @hdl: The control handler.
707 * @ops: The control ops.
708 * @id: The control ID.
709 * @max: The control's maximum value.
710 * @def: The control's default value.
711 * @qmenu_int: The control's menu entries.
716 * If @id refers to a non-integer-menu control, then this function will
725 * typedef v4l2_ctrl_filter - Typedef to define the filter function to be
726 * used when adding a control handler.
734 * v4l2_ctrl_add_handler() - Add all controls from handler @add to
737 * @hdl: The control handler.
738 * @add: The control handler whose controls you want to add to
739 * the @hdl control handler.
747 * In case of an error @hdl->error will be set to the error code (if it
756 * v4l2_ctrl_radio_filter() - Standard filter for radio controls.
758 * @ctrl: The control that is filtered.
769 * v4l2_ctrl_cluster() - Mark all controls in the cluster as belonging
773 * @controls: The cluster control array of size @ncontrols.
779 * v4l2_ctrl_auto_cluster() - Mark all controls in the cluster as belonging
780 * to that cluster and set it up for autofoo/foo-type handling.
783 * @controls: The cluster control array of size @ncontrols. The first control
784 * must be the 'auto' control (e.g. autogain, autoexposure, etc.)
785 * @manual_val: The value for the first control in the cluster that equals the
787 * @set_volatile: If true, then all controls except the first auto control will
790 * Use for control groups where one control selects some automatic feature and
792 * off (manual mode). Typical examples: autogain vs gain, auto-whitebalance vs
797 * When the autofoo control is set to automatic, then any manual controls
798 * are set to inactive and any reads will call g_volatile_ctrl (if the control
801 * When the autofoo control is set to manual, then any manual controls will
806 * on the autofoo control and %V4L2_CTRL_FLAG_INACTIVE on the foo control(s)
815 * v4l2_ctrl_find() - Find a control with the given ID.
817 * @hdl: The control handler.
818 * @id: The control ID to find.
826 * v4l2_ctrl_activate() - Make the control active or inactive.
827 * @ctrl: The control to (de)activate.
828 * @active: True if the control should become active.
835 * This function assumes that the control handler is locked.
840 * __v4l2_ctrl_grab() - Unlocked variant of v4l2_ctrl_grab.
842 * @ctrl: The control to (de)activate.
843 * @grabbed: True if the control should become grabbed.
851 * This function assumes that the control handler is locked by the caller.
856 * v4l2_ctrl_grab() - Mark the control as grabbed or not grabbed.
858 * @ctrl: The control to (de)activate.
859 * @grabbed: True if the control should become grabbed.
867 * This function assumes that the control handler is not locked and will
881 *__v4l2_ctrl_modify_range() - Unlocked variant of v4l2_ctrl_modify_range()
883 * @ctrl: The control to update.
884 * @min: The control's minimum value.
885 * @max: The control's maximum value.
886 * @step: The control's step value
887 * @def: The control's default value.
889 * Update the range of a control on the fly. This works for control types
894 * control type.
896 * The caller is responsible for acquiring the control handler mutex on behalf
903 * v4l2_ctrl_modify_range() - Update the range of a control.
905 * @ctrl: The control to update.
906 * @min: The control's minimum value.
907 * @max: The control's maximum value.
908 * @step: The control's step value
909 * @def: The control's default value.
911 * Update the range of a control on the fly. This works for control types
916 * control type.
918 * This function assumes that the control handler is not locked and will
934 * v4l2_ctrl_notify() - Function to set a notify callback for a control.
936 * @ctrl: The control.
940 * This function sets a callback function for the control. If @ctrl is NULL,
951 * v4l2_ctrl_get_name() - Get the name of the control
953 * @id: The control ID.
955 * This function returns the name of the given control ID or NULL if it isn't
956 * a known control.
961 * v4l2_ctrl_get_menu() - Get the menu string array of the control
963 * @id: The control ID.
965 * This function returns the NULL-terminated menu string array name of the
966 * given control ID or NULL if it isn't a known menu control.
971 * v4l2_ctrl_get_int_menu() - Get the integer menu array of the control
973 * @id: The control ID.
976 * This function returns the integer array of the given control ID or NULL if it
977 * if it isn't a known integer menu control.
982 * v4l2_ctrl_g_ctrl() - Helper function to get the control's value from
985 * @ctrl: The control.
987 * This returns the control's value safely by going through the control
988 * framework. This function will lock the control's handler, so it cannot be
996 * __v4l2_ctrl_s_ctrl() - Unlocked variant of v4l2_ctrl_s_ctrl().
998 * @ctrl: The control.
1001 * This sets the control's new value safely by going through the control
1002 * framework. This function assumes the control's handler is already locked,
1010 * v4l2_ctrl_s_ctrl() - Helper function to set the control's value from
1012 * @ctrl: The control.
1015 * This sets the control's new value safely by going through the control
1016 * framework. This function will lock the control's handler, so it cannot be
1033 * v4l2_ctrl_g_ctrl_int64() - Helper function to get a 64-bit control's value
1036 * @ctrl: The control.
1038 * This returns the control's value safely by going through the control
1039 * framework. This function will lock the control's handler, so it cannot be
1042 * This function is for 64-bit integer type controls only.
1047 * __v4l2_ctrl_s_ctrl_int64() - Unlocked variant of v4l2_ctrl_s_ctrl_int64().
1049 * @ctrl: The control.
1052 * This sets the control's new value safely by going through the control
1053 * framework. This function assumes the control's handler is already locked,
1056 * This function is for 64-bit integer type controls only.
1061 * v4l2_ctrl_s_ctrl_int64() - Helper function to set a 64-bit control's value
1064 * @ctrl: The control.
1067 * This sets the control's new value safely by going through the control
1068 * framework. This function will lock the control's handler, so it cannot be
1071 * This function is for 64-bit integer type controls only.
1085 * __v4l2_ctrl_s_ctrl_string() - Unlocked variant of v4l2_ctrl_s_ctrl_string().
1087 * @ctrl: The control.
1090 * This sets the control's new string safely by going through the control
1091 * framework. This function assumes the control's handler is already locked,
1099 * v4l2_ctrl_s_ctrl_string() - Helper function to set a control's string value
1102 * @ctrl: The control.
1105 * This sets the control's new string safely by going through the control
1106 * framework. This function will lock the control's handler, so it cannot be
1123 * __v4l2_ctrl_s_ctrl_compound() - Unlocked variant to set a compound control
1125 * @ctrl: The control.
1129 * This sets the control's new compound payload safely by going through the
1130 * control framework. This function assumes the control's handler is already
1139 * v4l2_ctrl_s_ctrl_compound() - Helper function to set a compound control
1142 * @ctrl: The control.
1146 * This sets the control's new compound payload safely by going through the
1147 * control framework. This function will lock the control's handler, so it
1171 /* Internal helper functions that deal with control events. */
1175 * v4l2_ctrl_replace - Function to be used as a callback to
1186 * v4l2_ctrl_merge - Function to be used as a callback to
1197 * v4l2_ctrl_log_status - helper function to implement %VIDIOC_LOG_STATUS ioctl
1209 * v4l2_ctrl_subscribe_event - Subscribes to an event
1216 * control events.
1222 * v4l2_ctrl_poll - function to be used as a callback to the poll()
1223 * That just polls for control events.
1231 * v4l2_ctrl_request_setup - helper function to apply control values in a request
1234 * @parent: The parent control handler ('priv' in media_request_object_find())
1236 * This is a helper function to call the control handler's s_ctrl callback with
1237 * the control values contained in the request. Do note that this approach of
1238 * applying control values in a request is only applicable to memory-to-memory
1242 struct v4l2_ctrl_handler *parent);
1245 * v4l2_ctrl_request_complete - Complete a control handler request object
1248 * @parent: The parent control handler ('priv' in media_request_object_find())
1250 * This function is to be called on each control handler that may have had a
1251 * request object associated with it, i.e. control handlers of a driver that
1254 * The function first obtains the values of any volatile controls in the control
1259 struct v4l2_ctrl_handler *parent);
1262 * v4l2_ctrl_request_hdl_find - Find the control handler in the request
1265 * @parent: The parent control handler ('priv' in media_request_object_find())
1267 * This function finds the control handler in the request. It may return
1280 struct v4l2_ctrl_handler *parent);
1283 * v4l2_ctrl_request_hdl_put - Put the control handler
1285 * @hdl: Put this control handler
1287 * This function released the control handler previously obtained from'
1293 media_request_object_put(&hdl->req_obj); in v4l2_ctrl_request_hdl_put()
1297 * v4l2_ctrl_request_ctrl_find() - Find a control with the given ID.
1299 * @hdl: The control handler from the request.
1300 * @id: The ID of the control to find.
1302 * This function returns a pointer to the control if this control is
1311 * v4l2_queryctrl - Helper function to implement
1317 * If hdl == NULL then they will all return -EINVAL.
1322 * v4l2_query_ext_ctrl - Helper function to implement
1328 * If hdl == NULL then they will all return -EINVAL.
1334 * v4l2_querymenu - Helper function to implement
1340 * If hdl == NULL then they will all return -EINVAL.
1345 * v4l2_g_ctrl - Helper function to implement
1351 * If hdl == NULL then they will all return -EINVAL.
1356 * v4l2_s_ctrl - Helper function to implement
1364 * If hdl == NULL then they will all return -EINVAL.
1370 * v4l2_g_ext_ctrls - Helper function to implement
1378 * If hdl == NULL then they will all return -EINVAL.
1384 * v4l2_try_ext_ctrls - Helper function to implement
1392 * If hdl == NULL then they will all return -EINVAL.
1400 * v4l2_s_ext_ctrls - Helper function to implement
1409 * If hdl == NULL then they will all return -EINVAL.
1417 * v4l2_ctrl_subdev_subscribe_event - Helper function to implement
1419 * that just subscribes control events.
1429 * v4l2_ctrl_subdev_log_status - Log all controls owned by subdev's control
1437 * v4l2_ctrl_new_fwnode_properties() - Register controls for the device
1449 * - V4L2_CID_CAMERA_ORIENTATION
1450 * - V4L2_CID_CAMERA_SENSOR_ROTATION;
1452 * Controls already registered by the caller with the @hdl control handler are