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