Lines Matching full:control
9 The V4L2 control API seems simple enough, but quickly becomes very hard to
15 1) How do I add a control?
16 2) How do I set the control's value? (i.e. s_ctrl)
20 3) How do I get the control's value? (i.e. g_volatile_ctrl)
21 4) How do I validate the user's proposed control value? (i.e. try_ctrl)
25 The control framework was created in order to implement all the rules of the
29 Note that the control framework relies on the presence of a struct
39 The :c:type:`v4l2_ctrl` object describes the control properties and keeps
40 track of the control's value (both the current value and the proposed new
93 1.3) Hook the control handler into the driver:
193 the new control, but if you do not need to access the pointer outside the
194 control ops, then there is no need to store it.
197 the control ID except for the min, max, step and default values. These are
199 control attributes like type, name, flags are all global. The control's
208 integer menu control with driver-specific items in the menu. It differs
215 driver specific menu for an otherwise standard menu control. A good example
216 for this control is the test pattern control for capture/display/sensors
229 It is recommended to add controls in ascending control ID order: it will be
232 3) Optionally force initial control setup:
239 initializes the hardware to the default control values. It is recommended
270 The control ops are called with the v4l2_ctrl pointer as argument.
271 The new control value has already been validated, so all you need to do is
275 to do any validation of control values, or implement QUERYCTRL, QUERY_EXT_CTRL
293 skipped (so a V4L2 driver can always override a subdev control).
300 Accessing Control Values
303 The following union is used inside the control framework to access control
329 If the control has a simple s32 type type, then:
339 Within the control ops you can freely use these. The val and cur.val speak for
343 Unless the control is marked volatile the p_cur field points to the the
344 current cached control value. When you create a new control this value is made
368 are not, a V4L2_EVENT_CTRL_CH_VALUE will not be generated when the control
371 To mark a control as volatile you have to set V4L2_CTRL_FLAG_VOLATILE:
383 If s_ctrl returns 0 (OK), then the control framework will copy the new final
391 Outside of the control ops you have to go through to helper functions to get
392 or set a single control value safely in your driver:
399 These functions go through the control framework just as VIDIOC_G/S_CTRL ioctls
400 do. Don't use these inside the control ops g_volatile/s/try_ctrl, though, that
431 A good example is the MPEG Audio Layer II Bitrate menu control where the
438 control, or by calling v4l2_ctrl_new_std_menu().
466 control and will fill in the name, type and flags fields accordingly.
473 activate and deactivate controls. For example, if the Chroma AGC control is
474 on, then the Chroma Gain control is inactive. That is, you may set it, but
476 control is on. Typically user interfaces can disable such input fields.
483 The other flag is the 'grabbed' flag. A grabbed control means that you cannot
487 If a control is set to 'grabbed' using v4l2_ctrl_grab(), then the framework
488 will return -EBUSY if an attempt is made to set this control. The
493 Control Clusters
497 complex scenarios you can get dependencies from one control to another.
517 cluster is set (or 'gotten', or 'tried'), only the control ops of the first
518 control ('volume' in this example) is called. You effectively create a new
519 composite control. Similar to how a 'struct' works in C.
562 The anonymous struct is used to clearly 'cluster' these two control pointers,
564 array with two control pointers. So you can just do:
578 only restriction is that the first control of the cluster must always be
579 present, since that is the 'master' control of the cluster. The master
580 control is the one that identifies the cluster and that provides the
584 a valid control or to NULL.
588 each control. For example, in the case of a volume/mute cluster the 'is_new'
589 flag of the mute control would be set if the user called VIDIOC_S_CTRL for
599 A common type of control cluster is one that handles 'auto-foo/foo'-type
601 autowhitebalance/red balance/blue balance. In all cases you have one control
602 that determines whether another control is handled automatically by the hardware,
603 or whether it is under manual control from the user.
616 Finally the V4L2_CTRL_FLAG_UPDATE should be set for the auto control since
617 changing that control affects the control flags of the manual controls.
635 The first control of the cluster is assumed to be the 'auto' control.
654 Usually the V4L2 driver has just one control handler that is global for
655 all video nodes. But you can also specify different control handlers for
661 control handler. You do that by simply setting the ctrl_handler field in
666 manually to add the subdev's control handler (sd->ctrl_handler) to the desired
667 control handler. This control handler may be specific to the video_device or
669 audio controls, while the video and vbi device nodes share the same control
706 control. The rule is to have one control for each hardware 'knob' that you
716 But sometimes you need to find a control from another handler that you do
717 not own. For example, if you have to find a volume control from a subdev.
746 attempting to find another control from the same handler will deadlock.
748 It is recommended not to use this function from inside the control ops.
754 When one control handler is added to another using v4l2_ctrl_add_handler, then
759 setting the 'is_private' flag of the control to 1:
766 .name = "Some Private Control",
781 Controls of this type can be used by GUIs to get the name of the control class.
783 containing the controls belonging to a particular control class. The name of
784 each tab can be found by querying a special control with ID <control class | 1>.
787 a control of this type whenever the first control belonging to a new control
794 Sometimes the platform or bridge driver needs to be notified when a control
803 Whenever the give control changes value the notify callback will be called
804 with a pointer to the control and the priv pointer that was passed with
805 v4l2_ctrl_notify. Note that the control's handler lock is held when the
808 There can be only one notify function per control handler. Any attempt