blob: 533315bd74e01c70e53d843401208acde55ef2a2 [file] [log] [blame]
Hans Verkuil09965172010-08-01 14:32:42 -03001/*
2 V4L2 controls support header.
3
4 Copyright (C) 2010 Hans Verkuil <hverkuil@xs4all.nl>
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef _V4L2_CTRLS_H
22#define _V4L2_CTRLS_H
23
24#include <linux/list.h>
25#include <linux/device.h>
Laurent Pinchart01c40c02010-11-19 11:20:06 -030026#include <linux/videodev2.h>
Hans Verkuil09965172010-08-01 14:32:42 -030027
28/* forward references */
29struct v4l2_ctrl_handler;
Hans Verkuileb5b16e2011-06-14 10:04:06 -030030struct v4l2_ctrl_helper;
Hans Verkuil09965172010-08-01 14:32:42 -030031struct v4l2_ctrl;
32struct video_device;
33struct v4l2_subdev;
Hans Verkuil77068d32011-06-13 18:55:58 -030034struct v4l2_subscribed_event;
Hans Verkuil6e239392011-06-07 11:13:44 -030035struct v4l2_fh;
Hans Verkuila26243b2012-01-27 16:18:42 -030036struct poll_table_struct;
Hans Verkuil09965172010-08-01 14:32:42 -030037
38/** struct v4l2_ctrl_ops - The control operations that the driver has to provide.
39 * @g_volatile_ctrl: Get a new value for this control. Generally only relevant
40 * for volatile (and usually read-only) controls such as a control
41 * that returns the current signal strength which changes
42 * continuously.
43 * If not set, then the currently cached value will be returned.
44 * @try_ctrl: Test whether the control's value is valid. Only relevant when
45 * the usual min/max/step checks are not sufficient.
46 * @s_ctrl: Actually set the new control value. s_ctrl is compulsory. The
47 * ctrl->handler->lock is held when these ops are called, so no
48 * one else can access controls owned by that handler.
49 */
50struct v4l2_ctrl_ops {
51 int (*g_volatile_ctrl)(struct v4l2_ctrl *ctrl);
52 int (*try_ctrl)(struct v4l2_ctrl *ctrl);
53 int (*s_ctrl)(struct v4l2_ctrl *ctrl);
54};
55
56/** struct v4l2_ctrl - The control structure.
57 * @node: The list node.
Hans Verkuil77068d32011-06-13 18:55:58 -030058 * @ev_subs: The list of control event subscriptions.
Hans Verkuil09965172010-08-01 14:32:42 -030059 * @handler: The handler that owns the control.
60 * @cluster: Point to start of cluster array.
61 * @ncontrols: Number of controls in cluster array.
Hans Verkuil09965172010-08-01 14:32:42 -030062 * @done: Internal flag: set for each processed control.
Hans Verkuil2a863792011-01-11 14:45:03 -030063 * @is_new: Set when the user specified a new value for this control. It
64 * is also set when called from v4l2_ctrl_handler_setup. Drivers
65 * should never set this flag.
Hans Verkuil09965172010-08-01 14:32:42 -030066 * @is_private: If set, then this control is private to its handler and it
67 * will not be added to any other handlers. Drivers can set
68 * this flag.
Hans Verkuil72d877c2011-06-10 05:44:36 -030069 * @is_auto: If set, then this control selects whether the other cluster
70 * members are in 'automatic' mode or 'manual' mode. This is
71 * used for autogain/gain type clusters. Drivers should never
72 * set this flag directly.
Hans Verkuil5626b8c2011-08-26 07:53:53 -030073 * @has_volatiles: If set, then one or more members of the cluster are volatile.
74 * Drivers should never touch this flag.
Hans Verkuil72d877c2011-06-10 05:44:36 -030075 * @manual_mode_value: If the is_auto flag is set, then this is the value
76 * of the auto control that determines if that control is in
77 * manual mode. So if the value of the auto control equals this
78 * value, then the whole cluster is in manual mode. Drivers should
79 * never set this flag directly.
Hans Verkuil09965172010-08-01 14:32:42 -030080 * @ops: The control ops.
81 * @id: The control ID.
82 * @name: The control name.
83 * @type: The control type.
84 * @minimum: The control's minimum value.
85 * @maximum: The control's maximum value.
86 * @default_value: The control's default value.
87 * @step: The control's step value for non-menu controls.
88 * @menu_skip_mask: The control's skip mask for menu controls. This makes it
89 * easy to skip menu items that are not valid. If bit X is set,
90 * then menu item X is skipped. Of course, this only works for
91 * menus with <= 32 menu items. There are no menus that come
92 * close to that number, so this is OK. Should we ever need more,
93 * then this will have to be extended to a u64 or a bit array.
94 * @qmenu: A const char * array for all menu items. Array entries that are
95 * empty strings ("") correspond to non-existing menu items (this
96 * is in addition to the menu_skip_mask above). The last entry
97 * must be NULL.
98 * @flags: The control's flags.
99 * @cur: The control's current value.
100 * @val: The control's new s32 value.
101 * @val64: The control's new s64 value.
102 * @string: The control's new string value.
103 * @priv: The control's private pointer. For use by the driver. It is
104 * untouched by the control framework. Note that this pointer is
105 * not freed when the control is deleted. Should this be needed
106 * then a new internal bitfield can be added to tell the framework
107 * to free this pointer.
108 */
109struct v4l2_ctrl {
110 /* Administrative fields */
111 struct list_head node;
Hans Verkuil77068d32011-06-13 18:55:58 -0300112 struct list_head ev_subs;
Hans Verkuil09965172010-08-01 14:32:42 -0300113 struct v4l2_ctrl_handler *handler;
114 struct v4l2_ctrl **cluster;
115 unsigned ncontrols;
Hans Verkuil09965172010-08-01 14:32:42 -0300116 unsigned int done:1;
117
Hans Verkuil2a863792011-01-11 14:45:03 -0300118 unsigned int is_new:1;
Hans Verkuil09965172010-08-01 14:32:42 -0300119 unsigned int is_private:1;
Hans Verkuil72d877c2011-06-10 05:44:36 -0300120 unsigned int is_auto:1;
Hans Verkuil5626b8c2011-08-26 07:53:53 -0300121 unsigned int has_volatiles:1;
Hans Verkuil82a7c042011-06-28 10:43:13 -0300122 unsigned int manual_mode_value:8;
Hans Verkuil09965172010-08-01 14:32:42 -0300123
124 const struct v4l2_ctrl_ops *ops;
125 u32 id;
126 const char *name;
127 enum v4l2_ctrl_type type;
128 s32 minimum, maximum, default_value;
129 union {
130 u32 step;
131 u32 menu_skip_mask;
132 };
Sakari Ailusce580fe2011-08-04 13:51:11 -0300133 union {
134 const char * const *qmenu;
135 const s64 *qmenu_int;
136 };
Hans Verkuil09965172010-08-01 14:32:42 -0300137 unsigned long flags;
138 union {
139 s32 val;
140 s64 val64;
141 char *string;
142 } cur;
143 union {
144 s32 val;
145 s64 val64;
146 char *string;
147 };
148 void *priv;
149};
150
151/** struct v4l2_ctrl_ref - The control reference.
152 * @node: List node for the sorted list.
153 * @next: Single-link list node for the hash.
154 * @ctrl: The actual control information.
Hans Verkuileb5b16e2011-06-14 10:04:06 -0300155 * @helper: Pointer to helper struct. Used internally in prepare_ext_ctrls().
Hans Verkuil09965172010-08-01 14:32:42 -0300156 *
157 * Each control handler has a list of these refs. The list_head is used to
158 * keep a sorted-by-control-ID list of all controls, while the next pointer
159 * is used to link the control in the hash's bucket.
160 */
161struct v4l2_ctrl_ref {
162 struct list_head node;
163 struct v4l2_ctrl_ref *next;
164 struct v4l2_ctrl *ctrl;
Hans Verkuileb5b16e2011-06-14 10:04:06 -0300165 struct v4l2_ctrl_helper *helper;
Hans Verkuil09965172010-08-01 14:32:42 -0300166};
167
168/** struct v4l2_ctrl_handler - The control handler keeps track of all the
169 * controls: both the controls owned by the handler and those inherited
170 * from other handlers.
171 * @lock: Lock to control access to this handler and its controls.
172 * @ctrls: The list of controls owned by this handler.
173 * @ctrl_refs: The list of control references.
174 * @cached: The last found control reference. It is common that the same
175 * control is needed multiple times, so this is a simple
176 * optimization.
177 * @buckets: Buckets for the hashing. Allows for quick control lookup.
178 * @nr_of_buckets: Total number of buckets in the array.
179 * @error: The error code of the first failed control addition.
180 */
181struct v4l2_ctrl_handler {
182 struct mutex lock;
183 struct list_head ctrls;
184 struct list_head ctrl_refs;
185 struct v4l2_ctrl_ref *cached;
186 struct v4l2_ctrl_ref **buckets;
187 u16 nr_of_buckets;
188 int error;
189};
190
191/** struct v4l2_ctrl_config - Control configuration structure.
192 * @ops: The control ops.
193 * @id: The control ID.
194 * @name: The control name.
195 * @type: The control type.
196 * @min: The control's minimum value.
197 * @max: The control's maximum value.
198 * @step: The control's step value for non-menu controls.
199 * @def: The control's default value.
200 * @flags: The control's flags.
201 * @menu_skip_mask: The control's skip mask for menu controls. This makes it
202 * easy to skip menu items that are not valid. If bit X is set,
203 * then menu item X is skipped. Of course, this only works for
204 * menus with <= 32 menu items. There are no menus that come
205 * close to that number, so this is OK. Should we ever need more,
206 * then this will have to be extended to a u64 or a bit array.
207 * @qmenu: A const char * array for all menu items. Array entries that are
208 * empty strings ("") correspond to non-existing menu items (this
209 * is in addition to the menu_skip_mask above). The last entry
210 * must be NULL.
211 * @is_private: If set, then this control is private to its handler and it
212 * will not be added to any other handlers.
Hans Verkuil09965172010-08-01 14:32:42 -0300213 */
214struct v4l2_ctrl_config {
215 const struct v4l2_ctrl_ops *ops;
216 u32 id;
217 const char *name;
218 enum v4l2_ctrl_type type;
219 s32 min;
220 s32 max;
221 u32 step;
222 s32 def;
223 u32 flags;
224 u32 menu_skip_mask;
Hans Verkuil513521e2010-12-29 14:25:52 -0300225 const char * const *qmenu;
Sakari Ailusce580fe2011-08-04 13:51:11 -0300226 const s64 *qmenu_int;
Hans Verkuil09965172010-08-01 14:32:42 -0300227 unsigned int is_private:1;
Hans Verkuil09965172010-08-01 14:32:42 -0300228};
229
230/** v4l2_ctrl_fill() - Fill in the control fields based on the control ID.
231 *
232 * This works for all standard V4L2 controls.
233 * For non-standard controls it will only fill in the given arguments
234 * and @name will be NULL.
235 *
236 * This function will overwrite the contents of @name, @type and @flags.
237 * The contents of @min, @max, @step and @def may be modified depending on
238 * the type.
239 *
240 * Do not use in drivers! It is used internally for backwards compatibility
241 * control handling only. Once all drivers are converted to use the new
242 * control framework this function will no longer be exported.
243 */
244void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
245 s32 *min, s32 *max, s32 *step, s32 *def, u32 *flags);
246
247
248/** v4l2_ctrl_handler_init() - Initialize the control handler.
249 * @hdl: The control handler.
250 * @nr_of_controls_hint: A hint of how many controls this handler is
251 * expected to refer to. This is the total number, so including
252 * any inherited controls. It doesn't have to be precise, but if
253 * it is way off, then you either waste memory (too many buckets
254 * are allocated) or the control lookup becomes slower (not enough
255 * buckets are allocated, so there are more slow list lookups).
256 * It will always work, though.
257 *
258 * Returns an error if the buckets could not be allocated. This error will
259 * also be stored in @hdl->error.
260 */
261int v4l2_ctrl_handler_init(struct v4l2_ctrl_handler *hdl,
262 unsigned nr_of_controls_hint);
263
264/** v4l2_ctrl_handler_free() - Free all controls owned by the handler and free
265 * the control list.
266 * @hdl: The control handler.
267 *
268 * Does nothing if @hdl == NULL.
269 */
270void v4l2_ctrl_handler_free(struct v4l2_ctrl_handler *hdl);
271
272/** v4l2_ctrl_handler_setup() - Call the s_ctrl op for all controls belonging
273 * to the handler to initialize the hardware to the current control values.
274 * @hdl: The control handler.
275 *
276 * Button controls will be skipped, as are read-only controls.
277 *
278 * If @hdl == NULL, then this just returns 0.
279 */
280int v4l2_ctrl_handler_setup(struct v4l2_ctrl_handler *hdl);
281
282/** v4l2_ctrl_handler_log_status() - Log all controls owned by the handler.
283 * @hdl: The control handler.
284 * @prefix: The prefix to use when logging the control values. If the
285 * prefix does not end with a space, then ": " will be added
286 * after the prefix. If @prefix == NULL, then no prefix will be
287 * used.
288 *
289 * For use with VIDIOC_LOG_STATUS.
290 *
291 * Does nothing if @hdl == NULL.
292 */
293void v4l2_ctrl_handler_log_status(struct v4l2_ctrl_handler *hdl,
294 const char *prefix);
295
296/** v4l2_ctrl_new_custom() - Allocate and initialize a new custom V4L2
297 * control.
298 * @hdl: The control handler.
299 * @cfg: The control's configuration data.
300 * @priv: The control's driver-specific private data.
301 *
302 * If the &v4l2_ctrl struct could not be allocated then NULL is returned
303 * and @hdl->error is set to the error code (if it wasn't set already).
304 */
305struct v4l2_ctrl *v4l2_ctrl_new_custom(struct v4l2_ctrl_handler *hdl,
306 const struct v4l2_ctrl_config *cfg, void *priv);
307
308/** v4l2_ctrl_new_std() - Allocate and initialize a new standard V4L2 non-menu control.
309 * @hdl: The control handler.
310 * @ops: The control ops.
311 * @id: The control ID.
312 * @min: The control's minimum value.
313 * @max: The control's maximum value.
314 * @step: The control's step value
315 * @def: The control's default value.
316 *
317 * If the &v4l2_ctrl struct could not be allocated, or the control
318 * ID is not known, then NULL is returned and @hdl->error is set to the
319 * appropriate error code (if it wasn't set already).
320 *
321 * If @id refers to a menu control, then this function will return NULL.
322 *
323 * Use v4l2_ctrl_new_std_menu() when adding menu controls.
324 */
325struct v4l2_ctrl *v4l2_ctrl_new_std(struct v4l2_ctrl_handler *hdl,
326 const struct v4l2_ctrl_ops *ops,
327 u32 id, s32 min, s32 max, u32 step, s32 def);
328
329/** v4l2_ctrl_new_std_menu() - Allocate and initialize a new standard V4L2 menu control.
330 * @hdl: The control handler.
331 * @ops: The control ops.
332 * @id: The control ID.
333 * @max: The control's maximum value.
334 * @mask: The control's skip mask for menu controls. This makes it
335 * easy to skip menu items that are not valid. If bit X is set,
336 * then menu item X is skipped. Of course, this only works for
337 * menus with <= 32 menu items. There are no menus that come
338 * close to that number, so this is OK. Should we ever need more,
339 * then this will have to be extended to a u64 or a bit array.
340 * @def: The control's default value.
341 *
342 * Same as v4l2_ctrl_new_std(), but @min is set to 0 and the @mask value
343 * determines which menu items are to be skipped.
344 *
345 * If @id refers to a non-menu control, then this function will return NULL.
346 */
347struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl,
348 const struct v4l2_ctrl_ops *ops,
349 u32 id, s32 max, s32 mask, s32 def);
350
351/** v4l2_ctrl_add_ctrl() - Add a control from another handler to this handler.
352 * @hdl: The control handler.
353 * @ctrl: The control to add.
354 *
355 * It will return NULL if it was unable to add the control reference.
356 * If the control already belonged to the handler, then it will do
357 * nothing and just return @ctrl.
358 */
359struct v4l2_ctrl *v4l2_ctrl_add_ctrl(struct v4l2_ctrl_handler *hdl,
360 struct v4l2_ctrl *ctrl);
361
362/** v4l2_ctrl_add_handler() - Add all controls from handler @add to
363 * handler @hdl.
364 * @hdl: The control handler.
365 * @add: The control handler whose controls you want to add to
366 * the @hdl control handler.
367 *
368 * Does nothing if either of the two is a NULL pointer.
369 * In case of an error @hdl->error will be set to the error code (if it
370 * wasn't set already).
371 */
372int v4l2_ctrl_add_handler(struct v4l2_ctrl_handler *hdl,
373 struct v4l2_ctrl_handler *add);
374
375
376/** v4l2_ctrl_cluster() - Mark all controls in the cluster as belonging to that cluster.
377 * @ncontrols: The number of controls in this cluster.
378 * @controls: The cluster control array of size @ncontrols.
379 */
380void v4l2_ctrl_cluster(unsigned ncontrols, struct v4l2_ctrl **controls);
381
382
Hans Verkuil72d877c2011-06-10 05:44:36 -0300383/** v4l2_ctrl_auto_cluster() - Mark all controls in the cluster as belonging to
384 * that cluster and set it up for autofoo/foo-type handling.
385 * @ncontrols: The number of controls in this cluster.
386 * @controls: The cluster control array of size @ncontrols. The first control
387 * must be the 'auto' control (e.g. autogain, autoexposure, etc.)
388 * @manual_val: The value for the first control in the cluster that equals the
389 * manual setting.
390 * @set_volatile: If true, then all controls except the first auto control will
Hans Verkuil88365102011-08-26 07:35:14 -0300391 * be volatile.
Hans Verkuil72d877c2011-06-10 05:44:36 -0300392 *
393 * Use for control groups where one control selects some automatic feature and
394 * the other controls are only active whenever the automatic feature is turned
395 * off (manual mode). Typical examples: autogain vs gain, auto-whitebalance vs
396 * red and blue balance, etc.
397 *
398 * The behavior of such controls is as follows:
399 *
400 * When the autofoo control is set to automatic, then any manual controls
401 * are set to inactive and any reads will call g_volatile_ctrl (if the control
402 * was marked volatile).
403 *
404 * When the autofoo control is set to manual, then any manual controls will
405 * be marked active, and any reads will just return the current value without
406 * going through g_volatile_ctrl.
407 *
408 * In addition, this function will set the V4L2_CTRL_FLAG_UPDATE flag
409 * on the autofoo control and V4L2_CTRL_FLAG_INACTIVE on the foo control(s)
410 * if autofoo is in auto mode.
411 */
412void v4l2_ctrl_auto_cluster(unsigned ncontrols, struct v4l2_ctrl **controls,
413 u8 manual_val, bool set_volatile);
414
415
Hans Verkuil09965172010-08-01 14:32:42 -0300416/** v4l2_ctrl_find() - Find a control with the given ID.
417 * @hdl: The control handler.
418 * @id: The control ID to find.
419 *
420 * If @hdl == NULL this will return NULL as well. Will lock the handler so
421 * do not use from inside &v4l2_ctrl_ops.
422 */
423struct v4l2_ctrl *v4l2_ctrl_find(struct v4l2_ctrl_handler *hdl, u32 id);
424
425/** v4l2_ctrl_activate() - Make the control active or inactive.
426 * @ctrl: The control to (de)activate.
427 * @active: True if the control should become active.
428 *
429 * This sets or clears the V4L2_CTRL_FLAG_INACTIVE flag atomically.
430 * Does nothing if @ctrl == NULL.
431 * This will usually be called from within the s_ctrl op.
Hans Verkuil6e239392011-06-07 11:13:44 -0300432 * The V4L2_EVENT_CTRL event will be generated afterwards.
Hans Verkuil09965172010-08-01 14:32:42 -0300433 *
Hans Verkuil6e239392011-06-07 11:13:44 -0300434 * This function assumes that the control handler is locked.
Hans Verkuil09965172010-08-01 14:32:42 -0300435 */
436void v4l2_ctrl_activate(struct v4l2_ctrl *ctrl, bool active);
437
438/** v4l2_ctrl_grab() - Mark the control as grabbed or not grabbed.
439 * @ctrl: The control to (de)activate.
440 * @grabbed: True if the control should become grabbed.
441 *
442 * This sets or clears the V4L2_CTRL_FLAG_GRABBED flag atomically.
443 * Does nothing if @ctrl == NULL.
Hans Verkuil6e239392011-06-07 11:13:44 -0300444 * The V4L2_EVENT_CTRL event will be generated afterwards.
Hans Verkuil09965172010-08-01 14:32:42 -0300445 * This will usually be called when starting or stopping streaming in the
446 * driver.
447 *
Hans Verkuil6e239392011-06-07 11:13:44 -0300448 * This function assumes that the control handler is not locked and will
449 * take the lock itself.
Hans Verkuil09965172010-08-01 14:32:42 -0300450 */
451void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed);
452
453/** v4l2_ctrl_lock() - Helper function to lock the handler
454 * associated with the control.
455 * @ctrl: The control to lock.
456 */
457static inline void v4l2_ctrl_lock(struct v4l2_ctrl *ctrl)
458{
459 mutex_lock(&ctrl->handler->lock);
460}
461
462/** v4l2_ctrl_lock() - Helper function to unlock the handler
463 * associated with the control.
464 * @ctrl: The control to unlock.
465 */
466static inline void v4l2_ctrl_unlock(struct v4l2_ctrl *ctrl)
467{
468 mutex_unlock(&ctrl->handler->lock);
469}
470
471/** v4l2_ctrl_g_ctrl() - Helper function to get the control's value from within a driver.
472 * @ctrl: The control.
473 *
474 * This returns the control's value safely by going through the control
475 * framework. This function will lock the control's handler, so it cannot be
476 * used from within the &v4l2_ctrl_ops functions.
477 *
478 * This function is for integer type controls only.
479 */
480s32 v4l2_ctrl_g_ctrl(struct v4l2_ctrl *ctrl);
481
482/** v4l2_ctrl_s_ctrl() - Helper function to set the control's value from within a driver.
483 * @ctrl: The control.
484 * @val: The new value.
485 *
486 * This set the control's new value safely by going through the control
487 * framework. This function will lock the control's handler, so it cannot be
488 * used from within the &v4l2_ctrl_ops functions.
489 *
490 * This function is for integer type controls only.
491 */
492int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val);
493
Hans Verkuilce727572011-06-10 05:56:39 -0300494/* Internal helper functions that deal with control events. */
Hans Verkuil77068d32011-06-13 18:55:58 -0300495void v4l2_ctrl_add_event(struct v4l2_ctrl *ctrl,
496 struct v4l2_subscribed_event *sev);
497void v4l2_ctrl_del_event(struct v4l2_ctrl *ctrl,
498 struct v4l2_subscribed_event *sev);
Hans Verkuil6e239392011-06-07 11:13:44 -0300499
Hans Verkuile2ecb252012-02-02 08:20:53 -0300500/* Can be used as a vidioc_log_status function that just dumps all controls
501 associated with the filehandle. */
502int v4l2_ctrl_log_status(struct file *file, void *fh);
503
Hans Verkuila26243b2012-01-27 16:18:42 -0300504/* Can be used as a vidioc_subscribe_event function that just subscribes
505 control events. */
506int v4l2_ctrl_subscribe_event(struct v4l2_fh *fh,
507 struct v4l2_event_subscription *sub);
508
509/* Can be used as a poll function that just polls for control events. */
510unsigned int v4l2_ctrl_poll(struct file *file, struct poll_table_struct *wait);
511
Hans Verkuil09965172010-08-01 14:32:42 -0300512/* Helpers for ioctl_ops. If hdl == NULL then they will all return -EINVAL. */
513int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc);
514int v4l2_querymenu(struct v4l2_ctrl_handler *hdl, struct v4l2_querymenu *qm);
515int v4l2_g_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_control *ctrl);
Hans Verkuilab892ba2011-06-07 06:47:18 -0300516int v4l2_s_ctrl(struct v4l2_fh *fh, struct v4l2_ctrl_handler *hdl,
517 struct v4l2_control *ctrl);
Hans Verkuil09965172010-08-01 14:32:42 -0300518int v4l2_g_ext_ctrls(struct v4l2_ctrl_handler *hdl, struct v4l2_ext_controls *c);
519int v4l2_try_ext_ctrls(struct v4l2_ctrl_handler *hdl, struct v4l2_ext_controls *c);
Hans Verkuilab892ba2011-06-07 06:47:18 -0300520int v4l2_s_ext_ctrls(struct v4l2_fh *fh, struct v4l2_ctrl_handler *hdl,
521 struct v4l2_ext_controls *c);
Hans Verkuil09965172010-08-01 14:32:42 -0300522
523/* Helpers for subdevices. If the associated ctrl_handler == NULL then they
524 will all return -EINVAL. */
525int v4l2_subdev_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc);
526int v4l2_subdev_querymenu(struct v4l2_subdev *sd, struct v4l2_querymenu *qm);
527int v4l2_subdev_g_ext_ctrls(struct v4l2_subdev *sd, struct v4l2_ext_controls *cs);
528int v4l2_subdev_try_ext_ctrls(struct v4l2_subdev *sd, struct v4l2_ext_controls *cs);
529int v4l2_subdev_s_ext_ctrls(struct v4l2_subdev *sd, struct v4l2_ext_controls *cs);
530int v4l2_subdev_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl);
531int v4l2_subdev_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl);
532
533#endif