v4l2-ctrls.h 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148
  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 an 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 an 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.
  439. * @hdl: The control handler.
  440. *
  441. * Button controls will be skipped, as are read-only controls.
  442. *
  443. * If @hdl == NULL, then this just returns 0.
  444. */
  445. int v4l2_ctrl_handler_setup(struct v4l2_ctrl_handler *hdl);
  446. /**
  447. * v4l2_ctrl_handler_log_status() - Log all controls owned by the handler.
  448. * @hdl: The control handler.
  449. * @prefix: The prefix to use when logging the control values. If the
  450. * prefix does not end with a space, then ": " will be added
  451. * after the prefix. If @prefix == NULL, then no prefix will be
  452. * used.
  453. *
  454. * For use with VIDIOC_LOG_STATUS.
  455. *
  456. * Does nothing if @hdl == NULL.
  457. */
  458. void v4l2_ctrl_handler_log_status(struct v4l2_ctrl_handler *hdl,
  459. const char *prefix);
  460. /**
  461. * v4l2_ctrl_new_custom() - Allocate and initialize a new custom V4L2
  462. * control.
  463. *
  464. * @hdl: The control handler.
  465. * @cfg: The control's configuration data.
  466. * @priv: The control's driver-specific private data.
  467. *
  468. * If the &v4l2_ctrl struct could not be allocated then NULL is returned
  469. * and @hdl->error is set to the error code (if it wasn't set already).
  470. */
  471. struct v4l2_ctrl *v4l2_ctrl_new_custom(struct v4l2_ctrl_handler *hdl,
  472. const struct v4l2_ctrl_config *cfg,
  473. void *priv);
  474. /**
  475. * v4l2_ctrl_new_std() - Allocate and initialize a new standard V4L2 non-menu
  476. * control.
  477. *
  478. * @hdl: The control handler.
  479. * @ops: The control ops.
  480. * @id: The control ID.
  481. * @min: The control's minimum value.
  482. * @max: The control's maximum value.
  483. * @step: The control's step value
  484. * @def: The control's default value.
  485. *
  486. * If the &v4l2_ctrl struct could not be allocated, or the control
  487. * ID is not known, then NULL is returned and @hdl->error is set to the
  488. * appropriate error code (if it wasn't set already).
  489. *
  490. * If @id refers to a menu control, then this function will return NULL.
  491. *
  492. * Use v4l2_ctrl_new_std_menu() when adding menu controls.
  493. */
  494. struct v4l2_ctrl *v4l2_ctrl_new_std(struct v4l2_ctrl_handler *hdl,
  495. const struct v4l2_ctrl_ops *ops,
  496. u32 id, s64 min, s64 max, u64 step,
  497. s64 def);
  498. /**
  499. * v4l2_ctrl_new_std_menu() - Allocate and initialize a new standard V4L2
  500. * menu control.
  501. *
  502. * @hdl: The control handler.
  503. * @ops: The control ops.
  504. * @id: The control ID.
  505. * @max: The control's maximum value.
  506. * @mask: The control's skip mask for menu controls. This makes it
  507. * easy to skip menu items that are not valid. If bit X is set,
  508. * then menu item X is skipped. Of course, this only works for
  509. * menus with <= 64 menu items. There are no menus that come
  510. * close to that number, so this is OK. Should we ever need more,
  511. * then this will have to be extended to a bit array.
  512. * @def: The control's default value.
  513. *
  514. * Same as v4l2_ctrl_new_std(), but @min is set to 0 and the @mask value
  515. * determines which menu items are to be skipped.
  516. *
  517. * If @id refers to a non-menu control, then this function will return NULL.
  518. */
  519. struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl,
  520. const struct v4l2_ctrl_ops *ops,
  521. u32 id, u8 max, u64 mask, u8 def);
  522. /**
  523. * v4l2_ctrl_new_std_menu_items() - Create a new standard V4L2 menu control
  524. * with driver specific menu.
  525. *
  526. * @hdl: The control handler.
  527. * @ops: The control ops.
  528. * @id: The control ID.
  529. * @max: The control's maximum value.
  530. * @mask: The control's skip mask for menu controls. This makes it
  531. * easy to skip menu items that are not valid. If bit X is set,
  532. * then menu item X is skipped. Of course, this only works for
  533. * menus with <= 64 menu items. There are no menus that come
  534. * close to that number, so this is OK. Should we ever need more,
  535. * then this will have to be extended to a bit array.
  536. * @def: The control's default value.
  537. * @qmenu: The new menu.
  538. *
  539. * Same as v4l2_ctrl_new_std_menu(), but @qmenu will be the driver specific
  540. * menu of this control.
  541. *
  542. */
  543. struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items(struct v4l2_ctrl_handler *hdl,
  544. const struct v4l2_ctrl_ops *ops,
  545. u32 id, u8 max,
  546. u64 mask, u8 def,
  547. const char * const *qmenu);
  548. /**
  549. * v4l2_ctrl_new_int_menu() - Create a new standard V4L2 integer menu control.
  550. *
  551. * @hdl: The control handler.
  552. * @ops: The control ops.
  553. * @id: The control ID.
  554. * @max: The control's maximum value.
  555. * @def: The control's default value.
  556. * @qmenu_int: The control's menu entries.
  557. *
  558. * Same as v4l2_ctrl_new_std_menu(), but @mask is set to 0 and it additionaly
  559. * takes as an argument an array of integers determining the menu items.
  560. *
  561. * If @id refers to a non-integer-menu control, then this function will
  562. * return %NULL.
  563. */
  564. struct v4l2_ctrl *v4l2_ctrl_new_int_menu(struct v4l2_ctrl_handler *hdl,
  565. const struct v4l2_ctrl_ops *ops,
  566. u32 id, u8 max, u8 def,
  567. const s64 *qmenu_int);
  568. /**
  569. * typedef v4l2_ctrl_filter - Typedef to define the filter function to be
  570. * used when adding a control handler.
  571. *
  572. * @ctrl: pointer to struct &v4l2_ctrl.
  573. */
  574. typedef bool (*v4l2_ctrl_filter)(const struct v4l2_ctrl *ctrl);
  575. /**
  576. * v4l2_ctrl_add_handler() - Add all controls from handler @add to
  577. * handler @hdl.
  578. *
  579. * @hdl: The control handler.
  580. * @add: The control handler whose controls you want to add to
  581. * the @hdl control handler.
  582. * @filter: This function will filter which controls should be added.
  583. *
  584. * Does nothing if either of the two handlers is a NULL pointer.
  585. * If @filter is NULL, then all controls are added. Otherwise only those
  586. * controls for which @filter returns true will be added.
  587. * In case of an error @hdl->error will be set to the error code (if it
  588. * wasn't set already).
  589. */
  590. int v4l2_ctrl_add_handler(struct v4l2_ctrl_handler *hdl,
  591. struct v4l2_ctrl_handler *add,
  592. v4l2_ctrl_filter filter);
  593. /**
  594. * v4l2_ctrl_radio_filter() - Standard filter for radio controls.
  595. *
  596. * @ctrl: The control that is filtered.
  597. *
  598. * This will return true for any controls that are valid for radio device
  599. * nodes. Those are all of the V4L2_CID_AUDIO_* user controls and all FM
  600. * transmitter class controls.
  601. *
  602. * This function is to be used with v4l2_ctrl_add_handler().
  603. */
  604. bool v4l2_ctrl_radio_filter(const struct v4l2_ctrl *ctrl);
  605. /**
  606. * v4l2_ctrl_cluster() - Mark all controls in the cluster as belonging
  607. * to that cluster.
  608. *
  609. * @ncontrols: The number of controls in this cluster.
  610. * @controls: The cluster control array of size @ncontrols.
  611. */
  612. void v4l2_ctrl_cluster(unsigned int ncontrols, struct v4l2_ctrl **controls);
  613. /**
  614. * v4l2_ctrl_auto_cluster() - Mark all controls in the cluster as belonging
  615. * to that cluster and set it up for autofoo/foo-type handling.
  616. *
  617. * @ncontrols: The number of controls in this cluster.
  618. * @controls: The cluster control array of size @ncontrols. The first control
  619. * must be the 'auto' control (e.g. autogain, autoexposure, etc.)
  620. * @manual_val: The value for the first control in the cluster that equals the
  621. * manual setting.
  622. * @set_volatile: If true, then all controls except the first auto control will
  623. * be volatile.
  624. *
  625. * Use for control groups where one control selects some automatic feature and
  626. * the other controls are only active whenever the automatic feature is turned
  627. * off (manual mode). Typical examples: autogain vs gain, auto-whitebalance vs
  628. * red and blue balance, etc.
  629. *
  630. * The behavior of such controls is as follows:
  631. *
  632. * When the autofoo control is set to automatic, then any manual controls
  633. * are set to inactive and any reads will call g_volatile_ctrl (if the control
  634. * was marked volatile).
  635. *
  636. * When the autofoo control is set to manual, then any manual controls will
  637. * be marked active, and any reads will just return the current value without
  638. * going through g_volatile_ctrl.
  639. *
  640. * In addition, this function will set the %V4L2_CTRL_FLAG_UPDATE flag
  641. * on the autofoo control and %V4L2_CTRL_FLAG_INACTIVE on the foo control(s)
  642. * if autofoo is in auto mode.
  643. */
  644. void v4l2_ctrl_auto_cluster(unsigned int ncontrols,
  645. struct v4l2_ctrl **controls,
  646. u8 manual_val, bool set_volatile);
  647. /**
  648. * v4l2_ctrl_find() - Find a control with the given ID.
  649. *
  650. * @hdl: The control handler.
  651. * @id: The control ID to find.
  652. *
  653. * If @hdl == NULL this will return NULL as well. Will lock the handler so
  654. * do not use from inside &v4l2_ctrl_ops.
  655. */
  656. struct v4l2_ctrl *v4l2_ctrl_find(struct v4l2_ctrl_handler *hdl, u32 id);
  657. /**
  658. * v4l2_ctrl_activate() - Make the control active or inactive.
  659. * @ctrl: The control to (de)activate.
  660. * @active: True if the control should become active.
  661. *
  662. * This sets or clears the V4L2_CTRL_FLAG_INACTIVE flag atomically.
  663. * Does nothing if @ctrl == NULL.
  664. * This will usually be called from within the s_ctrl op.
  665. * The V4L2_EVENT_CTRL event will be generated afterwards.
  666. *
  667. * This function assumes that the control handler is locked.
  668. */
  669. void v4l2_ctrl_activate(struct v4l2_ctrl *ctrl, bool active);
  670. /**
  671. * v4l2_ctrl_grab() - Mark the control as grabbed or not grabbed.
  672. *
  673. * @ctrl: The control to (de)activate.
  674. * @grabbed: True if the control should become grabbed.
  675. *
  676. * This sets or clears the V4L2_CTRL_FLAG_GRABBED flag atomically.
  677. * Does nothing if @ctrl == NULL.
  678. * The V4L2_EVENT_CTRL event will be generated afterwards.
  679. * This will usually be called when starting or stopping streaming in the
  680. * driver.
  681. *
  682. * This function assumes that the control handler is not locked and will
  683. * take the lock itself.
  684. */
  685. void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed);
  686. /**
  687. *__v4l2_ctrl_modify_range() - Unlocked variant of v4l2_ctrl_modify_range()
  688. *
  689. * @ctrl: The control to update.
  690. * @min: The control's minimum value.
  691. * @max: The control's maximum value.
  692. * @step: The control's step value
  693. * @def: The control's default value.
  694. *
  695. * Update the range of a control on the fly. This works for control types
  696. * INTEGER, BOOLEAN, MENU, INTEGER MENU and BITMASK. For menu controls the
  697. * @step value is interpreted as a menu_skip_mask.
  698. *
  699. * An error is returned if one of the range arguments is invalid for this
  700. * control type.
  701. *
  702. * This function assumes that the control handler is not locked and will
  703. * take the lock itself.
  704. */
  705. int __v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl,
  706. s64 min, s64 max, u64 step, s64 def);
  707. /**
  708. * v4l2_ctrl_modify_range() - Update the range of a control.
  709. *
  710. * @ctrl: The control to update.
  711. * @min: The control's minimum value.
  712. * @max: The control's maximum value.
  713. * @step: The control's step value
  714. * @def: The control's default value.
  715. *
  716. * Update the range of a control on the fly. This works for control types
  717. * INTEGER, BOOLEAN, MENU, INTEGER MENU and BITMASK. For menu controls the
  718. * @step value is interpreted as a menu_skip_mask.
  719. *
  720. * An error is returned if one of the range arguments is invalid for this
  721. * control type.
  722. *
  723. * This function assumes that the control handler is not locked and will
  724. * take the lock itself.
  725. */
  726. static inline int v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl,
  727. s64 min, s64 max, u64 step, s64 def)
  728. {
  729. int rval;
  730. v4l2_ctrl_lock(ctrl);
  731. rval = __v4l2_ctrl_modify_range(ctrl, min, max, step, def);
  732. v4l2_ctrl_unlock(ctrl);
  733. return rval;
  734. }
  735. /**
  736. * v4l2_ctrl_notify() - Function to set a notify callback for a control.
  737. *
  738. * @ctrl: The control.
  739. * @notify: The callback function.
  740. * @priv: The callback private handle, passed as argument to the callback.
  741. *
  742. * This function sets a callback function for the control. If @ctrl is NULL,
  743. * then it will do nothing. If @notify is NULL, then the notify callback will
  744. * be removed.
  745. *
  746. * There can be only one notify. If another already exists, then a WARN_ON
  747. * will be issued and the function will do nothing.
  748. */
  749. void v4l2_ctrl_notify(struct v4l2_ctrl *ctrl, v4l2_ctrl_notify_fnc notify,
  750. void *priv);
  751. /**
  752. * v4l2_ctrl_get_name() - Get the name of the control
  753. *
  754. * @id: The control ID.
  755. *
  756. * This function returns the name of the given control ID or NULL if it isn't
  757. * a known control.
  758. */
  759. const char *v4l2_ctrl_get_name(u32 id);
  760. /**
  761. * v4l2_ctrl_get_menu() - Get the menu string array of the control
  762. *
  763. * @id: The control ID.
  764. *
  765. * This function returns the NULL-terminated menu string array name of the
  766. * given control ID or NULL if it isn't a known menu control.
  767. */
  768. const char * const *v4l2_ctrl_get_menu(u32 id);
  769. /**
  770. * v4l2_ctrl_get_int_menu() - Get the integer menu array of the control
  771. *
  772. * @id: The control ID.
  773. * @len: The size of the integer array.
  774. *
  775. * This function returns the integer array of the given control ID or NULL if it
  776. * if it isn't a known integer menu control.
  777. */
  778. const s64 *v4l2_ctrl_get_int_menu(u32 id, u32 *len);
  779. /**
  780. * v4l2_ctrl_g_ctrl() - Helper function to get the control's value from
  781. * within a driver.
  782. *
  783. * @ctrl: The control.
  784. *
  785. * This returns the control's value safely by going through the control
  786. * framework. This function will lock the control's handler, so it cannot be
  787. * used from within the &v4l2_ctrl_ops functions.
  788. *
  789. * This function is for integer type controls only.
  790. */
  791. s32 v4l2_ctrl_g_ctrl(struct v4l2_ctrl *ctrl);
  792. /**
  793. * __v4l2_ctrl_s_ctrl() - Unlocked variant of v4l2_ctrl_s_ctrl().
  794. *
  795. * @ctrl: The control.
  796. * @val: TheControls name new value.
  797. *
  798. * This sets the control's new value safely by going through the control
  799. * framework. This function assumes the control's handler is already locked,
  800. * allowing it to be used from within the &v4l2_ctrl_ops functions.
  801. *
  802. * This function is for integer type controls only.
  803. */
  804. int __v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val);
  805. /**
  806. * v4l2_ctrl_s_ctrl() - Helper function to set the control's value from
  807. * within a driver.
  808. * @ctrl: The control.
  809. * @val: The new value.
  810. *
  811. * This sets the control's new value safely by going through the control
  812. * framework. This function will lock the control's handler, so it cannot be
  813. * used from within the &v4l2_ctrl_ops functions.
  814. *
  815. * This function is for integer type controls only.
  816. */
  817. static inline int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val)
  818. {
  819. int rval;
  820. v4l2_ctrl_lock(ctrl);
  821. rval = __v4l2_ctrl_s_ctrl(ctrl, val);
  822. v4l2_ctrl_unlock(ctrl);
  823. return rval;
  824. }
  825. /**
  826. * v4l2_ctrl_g_ctrl_int64() - Helper function to get a 64-bit control's value
  827. * from within a driver.
  828. *
  829. * @ctrl: The control.
  830. *
  831. * This returns the control's value safely by going through the control
  832. * framework. This function will lock the control's handler, so it cannot be
  833. * used from within the &v4l2_ctrl_ops functions.
  834. *
  835. * This function is for 64-bit integer type controls only.
  836. */
  837. s64 v4l2_ctrl_g_ctrl_int64(struct v4l2_ctrl *ctrl);
  838. /**
  839. * __v4l2_ctrl_s_ctrl_int64() - Unlocked variant of v4l2_ctrl_s_ctrl_int64().
  840. *
  841. * @ctrl: The control.
  842. * @val: The new value.
  843. *
  844. * This sets the control's new value safely by going through the control
  845. * framework. This function assumes the control's handler is already locked,
  846. * allowing it to be used from within the &v4l2_ctrl_ops functions.
  847. *
  848. * This function is for 64-bit integer type controls only.
  849. */
  850. int __v4l2_ctrl_s_ctrl_int64(struct v4l2_ctrl *ctrl, s64 val);
  851. /**
  852. * v4l2_ctrl_s_ctrl_int64() - Helper function to set a 64-bit control's value
  853. * from within a driver.
  854. *
  855. * @ctrl: The control.
  856. * @val: The new value.
  857. *
  858. * This sets the control's new value safely by going through the control
  859. * framework. This function will lock the control's handler, so it cannot be
  860. * used from within the &v4l2_ctrl_ops functions.
  861. *
  862. * This function is for 64-bit integer type controls only.
  863. */
  864. static inline int v4l2_ctrl_s_ctrl_int64(struct v4l2_ctrl *ctrl, s64 val)
  865. {
  866. int rval;
  867. v4l2_ctrl_lock(ctrl);
  868. rval = __v4l2_ctrl_s_ctrl_int64(ctrl, val);
  869. v4l2_ctrl_unlock(ctrl);
  870. return rval;
  871. }
  872. /**
  873. * __v4l2_ctrl_s_ctrl_string() - Unlocked variant of v4l2_ctrl_s_ctrl_string().
  874. *
  875. * @ctrl: The control.
  876. * @s: The new string.
  877. *
  878. * This sets the control's new string safely by going through the control
  879. * framework. This function assumes the control's handler is already locked,
  880. * allowing it to be used from within the &v4l2_ctrl_ops functions.
  881. *
  882. * This function is for string type controls only.
  883. */
  884. int __v4l2_ctrl_s_ctrl_string(struct v4l2_ctrl *ctrl, const char *s);
  885. /**
  886. * v4l2_ctrl_s_ctrl_string() - Helper function to set a control's string value
  887. * from within a driver.
  888. *
  889. * @ctrl: The control.
  890. * @s: The new string.
  891. *Controls name
  892. * This sets the control's new string safely by going through the control
  893. * framework. This function will lock the control's handler, so it cannot be
  894. * used from within the &v4l2_ctrl_ops functions.
  895. *
  896. * This function is for string type controls only.
  897. */
  898. static inline int v4l2_ctrl_s_ctrl_string(struct v4l2_ctrl *ctrl, const char *s)
  899. {
  900. int rval;
  901. v4l2_ctrl_lock(ctrl);
  902. rval = __v4l2_ctrl_s_ctrl_string(ctrl, s);
  903. v4l2_ctrl_unlock(ctrl);
  904. return rval;
  905. }
  906. /* Internal helper functions that deal with control events. */
  907. extern const struct v4l2_subscribed_event_ops v4l2_ctrl_sub_ev_ops;
  908. /**
  909. * v4l2_ctrl_replace - Function to be used as a callback to
  910. * &struct v4l2_subscribed_event_ops replace\(\)
  911. *
  912. * @old: pointer to struct &v4l2_event with the reported
  913. * event;
  914. * @new: pointer to struct &v4l2_event with the modified
  915. * event;
  916. */
  917. void v4l2_ctrl_replace(struct v4l2_event *old, const struct v4l2_event *new);
  918. /**
  919. * v4l2_ctrl_merge - Function to be used as a callback to
  920. * &struct v4l2_subscribed_event_ops merge(\)
  921. *
  922. * @old: pointer to struct &v4l2_event with the reported
  923. * event;
  924. * @new: pointer to struct &v4l2_event with the merged
  925. * event;
  926. */
  927. void v4l2_ctrl_merge(const struct v4l2_event *old, struct v4l2_event *new);
  928. /**
  929. * v4l2_ctrl_log_status - helper function to implement %VIDIOC_LOG_STATUS ioctl
  930. *
  931. * @file: pointer to struct file
  932. * @fh: unused. Kept just to be compatible to the arguments expected by
  933. * &struct v4l2_ioctl_ops.vidioc_log_status.
  934. *
  935. * Can be used as a vidioc_log_status function that just dumps all controls
  936. * associated with the filehandle.
  937. */
  938. int v4l2_ctrl_log_status(struct file *file, void *fh);
  939. /**
  940. * v4l2_ctrl_subscribe_event - Subscribes to an event
  941. *
  942. *
  943. * @fh: pointer to struct v4l2_fh
  944. * @sub: pointer to &struct v4l2_event_subscription
  945. *
  946. * Can be used as a vidioc_subscribe_event function that just subscribes
  947. * control events.
  948. */
  949. int v4l2_ctrl_subscribe_event(struct v4l2_fh *fh,
  950. const struct v4l2_event_subscription *sub);
  951. /**
  952. * v4l2_ctrl_poll - function to be used as a callback to the poll()
  953. * That just polls for control events.
  954. *
  955. * @file: pointer to struct file
  956. * @wait: pointer to struct poll_table_struct
  957. */
  958. unsigned int v4l2_ctrl_poll(struct file *file, struct poll_table_struct *wait);
  959. /* Helpers for ioctl_ops */
  960. /**
  961. * v4l2_queryctrl - Helper function to implement
  962. * :ref:`VIDIOC_QUERYCTRL <vidioc_queryctrl>` ioctl
  963. *
  964. * @hdl: pointer to &struct v4l2_ctrl_handler
  965. * @qc: pointer to &struct v4l2_queryctrl
  966. *
  967. * If hdl == NULL then they will all return -EINVAL.
  968. */
  969. int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc);
  970. /**
  971. * v4l2_query_ext_ctrl - Helper function to implement
  972. * :ref:`VIDIOC_QUERY_EXT_CTRL <vidioc_queryctrl>` ioctl
  973. *
  974. * @hdl: pointer to &struct v4l2_ctrl_handler
  975. * @qc: pointer to &struct v4l2_query_ext_ctrl
  976. *
  977. * If hdl == NULL then they will all return -EINVAL.
  978. */
  979. int v4l2_query_ext_ctrl(struct v4l2_ctrl_handler *hdl,
  980. struct v4l2_query_ext_ctrl *qc);
  981. /**
  982. * v4l2_querymenu - Helper function to implement
  983. * :ref:`VIDIOC_QUERYMENU <vidioc_queryctrl>` ioctl
  984. *
  985. * @hdl: pointer to &struct v4l2_ctrl_handler
  986. * @qm: pointer to &struct v4l2_querymenu
  987. *
  988. * If hdl == NULL then they will all return -EINVAL.
  989. */
  990. int v4l2_querymenu(struct v4l2_ctrl_handler *hdl, struct v4l2_querymenu *qm);
  991. /**
  992. * v4l2_g_ctrl - Helper function to implement
  993. * :ref:`VIDIOC_G_CTRL <vidioc_g_ctrl>` ioctl
  994. *
  995. * @hdl: pointer to &struct v4l2_ctrl_handler
  996. * @ctrl: pointer to &struct v4l2_control
  997. *
  998. * If hdl == NULL then they will all return -EINVAL.
  999. */
  1000. int v4l2_g_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_control *ctrl);
  1001. /**
  1002. * v4l2_s_ctrl - Helper function to implement
  1003. * :ref:`VIDIOC_S_CTRL <vidioc_g_ctrl>` ioctl
  1004. *
  1005. * @fh: pointer to &struct v4l2_fh
  1006. * @hdl: pointer to &struct v4l2_ctrl_handler
  1007. *
  1008. * @ctrl: pointer to &struct v4l2_control
  1009. *
  1010. * If hdl == NULL then they will all return -EINVAL.
  1011. */
  1012. int v4l2_s_ctrl(struct v4l2_fh *fh, struct v4l2_ctrl_handler *hdl,
  1013. struct v4l2_control *ctrl);
  1014. /**
  1015. * v4l2_g_ext_ctrls - Helper function to implement
  1016. * :ref:`VIDIOC_G_EXT_CTRLS <vidioc_g_ext_ctrls>` ioctl
  1017. *
  1018. * @hdl: pointer to &struct v4l2_ctrl_handler
  1019. * @c: pointer to &struct v4l2_ext_controls
  1020. *
  1021. * If hdl == NULL then they will all return -EINVAL.
  1022. */
  1023. int v4l2_g_ext_ctrls(struct v4l2_ctrl_handler *hdl,
  1024. struct v4l2_ext_controls *c);
  1025. /**
  1026. * v4l2_try_ext_ctrls - Helper function to implement
  1027. * :ref:`VIDIOC_TRY_EXT_CTRLS <vidioc_g_ext_ctrls>` ioctl
  1028. *
  1029. * @hdl: pointer to &struct v4l2_ctrl_handler
  1030. * @c: pointer to &struct v4l2_ext_controls
  1031. *
  1032. * If hdl == NULL then they will all return -EINVAL.
  1033. */
  1034. int v4l2_try_ext_ctrls(struct v4l2_ctrl_handler *hdl,
  1035. struct v4l2_ext_controls *c);
  1036. /**
  1037. * v4l2_s_ext_ctrls - Helper function to implement
  1038. * :ref:`VIDIOC_S_EXT_CTRLS <vidioc_g_ext_ctrls>` ioctl
  1039. *
  1040. * @fh: pointer to &struct v4l2_fh
  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_s_ext_ctrls(struct v4l2_fh *fh, struct v4l2_ctrl_handler *hdl,
  1047. struct v4l2_ext_controls *c);
  1048. /**
  1049. * v4l2_ctrl_subdev_subscribe_event - Helper function to implement
  1050. * as a &struct v4l2_subdev_core_ops subscribe_event function
  1051. * that just subscribes control events.
  1052. *
  1053. * @sd: pointer to &struct v4l2_subdev
  1054. * @fh: pointer to &struct v4l2_fh
  1055. * @sub: pointer to &struct v4l2_event_subscription
  1056. */
  1057. int v4l2_ctrl_subdev_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,
  1058. struct v4l2_event_subscription *sub);
  1059. /**
  1060. * v4l2_ctrl_subdev_log_status - Log all controls owned by subdev's control
  1061. * handler.
  1062. *
  1063. * @sd: pointer to &struct v4l2_subdev
  1064. */
  1065. int v4l2_ctrl_subdev_log_status(struct v4l2_subdev *sd);
  1066. #endif