v4l2-ctrls.h 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160
  1. /*
  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. #ifndef _V4L2_CTRLS_H
  17. #define _V4L2_CTRLS_H
  18. #include <linux/list.h>
  19. #include <linux/mutex.h>
  20. #include <linux/videodev2.h>
  21. /* forward references */
  22. struct file;
  23. struct v4l2_ctrl_handler;
  24. struct v4l2_ctrl_helper;
  25. struct v4l2_ctrl;
  26. struct video_device;
  27. struct v4l2_subdev;
  28. struct v4l2_subscribed_event;
  29. struct v4l2_fh;
  30. struct poll_table_struct;
  31. /**
  32. * union v4l2_ctrl_ptr - A pointer to a control value.
  33. * @p_s32: Pointer to a 32-bit signed value.
  34. * @p_s64: Pointer to a 64-bit signed value.
  35. * @p_u8: Pointer to a 8-bit unsigned value.
  36. * @p_u16: Pointer to a 16-bit unsigned value.
  37. * @p_u32: Pointer to a 32-bit unsigned value.
  38. * @p_char: Pointer to a string.
  39. * @p: Pointer to a compound value.
  40. */
  41. union v4l2_ctrl_ptr {
  42. s32 *p_s32;
  43. s64 *p_s64;
  44. u8 *p_u8;
  45. u16 *p_u16;
  46. u32 *p_u32;
  47. char *p_char;
  48. void *p;
  49. };
  50. /**
  51. * struct v4l2_ctrl_ops - The control operations that the driver has to provide.
  52. *
  53. * @g_volatile_ctrl: Get a new value for this control. Generally only relevant
  54. * for volatile (and usually read-only) controls such as a control
  55. * that returns the current signal strength which changes
  56. * continuously.
  57. * If not set, then the currently cached value will be returned.
  58. * @try_ctrl: Test whether the control's value is valid. Only relevant when
  59. * the usual min/max/step checks are not sufficient.
  60. * @s_ctrl: Actually set the new control value. s_ctrl is compulsory. The
  61. * ctrl->handler->lock is held when these ops are called, so no
  62. * one else can access controls owned by that handler.
  63. */
  64. struct v4l2_ctrl_ops {
  65. int (*g_volatile_ctrl)(struct v4l2_ctrl *ctrl);
  66. int (*try_ctrl)(struct v4l2_ctrl *ctrl);
  67. int (*s_ctrl)(struct v4l2_ctrl *ctrl);
  68. };
  69. /**
  70. * struct v4l2_ctrl_type_ops - The control type operations that the driver
  71. * has to provide.
  72. *
  73. * @equal: return true if both values are equal.
  74. * @init: initialize the value.
  75. * @log: log the value.
  76. * @validate: validate the value. Return 0 on success and a negative value
  77. * otherwise.
  78. */
  79. struct v4l2_ctrl_type_ops {
  80. bool (*equal)(const struct v4l2_ctrl *ctrl, u32 idx,
  81. union v4l2_ctrl_ptr ptr1,
  82. union v4l2_ctrl_ptr ptr2);
  83. void (*init)(const struct v4l2_ctrl *ctrl, u32 idx,
  84. union v4l2_ctrl_ptr ptr);
  85. void (*log)(const struct v4l2_ctrl *ctrl);
  86. int (*validate)(const struct v4l2_ctrl *ctrl, u32 idx,
  87. union v4l2_ctrl_ptr ptr);
  88. };
  89. /**
  90. * typedef v4l2_ctrl_notify_fnc - typedef for a notify argument with a function
  91. * that should be called when a control value has changed.
  92. *
  93. * @ctrl: pointer to struct &v4l2_ctrl
  94. * @priv: control private data
  95. *
  96. * This typedef definition is used as an argument to v4l2_ctrl_notify()
  97. * and as an argument at struct &v4l2_ctrl_handler.
  98. */
  99. typedef void (*v4l2_ctrl_notify_fnc)(struct v4l2_ctrl *ctrl, void *priv);
  100. /**
  101. * struct v4l2_ctrl - The control structure.
  102. *
  103. * @node: The list node.
  104. * @ev_subs: The list of control event subscriptions.
  105. * @handler: The handler that owns the control.
  106. * @cluster: Point to start of cluster array.
  107. * @ncontrols: Number of controls in cluster array.
  108. * @done: Internal flag: set for each processed control.
  109. * @is_new: Set when the user specified a new value for this control. It
  110. * is also set when called from v4l2_ctrl_handler_setup(). Drivers
  111. * should never set this flag.
  112. * @has_changed: Set when the current value differs from the new value. Drivers
  113. * should never use this flag.
  114. * @is_private: If set, then this control is private to its handler and it
  115. * will not be added to any other handlers. Drivers can set
  116. * this flag.
  117. * @is_auto: If set, then this control selects whether the other cluster
  118. * members are in 'automatic' mode or 'manual' mode. This is
  119. * used for autogain/gain type clusters. Drivers should never
  120. * set this flag directly.
  121. * @is_int: If set, then this control has a simple integer value (i.e. it
  122. * uses ctrl->val).
  123. * @is_string: If set, then this control has type %V4L2_CTRL_TYPE_STRING.
  124. * @is_ptr: If set, then this control is an array and/or has type >=
  125. * %V4L2_CTRL_COMPOUND_TYPES
  126. * and/or has type %V4L2_CTRL_TYPE_STRING. In other words, &struct
  127. * v4l2_ext_control uses field p to point to the data.
  128. * @is_array: If set, then this control contains an N-dimensional array.
  129. * @has_volatiles: If set, then one or more members of the cluster are volatile.
  130. * Drivers should never touch this flag.
  131. * @call_notify: If set, then call the handler's notify function whenever the
  132. * control's value changes.
  133. * @manual_mode_value: If the is_auto flag is set, then this is the value
  134. * of the auto control that determines if that control is in
  135. * manual mode. So if the value of the auto control equals this
  136. * value, then the whole cluster is in manual mode. Drivers should
  137. * never set this flag directly.
  138. * @ops: The control ops.
  139. * @type_ops: The control type ops.
  140. * @id: The control ID.
  141. * @name: The control name.
  142. * @type: The control type.
  143. * @minimum: The control's minimum value.
  144. * @maximum: The control's maximum value.
  145. * @default_value: The control's default value.
  146. * @step: The control's step value for non-menu controls.
  147. * @elems: The number of elements in the N-dimensional array.
  148. * @elem_size: The size in bytes of the control.
  149. * @dims: The size of each dimension.
  150. * @nr_of_dims:The number of dimensions in @dims.
  151. * @menu_skip_mask: The control's skip mask for menu controls. This makes it
  152. * easy to skip menu items that are not valid. If bit X is set,
  153. * then menu item X is skipped. Of course, this only works for
  154. * menus with <= 32 menu items. There are no menus that come
  155. * close to that number, so this is OK. Should we ever need more,
  156. * then this will have to be extended to a u64 or a bit array.
  157. * @qmenu: A const char * array for all menu items. Array entries that are
  158. * empty strings ("") correspond to non-existing menu items (this
  159. * is in addition to the menu_skip_mask above). The last entry
  160. * must be NULL.
  161. * @flags: The control's flags.
  162. * @cur: The control's current value.
  163. * @val: The control's new s32 value.
  164. * @priv: The control's private pointer. For use by the driver. It is
  165. * untouched by the control framework. Note that this pointer is
  166. * not freed when the control is deleted. Should this be needed
  167. * then a new internal bitfield can be added to tell the framework
  168. * to free this pointer.
  169. * @p_cur: The control's current value represented via a union with
  170. * provides a standard way of accessing control types
  171. * through a pointer.
  172. * @p_new: The control's new value represented via a union with provides
  173. * a standard way of accessing control types
  174. * through a pointer.
  175. */
  176. struct v4l2_ctrl {
  177. /* Administrative fields */
  178. struct list_head node;
  179. struct list_head ev_subs;
  180. struct v4l2_ctrl_handler *handler;
  181. struct v4l2_ctrl **cluster;
  182. unsigned int ncontrols;
  183. unsigned int done:1;
  184. unsigned int is_new:1;
  185. unsigned int has_changed:1;
  186. unsigned int is_private:1;
  187. unsigned int is_auto:1;
  188. unsigned int is_int:1;
  189. unsigned int is_string:1;
  190. unsigned int is_ptr:1;
  191. unsigned int is_array:1;
  192. unsigned int has_volatiles:1;
  193. unsigned int call_notify:1;
  194. unsigned int manual_mode_value:8;
  195. const struct v4l2_ctrl_ops *ops;
  196. const struct v4l2_ctrl_type_ops *type_ops;
  197. u32 id;
  198. const char *name;
  199. enum v4l2_ctrl_type type;
  200. s64 minimum, maximum, default_value;
  201. u32 elems;
  202. u32 elem_size;
  203. u32 dims[V4L2_CTRL_MAX_DIMS];
  204. u32 nr_of_dims;
  205. union {
  206. u64 step;
  207. u64 menu_skip_mask;
  208. };
  209. union {
  210. const char * const *qmenu;
  211. const s64 *qmenu_int;
  212. };
  213. unsigned long flags;
  214. void *priv;
  215. s32 val;
  216. struct {
  217. s32 val;
  218. } cur;
  219. union v4l2_ctrl_ptr p_new;
  220. union v4l2_ctrl_ptr p_cur;
  221. };
  222. /**
  223. * struct v4l2_ctrl_ref - The control reference.
  224. *
  225. * @node: List node for the sorted list.
  226. * @next: Single-link list node for the hash.
  227. * @ctrl: The actual control information.
  228. * @helper: Pointer to helper struct. Used internally in
  229. * ``prepare_ext_ctrls`` function at ``v4l2-ctrl.c``.
  230. *
  231. * Each control handler has a list of these refs. The list_head is used to
  232. * keep a sorted-by-control-ID list of all controls, while the next pointer
  233. * is used to link the control in the hash's bucket.
  234. */
  235. struct v4l2_ctrl_ref {
  236. struct list_head node;
  237. struct v4l2_ctrl_ref *next;
  238. struct v4l2_ctrl *ctrl;
  239. struct v4l2_ctrl_helper *helper;
  240. };
  241. /**
  242. * struct v4l2_ctrl_handler - The control handler keeps track of all the
  243. * controls: both the controls owned by the handler and those inherited
  244. * from other handlers.
  245. *
  246. * @_lock: Default for "lock".
  247. * @lock: Lock to control access to this handler and its controls.
  248. * May be replaced by the user right after init.
  249. * @ctrls: The list of controls owned by this handler.
  250. * @ctrl_refs: The list of control references.
  251. * @cached: The last found control reference. It is common that the same
  252. * control is needed multiple times, so this is a simple
  253. * optimization.
  254. * @buckets: Buckets for the hashing. Allows for quick control lookup.
  255. * @notify: A notify callback that is called whenever the control changes
  256. * value.
  257. * Note that the handler's lock is held when the notify function
  258. * is called!
  259. * @notify_priv: Passed as argument to the v4l2_ctrl notify callback.
  260. * @nr_of_buckets: Total number of buckets in the array.
  261. * @error: The error code of the first failed control addition.
  262. */
  263. struct v4l2_ctrl_handler {
  264. struct mutex _lock;
  265. struct mutex *lock;
  266. struct list_head ctrls;
  267. struct list_head ctrl_refs;
  268. struct v4l2_ctrl_ref *cached;
  269. struct v4l2_ctrl_ref **buckets;
  270. v4l2_ctrl_notify_fnc notify;
  271. void *notify_priv;
  272. u16 nr_of_buckets;
  273. int error;
  274. };
  275. /**
  276. * struct v4l2_ctrl_config - Control configuration structure.
  277. *
  278. * @ops: The control ops.
  279. * @type_ops: The control type ops. Only needed for compound controls.
  280. * @id: The control ID.
  281. * @name: The control name.
  282. * @type: The control type.
  283. * @min: The control's minimum value.
  284. * @max: The control's maximum value.
  285. * @step: The control's step value for non-menu controls.
  286. * @def: The control's default value.
  287. * @dims: The size of each dimension.
  288. * @elem_size: The size in bytes of the control.
  289. * @flags: The control's flags.
  290. * @menu_skip_mask: The control's skip mask for menu controls. This makes it
  291. * easy to skip menu items that are not valid. If bit X is set,
  292. * then menu item X is skipped. Of course, this only works for
  293. * menus with <= 64 menu items. There are no menus that come
  294. * close to that number, so this is OK. Should we ever need more,
  295. * then this will have to be extended to a bit array.
  296. * @qmenu: A const char * array for all menu items. Array entries that are
  297. * empty strings ("") correspond to non-existing menu items (this
  298. * is in addition to the menu_skip_mask above). The last entry
  299. * must be NULL.
  300. * @qmenu_int: A const s64 integer array for all menu items of the type
  301. * V4L2_CTRL_TYPE_INTEGER_MENU.
  302. * @is_private: If set, then this control is private to its handler and it
  303. * will not be added to any other handlers.
  304. */
  305. struct v4l2_ctrl_config {
  306. const struct v4l2_ctrl_ops *ops;
  307. const struct v4l2_ctrl_type_ops *type_ops;
  308. u32 id;
  309. const char *name;
  310. enum v4l2_ctrl_type type;
  311. s64 min;
  312. s64 max;
  313. u64 step;
  314. s64 def;
  315. u32 dims[V4L2_CTRL_MAX_DIMS];
  316. u32 elem_size;
  317. u32 flags;
  318. u64 menu_skip_mask;
  319. const char * const *qmenu;
  320. const s64 *qmenu_int;
  321. unsigned int is_private:1;
  322. };
  323. /**
  324. * v4l2_ctrl_fill - Fill in the control fields based on the control ID.
  325. *
  326. * @id: ID of the control
  327. * @name: name of the control
  328. * @type: type of the control
  329. * @min: minimum value for the control
  330. * @max: maximum value for the control
  331. * @step: control step
  332. * @def: default value for the control
  333. * @flags: flags to be used on the control
  334. *
  335. * This works for all standard V4L2 controls.
  336. * For non-standard controls it will only fill in the given arguments
  337. * and @name will be %NULL.
  338. *
  339. * This function will overwrite the contents of @name, @type and @flags.
  340. * The contents of @min, @max, @step and @def may be modified depending on
  341. * the type.
  342. *
  343. * .. note::
  344. *
  345. * Do not use in drivers! It is used internally for backwards compatibility
  346. * control handling only. Once all drivers are converted to use the new
  347. * control framework this function will no longer be exported.
  348. */
  349. void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
  350. s64 *min, s64 *max, u64 *step, s64 *def, u32 *flags);
  351. /**
  352. * v4l2_ctrl_handler_init_class() - Initialize the control handler.
  353. * @hdl: The control handler.
  354. * @nr_of_controls_hint: A hint of how many controls this handler is
  355. * expected to refer to. This is the total number, so including
  356. * any inherited controls. It doesn't have to be precise, but if
  357. * it is way off, then you either waste memory (too many buckets
  358. * are allocated) or the control lookup becomes slower (not enough
  359. * buckets are allocated, so there are more slow list lookups).
  360. * It will always work, though.
  361. * @key: Used by the lock validator if CONFIG_LOCKDEP is set.
  362. * @name: Used by the lock validator if CONFIG_LOCKDEP is set.
  363. *
  364. * .. attention::
  365. *
  366. * Never use this call directly, always use the v4l2_ctrl_handler_init()
  367. * macro that hides the @key and @name arguments.
  368. *
  369. * Return: returns an error if the buckets could not be allocated. This
  370. * error will also be stored in @hdl->error.
  371. */
  372. int v4l2_ctrl_handler_init_class(struct v4l2_ctrl_handler *hdl,
  373. unsigned int nr_of_controls_hint,
  374. struct lock_class_key *key, const char *name);
  375. #ifdef CONFIG_LOCKDEP
  376. /**
  377. * v4l2_ctrl_handler_init - helper function to create a static struct
  378. * &lock_class_key and calls v4l2_ctrl_handler_init_class()
  379. *
  380. * @hdl: The control handler.
  381. * @nr_of_controls_hint: A hint of how many controls this handler is
  382. * expected to refer to. This is the total number, so including
  383. * any inherited controls. It doesn't have to be precise, but if
  384. * it is way off, then you either waste memory (too many buckets
  385. * are allocated) or the control lookup becomes slower (not enough
  386. * buckets are allocated, so there are more slow list lookups).
  387. * It will always work, though.
  388. *
  389. * This helper function creates a static struct &lock_class_key and
  390. * calls v4l2_ctrl_handler_init_class(), providing a proper name for the lock
  391. * validador.
  392. *
  393. * Use this helper function to initialize a control handler.
  394. */
  395. #define v4l2_ctrl_handler_init(hdl, nr_of_controls_hint) \
  396. ( \
  397. ({ \
  398. static struct lock_class_key _key; \
  399. v4l2_ctrl_handler_init_class(hdl, nr_of_controls_hint, \
  400. &_key, \
  401. KBUILD_BASENAME ":" \
  402. __stringify(__LINE__) ":" \
  403. "(" #hdl ")->_lock"); \
  404. }) \
  405. )
  406. #else
  407. #define v4l2_ctrl_handler_init(hdl, nr_of_controls_hint) \
  408. v4l2_ctrl_handler_init_class(hdl, nr_of_controls_hint, NULL, NULL)
  409. #endif
  410. /**
  411. * v4l2_ctrl_handler_free() - Free all controls owned by the handler and free
  412. * the control list.
  413. * @hdl: The control handler.
  414. *
  415. * Does nothing if @hdl == NULL.
  416. */
  417. void v4l2_ctrl_handler_free(struct v4l2_ctrl_handler *hdl);
  418. /**
  419. * v4l2_ctrl_lock() - Helper function to lock the handler
  420. * associated with the control.
  421. * @ctrl: The control to lock.
  422. */
  423. static inline void v4l2_ctrl_lock(struct v4l2_ctrl *ctrl)
  424. {
  425. mutex_lock(ctrl->handler->lock);
  426. }
  427. /**
  428. * v4l2_ctrl_unlock() - Helper function to unlock the handler
  429. * associated with the control.
  430. * @ctrl: The control to unlock.
  431. */
  432. static inline void v4l2_ctrl_unlock(struct v4l2_ctrl *ctrl)
  433. {
  434. mutex_unlock(ctrl->handler->lock);
  435. }
  436. /**
  437. * __v4l2_ctrl_handler_setup() - Call the s_ctrl op for all controls belonging
  438. * to the handler to initialize the hardware to the current control values. The
  439. * caller is responsible for acquiring the control handler mutex on behalf of
  440. * __v4l2_ctrl_handler_setup().
  441. * @hdl: The control handler.
  442. *
  443. * Button controls will be skipped, as are read-only controls.
  444. *
  445. * If @hdl == NULL, then this just returns 0.
  446. */
  447. int __v4l2_ctrl_handler_setup(struct v4l2_ctrl_handler *hdl);
  448. /**
  449. * v4l2_ctrl_handler_setup() - Call the s_ctrl op for all controls belonging
  450. * to the handler to initialize the hardware to the current control values.
  451. * @hdl: The control handler.
  452. *
  453. * Button controls will be skipped, as are read-only controls.
  454. *
  455. * If @hdl == NULL, then this just returns 0.
  456. */
  457. int v4l2_ctrl_handler_setup(struct v4l2_ctrl_handler *hdl);
  458. /**
  459. * v4l2_ctrl_handler_log_status() - Log all controls owned by the handler.
  460. * @hdl: The control handler.
  461. * @prefix: The prefix to use when logging the control values. If the
  462. * prefix does not end with a space, then ": " will be added
  463. * after the prefix. If @prefix == NULL, then no prefix will be
  464. * used.
  465. *
  466. * For use with VIDIOC_LOG_STATUS.
  467. *
  468. * Does nothing if @hdl == NULL.
  469. */
  470. void v4l2_ctrl_handler_log_status(struct v4l2_ctrl_handler *hdl,
  471. const char *prefix);
  472. /**
  473. * v4l2_ctrl_new_custom() - Allocate and initialize a new custom V4L2
  474. * control.
  475. *
  476. * @hdl: The control handler.
  477. * @cfg: The control's configuration data.
  478. * @priv: The control's driver-specific private data.
  479. *
  480. * If the &v4l2_ctrl struct could not be allocated then NULL is returned
  481. * and @hdl->error is set to the error code (if it wasn't set already).
  482. */
  483. struct v4l2_ctrl *v4l2_ctrl_new_custom(struct v4l2_ctrl_handler *hdl,
  484. const struct v4l2_ctrl_config *cfg,
  485. void *priv);
  486. /**
  487. * v4l2_ctrl_new_std() - Allocate and initialize a new standard V4L2 non-menu
  488. * control.
  489. *
  490. * @hdl: The control handler.
  491. * @ops: The control ops.
  492. * @id: The control ID.
  493. * @min: The control's minimum value.
  494. * @max: The control's maximum value.
  495. * @step: The control's step value
  496. * @def: The control's default value.
  497. *
  498. * If the &v4l2_ctrl struct could not be allocated, or the control
  499. * ID is not known, then NULL is returned and @hdl->error is set to the
  500. * appropriate error code (if it wasn't set already).
  501. *
  502. * If @id refers to a menu control, then this function will return NULL.
  503. *
  504. * Use v4l2_ctrl_new_std_menu() when adding menu controls.
  505. */
  506. struct v4l2_ctrl *v4l2_ctrl_new_std(struct v4l2_ctrl_handler *hdl,
  507. const struct v4l2_ctrl_ops *ops,
  508. u32 id, s64 min, s64 max, u64 step,
  509. s64 def);
  510. /**
  511. * v4l2_ctrl_new_std_menu() - Allocate and initialize a new standard V4L2
  512. * menu control.
  513. *
  514. * @hdl: The control handler.
  515. * @ops: The control ops.
  516. * @id: The control ID.
  517. * @max: The control's maximum value.
  518. * @mask: The control's skip mask for menu controls. This makes it
  519. * easy to skip menu items that are not valid. If bit X is set,
  520. * then menu item X is skipped. Of course, this only works for
  521. * menus with <= 64 menu items. There are no menus that come
  522. * close to that number, so this is OK. Should we ever need more,
  523. * then this will have to be extended to a bit array.
  524. * @def: The control's default value.
  525. *
  526. * Same as v4l2_ctrl_new_std(), but @min is set to 0 and the @mask value
  527. * determines which menu items are to be skipped.
  528. *
  529. * If @id refers to a non-menu control, then this function will return NULL.
  530. */
  531. struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl,
  532. const struct v4l2_ctrl_ops *ops,
  533. u32 id, u8 max, u64 mask, u8 def);
  534. /**
  535. * v4l2_ctrl_new_std_menu_items() - Create a new standard V4L2 menu control
  536. * with driver specific menu.
  537. *
  538. * @hdl: The control handler.
  539. * @ops: The control ops.
  540. * @id: The control ID.
  541. * @max: The control's maximum value.
  542. * @mask: The control's skip mask for menu controls. This makes it
  543. * easy to skip menu items that are not valid. If bit X is set,
  544. * then menu item X is skipped. Of course, this only works for
  545. * menus with <= 64 menu items. There are no menus that come
  546. * close to that number, so this is OK. Should we ever need more,
  547. * then this will have to be extended to a bit array.
  548. * @def: The control's default value.
  549. * @qmenu: The new menu.
  550. *
  551. * Same as v4l2_ctrl_new_std_menu(), but @qmenu will be the driver specific
  552. * menu of this control.
  553. *
  554. */
  555. struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items(struct v4l2_ctrl_handler *hdl,
  556. const struct v4l2_ctrl_ops *ops,
  557. u32 id, u8 max,
  558. u64 mask, u8 def,
  559. const char * const *qmenu);
  560. /**
  561. * v4l2_ctrl_new_int_menu() - Create a new standard V4L2 integer menu control.
  562. *
  563. * @hdl: The control handler.
  564. * @ops: The control ops.
  565. * @id: The control ID.
  566. * @max: The control's maximum value.
  567. * @def: The control's default value.
  568. * @qmenu_int: The control's menu entries.
  569. *
  570. * Same as v4l2_ctrl_new_std_menu(), but @mask is set to 0 and it additionaly
  571. * takes as an argument an array of integers determining the menu items.
  572. *
  573. * If @id refers to a non-integer-menu control, then this function will
  574. * return %NULL.
  575. */
  576. struct v4l2_ctrl *v4l2_ctrl_new_int_menu(struct v4l2_ctrl_handler *hdl,
  577. const struct v4l2_ctrl_ops *ops,
  578. u32 id, u8 max, u8 def,
  579. const s64 *qmenu_int);
  580. /**
  581. * typedef v4l2_ctrl_filter - Typedef to define the filter function to be
  582. * used when adding a control handler.
  583. *
  584. * @ctrl: pointer to struct &v4l2_ctrl.
  585. */
  586. typedef bool (*v4l2_ctrl_filter)(const struct v4l2_ctrl *ctrl);
  587. /**
  588. * v4l2_ctrl_add_handler() - Add all controls from handler @add to
  589. * handler @hdl.
  590. *
  591. * @hdl: The control handler.
  592. * @add: The control handler whose controls you want to add to
  593. * the @hdl control handler.
  594. * @filter: This function will filter which controls should be added.
  595. *
  596. * Does nothing if either of the two handlers is a NULL pointer.
  597. * If @filter is NULL, then all controls are added. Otherwise only those
  598. * controls for which @filter returns true will be added.
  599. * In case of an error @hdl->error will be set to the error code (if it
  600. * wasn't set already).
  601. */
  602. int v4l2_ctrl_add_handler(struct v4l2_ctrl_handler *hdl,
  603. struct v4l2_ctrl_handler *add,
  604. v4l2_ctrl_filter filter);
  605. /**
  606. * v4l2_ctrl_radio_filter() - Standard filter for radio controls.
  607. *
  608. * @ctrl: The control that is filtered.
  609. *
  610. * This will return true for any controls that are valid for radio device
  611. * nodes. Those are all of the V4L2_CID_AUDIO_* user controls and all FM
  612. * transmitter class controls.
  613. *
  614. * This function is to be used with v4l2_ctrl_add_handler().
  615. */
  616. bool v4l2_ctrl_radio_filter(const struct v4l2_ctrl *ctrl);
  617. /**
  618. * v4l2_ctrl_cluster() - Mark all controls in the cluster as belonging
  619. * to that cluster.
  620. *
  621. * @ncontrols: The number of controls in this cluster.
  622. * @controls: The cluster control array of size @ncontrols.
  623. */
  624. void v4l2_ctrl_cluster(unsigned int ncontrols, struct v4l2_ctrl **controls);
  625. /**
  626. * v4l2_ctrl_auto_cluster() - Mark all controls in the cluster as belonging
  627. * to that cluster and set it up for autofoo/foo-type handling.
  628. *
  629. * @ncontrols: The number of controls in this cluster.
  630. * @controls: The cluster control array of size @ncontrols. The first control
  631. * must be the 'auto' control (e.g. autogain, autoexposure, etc.)
  632. * @manual_val: The value for the first control in the cluster that equals the
  633. * manual setting.
  634. * @set_volatile: If true, then all controls except the first auto control will
  635. * be volatile.
  636. *
  637. * Use for control groups where one control selects some automatic feature and
  638. * the other controls are only active whenever the automatic feature is turned
  639. * off (manual mode). Typical examples: autogain vs gain, auto-whitebalance vs
  640. * red and blue balance, etc.
  641. *
  642. * The behavior of such controls is as follows:
  643. *
  644. * When the autofoo control is set to automatic, then any manual controls
  645. * are set to inactive and any reads will call g_volatile_ctrl (if the control
  646. * was marked volatile).
  647. *
  648. * When the autofoo control is set to manual, then any manual controls will
  649. * be marked active, and any reads will just return the current value without
  650. * going through g_volatile_ctrl.
  651. *
  652. * In addition, this function will set the %V4L2_CTRL_FLAG_UPDATE flag
  653. * on the autofoo control and %V4L2_CTRL_FLAG_INACTIVE on the foo control(s)
  654. * if autofoo is in auto mode.
  655. */
  656. void v4l2_ctrl_auto_cluster(unsigned int ncontrols,
  657. struct v4l2_ctrl **controls,
  658. u8 manual_val, bool set_volatile);
  659. /**
  660. * v4l2_ctrl_find() - Find a control with the given ID.
  661. *
  662. * @hdl: The control handler.
  663. * @id: The control ID to find.
  664. *
  665. * If @hdl == NULL this will return NULL as well. Will lock the handler so
  666. * do not use from inside &v4l2_ctrl_ops.
  667. */
  668. struct v4l2_ctrl *v4l2_ctrl_find(struct v4l2_ctrl_handler *hdl, u32 id);
  669. /**
  670. * v4l2_ctrl_activate() - Make the control active or inactive.
  671. * @ctrl: The control to (de)activate.
  672. * @active: True if the control should become active.
  673. *
  674. * This sets or clears the V4L2_CTRL_FLAG_INACTIVE flag atomically.
  675. * Does nothing if @ctrl == NULL.
  676. * This will usually be called from within the s_ctrl op.
  677. * The V4L2_EVENT_CTRL event will be generated afterwards.
  678. *
  679. * This function assumes that the control handler is locked.
  680. */
  681. void v4l2_ctrl_activate(struct v4l2_ctrl *ctrl, bool active);
  682. /**
  683. * v4l2_ctrl_grab() - Mark the control as grabbed or not grabbed.
  684. *
  685. * @ctrl: The control to (de)activate.
  686. * @grabbed: True if the control should become grabbed.
  687. *
  688. * This sets or clears the V4L2_CTRL_FLAG_GRABBED flag atomically.
  689. * Does nothing if @ctrl == NULL.
  690. * The V4L2_EVENT_CTRL event will be generated afterwards.
  691. * This will usually be called when starting or stopping streaming in the
  692. * driver.
  693. *
  694. * This function assumes that the control handler is not locked and will
  695. * take the lock itself.
  696. */
  697. void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed);
  698. /**
  699. *__v4l2_ctrl_modify_range() - Unlocked variant of v4l2_ctrl_modify_range()
  700. *
  701. * @ctrl: The control to update.
  702. * @min: The control's minimum value.
  703. * @max: The control's maximum value.
  704. * @step: The control's step value
  705. * @def: The control's default value.
  706. *
  707. * Update the range of a control on the fly. This works for control types
  708. * INTEGER, BOOLEAN, MENU, INTEGER MENU and BITMASK. For menu controls the
  709. * @step value is interpreted as a menu_skip_mask.
  710. *
  711. * An error is returned if one of the range arguments is invalid for this
  712. * control type.
  713. *
  714. * This function assumes that the control handler is not locked and will
  715. * take the lock itself.
  716. */
  717. int __v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl,
  718. s64 min, s64 max, u64 step, s64 def);
  719. /**
  720. * v4l2_ctrl_modify_range() - Update the range of a control.
  721. *
  722. * @ctrl: The control to update.
  723. * @min: The control's minimum value.
  724. * @max: The control's maximum value.
  725. * @step: The control's step value
  726. * @def: The control's default value.
  727. *
  728. * Update the range of a control on the fly. This works for control types
  729. * INTEGER, BOOLEAN, MENU, INTEGER MENU and BITMASK. For menu controls the
  730. * @step value is interpreted as a menu_skip_mask.
  731. *
  732. * An error is returned if one of the range arguments is invalid for this
  733. * control type.
  734. *
  735. * This function assumes that the control handler is not locked and will
  736. * take the lock itself.
  737. */
  738. static inline int v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl,
  739. s64 min, s64 max, u64 step, s64 def)
  740. {
  741. int rval;
  742. v4l2_ctrl_lock(ctrl);
  743. rval = __v4l2_ctrl_modify_range(ctrl, min, max, step, def);
  744. v4l2_ctrl_unlock(ctrl);
  745. return rval;
  746. }
  747. /**
  748. * v4l2_ctrl_notify() - Function to set a notify callback for a control.
  749. *
  750. * @ctrl: The control.
  751. * @notify: The callback function.
  752. * @priv: The callback private handle, passed as argument to the callback.
  753. *
  754. * This function sets a callback function for the control. If @ctrl is NULL,
  755. * then it will do nothing. If @notify is NULL, then the notify callback will
  756. * be removed.
  757. *
  758. * There can be only one notify. If another already exists, then a WARN_ON
  759. * will be issued and the function will do nothing.
  760. */
  761. void v4l2_ctrl_notify(struct v4l2_ctrl *ctrl, v4l2_ctrl_notify_fnc notify,
  762. void *priv);
  763. /**
  764. * v4l2_ctrl_get_name() - Get the name of the control
  765. *
  766. * @id: The control ID.
  767. *
  768. * This function returns the name of the given control ID or NULL if it isn't
  769. * a known control.
  770. */
  771. const char *v4l2_ctrl_get_name(u32 id);
  772. /**
  773. * v4l2_ctrl_get_menu() - Get the menu string array of the control
  774. *
  775. * @id: The control ID.
  776. *
  777. * This function returns the NULL-terminated menu string array name of the
  778. * given control ID or NULL if it isn't a known menu control.
  779. */
  780. const char * const *v4l2_ctrl_get_menu(u32 id);
  781. /**
  782. * v4l2_ctrl_get_int_menu() - Get the integer menu array of the control
  783. *
  784. * @id: The control ID.
  785. * @len: The size of the integer array.
  786. *
  787. * This function returns the integer array of the given control ID or NULL if it
  788. * if it isn't a known integer menu control.
  789. */
  790. const s64 *v4l2_ctrl_get_int_menu(u32 id, u32 *len);
  791. /**
  792. * v4l2_ctrl_g_ctrl() - Helper function to get the control's value from
  793. * within a driver.
  794. *
  795. * @ctrl: The control.
  796. *
  797. * This returns the control's value safely by going through the control
  798. * framework. This function will lock the control's handler, so it cannot be
  799. * used from within the &v4l2_ctrl_ops functions.
  800. *
  801. * This function is for integer type controls only.
  802. */
  803. s32 v4l2_ctrl_g_ctrl(struct v4l2_ctrl *ctrl);
  804. /**
  805. * __v4l2_ctrl_s_ctrl() - Unlocked variant of v4l2_ctrl_s_ctrl().
  806. *
  807. * @ctrl: The control.
  808. * @val: TheControls name new value.
  809. *
  810. * This sets the control's new value safely by going through the control
  811. * framework. This function assumes the control's handler is already locked,
  812. * allowing it to be used from within the &v4l2_ctrl_ops functions.
  813. *
  814. * This function is for integer type controls only.
  815. */
  816. int __v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val);
  817. /**
  818. * v4l2_ctrl_s_ctrl() - Helper function to set the control's value from
  819. * within a driver.
  820. * @ctrl: The control.
  821. * @val: The new value.
  822. *
  823. * This sets the control's new value safely by going through the control
  824. * framework. This function will lock the control's handler, so it cannot be
  825. * used from within the &v4l2_ctrl_ops functions.
  826. *
  827. * This function is for integer type controls only.
  828. */
  829. static inline int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val)
  830. {
  831. int rval;
  832. v4l2_ctrl_lock(ctrl);
  833. rval = __v4l2_ctrl_s_ctrl(ctrl, val);
  834. v4l2_ctrl_unlock(ctrl);
  835. return rval;
  836. }
  837. /**
  838. * v4l2_ctrl_g_ctrl_int64() - Helper function to get a 64-bit control's value
  839. * from within a driver.
  840. *
  841. * @ctrl: The control.
  842. *
  843. * This returns the control's value safely by going through the control
  844. * framework. This function will lock the control's handler, so it cannot be
  845. * used from within the &v4l2_ctrl_ops functions.
  846. *
  847. * This function is for 64-bit integer type controls only.
  848. */
  849. s64 v4l2_ctrl_g_ctrl_int64(struct v4l2_ctrl *ctrl);
  850. /**
  851. * __v4l2_ctrl_s_ctrl_int64() - Unlocked variant of v4l2_ctrl_s_ctrl_int64().
  852. *
  853. * @ctrl: The control.
  854. * @val: The new value.
  855. *
  856. * This sets the control's new value safely by going through the control
  857. * framework. This function assumes the control's handler is already locked,
  858. * allowing it to be used from within the &v4l2_ctrl_ops functions.
  859. *
  860. * This function is for 64-bit integer type controls only.
  861. */
  862. int __v4l2_ctrl_s_ctrl_int64(struct v4l2_ctrl *ctrl, s64 val);
  863. /**
  864. * v4l2_ctrl_s_ctrl_int64() - Helper function to set a 64-bit control's value
  865. * from within a driver.
  866. *
  867. * @ctrl: The control.
  868. * @val: The new value.
  869. *
  870. * This sets the control's new value safely by going through the control
  871. * framework. This function will lock the control's handler, so it cannot be
  872. * used from within the &v4l2_ctrl_ops functions.
  873. *
  874. * This function is for 64-bit integer type controls only.
  875. */
  876. static inline int v4l2_ctrl_s_ctrl_int64(struct v4l2_ctrl *ctrl, s64 val)
  877. {
  878. int rval;
  879. v4l2_ctrl_lock(ctrl);
  880. rval = __v4l2_ctrl_s_ctrl_int64(ctrl, val);
  881. v4l2_ctrl_unlock(ctrl);
  882. return rval;
  883. }
  884. /**
  885. * __v4l2_ctrl_s_ctrl_string() - Unlocked variant of v4l2_ctrl_s_ctrl_string().
  886. *
  887. * @ctrl: The control.
  888. * @s: The new string.
  889. *
  890. * This sets the control's new string safely by going through the control
  891. * framework. This function assumes the control's handler is already locked,
  892. * allowing it to be used from within the &v4l2_ctrl_ops functions.
  893. *
  894. * This function is for string type controls only.
  895. */
  896. int __v4l2_ctrl_s_ctrl_string(struct v4l2_ctrl *ctrl, const char *s);
  897. /**
  898. * v4l2_ctrl_s_ctrl_string() - Helper function to set a control's string value
  899. * from within a driver.
  900. *
  901. * @ctrl: The control.
  902. * @s: The new string.
  903. *Controls name
  904. * This sets the control's new string safely by going through the control
  905. * framework. This function will lock the control's handler, so it cannot be
  906. * used from within the &v4l2_ctrl_ops functions.
  907. *
  908. * This function is for string type controls only.
  909. */
  910. static inline int v4l2_ctrl_s_ctrl_string(struct v4l2_ctrl *ctrl, const char *s)
  911. {
  912. int rval;
  913. v4l2_ctrl_lock(ctrl);
  914. rval = __v4l2_ctrl_s_ctrl_string(ctrl, s);
  915. v4l2_ctrl_unlock(ctrl);
  916. return rval;
  917. }
  918. /* Internal helper functions that deal with control events. */
  919. extern const struct v4l2_subscribed_event_ops v4l2_ctrl_sub_ev_ops;
  920. /**
  921. * v4l2_ctrl_replace - Function to be used as a callback to
  922. * &struct v4l2_subscribed_event_ops replace\(\)
  923. *
  924. * @old: pointer to struct &v4l2_event with the reported
  925. * event;
  926. * @new: pointer to struct &v4l2_event with the modified
  927. * event;
  928. */
  929. void v4l2_ctrl_replace(struct v4l2_event *old, const struct v4l2_event *new);
  930. /**
  931. * v4l2_ctrl_merge - Function to be used as a callback to
  932. * &struct v4l2_subscribed_event_ops merge(\)
  933. *
  934. * @old: pointer to struct &v4l2_event with the reported
  935. * event;
  936. * @new: pointer to struct &v4l2_event with the merged
  937. * event;
  938. */
  939. void v4l2_ctrl_merge(const struct v4l2_event *old, struct v4l2_event *new);
  940. /**
  941. * v4l2_ctrl_log_status - helper function to implement %VIDIOC_LOG_STATUS ioctl
  942. *
  943. * @file: pointer to struct file
  944. * @fh: unused. Kept just to be compatible to the arguments expected by
  945. * &struct v4l2_ioctl_ops.vidioc_log_status.
  946. *
  947. * Can be used as a vidioc_log_status function that just dumps all controls
  948. * associated with the filehandle.
  949. */
  950. int v4l2_ctrl_log_status(struct file *file, void *fh);
  951. /**
  952. * v4l2_ctrl_subscribe_event - Subscribes to an event
  953. *
  954. *
  955. * @fh: pointer to struct v4l2_fh
  956. * @sub: pointer to &struct v4l2_event_subscription
  957. *
  958. * Can be used as a vidioc_subscribe_event function that just subscribes
  959. * control events.
  960. */
  961. int v4l2_ctrl_subscribe_event(struct v4l2_fh *fh,
  962. const struct v4l2_event_subscription *sub);
  963. /**
  964. * v4l2_ctrl_poll - function to be used as a callback to the poll()
  965. * That just polls for control events.
  966. *
  967. * @file: pointer to struct file
  968. * @wait: pointer to struct poll_table_struct
  969. */
  970. unsigned int v4l2_ctrl_poll(struct file *file, struct poll_table_struct *wait);
  971. /* Helpers for ioctl_ops */
  972. /**
  973. * v4l2_queryctrl - Helper function to implement
  974. * :ref:`VIDIOC_QUERYCTRL <vidioc_queryctrl>` ioctl
  975. *
  976. * @hdl: pointer to &struct v4l2_ctrl_handler
  977. * @qc: pointer to &struct v4l2_queryctrl
  978. *
  979. * If hdl == NULL then they will all return -EINVAL.
  980. */
  981. int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc);
  982. /**
  983. * v4l2_query_ext_ctrl - Helper function to implement
  984. * :ref:`VIDIOC_QUERY_EXT_CTRL <vidioc_queryctrl>` ioctl
  985. *
  986. * @hdl: pointer to &struct v4l2_ctrl_handler
  987. * @qc: pointer to &struct v4l2_query_ext_ctrl
  988. *
  989. * If hdl == NULL then they will all return -EINVAL.
  990. */
  991. int v4l2_query_ext_ctrl(struct v4l2_ctrl_handler *hdl,
  992. struct v4l2_query_ext_ctrl *qc);
  993. /**
  994. * v4l2_querymenu - Helper function to implement
  995. * :ref:`VIDIOC_QUERYMENU <vidioc_queryctrl>` ioctl
  996. *
  997. * @hdl: pointer to &struct v4l2_ctrl_handler
  998. * @qm: pointer to &struct v4l2_querymenu
  999. *
  1000. * If hdl == NULL then they will all return -EINVAL.
  1001. */
  1002. int v4l2_querymenu(struct v4l2_ctrl_handler *hdl, struct v4l2_querymenu *qm);
  1003. /**
  1004. * v4l2_g_ctrl - Helper function to implement
  1005. * :ref:`VIDIOC_G_CTRL <vidioc_g_ctrl>` ioctl
  1006. *
  1007. * @hdl: pointer to &struct v4l2_ctrl_handler
  1008. * @ctrl: pointer to &struct v4l2_control
  1009. *
  1010. * If hdl == NULL then they will all return -EINVAL.
  1011. */
  1012. int v4l2_g_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_control *ctrl);
  1013. /**
  1014. * v4l2_s_ctrl - Helper function to implement
  1015. * :ref:`VIDIOC_S_CTRL <vidioc_g_ctrl>` ioctl
  1016. *
  1017. * @fh: pointer to &struct v4l2_fh
  1018. * @hdl: pointer to &struct v4l2_ctrl_handler
  1019. *
  1020. * @ctrl: pointer to &struct v4l2_control
  1021. *
  1022. * If hdl == NULL then they will all return -EINVAL.
  1023. */
  1024. int v4l2_s_ctrl(struct v4l2_fh *fh, struct v4l2_ctrl_handler *hdl,
  1025. struct v4l2_control *ctrl);
  1026. /**
  1027. * v4l2_g_ext_ctrls - Helper function to implement
  1028. * :ref:`VIDIOC_G_EXT_CTRLS <vidioc_g_ext_ctrls>` ioctl
  1029. *
  1030. * @hdl: pointer to &struct v4l2_ctrl_handler
  1031. * @c: pointer to &struct v4l2_ext_controls
  1032. *
  1033. * If hdl == NULL then they will all return -EINVAL.
  1034. */
  1035. int v4l2_g_ext_ctrls(struct v4l2_ctrl_handler *hdl,
  1036. struct v4l2_ext_controls *c);
  1037. /**
  1038. * v4l2_try_ext_ctrls - Helper function to implement
  1039. * :ref:`VIDIOC_TRY_EXT_CTRLS <vidioc_g_ext_ctrls>` ioctl
  1040. *
  1041. * @hdl: pointer to &struct v4l2_ctrl_handler
  1042. * @c: pointer to &struct v4l2_ext_controls
  1043. *
  1044. * If hdl == NULL then they will all return -EINVAL.
  1045. */
  1046. int v4l2_try_ext_ctrls(struct v4l2_ctrl_handler *hdl,
  1047. struct v4l2_ext_controls *c);
  1048. /**
  1049. * v4l2_s_ext_ctrls - Helper function to implement
  1050. * :ref:`VIDIOC_S_EXT_CTRLS <vidioc_g_ext_ctrls>` ioctl
  1051. *
  1052. * @fh: pointer to &struct v4l2_fh
  1053. * @hdl: pointer to &struct v4l2_ctrl_handler
  1054. * @c: pointer to &struct v4l2_ext_controls
  1055. *
  1056. * If hdl == NULL then they will all return -EINVAL.
  1057. */
  1058. int v4l2_s_ext_ctrls(struct v4l2_fh *fh, struct v4l2_ctrl_handler *hdl,
  1059. struct v4l2_ext_controls *c);
  1060. /**
  1061. * v4l2_ctrl_subdev_subscribe_event - Helper function to implement
  1062. * as a &struct v4l2_subdev_core_ops subscribe_event function
  1063. * that just subscribes control events.
  1064. *
  1065. * @sd: pointer to &struct v4l2_subdev
  1066. * @fh: pointer to &struct v4l2_fh
  1067. * @sub: pointer to &struct v4l2_event_subscription
  1068. */
  1069. int v4l2_ctrl_subdev_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,
  1070. struct v4l2_event_subscription *sub);
  1071. /**
  1072. * v4l2_ctrl_subdev_log_status - Log all controls owned by subdev's control
  1073. * handler.
  1074. *
  1075. * @sd: pointer to &struct v4l2_subdev
  1076. */
  1077. int v4l2_ctrl_subdev_log_status(struct v4l2_subdev *sd);
  1078. #endif