aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/video4linux/v4l2-controls.txt56
1 files changed, 56 insertions, 0 deletions
diff --git a/Documentation/video4linux/v4l2-controls.txt b/Documentation/video4linux/v4l2-controls.txt
index 95a381309d08..9346fc8cbf2b 100644
--- a/Documentation/video4linux/v4l2-controls.txt
+++ b/Documentation/video4linux/v4l2-controls.txt
@@ -450,6 +450,25 @@ In the example above the following are equivalent for the VOLUME case:
450 ctrl == ctrl->cluster[AUDIO_CL_VOLUME] == state->audio_cluster[AUDIO_CL_VOLUME] 450 ctrl == ctrl->cluster[AUDIO_CL_VOLUME] == state->audio_cluster[AUDIO_CL_VOLUME]
451 ctrl->cluster[AUDIO_CL_MUTE] == state->audio_cluster[AUDIO_CL_MUTE] 451 ctrl->cluster[AUDIO_CL_MUTE] == state->audio_cluster[AUDIO_CL_MUTE]
452 452
453In practice using cluster arrays like this becomes very tiresome. So instead
454the following equivalent method is used:
455
456 struct {
457 /* audio cluster */
458 struct v4l2_ctrl *volume;
459 struct v4l2_ctrl *mute;
460 };
461
462The anonymous struct is used to clearly 'cluster' these two control pointers,
463but it serves no other purpose. The effect is the same as creating an
464array with two control pointers. So you can just do:
465
466 state->volume = v4l2_ctrl_new_std(&state->ctrl_handler, ...);
467 state->mute = v4l2_ctrl_new_std(&state->ctrl_handler, ...);
468 v4l2_ctrl_cluster(2, &state->volume);
469
470And in foo_s_ctrl you can use these pointers directly: state->mute->val.
471
453Note that controls in a cluster may be NULL. For example, if for some 472Note that controls in a cluster may be NULL. For example, if for some
454reason mute was never added (because the hardware doesn't support that 473reason mute was never added (because the hardware doesn't support that
455particular feature), then mute will be NULL. So in that case we have a 474particular feature), then mute will be NULL. So in that case we have a
@@ -472,6 +491,43 @@ controls, then the 'is_new' flag would be 1 for both controls.
472The 'is_new' flag is always 1 when called from v4l2_ctrl_handler_setup(). 491The 'is_new' flag is always 1 when called from v4l2_ctrl_handler_setup().
473 492
474 493
494Handling autogain/gain-type Controls with Auto Clusters
495=======================================================
496
497A common type of control cluster is one that handles 'auto-foo/foo'-type
498controls. Typical examples are autogain/gain, autoexposure/exposure,
499autowhitebalance/red balance/blue balance. In all cases you have one controls
500that determines whether another control is handled automatically by the hardware,
501or whether it is under manual control from the user.
502
503If the cluster is in automatic mode, then the manual controls should be
504marked inactive. When the volatile controls are read the g_volatile_ctrl
505operation should return the value that the hardware's automatic mode set up
506automatically.
507
508If the cluster is put in manual mode, then the manual controls should become
509active again and the is_volatile flag should be ignored (so g_volatile_ctrl is
510no longer called while in manual mode).
511
512Finally the V4L2_CTRL_FLAG_UPDATE should be set for the auto control since
513changing that control affects the control flags of the manual controls.
514
515In order to simplify this a special variation of v4l2_ctrl_cluster was
516introduced:
517
518void v4l2_ctrl_auto_cluster(unsigned ncontrols, struct v4l2_ctrl **controls,
519 u8 manual_val, bool set_volatile);
520
521The first two arguments are identical to v4l2_ctrl_cluster. The third argument
522tells the framework which value switches the cluster into manual mode. The
523last argument will optionally set the is_volatile flag for the non-auto controls.
524
525The first control of the cluster is assumed to be the 'auto' control.
526
527Using this function will ensure that you don't need to handle all the complex
528flag and volatile handling.
529
530
475VIDIOC_LOG_STATUS Support 531VIDIOC_LOG_STATUS Support
476========================= 532=========================
477 533