~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/media/v4l2-ctrls.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/media/v4l2-ctrls.h (Version linux-6.12-rc7) and /include/media/v4l2-ctrls.h (Version linux-5.17.15)


  1 /* SPDX-License-Identifier: GPL-2.0-or-later *      1 /* SPDX-License-Identifier: GPL-2.0-or-later */
  2 /*                                                  2 /*
  3  *  V4L2 controls support header.                   3  *  V4L2 controls support header.
  4  *                                                  4  *
  5  *  Copyright (C) 2010  Hans Verkuil <hverkuil      5  *  Copyright (C) 2010  Hans Verkuil <hverkuil@xs4all.nl>
  6  */                                                 6  */
  7                                                     7 
  8 #ifndef _V4L2_CTRLS_H                               8 #ifndef _V4L2_CTRLS_H
  9 #define _V4L2_CTRLS_H                               9 #define _V4L2_CTRLS_H
 10                                                    10 
 11 #include <linux/list.h>                            11 #include <linux/list.h>
 12 #include <linux/mutex.h>                           12 #include <linux/mutex.h>
 13 #include <linux/videodev2.h>                       13 #include <linux/videodev2.h>
 14 #include <media/media-request.h>                   14 #include <media/media-request.h>
 15                                                    15 
                                                   >>  16 /*
                                                   >>  17  * Include the stateless codec compound control definitions.
                                                   >>  18  * This will move to the public headers once this API is fully stable.
                                                   >>  19  */
                                                   >>  20 #include <media/hevc-ctrls.h>
                                                   >>  21 
 16 /* forward references */                           22 /* forward references */
 17 struct file;                                       23 struct file;
 18 struct poll_table_struct;                          24 struct poll_table_struct;
 19 struct v4l2_ctrl;                                  25 struct v4l2_ctrl;
 20 struct v4l2_ctrl_handler;                          26 struct v4l2_ctrl_handler;
 21 struct v4l2_ctrl_helper;                           27 struct v4l2_ctrl_helper;
 22 struct v4l2_fh;                                    28 struct v4l2_fh;
 23 struct v4l2_fwnode_device_properties;              29 struct v4l2_fwnode_device_properties;
 24 struct v4l2_subdev;                                30 struct v4l2_subdev;
 25 struct v4l2_subscribed_event;                      31 struct v4l2_subscribed_event;
 26 struct video_device;                               32 struct video_device;
 27                                                    33 
 28 /**                                                34 /**
 29  * union v4l2_ctrl_ptr - A pointer to a contro     35  * union v4l2_ctrl_ptr - A pointer to a control value.
 30  * @p_s32:                      Pointer to a 3     36  * @p_s32:                      Pointer to a 32-bit signed value.
 31  * @p_s64:                      Pointer to a 6     37  * @p_s64:                      Pointer to a 64-bit signed value.
 32  * @p_u8:                       Pointer to a 8     38  * @p_u8:                       Pointer to a 8-bit unsigned value.
 33  * @p_u16:                      Pointer to a 1     39  * @p_u16:                      Pointer to a 16-bit unsigned value.
 34  * @p_u32:                      Pointer to a 3     40  * @p_u32:                      Pointer to a 32-bit unsigned value.
 35  * @p_char:                     Pointer to a s     41  * @p_char:                     Pointer to a string.
 36  * @p_mpeg2_sequence:           Pointer to a M     42  * @p_mpeg2_sequence:           Pointer to a MPEG2 sequence structure.
 37  * @p_mpeg2_picture:            Pointer to a M     43  * @p_mpeg2_picture:            Pointer to a MPEG2 picture structure.
 38  * @p_mpeg2_quantisation:       Pointer to a M     44  * @p_mpeg2_quantisation:       Pointer to a MPEG2 quantisation data structure.
 39  * @p_fwht_params:              Pointer to a F     45  * @p_fwht_params:              Pointer to a FWHT stateless parameters structure.
 40  * @p_h264_sps:                 Pointer to a s     46  * @p_h264_sps:                 Pointer to a struct v4l2_ctrl_h264_sps.
 41  * @p_h264_pps:                 Pointer to a s     47  * @p_h264_pps:                 Pointer to a struct v4l2_ctrl_h264_pps.
 42  * @p_h264_scaling_matrix:      Pointer to a s     48  * @p_h264_scaling_matrix:      Pointer to a struct v4l2_ctrl_h264_scaling_matrix.
 43  * @p_h264_slice_params:        Pointer to a s     49  * @p_h264_slice_params:        Pointer to a struct v4l2_ctrl_h264_slice_params.
 44  * @p_h264_decode_params:       Pointer to a s     50  * @p_h264_decode_params:       Pointer to a struct v4l2_ctrl_h264_decode_params.
 45  * @p_h264_pred_weights:        Pointer to a s     51  * @p_h264_pred_weights:        Pointer to a struct v4l2_ctrl_h264_pred_weights.
 46  * @p_vp8_frame:                Pointer to a V     52  * @p_vp8_frame:                Pointer to a VP8 frame params structure.
 47  * @p_vp9_compressed_hdr_probs: Pointer to a V     53  * @p_vp9_compressed_hdr_probs: Pointer to a VP9 frame compressed header probs structure.
 48  * @p_vp9_frame:                Pointer to a V     54  * @p_vp9_frame:                Pointer to a VP9 frame params structure.
 49  * @p_hevc_sps:                 Pointer to an      55  * @p_hevc_sps:                 Pointer to an HEVC sequence parameter set structure.
 50  * @p_hevc_pps:                 Pointer to an      56  * @p_hevc_pps:                 Pointer to an HEVC picture parameter set structure.
 51  * @p_hevc_slice_params:        Pointer to an      57  * @p_hevc_slice_params:        Pointer to an HEVC slice parameters structure.
 52  * @p_hdr10_cll:                Pointer to an      58  * @p_hdr10_cll:                Pointer to an HDR10 Content Light Level structure.
 53  * @p_hdr10_mastering:          Pointer to an      59  * @p_hdr10_mastering:          Pointer to an HDR10 Mastering Display structure.
 54  * @p_area:                     Pointer to an      60  * @p_area:                     Pointer to an area.
 55  * @p_av1_sequence:             Pointer to an  << 
 56  * @p_av1_tile_group_entry:     Pointer to an  << 
 57  * @p_av1_frame:                Pointer to an  << 
 58  * @p_av1_film_grain:           Pointer to an  << 
 59  * @p:                          Pointer to a c     61  * @p:                          Pointer to a compound value.
 60  * @p_const:                    Pointer to a c     62  * @p_const:                    Pointer to a constant compound value.
 61  */                                                63  */
 62 union v4l2_ctrl_ptr {                              64 union v4l2_ctrl_ptr {
 63         s32 *p_s32;                                65         s32 *p_s32;
 64         s64 *p_s64;                                66         s64 *p_s64;
 65         u8 *p_u8;                                  67         u8 *p_u8;
 66         u16 *p_u16;                                68         u16 *p_u16;
 67         u32 *p_u32;                                69         u32 *p_u32;
 68         char *p_char;                              70         char *p_char;
 69         struct v4l2_ctrl_mpeg2_sequence *p_mpe     71         struct v4l2_ctrl_mpeg2_sequence *p_mpeg2_sequence;
 70         struct v4l2_ctrl_mpeg2_picture *p_mpeg     72         struct v4l2_ctrl_mpeg2_picture *p_mpeg2_picture;
 71         struct v4l2_ctrl_mpeg2_quantisation *p     73         struct v4l2_ctrl_mpeg2_quantisation *p_mpeg2_quantisation;
 72         struct v4l2_ctrl_fwht_params *p_fwht_p     74         struct v4l2_ctrl_fwht_params *p_fwht_params;
 73         struct v4l2_ctrl_h264_sps *p_h264_sps;     75         struct v4l2_ctrl_h264_sps *p_h264_sps;
 74         struct v4l2_ctrl_h264_pps *p_h264_pps;     76         struct v4l2_ctrl_h264_pps *p_h264_pps;
 75         struct v4l2_ctrl_h264_scaling_matrix *     77         struct v4l2_ctrl_h264_scaling_matrix *p_h264_scaling_matrix;
 76         struct v4l2_ctrl_h264_slice_params *p_     78         struct v4l2_ctrl_h264_slice_params *p_h264_slice_params;
 77         struct v4l2_ctrl_h264_decode_params *p     79         struct v4l2_ctrl_h264_decode_params *p_h264_decode_params;
 78         struct v4l2_ctrl_h264_pred_weights *p_     80         struct v4l2_ctrl_h264_pred_weights *p_h264_pred_weights;
 79         struct v4l2_ctrl_vp8_frame *p_vp8_fram     81         struct v4l2_ctrl_vp8_frame *p_vp8_frame;
 80         struct v4l2_ctrl_hevc_sps *p_hevc_sps;     82         struct v4l2_ctrl_hevc_sps *p_hevc_sps;
 81         struct v4l2_ctrl_hevc_pps *p_hevc_pps;     83         struct v4l2_ctrl_hevc_pps *p_hevc_pps;
 82         struct v4l2_ctrl_hevc_slice_params *p_     84         struct v4l2_ctrl_hevc_slice_params *p_hevc_slice_params;
 83         struct v4l2_ctrl_vp9_compressed_hdr *p     85         struct v4l2_ctrl_vp9_compressed_hdr *p_vp9_compressed_hdr_probs;
 84         struct v4l2_ctrl_vp9_frame *p_vp9_fram     86         struct v4l2_ctrl_vp9_frame *p_vp9_frame;
 85         struct v4l2_ctrl_hdr10_cll_info *p_hdr     87         struct v4l2_ctrl_hdr10_cll_info *p_hdr10_cll;
 86         struct v4l2_ctrl_hdr10_mastering_displ     88         struct v4l2_ctrl_hdr10_mastering_display *p_hdr10_mastering;
 87         struct v4l2_area *p_area;                  89         struct v4l2_area *p_area;
 88         struct v4l2_ctrl_av1_sequence *p_av1_s << 
 89         struct v4l2_ctrl_av1_tile_group_entry  << 
 90         struct v4l2_ctrl_av1_frame *p_av1_fram << 
 91         struct v4l2_ctrl_av1_film_grain *p_av1 << 
 92         void *p;                                   90         void *p;
 93         const void *p_const;                       91         const void *p_const;
 94 };                                                 92 };
 95                                                    93 
 96 /**                                                94 /**
 97  * v4l2_ctrl_ptr_create() - Helper function to     95  * v4l2_ctrl_ptr_create() - Helper function to return a v4l2_ctrl_ptr from a
 98  * void pointer                                    96  * void pointer
 99  * @ptr:        The void pointer                   97  * @ptr:        The void pointer
100  */                                                98  */
101 static inline union v4l2_ctrl_ptr v4l2_ctrl_pt     99 static inline union v4l2_ctrl_ptr v4l2_ctrl_ptr_create(void *ptr)
102 {                                                 100 {
103         union v4l2_ctrl_ptr p = { .p = ptr };     101         union v4l2_ctrl_ptr p = { .p = ptr };
104                                                   102 
105         return p;                                 103         return p;
106 }                                                 104 }
107                                                   105 
108 /**                                               106 /**
109  * struct v4l2_ctrl_ops - The control operatio    107  * struct v4l2_ctrl_ops - The control operations that the driver has to provide.
110  *                                                108  *
111  * @g_volatile_ctrl: Get a new value for this     109  * @g_volatile_ctrl: Get a new value for this control. Generally only relevant
112  *              for volatile (and usually read    110  *              for volatile (and usually read-only) controls such as a control
113  *              that returns the current signa    111  *              that returns the current signal strength which changes
114  *              continuously.                     112  *              continuously.
115  *              If not set, then the currently    113  *              If not set, then the currently cached value will be returned.
116  * @try_ctrl:   Test whether the control's val    114  * @try_ctrl:   Test whether the control's value is valid. Only relevant when
117  *              the usual min/max/step checks     115  *              the usual min/max/step checks are not sufficient.
118  * @s_ctrl:     Actually set the new control v    116  * @s_ctrl:     Actually set the new control value. s_ctrl is compulsory. The
119  *              ctrl->handler->lock is held wh    117  *              ctrl->handler->lock is held when these ops are called, so no
120  *              one else can access controls o    118  *              one else can access controls owned by that handler.
121  */                                               119  */
122 struct v4l2_ctrl_ops {                            120 struct v4l2_ctrl_ops {
123         int (*g_volatile_ctrl)(struct v4l2_ctr    121         int (*g_volatile_ctrl)(struct v4l2_ctrl *ctrl);
124         int (*try_ctrl)(struct v4l2_ctrl *ctrl    122         int (*try_ctrl)(struct v4l2_ctrl *ctrl);
125         int (*s_ctrl)(struct v4l2_ctrl *ctrl);    123         int (*s_ctrl)(struct v4l2_ctrl *ctrl);
126 };                                                124 };
127                                                   125 
128 /**                                               126 /**
129  * struct v4l2_ctrl_type_ops - The control typ    127  * struct v4l2_ctrl_type_ops - The control type operations that the driver
130  *                             has to provide.    128  *                             has to provide.
131  *                                                129  *
132  * @equal: return true if all ctrl->elems arra !! 130  * @equal: return true if both values are equal.
133  * @init: initialize the value for array eleme !! 131  * @init: initialize the value.
134  * @log: log the value.                           132  * @log: log the value.
135  * @validate: validate the value for ctrl->new !! 133  * @validate: validate the value. Return 0 on success and a negative value
136  *      Return 0 on success and a negative val !! 134  *      otherwise.
137  */                                               135  */
138 struct v4l2_ctrl_type_ops {                       136 struct v4l2_ctrl_type_ops {
139         bool (*equal)(const struct v4l2_ctrl * !! 137         bool (*equal)(const struct v4l2_ctrl *ctrl, u32 idx,
140                       union v4l2_ctrl_ptr ptr1 !! 138                       union v4l2_ctrl_ptr ptr1,
141         void (*init)(const struct v4l2_ctrl *c !! 139                       union v4l2_ctrl_ptr ptr2);
                                                   >> 140         void (*init)(const struct v4l2_ctrl *ctrl, u32 idx,
142                      union v4l2_ctrl_ptr ptr);    141                      union v4l2_ctrl_ptr ptr);
143         void (*log)(const struct v4l2_ctrl *ct    142         void (*log)(const struct v4l2_ctrl *ctrl);
144         int (*validate)(const struct v4l2_ctrl !! 143         int (*validate)(const struct v4l2_ctrl *ctrl, u32 idx,
                                                   >> 144                         union v4l2_ctrl_ptr ptr);
145 };                                                145 };
146                                                   146 
147 /**                                               147 /**
148  * typedef v4l2_ctrl_notify_fnc - typedef for     148  * typedef v4l2_ctrl_notify_fnc - typedef for a notify argument with a function
149  *      that should be called when a control v    149  *      that should be called when a control value has changed.
150  *                                                150  *
151  * @ctrl: pointer to struct &v4l2_ctrl            151  * @ctrl: pointer to struct &v4l2_ctrl
152  * @priv: control private data                    152  * @priv: control private data
153  *                                                153  *
154  * This typedef definition is used as an argum    154  * This typedef definition is used as an argument to v4l2_ctrl_notify()
155  * and as an argument at struct &v4l2_ctrl_han    155  * and as an argument at struct &v4l2_ctrl_handler.
156  */                                               156  */
157 typedef void (*v4l2_ctrl_notify_fnc)(struct v4    157 typedef void (*v4l2_ctrl_notify_fnc)(struct v4l2_ctrl *ctrl, void *priv);
158                                                   158 
159 /**                                               159 /**
160  * struct v4l2_ctrl - The control structure.      160  * struct v4l2_ctrl - The control structure.
161  *                                                161  *
162  * @node:       The list node.                    162  * @node:       The list node.
163  * @ev_subs:    The list of control event subs    163  * @ev_subs:    The list of control event subscriptions.
164  * @handler:    The handler that owns the cont    164  * @handler:    The handler that owns the control.
165  * @cluster:    Point to start of cluster arra    165  * @cluster:    Point to start of cluster array.
166  * @ncontrols:  Number of controls in cluster     166  * @ncontrols:  Number of controls in cluster array.
167  * @done:       Internal flag: set for each pr    167  * @done:       Internal flag: set for each processed control.
168  * @is_new:     Set when the user specified a     168  * @is_new:     Set when the user specified a new value for this control. It
169  *              is also set when called from v    169  *              is also set when called from v4l2_ctrl_handler_setup(). Drivers
170  *              should never set this flag.       170  *              should never set this flag.
171  * @has_changed: Set when the current value di    171  * @has_changed: Set when the current value differs from the new value. Drivers
172  *              should never use this flag.       172  *              should never use this flag.
173  * @is_private: If set, then this control is p    173  * @is_private: If set, then this control is private to its handler and it
174  *              will not be added to any other    174  *              will not be added to any other handlers. Drivers can set
175  *              this flag.                        175  *              this flag.
176  * @is_auto:   If set, then this control selec    176  * @is_auto:   If set, then this control selects whether the other cluster
177  *              members are in 'automatic' mod    177  *              members are in 'automatic' mode or 'manual' mode. This is
178  *              used for autogain/gain type cl    178  *              used for autogain/gain type clusters. Drivers should never
179  *              set this flag directly.           179  *              set this flag directly.
180  * @is_int:    If set, then this control has a    180  * @is_int:    If set, then this control has a simple integer value (i.e. it
181  *              uses ctrl->val).                  181  *              uses ctrl->val).
182  * @is_string: If set, then this control has t    182  * @is_string: If set, then this control has type %V4L2_CTRL_TYPE_STRING.
183  * @is_ptr:     If set, then this control is a    183  * @is_ptr:     If set, then this control is an array and/or has type >=
184  *              %V4L2_CTRL_COMPOUND_TYPES         184  *              %V4L2_CTRL_COMPOUND_TYPES
185  *              and/or has type %V4L2_CTRL_TYP    185  *              and/or has type %V4L2_CTRL_TYPE_STRING. In other words, &struct
186  *              v4l2_ext_control uses field p     186  *              v4l2_ext_control uses field p to point to the data.
187  * @is_array: If set, then this control contai    187  * @is_array: If set, then this control contains an N-dimensional array.
188  * @is_dyn_array: If set, then this control co << 
189  *              If this is set, then @is_array << 
190  * @has_volatiles: If set, then one or more me    188  * @has_volatiles: If set, then one or more members of the cluster are volatile.
191  *              Drivers should never touch thi    189  *              Drivers should never touch this flag.
192  * @call_notify: If set, then call the handler    190  * @call_notify: If set, then call the handler's notify function whenever the
193  *              control's value changes.          191  *              control's value changes.
194  * @manual_mode_value: If the is_auto flag is     192  * @manual_mode_value: If the is_auto flag is set, then this is the value
195  *              of the auto control that deter    193  *              of the auto control that determines if that control is in
196  *              manual mode. So if the value o    194  *              manual mode. So if the value of the auto control equals this
197  *              value, then the whole cluster     195  *              value, then the whole cluster is in manual mode. Drivers should
198  *              never set this flag directly.     196  *              never set this flag directly.
199  * @ops:        The control ops.                  197  * @ops:        The control ops.
200  * @type_ops:   The control type ops.             198  * @type_ops:   The control type ops.
201  * @id: The control ID.                           199  * @id: The control ID.
202  * @name:       The control name.                 200  * @name:       The control name.
203  * @type:       The control type.                 201  * @type:       The control type.
204  * @minimum:    The control's minimum value.      202  * @minimum:    The control's minimum value.
205  * @maximum:    The control's maximum value.      203  * @maximum:    The control's maximum value.
206  * @default_value: The control's default value    204  * @default_value: The control's default value.
207  * @step:       The control's step value for n    205  * @step:       The control's step value for non-menu controls.
208  * @elems:      The number of elements in the     206  * @elems:      The number of elements in the N-dimensional array.
209  * @elem_size:  The size in bytes of the contr    207  * @elem_size:  The size in bytes of the control.
210  * @new_elems:  The number of elements in p_ne << 
211  *              except for dynamic arrays. In  << 
212  *              1 to @p_array_alloc_elems.     << 
213  * @dims:       The size of each dimension.       208  * @dims:       The size of each dimension.
214  * @nr_of_dims:The number of dimensions in @di    209  * @nr_of_dims:The number of dimensions in @dims.
215  * @menu_skip_mask: The control's skip mask fo    210  * @menu_skip_mask: The control's skip mask for menu controls. This makes it
216  *              easy to skip menu items that a    211  *              easy to skip menu items that are not valid. If bit X is set,
217  *              then menu item X is skipped. O    212  *              then menu item X is skipped. Of course, this only works for
218  *              menus with <= 32 menu items. T    213  *              menus with <= 32 menu items. There are no menus that come
219  *              close to that number, so this     214  *              close to that number, so this is OK. Should we ever need more,
220  *              then this will have to be exte    215  *              then this will have to be extended to a u64 or a bit array.
221  * @qmenu:      A const char * array for all m    216  * @qmenu:      A const char * array for all menu items. Array entries that are
222  *              empty strings ("") correspond     217  *              empty strings ("") correspond to non-existing menu items (this
223  *              is in addition to the menu_ski    218  *              is in addition to the menu_skip_mask above). The last entry
224  *              must be NULL.                     219  *              must be NULL.
225  *              Used only if the @type is %V4L    220  *              Used only if the @type is %V4L2_CTRL_TYPE_MENU.
226  * @qmenu_int:  A 64-bit integer array for wit    221  * @qmenu_int:  A 64-bit integer array for with integer menu items.
227  *              The size of array must be equa    222  *              The size of array must be equal to the menu size, e. g.:
228  *              :math:`ceil(\frac{maximum - mi    223  *              :math:`ceil(\frac{maximum - minimum}{step}) + 1`.
229  *              Used only if the @type is %V4L    224  *              Used only if the @type is %V4L2_CTRL_TYPE_INTEGER_MENU.
230  * @flags:      The control's flags.              225  * @flags:      The control's flags.
                                                   >> 226  * @cur:        Structure to store the current value.
                                                   >> 227  * @cur.val:    The control's current value, if the @type is represented via
                                                   >> 228  *              a u32 integer (see &enum v4l2_ctrl_type).
                                                   >> 229  * @val:        The control's new s32 value.
231  * @priv:       The control's private pointer.    230  * @priv:       The control's private pointer. For use by the driver. It is
232  *              untouched by the control frame    231  *              untouched by the control framework. Note that this pointer is
233  *              not freed when the control is     232  *              not freed when the control is deleted. Should this be needed
234  *              then a new internal bitfield c    233  *              then a new internal bitfield can be added to tell the framework
235  *              to free this pointer.             234  *              to free this pointer.
236  * @p_array:    Pointer to the allocated array << 
237  * @p_array_alloc_elems: The number of element << 
238  *              array for both the cur and new << 
239  *              sized for 2 * @p_array_alloc_e << 
240  *              @is_array is true.             << 
241  * @cur:        Structure to store the current << 
242  * @cur.val:    The control's current value, i << 
243  *              a u32 integer (see &enum v4l2_ << 
244  * @val:        The control's new s32 value.   << 
245  * @p_def:      The control's default value re    235  * @p_def:      The control's default value represented via a union which
246  *              provides a standard way of acc    236  *              provides a standard way of accessing control types
247  *              through a pointer (for compoun    237  *              through a pointer (for compound controls only).
248  * @p_cur:      The control's current value re    238  * @p_cur:      The control's current value represented via a union which
249  *              provides a standard way of acc    239  *              provides a standard way of accessing control types
250  *              through a pointer.                240  *              through a pointer.
251  * @p_new:      The control's new value repres    241  * @p_new:      The control's new value represented via a union which provides
252  *              a standard way of accessing co    242  *              a standard way of accessing control types
253  *              through a pointer.                243  *              through a pointer.
254  */                                               244  */
255 struct v4l2_ctrl {                                245 struct v4l2_ctrl {
256         /* Administrative fields */               246         /* Administrative fields */
257         struct list_head node;                    247         struct list_head node;
258         struct list_head ev_subs;                 248         struct list_head ev_subs;
259         struct v4l2_ctrl_handler *handler;        249         struct v4l2_ctrl_handler *handler;
260         struct v4l2_ctrl **cluster;               250         struct v4l2_ctrl **cluster;
261         unsigned int ncontrols;                   251         unsigned int ncontrols;
262                                                   252 
263         unsigned int done:1;                      253         unsigned int done:1;
264                                                   254 
265         unsigned int is_new:1;                    255         unsigned int is_new:1;
266         unsigned int has_changed:1;               256         unsigned int has_changed:1;
267         unsigned int is_private:1;                257         unsigned int is_private:1;
268         unsigned int is_auto:1;                   258         unsigned int is_auto:1;
269         unsigned int is_int:1;                    259         unsigned int is_int:1;
270         unsigned int is_string:1;                 260         unsigned int is_string:1;
271         unsigned int is_ptr:1;                    261         unsigned int is_ptr:1;
272         unsigned int is_array:1;                  262         unsigned int is_array:1;
273         unsigned int is_dyn_array:1;           << 
274         unsigned int has_volatiles:1;             263         unsigned int has_volatiles:1;
275         unsigned int call_notify:1;               264         unsigned int call_notify:1;
276         unsigned int manual_mode_value:8;         265         unsigned int manual_mode_value:8;
277                                                   266 
278         const struct v4l2_ctrl_ops *ops;          267         const struct v4l2_ctrl_ops *ops;
279         const struct v4l2_ctrl_type_ops *type_    268         const struct v4l2_ctrl_type_ops *type_ops;
280         u32 id;                                   269         u32 id;
281         const char *name;                         270         const char *name;
282         enum v4l2_ctrl_type type;                 271         enum v4l2_ctrl_type type;
283         s64 minimum, maximum, default_value;      272         s64 minimum, maximum, default_value;
284         u32 elems;                                273         u32 elems;
285         u32 elem_size;                            274         u32 elem_size;
286         u32 new_elems;                         << 
287         u32 dims[V4L2_CTRL_MAX_DIMS];             275         u32 dims[V4L2_CTRL_MAX_DIMS];
288         u32 nr_of_dims;                           276         u32 nr_of_dims;
289         union {                                   277         union {
290                 u64 step;                         278                 u64 step;
291                 u64 menu_skip_mask;               279                 u64 menu_skip_mask;
292         };                                        280         };
293         union {                                   281         union {
294                 const char * const *qmenu;        282                 const char * const *qmenu;
295                 const s64 *qmenu_int;             283                 const s64 *qmenu_int;
296         };                                        284         };
297         unsigned long flags;                      285         unsigned long flags;
298         void *priv;                               286         void *priv;
299         void *p_array;                         << 
300         u32 p_array_alloc_elems;               << 
301         s32 val;                                  287         s32 val;
302         struct {                                  288         struct {
303                 s32 val;                          289                 s32 val;
304         } cur;                                    290         } cur;
305                                                   291 
306         union v4l2_ctrl_ptr p_def;                292         union v4l2_ctrl_ptr p_def;
307         union v4l2_ctrl_ptr p_new;                293         union v4l2_ctrl_ptr p_new;
308         union v4l2_ctrl_ptr p_cur;                294         union v4l2_ctrl_ptr p_cur;
309 };                                                295 };
310                                                   296 
311 /**                                               297 /**
312  * struct v4l2_ctrl_ref - The control referenc    298  * struct v4l2_ctrl_ref - The control reference.
313  *                                                299  *
314  * @node:       List node for the sorted list.    300  * @node:       List node for the sorted list.
315  * @next:       Single-link list node for the     301  * @next:       Single-link list node for the hash.
316  * @ctrl:       The actual control information    302  * @ctrl:       The actual control information.
317  * @helper:     Pointer to helper struct. Used    303  * @helper:     Pointer to helper struct. Used internally in
318  *              ``prepare_ext_ctrls`` function    304  *              ``prepare_ext_ctrls`` function at ``v4l2-ctrl.c``.
319  * @from_other_dev: If true, then @ctrl was de    305  * @from_other_dev: If true, then @ctrl was defined in another
320  *              device than the &struct v4l2_c    306  *              device than the &struct v4l2_ctrl_handler.
321  * @req_done:   Internal flag: if the control     307  * @req_done:   Internal flag: if the control handler containing this control
322  *              reference is bound to a media     308  *              reference is bound to a media request, then this is set when
323  *              the control has been applied.     309  *              the control has been applied. This prevents applying controls
324  *              from a cluster with multiple c    310  *              from a cluster with multiple controls twice (when the first
325  *              control of a cluster is applie    311  *              control of a cluster is applied, they all are).
326  * @p_req_valid: If set, then p_req contains t !! 312  * @valid_p_req: If set, then p_req contains the control value for the request.
327  * @p_req_array_enomem: If set, then p_req is  << 
328  *              an array failed. Attempting to << 
329  *              result in ENOMEM. Only valid i << 
330  * @p_req_array_alloc_elems: The number of ele << 
331  *              array. Only valid if @p_req_va << 
332  *              true.                          << 
333  * @p_req_elems: The number of elements in @p_ << 
334  *              ctrl->elems, except for dynami << 
335  *              the range of 1 to @p_req_array << 
336  *              @p_req_valid is true.          << 
337  * @p_req:      If the control handler contain    313  * @p_req:      If the control handler containing this control reference
338  *              is bound to a media request, t    314  *              is bound to a media request, then this points to the
339  *              value of the control that must    315  *              value of the control that must be applied when the request
340  *              is executed, or to the value o    316  *              is executed, or to the value of the control at the time
341  *              that the request was completed !! 317  *              that the request was completed. If @valid_p_req is false,
342  *              then this control was never se    318  *              then this control was never set for this request and the
343  *              control will not be updated wh    319  *              control will not be updated when this request is applied.
344  *                                                320  *
345  * Each control handler has a list of these re    321  * Each control handler has a list of these refs. The list_head is used to
346  * keep a sorted-by-control-ID list of all con    322  * keep a sorted-by-control-ID list of all controls, while the next pointer
347  * is used to link the control in the hash's b    323  * is used to link the control in the hash's bucket.
348  */                                               324  */
349 struct v4l2_ctrl_ref {                            325 struct v4l2_ctrl_ref {
350         struct list_head node;                    326         struct list_head node;
351         struct v4l2_ctrl_ref *next;               327         struct v4l2_ctrl_ref *next;
352         struct v4l2_ctrl *ctrl;                   328         struct v4l2_ctrl *ctrl;
353         struct v4l2_ctrl_helper *helper;          329         struct v4l2_ctrl_helper *helper;
354         bool from_other_dev;                      330         bool from_other_dev;
355         bool req_done;                            331         bool req_done;
356         bool p_req_valid;                      !! 332         bool valid_p_req;
357         bool p_req_array_enomem;               << 
358         u32 p_req_array_alloc_elems;           << 
359         u32 p_req_elems;                       << 
360         union v4l2_ctrl_ptr p_req;                333         union v4l2_ctrl_ptr p_req;
361 };                                                334 };
362                                                   335 
363 /**                                               336 /**
364  * struct v4l2_ctrl_handler - The control hand    337  * struct v4l2_ctrl_handler - The control handler keeps track of all the
365  *      controls: both the controls owned by t    338  *      controls: both the controls owned by the handler and those inherited
366  *      from other handlers.                      339  *      from other handlers.
367  *                                                340  *
368  * @_lock:      Default for "lock".               341  * @_lock:      Default for "lock".
369  * @lock:       Lock to control access to this    342  * @lock:       Lock to control access to this handler and its controls.
370  *              May be replaced by the user ri    343  *              May be replaced by the user right after init.
371  * @ctrls:      The list of controls owned by     344  * @ctrls:      The list of controls owned by this handler.
372  * @ctrl_refs:  The list of control references    345  * @ctrl_refs:  The list of control references.
373  * @cached:     The last found control referen    346  * @cached:     The last found control reference. It is common that the same
374  *              control is needed multiple tim    347  *              control is needed multiple times, so this is a simple
375  *              optimization.                     348  *              optimization.
376  * @buckets:    Buckets for the hashing. Allow    349  * @buckets:    Buckets for the hashing. Allows for quick control lookup.
377  * @notify:     A notify callback that is call    350  * @notify:     A notify callback that is called whenever the control changes
378  *              value.                            351  *              value.
379  *              Note that the handler's lock i    352  *              Note that the handler's lock is held when the notify function
380  *              is called!                        353  *              is called!
381  * @notify_priv: Passed as argument to the v4l    354  * @notify_priv: Passed as argument to the v4l2_ctrl notify callback.
382  * @nr_of_buckets: Total number of buckets in     355  * @nr_of_buckets: Total number of buckets in the array.
383  * @error:      The error code of the first fa    356  * @error:      The error code of the first failed control addition.
384  * @request_is_queued: True if the request was    357  * @request_is_queued: True if the request was queued.
385  * @requests:   List to keep track of open con    358  * @requests:   List to keep track of open control handler request objects.
386  *              For the parent control handler    359  *              For the parent control handler (@req_obj.ops == NULL) this
387  *              is the list header. When the p    360  *              is the list header. When the parent control handler is
388  *              removed, it has to unbind and     361  *              removed, it has to unbind and put all these requests since
389  *              they refer to the parent.         362  *              they refer to the parent.
390  * @requests_queued: List of the queued reques    363  * @requests_queued: List of the queued requests. This determines the order
391  *              in which these controls are ap    364  *              in which these controls are applied. Once the request is
392  *              completed it is removed from t    365  *              completed it is removed from this list.
393  * @req_obj:    The &struct media_request_obje    366  * @req_obj:    The &struct media_request_object, used to link into a
394  *              &struct media_request. This re    367  *              &struct media_request. This request object has a refcount.
395  */                                               368  */
396 struct v4l2_ctrl_handler {                        369 struct v4l2_ctrl_handler {
397         struct mutex _lock;                       370         struct mutex _lock;
398         struct mutex *lock;                       371         struct mutex *lock;
399         struct list_head ctrls;                   372         struct list_head ctrls;
400         struct list_head ctrl_refs;               373         struct list_head ctrl_refs;
401         struct v4l2_ctrl_ref *cached;             374         struct v4l2_ctrl_ref *cached;
402         struct v4l2_ctrl_ref **buckets;           375         struct v4l2_ctrl_ref **buckets;
403         v4l2_ctrl_notify_fnc notify;              376         v4l2_ctrl_notify_fnc notify;
404         void *notify_priv;                        377         void *notify_priv;
405         u16 nr_of_buckets;                        378         u16 nr_of_buckets;
406         int error;                                379         int error;
407         bool request_is_queued;                   380         bool request_is_queued;
408         struct list_head requests;                381         struct list_head requests;
409         struct list_head requests_queued;         382         struct list_head requests_queued;
410         struct media_request_object req_obj;      383         struct media_request_object req_obj;
411 };                                                384 };
412                                                   385 
413 /**                                               386 /**
414  * struct v4l2_ctrl_config - Control configura    387  * struct v4l2_ctrl_config - Control configuration structure.
415  *                                                388  *
416  * @ops:        The control ops.                  389  * @ops:        The control ops.
417  * @type_ops:   The control type ops. Only nee    390  * @type_ops:   The control type ops. Only needed for compound controls.
418  * @id: The control ID.                           391  * @id: The control ID.
419  * @name:       The control name.                 392  * @name:       The control name.
420  * @type:       The control type.                 393  * @type:       The control type.
421  * @min:        The control's minimum value.      394  * @min:        The control's minimum value.
422  * @max:        The control's maximum value.      395  * @max:        The control's maximum value.
423  * @step:       The control's step value for n    396  * @step:       The control's step value for non-menu controls.
424  * @def:        The control's default value.      397  * @def:        The control's default value.
425  * @p_def:      The control's default value fo    398  * @p_def:      The control's default value for compound controls.
426  * @dims:       The size of each dimension.       399  * @dims:       The size of each dimension.
427  * @elem_size:  The size in bytes of the contr    400  * @elem_size:  The size in bytes of the control.
428  * @flags:      The control's flags.              401  * @flags:      The control's flags.
429  * @menu_skip_mask: The control's skip mask fo    402  * @menu_skip_mask: The control's skip mask for menu controls. This makes it
430  *              easy to skip menu items that a    403  *              easy to skip menu items that are not valid. If bit X is set,
431  *              then menu item X is skipped. O    404  *              then menu item X is skipped. Of course, this only works for
432  *              menus with <= 64 menu items. T    405  *              menus with <= 64 menu items. There are no menus that come
433  *              close to that number, so this     406  *              close to that number, so this is OK. Should we ever need more,
434  *              then this will have to be exte    407  *              then this will have to be extended to a bit array.
435  * @qmenu:      A const char * array for all m    408  * @qmenu:      A const char * array for all menu items. Array entries that are
436  *              empty strings ("") correspond     409  *              empty strings ("") correspond to non-existing menu items (this
437  *              is in addition to the menu_ski    410  *              is in addition to the menu_skip_mask above). The last entry
438  *              must be NULL.                     411  *              must be NULL.
439  * @qmenu_int:  A const s64 integer array for     412  * @qmenu_int:  A const s64 integer array for all menu items of the type
440  *              V4L2_CTRL_TYPE_INTEGER_MENU.      413  *              V4L2_CTRL_TYPE_INTEGER_MENU.
441  * @is_private: If set, then this control is p    414  * @is_private: If set, then this control is private to its handler and it
442  *              will not be added to any other    415  *              will not be added to any other handlers.
443  */                                               416  */
444 struct v4l2_ctrl_config {                         417 struct v4l2_ctrl_config {
445         const struct v4l2_ctrl_ops *ops;          418         const struct v4l2_ctrl_ops *ops;
446         const struct v4l2_ctrl_type_ops *type_    419         const struct v4l2_ctrl_type_ops *type_ops;
447         u32 id;                                   420         u32 id;
448         const char *name;                         421         const char *name;
449         enum v4l2_ctrl_type type;                 422         enum v4l2_ctrl_type type;
450         s64 min;                                  423         s64 min;
451         s64 max;                                  424         s64 max;
452         u64 step;                                 425         u64 step;
453         s64 def;                                  426         s64 def;
454         union v4l2_ctrl_ptr p_def;                427         union v4l2_ctrl_ptr p_def;
455         u32 dims[V4L2_CTRL_MAX_DIMS];             428         u32 dims[V4L2_CTRL_MAX_DIMS];
456         u32 elem_size;                            429         u32 elem_size;
457         u32 flags;                                430         u32 flags;
458         u64 menu_skip_mask;                       431         u64 menu_skip_mask;
459         const char * const *qmenu;                432         const char * const *qmenu;
460         const s64 *qmenu_int;                     433         const s64 *qmenu_int;
461         unsigned int is_private:1;                434         unsigned int is_private:1;
462 };                                                435 };
463                                                   436 
464 /**                                               437 /**
465  * v4l2_ctrl_fill - Fill in the control fields    438  * v4l2_ctrl_fill - Fill in the control fields based on the control ID.
466  *                                                439  *
467  * @id: ID of the control                         440  * @id: ID of the control
468  * @name: pointer to be filled with a string w    441  * @name: pointer to be filled with a string with the name of the control
469  * @type: pointer for storing the type of the     442  * @type: pointer for storing the type of the control
470  * @min: pointer for storing the minimum value    443  * @min: pointer for storing the minimum value for the control
471  * @max: pointer for storing the maximum value    444  * @max: pointer for storing the maximum value for the control
472  * @step: pointer for storing the control step    445  * @step: pointer for storing the control step
473  * @def: pointer for storing the default value    446  * @def: pointer for storing the default value for the control
474  * @flags: pointer for storing the flags to be    447  * @flags: pointer for storing the flags to be used on the control
475  *                                                448  *
476  * This works for all standard V4L2 controls.     449  * This works for all standard V4L2 controls.
477  * For non-standard controls it will only fill    450  * For non-standard controls it will only fill in the given arguments
478  * and @name content will be set to %NULL.        451  * and @name content will be set to %NULL.
479  *                                                452  *
480  * This function will overwrite the contents o    453  * This function will overwrite the contents of @name, @type and @flags.
481  * The contents of @min, @max, @step and @def     454  * The contents of @min, @max, @step and @def may be modified depending on
482  * the type.                                      455  * the type.
483  *                                                456  *
484  * .. note::                                      457  * .. note::
485  *                                                458  *
486  *    Do not use in drivers! It is used intern    459  *    Do not use in drivers! It is used internally for backwards compatibility
487  *    control handling only. Once all drivers     460  *    control handling only. Once all drivers are converted to use the new
488  *    control framework this function will no     461  *    control framework this function will no longer be exported.
489  */                                               462  */
490 void v4l2_ctrl_fill(u32 id, const char **name,    463 void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
491                     s64 *min, s64 *max, u64 *s    464                     s64 *min, s64 *max, u64 *step, s64 *def, u32 *flags);
492                                                   465 
493                                                   466 
494 /**                                               467 /**
495  * v4l2_ctrl_handler_init_class() - Initialize    468  * v4l2_ctrl_handler_init_class() - Initialize the control handler.
496  * @hdl:        The control handler.              469  * @hdl:        The control handler.
497  * @nr_of_controls_hint: A hint of how many co    470  * @nr_of_controls_hint: A hint of how many controls this handler is
498  *              expected to refer to. This is     471  *              expected to refer to. This is the total number, so including
499  *              any inherited controls. It doe    472  *              any inherited controls. It doesn't have to be precise, but if
500  *              it is way off, then you either    473  *              it is way off, then you either waste memory (too many buckets
501  *              are allocated) or the control     474  *              are allocated) or the control lookup becomes slower (not enough
502  *              buckets are allocated, so ther    475  *              buckets are allocated, so there are more slow list lookups).
503  *              It will always work, though.      476  *              It will always work, though.
504  * @key:        Used by the lock validator if     477  * @key:        Used by the lock validator if CONFIG_LOCKDEP is set.
505  * @name:       Used by the lock validator if     478  * @name:       Used by the lock validator if CONFIG_LOCKDEP is set.
506  *                                                479  *
507  * .. attention::                                 480  * .. attention::
508  *                                                481  *
509  *    Never use this call directly, always use    482  *    Never use this call directly, always use the v4l2_ctrl_handler_init()
510  *    macro that hides the @key and @name argu    483  *    macro that hides the @key and @name arguments.
511  *                                                484  *
512  * Return: returns an error if the buckets cou    485  * Return: returns an error if the buckets could not be allocated. This
513  * error will also be stored in @hdl->error.      486  * error will also be stored in @hdl->error.
514  */                                               487  */
515 int v4l2_ctrl_handler_init_class(struct v4l2_c    488 int v4l2_ctrl_handler_init_class(struct v4l2_ctrl_handler *hdl,
516                                  unsigned int     489                                  unsigned int nr_of_controls_hint,
517                                  struct lock_c    490                                  struct lock_class_key *key, const char *name);
518                                                   491 
519 #ifdef CONFIG_LOCKDEP                             492 #ifdef CONFIG_LOCKDEP
520                                                   493 
521 /**                                               494 /**
522  * v4l2_ctrl_handler_init - helper function to    495  * v4l2_ctrl_handler_init - helper function to create a static struct
523  *       &lock_class_key and calls v4l2_ctrl_h    496  *       &lock_class_key and calls v4l2_ctrl_handler_init_class()
524  *                                                497  *
525  * @hdl:        The control handler.              498  * @hdl:        The control handler.
526  * @nr_of_controls_hint: A hint of how many co    499  * @nr_of_controls_hint: A hint of how many controls this handler is
527  *              expected to refer to. This is     500  *              expected to refer to. This is the total number, so including
528  *              any inherited controls. It doe    501  *              any inherited controls. It doesn't have to be precise, but if
529  *              it is way off, then you either    502  *              it is way off, then you either waste memory (too many buckets
530  *              are allocated) or the control     503  *              are allocated) or the control lookup becomes slower (not enough
531  *              buckets are allocated, so ther    504  *              buckets are allocated, so there are more slow list lookups).
532  *              It will always work, though.      505  *              It will always work, though.
533  *                                                506  *
534  * This helper function creates a static struc    507  * This helper function creates a static struct &lock_class_key and
535  * calls v4l2_ctrl_handler_init_class(), provi    508  * calls v4l2_ctrl_handler_init_class(), providing a proper name for the lock
536  * validador.                                     509  * validador.
537  *                                                510  *
538  * Use this helper function to initialize a co    511  * Use this helper function to initialize a control handler.
539  */                                               512  */
540 #define v4l2_ctrl_handler_init(hdl, nr_of_cont    513 #define v4l2_ctrl_handler_init(hdl, nr_of_controls_hint)                \
541 (                                                 514 (                                                                       \
542         ({                                        515         ({                                                              \
543                 static struct lock_class_key _    516                 static struct lock_class_key _key;                      \
544                 v4l2_ctrl_handler_init_class(h    517                 v4l2_ctrl_handler_init_class(hdl, nr_of_controls_hint,  \
545                                         &_key,    518                                         &_key,                          \
546                                         KBUILD    519                                         KBUILD_BASENAME ":"             \
547                                         __stri    520                                         __stringify(__LINE__) ":"       \
548                                         "(" #h    521                                         "(" #hdl ")->_lock");           \
549         })                                        522         })                                                              \
550 )                                                 523 )
551 #else                                             524 #else
552 #define v4l2_ctrl_handler_init(hdl, nr_of_cont    525 #define v4l2_ctrl_handler_init(hdl, nr_of_controls_hint)                \
553         v4l2_ctrl_handler_init_class(hdl, nr_o    526         v4l2_ctrl_handler_init_class(hdl, nr_of_controls_hint, NULL, NULL)
554 #endif                                            527 #endif
555                                                   528 
556 /**                                               529 /**
557  * v4l2_ctrl_handler_free() - Free all control    530  * v4l2_ctrl_handler_free() - Free all controls owned by the handler and free
558  * the control list.                              531  * the control list.
559  * @hdl:        The control handler.              532  * @hdl:        The control handler.
560  *                                                533  *
561  * Does nothing if @hdl == NULL.                  534  * Does nothing if @hdl == NULL.
562  */                                               535  */
563 void v4l2_ctrl_handler_free(struct v4l2_ctrl_h    536 void v4l2_ctrl_handler_free(struct v4l2_ctrl_handler *hdl);
564                                                   537 
565 /**                                               538 /**
566  * v4l2_ctrl_lock() - Helper function to lock     539  * v4l2_ctrl_lock() - Helper function to lock the handler
567  * associated with the control.                   540  * associated with the control.
568  * @ctrl:       The control to lock.              541  * @ctrl:       The control to lock.
569  */                                               542  */
570 static inline void v4l2_ctrl_lock(struct v4l2_    543 static inline void v4l2_ctrl_lock(struct v4l2_ctrl *ctrl)
571 {                                                 544 {
572         mutex_lock(ctrl->handler->lock);          545         mutex_lock(ctrl->handler->lock);
573 }                                                 546 }
574                                                   547 
575 /**                                               548 /**
576  * v4l2_ctrl_unlock() - Helper function to unl    549  * v4l2_ctrl_unlock() - Helper function to unlock the handler
577  * associated with the control.                   550  * associated with the control.
578  * @ctrl:       The control to unlock.            551  * @ctrl:       The control to unlock.
579  */                                               552  */
580 static inline void v4l2_ctrl_unlock(struct v4l    553 static inline void v4l2_ctrl_unlock(struct v4l2_ctrl *ctrl)
581 {                                                 554 {
582         mutex_unlock(ctrl->handler->lock);        555         mutex_unlock(ctrl->handler->lock);
583 }                                                 556 }
584                                                   557 
585 /**                                               558 /**
586  * __v4l2_ctrl_handler_setup() - Call the s_ct    559  * __v4l2_ctrl_handler_setup() - Call the s_ctrl op for all controls belonging
587  * to the handler to initialize the hardware t    560  * to the handler to initialize the hardware to the current control values. The
588  * caller is responsible for acquiring the con    561  * caller is responsible for acquiring the control handler mutex on behalf of
589  * __v4l2_ctrl_handler_setup().                   562  * __v4l2_ctrl_handler_setup().
590  * @hdl:        The control handler.              563  * @hdl:        The control handler.
591  *                                                564  *
592  * Button controls will be skipped, as are rea    565  * Button controls will be skipped, as are read-only controls.
593  *                                                566  *
594  * If @hdl == NULL, then this just returns 0.     567  * If @hdl == NULL, then this just returns 0.
595  */                                               568  */
596 int __v4l2_ctrl_handler_setup(struct v4l2_ctrl    569 int __v4l2_ctrl_handler_setup(struct v4l2_ctrl_handler *hdl);
597                                                   570 
598 /**                                               571 /**
599  * v4l2_ctrl_handler_setup() - Call the s_ctrl    572  * v4l2_ctrl_handler_setup() - Call the s_ctrl op for all controls belonging
600  * to the handler to initialize the hardware t    573  * to the handler to initialize the hardware to the current control values.
601  * @hdl:        The control handler.              574  * @hdl:        The control handler.
602  *                                                575  *
603  * Button controls will be skipped, as are rea    576  * Button controls will be skipped, as are read-only controls.
604  *                                                577  *
605  * If @hdl == NULL, then this just returns 0.     578  * If @hdl == NULL, then this just returns 0.
606  */                                               579  */
607 int v4l2_ctrl_handler_setup(struct v4l2_ctrl_h    580 int v4l2_ctrl_handler_setup(struct v4l2_ctrl_handler *hdl);
608                                                   581 
609 /**                                               582 /**
610  * v4l2_ctrl_handler_log_status() - Log all co    583  * v4l2_ctrl_handler_log_status() - Log all controls owned by the handler.
611  * @hdl:        The control handler.              584  * @hdl:        The control handler.
612  * @prefix:     The prefix to use when logging    585  * @prefix:     The prefix to use when logging the control values. If the
613  *              prefix does not end with a spa    586  *              prefix does not end with a space, then ": " will be added
614  *              after the prefix. If @prefix =    587  *              after the prefix. If @prefix == NULL, then no prefix will be
615  *              used.                             588  *              used.
616  *                                                589  *
617  * For use with VIDIOC_LOG_STATUS.                590  * For use with VIDIOC_LOG_STATUS.
618  *                                                591  *
619  * Does nothing if @hdl == NULL.                  592  * Does nothing if @hdl == NULL.
620  */                                               593  */
621 void v4l2_ctrl_handler_log_status(struct v4l2_    594 void v4l2_ctrl_handler_log_status(struct v4l2_ctrl_handler *hdl,
622                                   const char *    595                                   const char *prefix);
623                                                   596 
624 /**                                               597 /**
625  * v4l2_ctrl_new_custom() - Allocate and initi    598  * v4l2_ctrl_new_custom() - Allocate and initialize a new custom V4L2
626  *      control.                                  599  *      control.
627  *                                                600  *
628  * @hdl:        The control handler.              601  * @hdl:        The control handler.
629  * @cfg:        The control's configuration da    602  * @cfg:        The control's configuration data.
630  * @priv:       The control's driver-specific     603  * @priv:       The control's driver-specific private data.
631  *                                                604  *
632  * If the &v4l2_ctrl struct could not be alloc    605  * If the &v4l2_ctrl struct could not be allocated then NULL is returned
633  * and @hdl->error is set to the error code (i    606  * and @hdl->error is set to the error code (if it wasn't set already).
634  */                                               607  */
635 struct v4l2_ctrl *v4l2_ctrl_new_custom(struct     608 struct v4l2_ctrl *v4l2_ctrl_new_custom(struct v4l2_ctrl_handler *hdl,
636                                        const s    609                                        const struct v4l2_ctrl_config *cfg,
637                                        void *p    610                                        void *priv);
638                                                   611 
639 /**                                               612 /**
640  * v4l2_ctrl_new_std() - Allocate and initiali    613  * v4l2_ctrl_new_std() - Allocate and initialize a new standard V4L2 non-menu
641  *      control.                                  614  *      control.
642  *                                                615  *
643  * @hdl:        The control handler.              616  * @hdl:        The control handler.
644  * @ops:        The control ops.                  617  * @ops:        The control ops.
645  * @id:         The control ID.                   618  * @id:         The control ID.
646  * @min:        The control's minimum value.      619  * @min:        The control's minimum value.
647  * @max:        The control's maximum value.      620  * @max:        The control's maximum value.
648  * @step:       The control's step value          621  * @step:       The control's step value
649  * @def:        The control's default value.      622  * @def:        The control's default value.
650  *                                                623  *
651  * If the &v4l2_ctrl struct could not be alloc    624  * If the &v4l2_ctrl struct could not be allocated, or the control
652  * ID is not known, then NULL is returned and     625  * ID is not known, then NULL is returned and @hdl->error is set to the
653  * appropriate error code (if it wasn't set al    626  * appropriate error code (if it wasn't set already).
654  *                                                627  *
655  * If @id refers to a menu control, then this     628  * If @id refers to a menu control, then this function will return NULL.
656  *                                                629  *
657  * Use v4l2_ctrl_new_std_menu() when adding me    630  * Use v4l2_ctrl_new_std_menu() when adding menu controls.
658  */                                               631  */
659 struct v4l2_ctrl *v4l2_ctrl_new_std(struct v4l    632 struct v4l2_ctrl *v4l2_ctrl_new_std(struct v4l2_ctrl_handler *hdl,
660                                     const stru    633                                     const struct v4l2_ctrl_ops *ops,
661                                     u32 id, s6    634                                     u32 id, s64 min, s64 max, u64 step,
662                                     s64 def);     635                                     s64 def);
663                                                   636 
664 /**                                               637 /**
665  * v4l2_ctrl_new_std_menu() - Allocate and ini    638  * v4l2_ctrl_new_std_menu() - Allocate and initialize a new standard V4L2
666  *      menu control.                             639  *      menu control.
667  *                                                640  *
668  * @hdl:        The control handler.              641  * @hdl:        The control handler.
669  * @ops:        The control ops.                  642  * @ops:        The control ops.
670  * @id:         The control ID.                   643  * @id:         The control ID.
671  * @max:        The control's maximum value.      644  * @max:        The control's maximum value.
672  * @mask:       The control's skip mask for me    645  * @mask:       The control's skip mask for menu controls. This makes it
673  *              easy to skip menu items that a    646  *              easy to skip menu items that are not valid. If bit X is set,
674  *              then menu item X is skipped. O    647  *              then menu item X is skipped. Of course, this only works for
675  *              menus with <= 64 menu items. T    648  *              menus with <= 64 menu items. There are no menus that come
676  *              close to that number, so this     649  *              close to that number, so this is OK. Should we ever need more,
677  *              then this will have to be exte    650  *              then this will have to be extended to a bit array.
678  * @def:        The control's default value.      651  * @def:        The control's default value.
679  *                                                652  *
680  * Same as v4l2_ctrl_new_std(), but @min is se    653  * Same as v4l2_ctrl_new_std(), but @min is set to 0 and the @mask value
681  * determines which menu items are to be skipp    654  * determines which menu items are to be skipped.
682  *                                                655  *
683  * If @id refers to a non-menu control, then t    656  * If @id refers to a non-menu control, then this function will return NULL.
684  */                                               657  */
685 struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struc    658 struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl,
686                                          const    659                                          const struct v4l2_ctrl_ops *ops,
687                                          u32 i    660                                          u32 id, u8 max, u64 mask, u8 def);
688                                                   661 
689 /**                                               662 /**
690  * v4l2_ctrl_new_std_menu_items() - Create a n    663  * v4l2_ctrl_new_std_menu_items() - Create a new standard V4L2 menu control
691  *      with driver specific menu.                664  *      with driver specific menu.
692  *                                                665  *
693  * @hdl:        The control handler.              666  * @hdl:        The control handler.
694  * @ops:        The control ops.                  667  * @ops:        The control ops.
695  * @id: The control ID.                           668  * @id: The control ID.
696  * @max:        The control's maximum value.      669  * @max:        The control's maximum value.
697  * @mask:       The control's skip mask for me    670  * @mask:       The control's skip mask for menu controls. This makes it
698  *              easy to skip menu items that a    671  *              easy to skip menu items that are not valid. If bit X is set,
699  *              then menu item X is skipped. O    672  *              then menu item X is skipped. Of course, this only works for
700  *              menus with <= 64 menu items. T    673  *              menus with <= 64 menu items. There are no menus that come
701  *              close to that number, so this     674  *              close to that number, so this is OK. Should we ever need more,
702  *              then this will have to be exte    675  *              then this will have to be extended to a bit array.
703  * @def:        The control's default value.      676  * @def:        The control's default value.
704  * @qmenu:      The new menu.                     677  * @qmenu:      The new menu.
705  *                                                678  *
706  * Same as v4l2_ctrl_new_std_menu(), but @qmen    679  * Same as v4l2_ctrl_new_std_menu(), but @qmenu will be the driver specific
707  * menu of this control.                          680  * menu of this control.
708  *                                                681  *
709  */                                               682  */
710 struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items    683 struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items(struct v4l2_ctrl_handler *hdl,
711                                                   684                                                const struct v4l2_ctrl_ops *ops,
712                                                   685                                                u32 id, u8 max,
713                                                   686                                                u64 mask, u8 def,
714                                                   687                                                const char * const *qmenu);
715                                                   688 
716 /**                                               689 /**
717  * v4l2_ctrl_new_std_compound() - Allocate and    690  * v4l2_ctrl_new_std_compound() - Allocate and initialize a new standard V4L2
718  *      compound control.                         691  *      compound control.
719  *                                                692  *
720  * @hdl:       The control handler.               693  * @hdl:       The control handler.
721  * @ops:       The control ops.                   694  * @ops:       The control ops.
722  * @id:        The control ID.                    695  * @id:        The control ID.
723  * @p_def:     The control's default value.       696  * @p_def:     The control's default value.
724  *                                                697  *
725  * Sames as v4l2_ctrl_new_std(), but with supp    698  * Sames as v4l2_ctrl_new_std(), but with support to compound controls, thanks
726  * to the @p_def field. Use v4l2_ctrl_ptr_crea    699  * to the @p_def field. Use v4l2_ctrl_ptr_create() to create @p_def from a
727  * pointer. Use v4l2_ctrl_ptr_create(NULL) if     700  * pointer. Use v4l2_ctrl_ptr_create(NULL) if the default value of the
728  * compound control should be all zeroes.         701  * compound control should be all zeroes.
729  *                                                702  *
730  */                                               703  */
731 struct v4l2_ctrl *v4l2_ctrl_new_std_compound(s    704 struct v4l2_ctrl *v4l2_ctrl_new_std_compound(struct v4l2_ctrl_handler *hdl,
732                                              c    705                                              const struct v4l2_ctrl_ops *ops,
733                                              u    706                                              u32 id,
734                                              c    707                                              const union v4l2_ctrl_ptr p_def);
735                                                   708 
736 /**                                               709 /**
737  * v4l2_ctrl_new_int_menu() - Create a new sta    710  * v4l2_ctrl_new_int_menu() - Create a new standard V4L2 integer menu control.
738  *                                                711  *
739  * @hdl:        The control handler.              712  * @hdl:        The control handler.
740  * @ops:        The control ops.                  713  * @ops:        The control ops.
741  * @id: The control ID.                           714  * @id: The control ID.
742  * @max:        The control's maximum value.      715  * @max:        The control's maximum value.
743  * @def:        The control's default value.      716  * @def:        The control's default value.
744  * @qmenu_int:  The control's menu entries.       717  * @qmenu_int:  The control's menu entries.
745  *                                                718  *
746  * Same as v4l2_ctrl_new_std_menu(), but @mask    719  * Same as v4l2_ctrl_new_std_menu(), but @mask is set to 0 and it additionally
747  * takes as an argument an array of integers d    720  * takes as an argument an array of integers determining the menu items.
748  *                                                721  *
749  * If @id refers to a non-integer-menu control    722  * If @id refers to a non-integer-menu control, then this function will
750  * return %NULL.                                  723  * return %NULL.
751  */                                               724  */
752 struct v4l2_ctrl *v4l2_ctrl_new_int_menu(struc    725 struct v4l2_ctrl *v4l2_ctrl_new_int_menu(struct v4l2_ctrl_handler *hdl,
753                                          const    726                                          const struct v4l2_ctrl_ops *ops,
754                                          u32 i    727                                          u32 id, u8 max, u8 def,
755                                          const    728                                          const s64 *qmenu_int);
756                                                   729 
757 /**                                               730 /**
758  * typedef v4l2_ctrl_filter - Typedef to defin    731  * typedef v4l2_ctrl_filter - Typedef to define the filter function to be
759  *      used when adding a control handler.       732  *      used when adding a control handler.
760  *                                                733  *
761  * @ctrl: pointer to struct &v4l2_ctrl.           734  * @ctrl: pointer to struct &v4l2_ctrl.
762  */                                               735  */
763                                                   736 
764 typedef bool (*v4l2_ctrl_filter)(const struct     737 typedef bool (*v4l2_ctrl_filter)(const struct v4l2_ctrl *ctrl);
765                                                   738 
766 /**                                               739 /**
767  * v4l2_ctrl_add_handler() - Add all controls     740  * v4l2_ctrl_add_handler() - Add all controls from handler @add to
768  *      handler @hdl.                             741  *      handler @hdl.
769  *                                                742  *
770  * @hdl:        The control handler.              743  * @hdl:        The control handler.
771  * @add:        The control handler whose cont    744  * @add:        The control handler whose controls you want to add to
772  *              the @hdl control handler.         745  *              the @hdl control handler.
773  * @filter:     This function will filter whic    746  * @filter:     This function will filter which controls should be added.
774  * @from_other_dev: If true, then the controls    747  * @from_other_dev: If true, then the controls in @add were defined in another
775  *              device than @hdl.                 748  *              device than @hdl.
776  *                                                749  *
777  * Does nothing if either of the two handlers     750  * Does nothing if either of the two handlers is a NULL pointer.
778  * If @filter is NULL, then all controls are a    751  * If @filter is NULL, then all controls are added. Otherwise only those
779  * controls for which @filter returns true wil    752  * controls for which @filter returns true will be added.
780  * In case of an error @hdl->error will be set    753  * In case of an error @hdl->error will be set to the error code (if it
781  * wasn't set already).                           754  * wasn't set already).
782  */                                               755  */
783 int v4l2_ctrl_add_handler(struct v4l2_ctrl_han    756 int v4l2_ctrl_add_handler(struct v4l2_ctrl_handler *hdl,
784                           struct v4l2_ctrl_han    757                           struct v4l2_ctrl_handler *add,
785                           v4l2_ctrl_filter fil    758                           v4l2_ctrl_filter filter,
786                           bool from_other_dev)    759                           bool from_other_dev);
787                                                   760 
788 /**                                               761 /**
789  * v4l2_ctrl_radio_filter() - Standard filter     762  * v4l2_ctrl_radio_filter() - Standard filter for radio controls.
790  *                                                763  *
791  * @ctrl:       The control that is filtered.     764  * @ctrl:       The control that is filtered.
792  *                                                765  *
793  * This will return true for any controls that    766  * This will return true for any controls that are valid for radio device
794  * nodes. Those are all of the V4L2_CID_AUDIO_    767  * nodes. Those are all of the V4L2_CID_AUDIO_* user controls and all FM
795  * transmitter class controls.                    768  * transmitter class controls.
796  *                                                769  *
797  * This function is to be used with v4l2_ctrl_    770  * This function is to be used with v4l2_ctrl_add_handler().
798  */                                               771  */
799 bool v4l2_ctrl_radio_filter(const struct v4l2_    772 bool v4l2_ctrl_radio_filter(const struct v4l2_ctrl *ctrl);
800                                                   773 
801 /**                                               774 /**
802  * v4l2_ctrl_cluster() - Mark all controls in     775  * v4l2_ctrl_cluster() - Mark all controls in the cluster as belonging
803  *      to that cluster.                          776  *      to that cluster.
804  *                                                777  *
805  * @ncontrols:  The number of controls in this    778  * @ncontrols:  The number of controls in this cluster.
806  * @controls:   The cluster control array of s    779  * @controls:   The cluster control array of size @ncontrols.
807  */                                               780  */
808 void v4l2_ctrl_cluster(unsigned int ncontrols,    781 void v4l2_ctrl_cluster(unsigned int ncontrols, struct v4l2_ctrl **controls);
809                                                   782 
810                                                   783 
811 /**                                               784 /**
812  * v4l2_ctrl_auto_cluster() - Mark all control    785  * v4l2_ctrl_auto_cluster() - Mark all controls in the cluster as belonging
813  *      to that cluster and set it up for auto    786  *      to that cluster and set it up for autofoo/foo-type handling.
814  *                                                787  *
815  * @ncontrols:  The number of controls in this    788  * @ncontrols:  The number of controls in this cluster.
816  * @controls:   The cluster control array of s    789  * @controls:   The cluster control array of size @ncontrols. The first control
817  *              must be the 'auto' control (e.    790  *              must be the 'auto' control (e.g. autogain, autoexposure, etc.)
818  * @manual_val: The value for the first contro    791  * @manual_val: The value for the first control in the cluster that equals the
819  *              manual setting.                   792  *              manual setting.
820  * @set_volatile: If true, then all controls e    793  * @set_volatile: If true, then all controls except the first auto control will
821  *              be volatile.                      794  *              be volatile.
822  *                                                795  *
823  * Use for control groups where one control se    796  * Use for control groups where one control selects some automatic feature and
824  * the other controls are only active whenever    797  * the other controls are only active whenever the automatic feature is turned
825  * off (manual mode). Typical examples: autoga    798  * off (manual mode). Typical examples: autogain vs gain, auto-whitebalance vs
826  * red and blue balance, etc.                     799  * red and blue balance, etc.
827  *                                                800  *
828  * The behavior of such controls is as follows    801  * The behavior of such controls is as follows:
829  *                                                802  *
830  * When the autofoo control is set to automati    803  * When the autofoo control is set to automatic, then any manual controls
831  * are set to inactive and any reads will call    804  * are set to inactive and any reads will call g_volatile_ctrl (if the control
832  * was marked volatile).                          805  * was marked volatile).
833  *                                                806  *
834  * When the autofoo control is set to manual,     807  * When the autofoo control is set to manual, then any manual controls will
835  * be marked active, and any reads will just r    808  * be marked active, and any reads will just return the current value without
836  * going through g_volatile_ctrl.                 809  * going through g_volatile_ctrl.
837  *                                                810  *
838  * In addition, this function will set the %V4    811  * In addition, this function will set the %V4L2_CTRL_FLAG_UPDATE flag
839  * on the autofoo control and %V4L2_CTRL_FLAG_    812  * on the autofoo control and %V4L2_CTRL_FLAG_INACTIVE on the foo control(s)
840  * if autofoo is in auto mode.                    813  * if autofoo is in auto mode.
841  */                                               814  */
842 void v4l2_ctrl_auto_cluster(unsigned int ncont    815 void v4l2_ctrl_auto_cluster(unsigned int ncontrols,
843                             struct v4l2_ctrl *    816                             struct v4l2_ctrl **controls,
844                             u8 manual_val, boo    817                             u8 manual_val, bool set_volatile);
845                                                   818 
846                                                   819 
847 /**                                               820 /**
848  * v4l2_ctrl_find() - Find a control with the     821  * v4l2_ctrl_find() - Find a control with the given ID.
849  *                                                822  *
850  * @hdl:        The control handler.              823  * @hdl:        The control handler.
851  * @id: The control ID to find.                   824  * @id: The control ID to find.
852  *                                                825  *
853  * If @hdl == NULL this will return NULL as we    826  * If @hdl == NULL this will return NULL as well. Will lock the handler so
854  * do not use from inside &v4l2_ctrl_ops.         827  * do not use from inside &v4l2_ctrl_ops.
855  */                                               828  */
856 struct v4l2_ctrl *v4l2_ctrl_find(struct v4l2_c    829 struct v4l2_ctrl *v4l2_ctrl_find(struct v4l2_ctrl_handler *hdl, u32 id);
857                                                   830 
858 /**                                               831 /**
859  * v4l2_ctrl_activate() - Make the control act    832  * v4l2_ctrl_activate() - Make the control active or inactive.
860  * @ctrl:       The control to (de)activate.      833  * @ctrl:       The control to (de)activate.
861  * @active:     True if the control should bec    834  * @active:     True if the control should become active.
862  *                                                835  *
863  * This sets or clears the V4L2_CTRL_FLAG_INAC    836  * This sets or clears the V4L2_CTRL_FLAG_INACTIVE flag atomically.
864  * Does nothing if @ctrl == NULL.                 837  * Does nothing if @ctrl == NULL.
865  * This will usually be called from within the    838  * This will usually be called from within the s_ctrl op.
866  * The V4L2_EVENT_CTRL event will be generated    839  * The V4L2_EVENT_CTRL event will be generated afterwards.
867  *                                                840  *
868  * This function assumes that the control hand    841  * This function assumes that the control handler is locked.
869  */                                               842  */
870 void v4l2_ctrl_activate(struct v4l2_ctrl *ctrl    843 void v4l2_ctrl_activate(struct v4l2_ctrl *ctrl, bool active);
871                                                   844 
872 /**                                               845 /**
873  * __v4l2_ctrl_grab() - Unlocked variant of v4    846  * __v4l2_ctrl_grab() - Unlocked variant of v4l2_ctrl_grab.
874  *                                                847  *
875  * @ctrl:       The control to (de)activate.      848  * @ctrl:       The control to (de)activate.
876  * @grabbed:    True if the control should bec    849  * @grabbed:    True if the control should become grabbed.
877  *                                                850  *
878  * This sets or clears the V4L2_CTRL_FLAG_GRAB    851  * This sets or clears the V4L2_CTRL_FLAG_GRABBED flag atomically.
879  * Does nothing if @ctrl == NULL.                 852  * Does nothing if @ctrl == NULL.
880  * The V4L2_EVENT_CTRL event will be generated    853  * The V4L2_EVENT_CTRL event will be generated afterwards.
881  * This will usually be called when starting o    854  * This will usually be called when starting or stopping streaming in the
882  * driver.                                        855  * driver.
883  *                                                856  *
884  * This function assumes that the control hand    857  * This function assumes that the control handler is locked by the caller.
885  */                                               858  */
886 void __v4l2_ctrl_grab(struct v4l2_ctrl *ctrl,     859 void __v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed);
887                                                   860 
888 /**                                               861 /**
889  * v4l2_ctrl_grab() - Mark the control as grab    862  * v4l2_ctrl_grab() - Mark the control as grabbed or not grabbed.
890  *                                                863  *
891  * @ctrl:       The control to (de)activate.      864  * @ctrl:       The control to (de)activate.
892  * @grabbed:    True if the control should bec    865  * @grabbed:    True if the control should become grabbed.
893  *                                                866  *
894  * This sets or clears the V4L2_CTRL_FLAG_GRAB    867  * This sets or clears the V4L2_CTRL_FLAG_GRABBED flag atomically.
895  * Does nothing if @ctrl == NULL.                 868  * Does nothing if @ctrl == NULL.
896  * The V4L2_EVENT_CTRL event will be generated    869  * The V4L2_EVENT_CTRL event will be generated afterwards.
897  * This will usually be called when starting o    870  * This will usually be called when starting or stopping streaming in the
898  * driver.                                        871  * driver.
899  *                                                872  *
900  * This function assumes that the control hand    873  * This function assumes that the control handler is not locked and will
901  * take the lock itself.                          874  * take the lock itself.
902  */                                               875  */
903 static inline void v4l2_ctrl_grab(struct v4l2_    876 static inline void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed)
904 {                                                 877 {
905         if (!ctrl)                                878         if (!ctrl)
906                 return;                           879                 return;
907                                                   880 
908         v4l2_ctrl_lock(ctrl);                     881         v4l2_ctrl_lock(ctrl);
909         __v4l2_ctrl_grab(ctrl, grabbed);          882         __v4l2_ctrl_grab(ctrl, grabbed);
910         v4l2_ctrl_unlock(ctrl);                   883         v4l2_ctrl_unlock(ctrl);
911 }                                                 884 }
912                                                   885 
913 /**                                               886 /**
914  *__v4l2_ctrl_modify_range() - Unlocked varian    887  *__v4l2_ctrl_modify_range() - Unlocked variant of v4l2_ctrl_modify_range()
915  *                                                888  *
916  * @ctrl:       The control to update.            889  * @ctrl:       The control to update.
917  * @min:        The control's minimum value.      890  * @min:        The control's minimum value.
918  * @max:        The control's maximum value.      891  * @max:        The control's maximum value.
919  * @step:       The control's step value          892  * @step:       The control's step value
920  * @def:        The control's default value.      893  * @def:        The control's default value.
921  *                                                894  *
922  * Update the range of a control on the fly. T    895  * Update the range of a control on the fly. This works for control types
923  * INTEGER, BOOLEAN, MENU, INTEGER MENU and BI    896  * INTEGER, BOOLEAN, MENU, INTEGER MENU and BITMASK. For menu controls the
924  * @step value is interpreted as a menu_skip_m    897  * @step value is interpreted as a menu_skip_mask.
925  *                                                898  *
926  * An error is returned if one of the range ar    899  * An error is returned if one of the range arguments is invalid for this
927  * control type.                                  900  * control type.
928  *                                                901  *
929  * The caller is responsible for acquiring the    902  * The caller is responsible for acquiring the control handler mutex on behalf
930  * of __v4l2_ctrl_modify_range().                 903  * of __v4l2_ctrl_modify_range().
931  */                                               904  */
932 int __v4l2_ctrl_modify_range(struct v4l2_ctrl     905 int __v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl,
933                              s64 min, s64 max,    906                              s64 min, s64 max, u64 step, s64 def);
934                                                   907 
935 /**                                               908 /**
936  * v4l2_ctrl_modify_range() - Update the range    909  * v4l2_ctrl_modify_range() - Update the range of a control.
937  *                                                910  *
938  * @ctrl:       The control to update.            911  * @ctrl:       The control to update.
939  * @min:        The control's minimum value.      912  * @min:        The control's minimum value.
940  * @max:        The control's maximum value.      913  * @max:        The control's maximum value.
941  * @step:       The control's step value          914  * @step:       The control's step value
942  * @def:        The control's default value.      915  * @def:        The control's default value.
943  *                                                916  *
944  * Update the range of a control on the fly. T    917  * Update the range of a control on the fly. This works for control types
945  * INTEGER, BOOLEAN, MENU, INTEGER MENU and BI    918  * INTEGER, BOOLEAN, MENU, INTEGER MENU and BITMASK. For menu controls the
946  * @step value is interpreted as a menu_skip_m    919  * @step value is interpreted as a menu_skip_mask.
947  *                                                920  *
948  * An error is returned if one of the range ar    921  * An error is returned if one of the range arguments is invalid for this
949  * control type.                                  922  * control type.
950  *                                                923  *
951  * This function assumes that the control hand    924  * This function assumes that the control handler is not locked and will
952  * take the lock itself.                          925  * take the lock itself.
953  */                                               926  */
954 static inline int v4l2_ctrl_modify_range(struc    927 static inline int v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl,
955                                          s64 m    928                                          s64 min, s64 max, u64 step, s64 def)
956 {                                                 929 {
957         int rval;                                 930         int rval;
958                                                   931 
959         v4l2_ctrl_lock(ctrl);                     932         v4l2_ctrl_lock(ctrl);
960         rval = __v4l2_ctrl_modify_range(ctrl,     933         rval = __v4l2_ctrl_modify_range(ctrl, min, max, step, def);
961         v4l2_ctrl_unlock(ctrl);                   934         v4l2_ctrl_unlock(ctrl);
962                                                   935 
963         return rval;                              936         return rval;
964 }                                                 937 }
965                                                   938 
966 /**                                               939 /**
967  *__v4l2_ctrl_modify_dimensions() - Unlocked v << 
968  *                                             << 
969  * @ctrl:       The control to update.         << 
970  * @dims:       The control's new dimensions.  << 
971  *                                             << 
972  * Update the dimensions of an array control o << 
973  * array are reset to their default value, eve << 
974  * unchanged.                                  << 
975  *                                             << 
976  * An error is returned if @dims is invalid fo << 
977  *                                             << 
978  * The caller is responsible for acquiring the << 
979  * of __v4l2_ctrl_modify_dimensions().         << 
980  *                                             << 
981  * Note: calling this function when the same c << 
982  * is untested. It should work (a request with << 
983  * will drop that control silently), but it wi << 
984  */                                            << 
985 int __v4l2_ctrl_modify_dimensions(struct v4l2_ << 
986                                   u32 dims[V4L << 
987                                                << 
988 /**                                            << 
989  * v4l2_ctrl_modify_dimensions() - Update the  << 
990  *                                             << 
991  * @ctrl:       The control to update.         << 
992  * @dims:       The control's new dimensions.  << 
993  *                                             << 
994  * Update the dimensions of an array control o << 
995  * array are reset to their default value, eve << 
996  * unchanged.                                  << 
997  *                                             << 
998  * An error is returned if @dims is invalid fo << 
999  *                                             << 
1000  * This function assumes that the control han << 
1001  * take the lock itself.                      << 
1002  *                                            << 
1003  * Note: calling this function when the same  << 
1004  * is untested. It should work (a request wit << 
1005  * will drop that control silently), but it w << 
1006  */                                           << 
1007 static inline int v4l2_ctrl_modify_dimensions << 
1008                                               << 
1009 {                                             << 
1010         int rval;                             << 
1011                                               << 
1012         v4l2_ctrl_lock(ctrl);                 << 
1013         rval = __v4l2_ctrl_modify_dimensions( << 
1014         v4l2_ctrl_unlock(ctrl);               << 
1015                                               << 
1016         return rval;                          << 
1017 }                                             << 
1018                                               << 
1019 /**                                           << 
1020  * v4l2_ctrl_notify() - Function to set a not    940  * v4l2_ctrl_notify() - Function to set a notify callback for a control.
1021  *                                               941  *
1022  * @ctrl:       The control.                     942  * @ctrl:       The control.
1023  * @notify:     The callback function.           943  * @notify:     The callback function.
1024  * @priv:       The callback private handle,     944  * @priv:       The callback private handle, passed as argument to the callback.
1025  *                                               945  *
1026  * This function sets a callback function for    946  * This function sets a callback function for the control. If @ctrl is NULL,
1027  * then it will do nothing. If @notify is NUL    947  * then it will do nothing. If @notify is NULL, then the notify callback will
1028  * be removed.                                   948  * be removed.
1029  *                                               949  *
1030  * There can be only one notify. If another a    950  * There can be only one notify. If another already exists, then a WARN_ON
1031  * will be issued and the function will do no    951  * will be issued and the function will do nothing.
1032  */                                              952  */
1033 void v4l2_ctrl_notify(struct v4l2_ctrl *ctrl,    953 void v4l2_ctrl_notify(struct v4l2_ctrl *ctrl, v4l2_ctrl_notify_fnc notify,
1034                       void *priv);               954                       void *priv);
1035                                                  955 
1036 /**                                              956 /**
1037  * v4l2_ctrl_get_name() - Get the name of the    957  * v4l2_ctrl_get_name() - Get the name of the control
1038  *                                               958  *
1039  * @id:         The control ID.                  959  * @id:         The control ID.
1040  *                                               960  *
1041  * This function returns the name of the give    961  * This function returns the name of the given control ID or NULL if it isn't
1042  * a known control.                              962  * a known control.
1043  */                                              963  */
1044 const char *v4l2_ctrl_get_name(u32 id);          964 const char *v4l2_ctrl_get_name(u32 id);
1045                                                  965 
1046 /**                                              966 /**
1047  * v4l2_ctrl_get_menu() - Get the menu string    967  * v4l2_ctrl_get_menu() - Get the menu string array of the control
1048  *                                               968  *
1049  * @id:         The control ID.                  969  * @id:         The control ID.
1050  *                                               970  *
1051  * This function returns the NULL-terminated     971  * This function returns the NULL-terminated menu string array name of the
1052  * given control ID or NULL if it isn't a kno    972  * given control ID or NULL if it isn't a known menu control.
1053  */                                              973  */
1054 const char * const *v4l2_ctrl_get_menu(u32 id    974 const char * const *v4l2_ctrl_get_menu(u32 id);
1055                                                  975 
1056 /**                                              976 /**
1057  * v4l2_ctrl_get_int_menu() - Get the integer    977  * v4l2_ctrl_get_int_menu() - Get the integer menu array of the control
1058  *                                               978  *
1059  * @id:         The control ID.                  979  * @id:         The control ID.
1060  * @len:        The size of the integer array    980  * @len:        The size of the integer array.
1061  *                                               981  *
1062  * This function returns the integer array of    982  * This function returns the integer array of the given control ID or NULL if it
1063  * if it isn't a known integer menu control.     983  * if it isn't a known integer menu control.
1064  */                                              984  */
1065 const s64 *v4l2_ctrl_get_int_menu(u32 id, u32    985 const s64 *v4l2_ctrl_get_int_menu(u32 id, u32 *len);
1066                                                  986 
1067 /**                                              987 /**
1068  * v4l2_ctrl_g_ctrl() - Helper function to ge    988  * v4l2_ctrl_g_ctrl() - Helper function to get the control's value from
1069  *      within a driver.                         989  *      within a driver.
1070  *                                               990  *
1071  * @ctrl:       The control.                     991  * @ctrl:       The control.
1072  *                                               992  *
1073  * This returns the control's value safely by    993  * This returns the control's value safely by going through the control
1074  * framework. This function will lock the con    994  * framework. This function will lock the control's handler, so it cannot be
1075  * used from within the &v4l2_ctrl_ops functi    995  * used from within the &v4l2_ctrl_ops functions.
1076  *                                               996  *
1077  * This function is for integer type controls    997  * This function is for integer type controls only.
1078  */                                              998  */
1079 s32 v4l2_ctrl_g_ctrl(struct v4l2_ctrl *ctrl);    999 s32 v4l2_ctrl_g_ctrl(struct v4l2_ctrl *ctrl);
1080                                                  1000 
1081 /**                                              1001 /**
1082  * __v4l2_ctrl_s_ctrl() - Unlocked variant of    1002  * __v4l2_ctrl_s_ctrl() - Unlocked variant of v4l2_ctrl_s_ctrl().
1083  *                                               1003  *
1084  * @ctrl:       The control.                     1004  * @ctrl:       The control.
1085  * @val:        The new value.                   1005  * @val:        The new value.
1086  *                                               1006  *
1087  * This sets the control's new value safely b    1007  * This sets the control's new value safely by going through the control
1088  * framework. This function assumes the contr    1008  * framework. This function assumes the control's handler is already locked,
1089  * allowing it to be used from within the &v4    1009  * allowing it to be used from within the &v4l2_ctrl_ops functions.
1090  *                                               1010  *
1091  * This function is for integer type controls    1011  * This function is for integer type controls only.
1092  */                                              1012  */
1093 int __v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl    1013 int __v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val);
1094                                                  1014 
1095 /**                                              1015 /**
1096  * v4l2_ctrl_s_ctrl() - Helper function to se    1016  * v4l2_ctrl_s_ctrl() - Helper function to set the control's value from
1097  *      within a driver.                         1017  *      within a driver.
1098  * @ctrl:       The control.                     1018  * @ctrl:       The control.
1099  * @val:        The new value.                   1019  * @val:        The new value.
1100  *                                               1020  *
1101  * This sets the control's new value safely b    1021  * This sets the control's new value safely by going through the control
1102  * framework. This function will lock the con    1022  * framework. This function will lock the control's handler, so it cannot be
1103  * used from within the &v4l2_ctrl_ops functi    1023  * used from within the &v4l2_ctrl_ops functions.
1104  *                                               1024  *
1105  * This function is for integer type controls    1025  * This function is for integer type controls only.
1106  */                                              1026  */
1107 static inline int v4l2_ctrl_s_ctrl(struct v4l    1027 static inline int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val)
1108 {                                                1028 {
1109         int rval;                                1029         int rval;
1110                                                  1030 
1111         v4l2_ctrl_lock(ctrl);                    1031         v4l2_ctrl_lock(ctrl);
1112         rval = __v4l2_ctrl_s_ctrl(ctrl, val);    1032         rval = __v4l2_ctrl_s_ctrl(ctrl, val);
1113         v4l2_ctrl_unlock(ctrl);                  1033         v4l2_ctrl_unlock(ctrl);
1114                                                  1034 
1115         return rval;                             1035         return rval;
1116 }                                                1036 }
1117                                                  1037 
1118 /**                                              1038 /**
1119  * v4l2_ctrl_g_ctrl_int64() - Helper function    1039  * v4l2_ctrl_g_ctrl_int64() - Helper function to get a 64-bit control's value
1120  *      from within a driver.                    1040  *      from within a driver.
1121  *                                               1041  *
1122  * @ctrl:       The control.                     1042  * @ctrl:       The control.
1123  *                                               1043  *
1124  * This returns the control's value safely by    1044  * This returns the control's value safely by going through the control
1125  * framework. This function will lock the con    1045  * framework. This function will lock the control's handler, so it cannot be
1126  * used from within the &v4l2_ctrl_ops functi    1046  * used from within the &v4l2_ctrl_ops functions.
1127  *                                               1047  *
1128  * This function is for 64-bit integer type c    1048  * This function is for 64-bit integer type controls only.
1129  */                                              1049  */
1130 s64 v4l2_ctrl_g_ctrl_int64(struct v4l2_ctrl *    1050 s64 v4l2_ctrl_g_ctrl_int64(struct v4l2_ctrl *ctrl);
1131                                                  1051 
1132 /**                                              1052 /**
1133  * __v4l2_ctrl_s_ctrl_int64() - Unlocked vari    1053  * __v4l2_ctrl_s_ctrl_int64() - Unlocked variant of v4l2_ctrl_s_ctrl_int64().
1134  *                                               1054  *
1135  * @ctrl:       The control.                     1055  * @ctrl:       The control.
1136  * @val:        The new value.                   1056  * @val:        The new value.
1137  *                                               1057  *
1138  * This sets the control's new value safely b    1058  * This sets the control's new value safely by going through the control
1139  * framework. This function assumes the contr    1059  * framework. This function assumes the control's handler is already locked,
1140  * allowing it to be used from within the &v4    1060  * allowing it to be used from within the &v4l2_ctrl_ops functions.
1141  *                                               1061  *
1142  * This function is for 64-bit integer type c    1062  * This function is for 64-bit integer type controls only.
1143  */                                              1063  */
1144 int __v4l2_ctrl_s_ctrl_int64(struct v4l2_ctrl    1064 int __v4l2_ctrl_s_ctrl_int64(struct v4l2_ctrl *ctrl, s64 val);
1145                                                  1065 
1146 /**                                              1066 /**
1147  * v4l2_ctrl_s_ctrl_int64() - Helper function    1067  * v4l2_ctrl_s_ctrl_int64() - Helper function to set a 64-bit control's value
1148  *      from within a driver.                    1068  *      from within a driver.
1149  *                                               1069  *
1150  * @ctrl:       The control.                     1070  * @ctrl:       The control.
1151  * @val:        The new value.                   1071  * @val:        The new value.
1152  *                                               1072  *
1153  * This sets the control's new value safely b    1073  * This sets the control's new value safely by going through the control
1154  * framework. This function will lock the con    1074  * framework. This function will lock the control's handler, so it cannot be
1155  * used from within the &v4l2_ctrl_ops functi    1075  * used from within the &v4l2_ctrl_ops functions.
1156  *                                               1076  *
1157  * This function is for 64-bit integer type c    1077  * This function is for 64-bit integer type controls only.
1158  */                                              1078  */
1159 static inline int v4l2_ctrl_s_ctrl_int64(stru    1079 static inline int v4l2_ctrl_s_ctrl_int64(struct v4l2_ctrl *ctrl, s64 val)
1160 {                                                1080 {
1161         int rval;                                1081         int rval;
1162                                                  1082 
1163         v4l2_ctrl_lock(ctrl);                    1083         v4l2_ctrl_lock(ctrl);
1164         rval = __v4l2_ctrl_s_ctrl_int64(ctrl,    1084         rval = __v4l2_ctrl_s_ctrl_int64(ctrl, val);
1165         v4l2_ctrl_unlock(ctrl);                  1085         v4l2_ctrl_unlock(ctrl);
1166                                                  1086 
1167         return rval;                             1087         return rval;
1168 }                                                1088 }
1169                                                  1089 
1170 /**                                              1090 /**
1171  * __v4l2_ctrl_s_ctrl_string() - Unlocked var    1091  * __v4l2_ctrl_s_ctrl_string() - Unlocked variant of v4l2_ctrl_s_ctrl_string().
1172  *                                               1092  *
1173  * @ctrl:       The control.                     1093  * @ctrl:       The control.
1174  * @s:          The new string.                  1094  * @s:          The new string.
1175  *                                               1095  *
1176  * This sets the control's new string safely     1096  * This sets the control's new string safely by going through the control
1177  * framework. This function assumes the contr    1097  * framework. This function assumes the control's handler is already locked,
1178  * allowing it to be used from within the &v4    1098  * allowing it to be used from within the &v4l2_ctrl_ops functions.
1179  *                                               1099  *
1180  * This function is for string type controls     1100  * This function is for string type controls only.
1181  */                                              1101  */
1182 int __v4l2_ctrl_s_ctrl_string(struct v4l2_ctr    1102 int __v4l2_ctrl_s_ctrl_string(struct v4l2_ctrl *ctrl, const char *s);
1183                                                  1103 
1184 /**                                              1104 /**
1185  * v4l2_ctrl_s_ctrl_string() - Helper functio    1105  * v4l2_ctrl_s_ctrl_string() - Helper function to set a control's string value
1186  *       from within a driver.                   1106  *       from within a driver.
1187  *                                               1107  *
1188  * @ctrl:       The control.                     1108  * @ctrl:       The control.
1189  * @s:          The new string.                  1109  * @s:          The new string.
1190  *                                               1110  *
1191  * This sets the control's new string safely     1111  * This sets the control's new string safely by going through the control
1192  * framework. This function will lock the con    1112  * framework. This function will lock the control's handler, so it cannot be
1193  * used from within the &v4l2_ctrl_ops functi    1113  * used from within the &v4l2_ctrl_ops functions.
1194  *                                               1114  *
1195  * This function is for string type controls     1115  * This function is for string type controls only.
1196  */                                              1116  */
1197 static inline int v4l2_ctrl_s_ctrl_string(str    1117 static inline int v4l2_ctrl_s_ctrl_string(struct v4l2_ctrl *ctrl, const char *s)
1198 {                                                1118 {
1199         int rval;                                1119         int rval;
1200                                                  1120 
1201         v4l2_ctrl_lock(ctrl);                    1121         v4l2_ctrl_lock(ctrl);
1202         rval = __v4l2_ctrl_s_ctrl_string(ctrl    1122         rval = __v4l2_ctrl_s_ctrl_string(ctrl, s);
1203         v4l2_ctrl_unlock(ctrl);                  1123         v4l2_ctrl_unlock(ctrl);
1204                                                  1124 
1205         return rval;                             1125         return rval;
1206 }                                                1126 }
1207                                                  1127 
1208 /**                                              1128 /**
1209  * __v4l2_ctrl_s_ctrl_compound() - Unlocked v    1129  * __v4l2_ctrl_s_ctrl_compound() - Unlocked variant to set a compound control
1210  *                                               1130  *
1211  * @ctrl: The control.                           1131  * @ctrl: The control.
1212  * @type: The type of the data.                  1132  * @type: The type of the data.
1213  * @p:    The new compound payload.              1133  * @p:    The new compound payload.
1214  *                                               1134  *
1215  * This sets the control's new compound paylo    1135  * This sets the control's new compound payload safely by going through the
1216  * control framework. This function assumes t    1136  * control framework. This function assumes the control's handler is already
1217  * locked, allowing it to be used from within    1137  * locked, allowing it to be used from within the &v4l2_ctrl_ops functions.
1218  *                                               1138  *
1219  * This function is for compound type control    1139  * This function is for compound type controls only.
1220  */                                              1140  */
1221 int __v4l2_ctrl_s_ctrl_compound(struct v4l2_c    1141 int __v4l2_ctrl_s_ctrl_compound(struct v4l2_ctrl *ctrl,
1222                                 enum v4l2_ctr    1142                                 enum v4l2_ctrl_type type, const void *p);
1223                                                  1143 
1224 /**                                              1144 /**
1225  * v4l2_ctrl_s_ctrl_compound() - Helper funct    1145  * v4l2_ctrl_s_ctrl_compound() - Helper function to set a compound control
1226  *      from within a driver.                    1146  *      from within a driver.
1227  *                                               1147  *
1228  * @ctrl: The control.                           1148  * @ctrl: The control.
1229  * @type: The type of the data.                  1149  * @type: The type of the data.
1230  * @p:    The new compound payload.              1150  * @p:    The new compound payload.
1231  *                                               1151  *
1232  * This sets the control's new compound paylo    1152  * This sets the control's new compound payload safely by going through the
1233  * control framework. This function will lock    1153  * control framework. This function will lock the control's handler, so it
1234  * cannot be used from within the &v4l2_ctrl_    1154  * cannot be used from within the &v4l2_ctrl_ops functions.
1235  *                                               1155  *
1236  * This function is for compound type control    1156  * This function is for compound type controls only.
1237  */                                              1157  */
1238 static inline int v4l2_ctrl_s_ctrl_compound(s    1158 static inline int v4l2_ctrl_s_ctrl_compound(struct v4l2_ctrl *ctrl,
1239                                             e    1159                                             enum v4l2_ctrl_type type,
1240                                             c    1160                                             const void *p)
1241 {                                                1161 {
1242         int rval;                                1162         int rval;
1243                                                  1163 
1244         v4l2_ctrl_lock(ctrl);                    1164         v4l2_ctrl_lock(ctrl);
1245         rval = __v4l2_ctrl_s_ctrl_compound(ct    1165         rval = __v4l2_ctrl_s_ctrl_compound(ctrl, type, p);
1246         v4l2_ctrl_unlock(ctrl);                  1166         v4l2_ctrl_unlock(ctrl);
1247                                                  1167 
1248         return rval;                             1168         return rval;
1249 }                                                1169 }
1250                                                  1170 
1251 /* Helper defines for area type controls */      1171 /* Helper defines for area type controls */
1252 #define __v4l2_ctrl_s_ctrl_area(ctrl, area) \    1172 #define __v4l2_ctrl_s_ctrl_area(ctrl, area) \
1253         __v4l2_ctrl_s_ctrl_compound((ctrl), V    1173         __v4l2_ctrl_s_ctrl_compound((ctrl), V4L2_CTRL_TYPE_AREA, (area))
1254 #define v4l2_ctrl_s_ctrl_area(ctrl, area) \      1174 #define v4l2_ctrl_s_ctrl_area(ctrl, area) \
1255         v4l2_ctrl_s_ctrl_compound((ctrl), V4L    1175         v4l2_ctrl_s_ctrl_compound((ctrl), V4L2_CTRL_TYPE_AREA, (area))
1256                                                  1176 
1257 /* Internal helper functions that deal with c    1177 /* Internal helper functions that deal with control events. */
1258 extern const struct v4l2_subscribed_event_ops    1178 extern const struct v4l2_subscribed_event_ops v4l2_ctrl_sub_ev_ops;
1259                                                  1179 
1260 /**                                              1180 /**
1261  * v4l2_ctrl_replace - Function to be used as    1181  * v4l2_ctrl_replace - Function to be used as a callback to
1262  *      &struct v4l2_subscribed_event_ops rep    1182  *      &struct v4l2_subscribed_event_ops replace\(\)
1263  *                                               1183  *
1264  * @old: pointer to struct &v4l2_event with t    1184  * @old: pointer to struct &v4l2_event with the reported
1265  *       event;                                  1185  *       event;
1266  * @new: pointer to struct &v4l2_event with t    1186  * @new: pointer to struct &v4l2_event with the modified
1267  *       event;                                  1187  *       event;
1268  */                                              1188  */
1269 void v4l2_ctrl_replace(struct v4l2_event *old    1189 void v4l2_ctrl_replace(struct v4l2_event *old, const struct v4l2_event *new);
1270                                                  1190 
1271 /**                                              1191 /**
1272  * v4l2_ctrl_merge - Function to be used as a    1192  * v4l2_ctrl_merge - Function to be used as a callback to
1273  *      &struct v4l2_subscribed_event_ops mer    1193  *      &struct v4l2_subscribed_event_ops merge(\)
1274  *                                               1194  *
1275  * @old: pointer to struct &v4l2_event with t    1195  * @old: pointer to struct &v4l2_event with the reported
1276  *       event;                                  1196  *       event;
1277  * @new: pointer to struct &v4l2_event with t    1197  * @new: pointer to struct &v4l2_event with the merged
1278  *       event;                                  1198  *       event;
1279  */                                              1199  */
1280 void v4l2_ctrl_merge(const struct v4l2_event     1200 void v4l2_ctrl_merge(const struct v4l2_event *old, struct v4l2_event *new);
1281                                                  1201 
1282 /**                                              1202 /**
1283  * v4l2_ctrl_log_status - helper function to     1203  * v4l2_ctrl_log_status - helper function to implement %VIDIOC_LOG_STATUS ioctl
1284  *                                               1204  *
1285  * @file: pointer to struct file                 1205  * @file: pointer to struct file
1286  * @fh: unused. Kept just to be compatible to    1206  * @fh: unused. Kept just to be compatible to the arguments expected by
1287  *      &struct v4l2_ioctl_ops.vidioc_log_sta    1207  *      &struct v4l2_ioctl_ops.vidioc_log_status.
1288  *                                               1208  *
1289  * Can be used as a vidioc_log_status functio    1209  * Can be used as a vidioc_log_status function that just dumps all controls
1290  * associated with the filehandle.               1210  * associated with the filehandle.
1291  */                                              1211  */
1292 int v4l2_ctrl_log_status(struct file *file, v    1212 int v4l2_ctrl_log_status(struct file *file, void *fh);
1293                                                  1213 
1294 /**                                              1214 /**
1295  * v4l2_ctrl_subscribe_event - Subscribes to     1215  * v4l2_ctrl_subscribe_event - Subscribes to an event
1296  *                                               1216  *
1297  *                                               1217  *
1298  * @fh: pointer to struct v4l2_fh                1218  * @fh: pointer to struct v4l2_fh
1299  * @sub: pointer to &struct v4l2_event_subscr    1219  * @sub: pointer to &struct v4l2_event_subscription
1300  *                                               1220  *
1301  * Can be used as a vidioc_subscribe_event fu    1221  * Can be used as a vidioc_subscribe_event function that just subscribes
1302  * control events.                               1222  * control events.
1303  */                                              1223  */
1304 int v4l2_ctrl_subscribe_event(struct v4l2_fh     1224 int v4l2_ctrl_subscribe_event(struct v4l2_fh *fh,
1305                                 const struct     1225                                 const struct v4l2_event_subscription *sub);
1306                                                  1226 
1307 /**                                              1227 /**
1308  * v4l2_ctrl_poll - function to be used as a     1228  * v4l2_ctrl_poll - function to be used as a callback to the poll()
1309  *      That just polls for control events.      1229  *      That just polls for control events.
1310  *                                               1230  *
1311  * @file: pointer to struct file                 1231  * @file: pointer to struct file
1312  * @wait: pointer to struct poll_table_struct    1232  * @wait: pointer to struct poll_table_struct
1313  */                                              1233  */
1314 __poll_t v4l2_ctrl_poll(struct file *file, st    1234 __poll_t v4l2_ctrl_poll(struct file *file, struct poll_table_struct *wait);
1315                                                  1235 
1316 /**                                              1236 /**
1317  * v4l2_ctrl_request_setup - helper function     1237  * v4l2_ctrl_request_setup - helper function to apply control values in a request
1318  *                                               1238  *
1319  * @req: The request                             1239  * @req: The request
1320  * @parent: The parent control handler ('priv    1240  * @parent: The parent control handler ('priv' in media_request_object_find())
1321  *                                               1241  *
1322  * This is a helper function to call the cont    1242  * This is a helper function to call the control handler's s_ctrl callback with
1323  * the control values contained in the reques    1243  * the control values contained in the request. Do note that this approach of
1324  * applying control values in a request is on    1244  * applying control values in a request is only applicable to memory-to-memory
1325  * devices.                                      1245  * devices.
1326  */                                              1246  */
1327 int v4l2_ctrl_request_setup(struct media_requ    1247 int v4l2_ctrl_request_setup(struct media_request *req,
1328                              struct v4l2_ctrl    1248                              struct v4l2_ctrl_handler *parent);
1329                                                  1249 
1330 /**                                              1250 /**
1331  * v4l2_ctrl_request_complete - Complete a co    1251  * v4l2_ctrl_request_complete - Complete a control handler request object
1332  *                                               1252  *
1333  * @req: The request                             1253  * @req: The request
1334  * @parent: The parent control handler ('priv    1254  * @parent: The parent control handler ('priv' in media_request_object_find())
1335  *                                               1255  *
1336  * This function is to be called on each cont    1256  * This function is to be called on each control handler that may have had a
1337  * request object associated with it, i.e. co    1257  * request object associated with it, i.e. control handlers of a driver that
1338  * supports requests.                            1258  * supports requests.
1339  *                                               1259  *
1340  * The function first obtains the values of a    1260  * The function first obtains the values of any volatile controls in the control
1341  * handler and attach them to the request. Th    1261  * handler and attach them to the request. Then, the function completes the
1342  * request object.                               1262  * request object.
1343  */                                              1263  */
1344 void v4l2_ctrl_request_complete(struct media_    1264 void v4l2_ctrl_request_complete(struct media_request *req,
1345                                 struct v4l2_c    1265                                 struct v4l2_ctrl_handler *parent);
1346                                                  1266 
1347 /**                                              1267 /**
1348  * v4l2_ctrl_request_hdl_find - Find the cont    1268  * v4l2_ctrl_request_hdl_find - Find the control handler in the request
1349  *                                               1269  *
1350  * @req: The request                             1270  * @req: The request
1351  * @parent: The parent control handler ('priv    1271  * @parent: The parent control handler ('priv' in media_request_object_find())
1352  *                                               1272  *
1353  * This function finds the control handler in    1273  * This function finds the control handler in the request. It may return
1354  * NULL if not found. When done, you must cal !! 1274  * NULL if not found. When done, you must call v4l2_ctrl_request_put_hdl()
1355  * with the returned handler pointer.            1275  * with the returned handler pointer.
1356  *                                               1276  *
1357  * If the request is not in state VALIDATING     1277  * If the request is not in state VALIDATING or QUEUED, then this function
1358  * will always return NULL.                      1278  * will always return NULL.
1359  *                                               1279  *
1360  * Note that in state VALIDATING the req_queu    1280  * Note that in state VALIDATING the req_queue_mutex is held, so
1361  * no objects can be added or deleted from th    1281  * no objects can be added or deleted from the request.
1362  *                                               1282  *
1363  * In state QUEUED it is the driver that will    1283  * In state QUEUED it is the driver that will have to ensure this.
1364  */                                              1284  */
1365 struct v4l2_ctrl_handler *v4l2_ctrl_request_h    1285 struct v4l2_ctrl_handler *v4l2_ctrl_request_hdl_find(struct media_request *req,
1366                                         struc    1286                                         struct v4l2_ctrl_handler *parent);
1367                                                  1287 
1368 /**                                              1288 /**
1369  * v4l2_ctrl_request_hdl_put - Put the contro    1289  * v4l2_ctrl_request_hdl_put - Put the control handler
1370  *                                               1290  *
1371  * @hdl: Put this control handler                1291  * @hdl: Put this control handler
1372  *                                               1292  *
1373  * This function released the control handler    1293  * This function released the control handler previously obtained from'
1374  * v4l2_ctrl_request_hdl_find().                 1294  * v4l2_ctrl_request_hdl_find().
1375  */                                              1295  */
1376 static inline void v4l2_ctrl_request_hdl_put(    1296 static inline void v4l2_ctrl_request_hdl_put(struct v4l2_ctrl_handler *hdl)
1377 {                                                1297 {
1378         if (hdl)                                 1298         if (hdl)
1379                 media_request_object_put(&hdl    1299                 media_request_object_put(&hdl->req_obj);
1380 }                                                1300 }
1381                                                  1301 
1382 /**                                              1302 /**
1383  * v4l2_ctrl_request_hdl_ctrl_find() - Find a    1303  * v4l2_ctrl_request_hdl_ctrl_find() - Find a control with the given ID.
1384  *                                               1304  *
1385  * @hdl: The control handler from the request    1305  * @hdl: The control handler from the request.
1386  * @id: The ID of the control to find.           1306  * @id: The ID of the control to find.
1387  *                                               1307  *
1388  * This function returns a pointer to the con    1308  * This function returns a pointer to the control if this control is
1389  * part of the request or NULL otherwise.        1309  * part of the request or NULL otherwise.
1390  */                                              1310  */
1391 struct v4l2_ctrl *                               1311 struct v4l2_ctrl *
1392 v4l2_ctrl_request_hdl_ctrl_find(struct v4l2_c    1312 v4l2_ctrl_request_hdl_ctrl_find(struct v4l2_ctrl_handler *hdl, u32 id);
1393                                                  1313 
1394 /* Helpers for ioctl_ops */                      1314 /* Helpers for ioctl_ops */
1395                                                  1315 
1396 /**                                              1316 /**
1397  * v4l2_queryctrl - Helper function to implem    1317  * v4l2_queryctrl - Helper function to implement
1398  *      :ref:`VIDIOC_QUERYCTRL <vidioc_queryc    1318  *      :ref:`VIDIOC_QUERYCTRL <vidioc_queryctrl>` ioctl
1399  *                                               1319  *
1400  * @hdl: pointer to &struct v4l2_ctrl_handler    1320  * @hdl: pointer to &struct v4l2_ctrl_handler
1401  * @qc: pointer to &struct v4l2_queryctrl        1321  * @qc: pointer to &struct v4l2_queryctrl
1402  *                                               1322  *
1403  * If hdl == NULL then they will all return -    1323  * If hdl == NULL then they will all return -EINVAL.
1404  */                                              1324  */
1405 int v4l2_queryctrl(struct v4l2_ctrl_handler *    1325 int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc);
1406                                                  1326 
1407 /**                                              1327 /**
1408  * v4l2_query_ext_ctrl - Helper function to i    1328  * v4l2_query_ext_ctrl - Helper function to implement
1409  *       :ref:`VIDIOC_QUERY_EXT_CTRL <vidioc_    1329  *       :ref:`VIDIOC_QUERY_EXT_CTRL <vidioc_queryctrl>` ioctl
1410  *                                               1330  *
1411  * @hdl: pointer to &struct v4l2_ctrl_handler    1331  * @hdl: pointer to &struct v4l2_ctrl_handler
1412  * @qc: pointer to &struct v4l2_query_ext_ctr    1332  * @qc: pointer to &struct v4l2_query_ext_ctrl
1413  *                                               1333  *
1414  * If hdl == NULL then they will all return -    1334  * If hdl == NULL then they will all return -EINVAL.
1415  */                                              1335  */
1416 int v4l2_query_ext_ctrl(struct v4l2_ctrl_hand    1336 int v4l2_query_ext_ctrl(struct v4l2_ctrl_handler *hdl,
1417                         struct v4l2_query_ext    1337                         struct v4l2_query_ext_ctrl *qc);
1418                                                  1338 
1419 /**                                              1339 /**
1420  * v4l2_querymenu - Helper function to implem    1340  * v4l2_querymenu - Helper function to implement
1421  *      :ref:`VIDIOC_QUERYMENU <vidioc_queryc    1341  *      :ref:`VIDIOC_QUERYMENU <vidioc_queryctrl>` ioctl
1422  *                                               1342  *
1423  * @hdl: pointer to &struct v4l2_ctrl_handler    1343  * @hdl: pointer to &struct v4l2_ctrl_handler
1424  * @qm: pointer to &struct v4l2_querymenu        1344  * @qm: pointer to &struct v4l2_querymenu
1425  *                                               1345  *
1426  * If hdl == NULL then they will all return -    1346  * If hdl == NULL then they will all return -EINVAL.
1427  */                                              1347  */
1428 int v4l2_querymenu(struct v4l2_ctrl_handler *    1348 int v4l2_querymenu(struct v4l2_ctrl_handler *hdl, struct v4l2_querymenu *qm);
1429                                                  1349 
1430 /**                                              1350 /**
1431  * v4l2_g_ctrl - Helper function to implement    1351  * v4l2_g_ctrl - Helper function to implement
1432  *      :ref:`VIDIOC_G_CTRL <vidioc_g_ctrl>`     1352  *      :ref:`VIDIOC_G_CTRL <vidioc_g_ctrl>` ioctl
1433  *                                               1353  *
1434  * @hdl: pointer to &struct v4l2_ctrl_handler    1354  * @hdl: pointer to &struct v4l2_ctrl_handler
1435  * @ctrl: pointer to &struct v4l2_control        1355  * @ctrl: pointer to &struct v4l2_control
1436  *                                               1356  *
1437  * If hdl == NULL then they will all return -    1357  * If hdl == NULL then they will all return -EINVAL.
1438  */                                              1358  */
1439 int v4l2_g_ctrl(struct v4l2_ctrl_handler *hdl    1359 int v4l2_g_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_control *ctrl);
1440                                                  1360 
1441 /**                                              1361 /**
1442  * v4l2_s_ctrl - Helper function to implement    1362  * v4l2_s_ctrl - Helper function to implement
1443  *      :ref:`VIDIOC_S_CTRL <vidioc_g_ctrl>`     1363  *      :ref:`VIDIOC_S_CTRL <vidioc_g_ctrl>` ioctl
1444  *                                               1364  *
1445  * @fh: pointer to &struct v4l2_fh               1365  * @fh: pointer to &struct v4l2_fh
1446  * @hdl: pointer to &struct v4l2_ctrl_handler    1366  * @hdl: pointer to &struct v4l2_ctrl_handler
1447  *                                               1367  *
1448  * @ctrl: pointer to &struct v4l2_control        1368  * @ctrl: pointer to &struct v4l2_control
1449  *                                               1369  *
1450  * If hdl == NULL then they will all return -    1370  * If hdl == NULL then they will all return -EINVAL.
1451  */                                              1371  */
1452 int v4l2_s_ctrl(struct v4l2_fh *fh, struct v4    1372 int v4l2_s_ctrl(struct v4l2_fh *fh, struct v4l2_ctrl_handler *hdl,
1453                 struct v4l2_control *ctrl);      1373                 struct v4l2_control *ctrl);
1454                                                  1374 
1455 /**                                              1375 /**
1456  * v4l2_g_ext_ctrls - Helper function to impl    1376  * v4l2_g_ext_ctrls - Helper function to implement
1457  *      :ref:`VIDIOC_G_EXT_CTRLS <vidioc_g_ex    1377  *      :ref:`VIDIOC_G_EXT_CTRLS <vidioc_g_ext_ctrls>` ioctl
1458  *                                               1378  *
1459  * @hdl: pointer to &struct v4l2_ctrl_handler    1379  * @hdl: pointer to &struct v4l2_ctrl_handler
1460  * @vdev: pointer to &struct video_device        1380  * @vdev: pointer to &struct video_device
1461  * @mdev: pointer to &struct media_device        1381  * @mdev: pointer to &struct media_device
1462  * @c: pointer to &struct v4l2_ext_controls      1382  * @c: pointer to &struct v4l2_ext_controls
1463  *                                               1383  *
1464  * If hdl == NULL then they will all return -    1384  * If hdl == NULL then they will all return -EINVAL.
1465  */                                              1385  */
1466 int v4l2_g_ext_ctrls(struct v4l2_ctrl_handler    1386 int v4l2_g_ext_ctrls(struct v4l2_ctrl_handler *hdl, struct video_device *vdev,
1467                      struct media_device *mde    1387                      struct media_device *mdev, struct v4l2_ext_controls *c);
1468                                                  1388 
1469 /**                                              1389 /**
1470  * v4l2_try_ext_ctrls - Helper function to im    1390  * v4l2_try_ext_ctrls - Helper function to implement
1471  *      :ref:`VIDIOC_TRY_EXT_CTRLS <vidioc_g_    1391  *      :ref:`VIDIOC_TRY_EXT_CTRLS <vidioc_g_ext_ctrls>` ioctl
1472  *                                               1392  *
1473  * @hdl: pointer to &struct v4l2_ctrl_handler    1393  * @hdl: pointer to &struct v4l2_ctrl_handler
1474  * @vdev: pointer to &struct video_device        1394  * @vdev: pointer to &struct video_device
1475  * @mdev: pointer to &struct media_device        1395  * @mdev: pointer to &struct media_device
1476  * @c: pointer to &struct v4l2_ext_controls      1396  * @c: pointer to &struct v4l2_ext_controls
1477  *                                               1397  *
1478  * If hdl == NULL then they will all return -    1398  * If hdl == NULL then they will all return -EINVAL.
1479  */                                              1399  */
1480 int v4l2_try_ext_ctrls(struct v4l2_ctrl_handl    1400 int v4l2_try_ext_ctrls(struct v4l2_ctrl_handler *hdl,
1481                        struct video_device *v    1401                        struct video_device *vdev,
1482                        struct media_device *m    1402                        struct media_device *mdev,
1483                        struct v4l2_ext_contro    1403                        struct v4l2_ext_controls *c);
1484                                                  1404 
1485 /**                                              1405 /**
1486  * v4l2_s_ext_ctrls - Helper function to impl    1406  * v4l2_s_ext_ctrls - Helper function to implement
1487  *      :ref:`VIDIOC_S_EXT_CTRLS <vidioc_g_ex    1407  *      :ref:`VIDIOC_S_EXT_CTRLS <vidioc_g_ext_ctrls>` ioctl
1488  *                                               1408  *
1489  * @fh: pointer to &struct v4l2_fh               1409  * @fh: pointer to &struct v4l2_fh
1490  * @hdl: pointer to &struct v4l2_ctrl_handler    1410  * @hdl: pointer to &struct v4l2_ctrl_handler
1491  * @vdev: pointer to &struct video_device        1411  * @vdev: pointer to &struct video_device
1492  * @mdev: pointer to &struct media_device        1412  * @mdev: pointer to &struct media_device
1493  * @c: pointer to &struct v4l2_ext_controls      1413  * @c: pointer to &struct v4l2_ext_controls
1494  *                                               1414  *
1495  * If hdl == NULL then they will all return -    1415  * If hdl == NULL then they will all return -EINVAL.
1496  */                                              1416  */
1497 int v4l2_s_ext_ctrls(struct v4l2_fh *fh, stru    1417 int v4l2_s_ext_ctrls(struct v4l2_fh *fh, struct v4l2_ctrl_handler *hdl,
1498                      struct video_device *vde    1418                      struct video_device *vdev,
1499                      struct media_device *mde    1419                      struct media_device *mdev,
1500                      struct v4l2_ext_controls    1420                      struct v4l2_ext_controls *c);
1501                                                  1421 
1502 /**                                              1422 /**
1503  * v4l2_ctrl_subdev_subscribe_event - Helper     1423  * v4l2_ctrl_subdev_subscribe_event - Helper function to implement
1504  *      as a &struct v4l2_subdev_core_ops sub    1424  *      as a &struct v4l2_subdev_core_ops subscribe_event function
1505  *      that just subscribes control events.     1425  *      that just subscribes control events.
1506  *                                               1426  *
1507  * @sd: pointer to &struct v4l2_subdev           1427  * @sd: pointer to &struct v4l2_subdev
1508  * @fh: pointer to &struct v4l2_fh               1428  * @fh: pointer to &struct v4l2_fh
1509  * @sub: pointer to &struct v4l2_event_subscr    1429  * @sub: pointer to &struct v4l2_event_subscription
1510  */                                              1430  */
1511 int v4l2_ctrl_subdev_subscribe_event(struct v    1431 int v4l2_ctrl_subdev_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,
1512                                      struct v    1432                                      struct v4l2_event_subscription *sub);
1513                                                  1433 
1514 /**                                              1434 /**
1515  * v4l2_ctrl_subdev_log_status - Log all cont    1435  * v4l2_ctrl_subdev_log_status - Log all controls owned by subdev's control
1516  *       handler.                                1436  *       handler.
1517  *                                               1437  *
1518  * @sd: pointer to &struct v4l2_subdev           1438  * @sd: pointer to &struct v4l2_subdev
1519  */                                              1439  */
1520 int v4l2_ctrl_subdev_log_status(struct v4l2_s    1440 int v4l2_ctrl_subdev_log_status(struct v4l2_subdev *sd);
1521                                                  1441 
1522 /**                                              1442 /**
1523  * v4l2_ctrl_new_fwnode_properties() - Regist    1443  * v4l2_ctrl_new_fwnode_properties() - Register controls for the device
1524  *                                     proper    1444  *                                     properties
1525  *                                               1445  *
1526  * @hdl: pointer to &struct v4l2_ctrl_handler    1446  * @hdl: pointer to &struct v4l2_ctrl_handler to register controls on
1527  * @ctrl_ops: pointer to &struct v4l2_ctrl_op    1447  * @ctrl_ops: pointer to &struct v4l2_ctrl_ops to register controls with
1528  * @p: pointer to &struct v4l2_fwnode_device_    1448  * @p: pointer to &struct v4l2_fwnode_device_properties
1529  *                                               1449  *
1530  * This function registers controls associate    1450  * This function registers controls associated to device properties, using the
1531  * property values contained in @p parameter,    1451  * property values contained in @p parameter, if the property has been set to
1532  * a value.                                      1452  * a value.
1533  *                                               1453  *
1534  * Currently the following v4l2 controls are     1454  * Currently the following v4l2 controls are parsed and registered:
1535  * - V4L2_CID_CAMERA_ORIENTATION                 1455  * - V4L2_CID_CAMERA_ORIENTATION
1536  * - V4L2_CID_CAMERA_SENSOR_ROTATION;            1456  * - V4L2_CID_CAMERA_SENSOR_ROTATION;
1537  *                                               1457  *
1538  * Controls already registered by the caller     1458  * Controls already registered by the caller with the @hdl control handler are
1539  * not overwritten. Callers should register t    1459  * not overwritten. Callers should register the controls they want to handle
1540  * themselves before calling this function.      1460  * themselves before calling this function.
1541  *                                               1461  *
1542  * Return: 0 on success, a negative error cod    1462  * Return: 0 on success, a negative error code on failure.
1543  */                                              1463  */
1544 int v4l2_ctrl_new_fwnode_properties(struct v4    1464 int v4l2_ctrl_new_fwnode_properties(struct v4l2_ctrl_handler *hdl,
1545                                     const str    1465                                     const struct v4l2_ctrl_ops *ctrl_ops,
1546                                     const str    1466                                     const struct v4l2_fwnode_device_properties *p);
1547                                               << 
1548 /**                                           << 
1549  * v4l2_ctrl_type_op_equal - Default v4l2_ctr << 
1550  *                                            << 
1551  * @ctrl: The v4l2_ctrl pointer.              << 
1552  * @ptr1: A v4l2 control value.               << 
1553  * @ptr2: A v4l2 control value.               << 
1554  *                                            << 
1555  * Return: true if values are equal, otherwis << 
1556  */                                           << 
1557 bool v4l2_ctrl_type_op_equal(const struct v4l << 
1558                              union v4l2_ctrl_ << 
1559                                               << 
1560 /**                                           << 
1561  * v4l2_ctrl_type_op_init - Default v4l2_ctrl << 
1562  *                                            << 
1563  * @ctrl: The v4l2_ctrl pointer.              << 
1564  * @from_idx: Starting element index.         << 
1565  * @ptr: The v4l2 control value.              << 
1566  *                                            << 
1567  * Return: void                               << 
1568  */                                           << 
1569 void v4l2_ctrl_type_op_init(const struct v4l2 << 
1570                             union v4l2_ctrl_p << 
1571                                               << 
1572 /**                                           << 
1573  * v4l2_ctrl_type_op_log - Default v4l2_ctrl_ << 
1574  *                                            << 
1575  * @ctrl: The v4l2_ctrl pointer.              << 
1576  *                                            << 
1577  * Return: void                               << 
1578  */                                           << 
1579 void v4l2_ctrl_type_op_log(const struct v4l2_ << 
1580                                               << 
1581 /**                                           << 
1582  * v4l2_ctrl_type_op_validate - Default v4l2_ << 
1583  *                                            << 
1584  * @ctrl: The v4l2_ctrl pointer.              << 
1585  * @ptr: The v4l2 control value.              << 
1586  *                                            << 
1587  * Return: 0 on success, a negative error cod << 
1588  */                                           << 
1589 int v4l2_ctrl_type_op_validate(const struct v << 
1590                                               << 
1591 #endif                                           1467 #endif
1592                                                  1468 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php