v4l2-ioctl.h 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. *
  4. * V 4 L 2 D R I V E R H E L P E R A P I
  5. *
  6. * Moved from videodev2.h
  7. *
  8. * Some commonly needed functions for drivers (v4l2-common.o module)
  9. */
  10. #ifndef _V4L2_IOCTL_H
  11. #define _V4L2_IOCTL_H
  12. #include <linux/poll.h>
  13. #include <linux/fs.h>
  14. #include <linux/mutex.h>
  15. #include <linux/sched/signal.h>
  16. #include <linux/compiler.h> /* need __user */
  17. #include <linux/videodev2.h>
  18. struct v4l2_fh;
  19. /**
  20. * struct v4l2_ioctl_ops - describe operations for each V4L2 ioctl
  21. *
  22. * @vidioc_querycap: pointer to the function that implements
  23. * :ref:`VIDIOC_QUERYCAP <vidioc_querycap>` ioctl
  24. * @vidioc_enum_fmt_vid_cap: pointer to the function that implements
  25. * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
  26. * for video capture in single and multi plane mode
  27. * @vidioc_enum_fmt_vid_overlay: pointer to the function that implements
  28. * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
  29. * for video overlay
  30. * @vidioc_enum_fmt_vid_out: pointer to the function that implements
  31. * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
  32. * for video output in single and multi plane mode
  33. * @vidioc_enum_fmt_sdr_cap: pointer to the function that implements
  34. * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
  35. * for Software Defined Radio capture
  36. * @vidioc_enum_fmt_sdr_out: pointer to the function that implements
  37. * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
  38. * for Software Defined Radio output
  39. * @vidioc_enum_fmt_meta_cap: pointer to the function that implements
  40. * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
  41. * for metadata capture
  42. * @vidioc_enum_fmt_meta_out: pointer to the function that implements
  43. * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
  44. * for metadata output
  45. * @vidioc_g_fmt_vid_cap: pointer to the function that implements
  46. * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for video capture
  47. * in single plane mode
  48. * @vidioc_g_fmt_vid_overlay: pointer to the function that implements
  49. * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for video overlay
  50. * @vidioc_g_fmt_vid_out: pointer to the function that implements
  51. * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for video out
  52. * in single plane mode
  53. * @vidioc_g_fmt_vid_out_overlay: pointer to the function that implements
  54. * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for video overlay output
  55. * @vidioc_g_fmt_vbi_cap: pointer to the function that implements
  56. * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for raw VBI capture
  57. * @vidioc_g_fmt_vbi_out: pointer to the function that implements
  58. * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for raw VBI output
  59. * @vidioc_g_fmt_sliced_vbi_cap: pointer to the function that implements
  60. * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for sliced VBI capture
  61. * @vidioc_g_fmt_sliced_vbi_out: pointer to the function that implements
  62. * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for sliced VBI output
  63. * @vidioc_g_fmt_vid_cap_mplane: pointer to the function that implements
  64. * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for video capture
  65. * in multiple plane mode
  66. * @vidioc_g_fmt_vid_out_mplane: pointer to the function that implements
  67. * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for video out
  68. * in multiplane plane mode
  69. * @vidioc_g_fmt_sdr_cap: pointer to the function that implements
  70. * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for Software Defined
  71. * Radio capture
  72. * @vidioc_g_fmt_sdr_out: pointer to the function that implements
  73. * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for Software Defined
  74. * Radio output
  75. * @vidioc_g_fmt_meta_cap: pointer to the function that implements
  76. * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for metadata capture
  77. * @vidioc_g_fmt_meta_out: pointer to the function that implements
  78. * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for metadata output
  79. * @vidioc_s_fmt_vid_cap: pointer to the function that implements
  80. * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for video capture
  81. * in single plane mode
  82. * @vidioc_s_fmt_vid_overlay: pointer to the function that implements
  83. * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for video overlay
  84. * @vidioc_s_fmt_vid_out: pointer to the function that implements
  85. * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for video out
  86. * in single plane mode
  87. * @vidioc_s_fmt_vid_out_overlay: pointer to the function that implements
  88. * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for video overlay output
  89. * @vidioc_s_fmt_vbi_cap: pointer to the function that implements
  90. * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for raw VBI capture
  91. * @vidioc_s_fmt_vbi_out: pointer to the function that implements
  92. * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for raw VBI output
  93. * @vidioc_s_fmt_sliced_vbi_cap: pointer to the function that implements
  94. * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for sliced VBI capture
  95. * @vidioc_s_fmt_sliced_vbi_out: pointer to the function that implements
  96. * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for sliced VBI output
  97. * @vidioc_s_fmt_vid_cap_mplane: pointer to the function that implements
  98. * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for video capture
  99. * in multiple plane mode
  100. * @vidioc_s_fmt_vid_out_mplane: pointer to the function that implements
  101. * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for video out
  102. * in multiplane plane mode
  103. * @vidioc_s_fmt_sdr_cap: pointer to the function that implements
  104. * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for Software Defined
  105. * Radio capture
  106. * @vidioc_s_fmt_sdr_out: pointer to the function that implements
  107. * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for Software Defined
  108. * Radio output
  109. * @vidioc_s_fmt_meta_cap: pointer to the function that implements
  110. * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for metadata capture
  111. * @vidioc_s_fmt_meta_out: pointer to the function that implements
  112. * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for metadata output
  113. * @vidioc_try_fmt_vid_cap: pointer to the function that implements
  114. * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for video capture
  115. * in single plane mode
  116. * @vidioc_try_fmt_vid_overlay: pointer to the function that implements
  117. * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for video overlay
  118. * @vidioc_try_fmt_vid_out: pointer to the function that implements
  119. * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for video out
  120. * in single plane mode
  121. * @vidioc_try_fmt_vid_out_overlay: pointer to the function that implements
  122. * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for video overlay
  123. * output
  124. * @vidioc_try_fmt_vbi_cap: pointer to the function that implements
  125. * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for raw VBI capture
  126. * @vidioc_try_fmt_vbi_out: pointer to the function that implements
  127. * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for raw VBI output
  128. * @vidioc_try_fmt_sliced_vbi_cap: pointer to the function that implements
  129. * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for sliced VBI
  130. * capture
  131. * @vidioc_try_fmt_sliced_vbi_out: pointer to the function that implements
  132. * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for sliced VBI output
  133. * @vidioc_try_fmt_vid_cap_mplane: pointer to the function that implements
  134. * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for video capture
  135. * in multiple plane mode
  136. * @vidioc_try_fmt_vid_out_mplane: pointer to the function that implements
  137. * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for video out
  138. * in multiplane plane mode
  139. * @vidioc_try_fmt_sdr_cap: pointer to the function that implements
  140. * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for Software Defined
  141. * Radio capture
  142. * @vidioc_try_fmt_sdr_out: pointer to the function that implements
  143. * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for Software Defined
  144. * Radio output
  145. * @vidioc_try_fmt_meta_cap: pointer to the function that implements
  146. * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for metadata capture
  147. * @vidioc_try_fmt_meta_out: pointer to the function that implements
  148. * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for metadata output
  149. * @vidioc_reqbufs: pointer to the function that implements
  150. * :ref:`VIDIOC_REQBUFS <vidioc_reqbufs>` ioctl
  151. * @vidioc_querybuf: pointer to the function that implements
  152. * :ref:`VIDIOC_QUERYBUF <vidioc_querybuf>` ioctl
  153. * @vidioc_qbuf: pointer to the function that implements
  154. * :ref:`VIDIOC_QBUF <vidioc_qbuf>` ioctl
  155. * @vidioc_expbuf: pointer to the function that implements
  156. * :ref:`VIDIOC_EXPBUF <vidioc_expbuf>` ioctl
  157. * @vidioc_dqbuf: pointer to the function that implements
  158. * :ref:`VIDIOC_DQBUF <vidioc_qbuf>` ioctl
  159. * @vidioc_create_bufs: pointer to the function that implements
  160. * :ref:`VIDIOC_CREATE_BUFS <vidioc_create_bufs>` ioctl
  161. * @vidioc_prepare_buf: pointer to the function that implements
  162. * :ref:`VIDIOC_PREPARE_BUF <vidioc_prepare_buf>` ioctl
  163. * @vidioc_remove_bufs: pointer to the function that implements
  164. * :ref:`VIDIOC_REMOVE_BUFS <vidioc_remove_bufs>` ioctl
  165. * @vidioc_overlay: pointer to the function that implements
  166. * :ref:`VIDIOC_OVERLAY <vidioc_overlay>` ioctl
  167. * @vidioc_g_fbuf: pointer to the function that implements
  168. * :ref:`VIDIOC_G_FBUF <vidioc_g_fbuf>` ioctl
  169. * @vidioc_s_fbuf: pointer to the function that implements
  170. * :ref:`VIDIOC_S_FBUF <vidioc_g_fbuf>` ioctl
  171. * @vidioc_streamon: pointer to the function that implements
  172. * :ref:`VIDIOC_STREAMON <vidioc_streamon>` ioctl
  173. * @vidioc_streamoff: pointer to the function that implements
  174. * :ref:`VIDIOC_STREAMOFF <vidioc_streamon>` ioctl
  175. * @vidioc_g_std: pointer to the function that implements
  176. * :ref:`VIDIOC_G_STD <vidioc_g_std>` ioctl
  177. * @vidioc_s_std: pointer to the function that implements
  178. * :ref:`VIDIOC_S_STD <vidioc_g_std>` ioctl
  179. * @vidioc_querystd: pointer to the function that implements
  180. * :ref:`VIDIOC_QUERYSTD <vidioc_querystd>` ioctl
  181. * @vidioc_enum_input: pointer to the function that implements
  182. * :ref:`VIDIOC_ENUM_INPUT <vidioc_g_input>` ioctl
  183. * @vidioc_g_input: pointer to the function that implements
  184. * :ref:`VIDIOC_G_INPUT <vidioc_g_input>` ioctl
  185. * @vidioc_s_input: pointer to the function that implements
  186. * :ref:`VIDIOC_S_INPUT <vidioc_g_input>` ioctl
  187. * @vidioc_enum_output: pointer to the function that implements
  188. * :ref:`VIDIOC_ENUM_OUTPUT <vidioc_g_output>` ioctl
  189. * @vidioc_g_output: pointer to the function that implements
  190. * :ref:`VIDIOC_G_OUTPUT <vidioc_g_output>` ioctl
  191. * @vidioc_s_output: pointer to the function that implements
  192. * :ref:`VIDIOC_S_OUTPUT <vidioc_g_output>` ioctl
  193. * @vidioc_query_ext_ctrl: pointer to the function that implements
  194. * :ref:`VIDIOC_QUERY_EXT_CTRL <vidioc_queryctrl>` ioctl
  195. * @vidioc_g_ext_ctrls: pointer to the function that implements
  196. * :ref:`VIDIOC_G_EXT_CTRLS <vidioc_g_ext_ctrls>` ioctl
  197. * @vidioc_s_ext_ctrls: pointer to the function that implements
  198. * :ref:`VIDIOC_S_EXT_CTRLS <vidioc_g_ext_ctrls>` ioctl
  199. * @vidioc_try_ext_ctrls: pointer to the function that implements
  200. * :ref:`VIDIOC_TRY_EXT_CTRLS <vidioc_g_ext_ctrls>` ioctl
  201. * @vidioc_querymenu: pointer to the function that implements
  202. * :ref:`VIDIOC_QUERYMENU <vidioc_queryctrl>` ioctl
  203. * @vidioc_enumaudio: pointer to the function that implements
  204. * :ref:`VIDIOC_ENUMAUDIO <vidioc_enumaudio>` ioctl
  205. * @vidioc_g_audio: pointer to the function that implements
  206. * :ref:`VIDIOC_G_AUDIO <vidioc_g_audio>` ioctl
  207. * @vidioc_s_audio: pointer to the function that implements
  208. * :ref:`VIDIOC_S_AUDIO <vidioc_g_audio>` ioctl
  209. * @vidioc_enumaudout: pointer to the function that implements
  210. * :ref:`VIDIOC_ENUMAUDOUT <vidioc_enumaudout>` ioctl
  211. * @vidioc_g_audout: pointer to the function that implements
  212. * :ref:`VIDIOC_G_AUDOUT <vidioc_g_audout>` ioctl
  213. * @vidioc_s_audout: pointer to the function that implements
  214. * :ref:`VIDIOC_S_AUDOUT <vidioc_g_audout>` ioctl
  215. * @vidioc_g_modulator: pointer to the function that implements
  216. * :ref:`VIDIOC_G_MODULATOR <vidioc_g_modulator>` ioctl
  217. * @vidioc_s_modulator: pointer to the function that implements
  218. * :ref:`VIDIOC_S_MODULATOR <vidioc_g_modulator>` ioctl
  219. * @vidioc_g_pixelaspect: pointer to the function that implements
  220. * the pixelaspect part of the :ref:`VIDIOC_CROPCAP <vidioc_cropcap>` ioctl
  221. * @vidioc_g_selection: pointer to the function that implements
  222. * :ref:`VIDIOC_G_SELECTION <vidioc_g_selection>` ioctl
  223. * @vidioc_s_selection: pointer to the function that implements
  224. * :ref:`VIDIOC_S_SELECTION <vidioc_g_selection>` ioctl
  225. * @vidioc_g_jpegcomp: pointer to the function that implements
  226. * :ref:`VIDIOC_G_JPEGCOMP <vidioc_g_jpegcomp>` ioctl
  227. * @vidioc_s_jpegcomp: pointer to the function that implements
  228. * :ref:`VIDIOC_S_JPEGCOMP <vidioc_g_jpegcomp>` ioctl
  229. * @vidioc_g_enc_index: pointer to the function that implements
  230. * :ref:`VIDIOC_G_ENC_INDEX <vidioc_g_enc_index>` ioctl
  231. * @vidioc_encoder_cmd: pointer to the function that implements
  232. * :ref:`VIDIOC_ENCODER_CMD <vidioc_encoder_cmd>` ioctl
  233. * @vidioc_try_encoder_cmd: pointer to the function that implements
  234. * :ref:`VIDIOC_TRY_ENCODER_CMD <vidioc_encoder_cmd>` ioctl
  235. * @vidioc_decoder_cmd: pointer to the function that implements
  236. * :ref:`VIDIOC_DECODER_CMD <vidioc_decoder_cmd>` ioctl
  237. * @vidioc_try_decoder_cmd: pointer to the function that implements
  238. * :ref:`VIDIOC_TRY_DECODER_CMD <vidioc_decoder_cmd>` ioctl
  239. * @vidioc_g_parm: pointer to the function that implements
  240. * :ref:`VIDIOC_G_PARM <vidioc_g_parm>` ioctl
  241. * @vidioc_s_parm: pointer to the function that implements
  242. * :ref:`VIDIOC_S_PARM <vidioc_g_parm>` ioctl
  243. * @vidioc_g_tuner: pointer to the function that implements
  244. * :ref:`VIDIOC_G_TUNER <vidioc_g_tuner>` ioctl
  245. * @vidioc_s_tuner: pointer to the function that implements
  246. * :ref:`VIDIOC_S_TUNER <vidioc_g_tuner>` ioctl
  247. * @vidioc_g_frequency: pointer to the function that implements
  248. * :ref:`VIDIOC_G_FREQUENCY <vidioc_g_frequency>` ioctl
  249. * @vidioc_s_frequency: pointer to the function that implements
  250. * :ref:`VIDIOC_S_FREQUENCY <vidioc_g_frequency>` ioctl
  251. * @vidioc_enum_freq_bands: pointer to the function that implements
  252. * :ref:`VIDIOC_ENUM_FREQ_BANDS <vidioc_enum_freq_bands>` ioctl
  253. * @vidioc_g_sliced_vbi_cap: pointer to the function that implements
  254. * :ref:`VIDIOC_G_SLICED_VBI_CAP <vidioc_g_sliced_vbi_cap>` ioctl
  255. * @vidioc_log_status: pointer to the function that implements
  256. * :ref:`VIDIOC_LOG_STATUS <vidioc_log_status>` ioctl
  257. * @vidioc_s_hw_freq_seek: pointer to the function that implements
  258. * :ref:`VIDIOC_S_HW_FREQ_SEEK <vidioc_s_hw_freq_seek>` ioctl
  259. * @vidioc_g_register: pointer to the function that implements
  260. * :ref:`VIDIOC_DBG_G_REGISTER <vidioc_dbg_g_register>` ioctl
  261. * @vidioc_s_register: pointer to the function that implements
  262. * :ref:`VIDIOC_DBG_S_REGISTER <vidioc_dbg_g_register>` ioctl
  263. * @vidioc_g_chip_info: pointer to the function that implements
  264. * :ref:`VIDIOC_DBG_G_CHIP_INFO <vidioc_dbg_g_chip_info>` ioctl
  265. * @vidioc_enum_framesizes: pointer to the function that implements
  266. * :ref:`VIDIOC_ENUM_FRAMESIZES <vidioc_enum_framesizes>` ioctl
  267. * @vidioc_enum_frameintervals: pointer to the function that implements
  268. * :ref:`VIDIOC_ENUM_FRAMEINTERVALS <vidioc_enum_frameintervals>` ioctl
  269. * @vidioc_s_dv_timings: pointer to the function that implements
  270. * :ref:`VIDIOC_S_DV_TIMINGS <vidioc_g_dv_timings>` ioctl
  271. * @vidioc_g_dv_timings: pointer to the function that implements
  272. * :ref:`VIDIOC_G_DV_TIMINGS <vidioc_g_dv_timings>` ioctl
  273. * @vidioc_query_dv_timings: pointer to the function that implements
  274. * :ref:`VIDIOC_QUERY_DV_TIMINGS <vidioc_query_dv_timings>` ioctl
  275. * @vidioc_enum_dv_timings: pointer to the function that implements
  276. * :ref:`VIDIOC_ENUM_DV_TIMINGS <vidioc_enum_dv_timings>` ioctl
  277. * @vidioc_dv_timings_cap: pointer to the function that implements
  278. * :ref:`VIDIOC_DV_TIMINGS_CAP <vidioc_dv_timings_cap>` ioctl
  279. * @vidioc_g_edid: pointer to the function that implements
  280. * :ref:`VIDIOC_G_EDID <vidioc_g_edid>` ioctl
  281. * @vidioc_s_edid: pointer to the function that implements
  282. * :ref:`VIDIOC_S_EDID <vidioc_g_edid>` ioctl
  283. * @vidioc_subscribe_event: pointer to the function that implements
  284. * :ref:`VIDIOC_SUBSCRIBE_EVENT <vidioc_subscribe_event>` ioctl
  285. * @vidioc_unsubscribe_event: pointer to the function that implements
  286. * :ref:`VIDIOC_UNSUBSCRIBE_EVENT <vidioc_unsubscribe_event>` ioctl
  287. * @vidioc_default: pointed used to allow other ioctls
  288. */
  289. struct v4l2_ioctl_ops {
  290. /* ioctl callbacks */
  291. /* VIDIOC_QUERYCAP handler */
  292. int (*vidioc_querycap)(struct file *file, void *priv,
  293. struct v4l2_capability *cap);
  294. /* VIDIOC_ENUM_FMT handlers */
  295. int (*vidioc_enum_fmt_vid_cap)(struct file *file, void *priv,
  296. struct v4l2_fmtdesc *f);
  297. int (*vidioc_enum_fmt_vid_overlay)(struct file *file, void *priv,
  298. struct v4l2_fmtdesc *f);
  299. int (*vidioc_enum_fmt_vid_out)(struct file *file, void *priv,
  300. struct v4l2_fmtdesc *f);
  301. int (*vidioc_enum_fmt_sdr_cap)(struct file *file, void *priv,
  302. struct v4l2_fmtdesc *f);
  303. int (*vidioc_enum_fmt_sdr_out)(struct file *file, void *priv,
  304. struct v4l2_fmtdesc *f);
  305. int (*vidioc_enum_fmt_meta_cap)(struct file *file, void *priv,
  306. struct v4l2_fmtdesc *f);
  307. int (*vidioc_enum_fmt_meta_out)(struct file *file, void *priv,
  308. struct v4l2_fmtdesc *f);
  309. /* VIDIOC_G_FMT handlers */
  310. int (*vidioc_g_fmt_vid_cap)(struct file *file, void *priv,
  311. struct v4l2_format *f);
  312. int (*vidioc_g_fmt_vid_overlay)(struct file *file, void *priv,
  313. struct v4l2_format *f);
  314. int (*vidioc_g_fmt_vid_out)(struct file *file, void *priv,
  315. struct v4l2_format *f);
  316. int (*vidioc_g_fmt_vid_out_overlay)(struct file *file, void *priv,
  317. struct v4l2_format *f);
  318. int (*vidioc_g_fmt_vbi_cap)(struct file *file, void *priv,
  319. struct v4l2_format *f);
  320. int (*vidioc_g_fmt_vbi_out)(struct file *file, void *priv,
  321. struct v4l2_format *f);
  322. int (*vidioc_g_fmt_sliced_vbi_cap)(struct file *file, void *priv,
  323. struct v4l2_format *f);
  324. int (*vidioc_g_fmt_sliced_vbi_out)(struct file *file, void *priv,
  325. struct v4l2_format *f);
  326. int (*vidioc_g_fmt_vid_cap_mplane)(struct file *file, void *priv,
  327. struct v4l2_format *f);
  328. int (*vidioc_g_fmt_vid_out_mplane)(struct file *file, void *priv,
  329. struct v4l2_format *f);
  330. int (*vidioc_g_fmt_sdr_cap)(struct file *file, void *priv,
  331. struct v4l2_format *f);
  332. int (*vidioc_g_fmt_sdr_out)(struct file *file, void *priv,
  333. struct v4l2_format *f);
  334. int (*vidioc_g_fmt_meta_cap)(struct file *file, void *priv,
  335. struct v4l2_format *f);
  336. int (*vidioc_g_fmt_meta_out)(struct file *file, void *priv,
  337. struct v4l2_format *f);
  338. /* VIDIOC_S_FMT handlers */
  339. int (*vidioc_s_fmt_vid_cap)(struct file *file, void *priv,
  340. struct v4l2_format *f);
  341. int (*vidioc_s_fmt_vid_overlay)(struct file *file, void *priv,
  342. struct v4l2_format *f);
  343. int (*vidioc_s_fmt_vid_out)(struct file *file, void *priv,
  344. struct v4l2_format *f);
  345. int (*vidioc_s_fmt_vid_out_overlay)(struct file *file, void *priv,
  346. struct v4l2_format *f);
  347. int (*vidioc_s_fmt_vbi_cap)(struct file *file, void *priv,
  348. struct v4l2_format *f);
  349. int (*vidioc_s_fmt_vbi_out)(struct file *file, void *priv,
  350. struct v4l2_format *f);
  351. int (*vidioc_s_fmt_sliced_vbi_cap)(struct file *file, void *priv,
  352. struct v4l2_format *f);
  353. int (*vidioc_s_fmt_sliced_vbi_out)(struct file *file, void *priv,
  354. struct v4l2_format *f);
  355. int (*vidioc_s_fmt_vid_cap_mplane)(struct file *file, void *priv,
  356. struct v4l2_format *f);
  357. int (*vidioc_s_fmt_vid_out_mplane)(struct file *file, void *priv,
  358. struct v4l2_format *f);
  359. int (*vidioc_s_fmt_sdr_cap)(struct file *file, void *priv,
  360. struct v4l2_format *f);
  361. int (*vidioc_s_fmt_sdr_out)(struct file *file, void *priv,
  362. struct v4l2_format *f);
  363. int (*vidioc_s_fmt_meta_cap)(struct file *file, void *priv,
  364. struct v4l2_format *f);
  365. int (*vidioc_s_fmt_meta_out)(struct file *file, void *priv,
  366. struct v4l2_format *f);
  367. /* VIDIOC_TRY_FMT handlers */
  368. int (*vidioc_try_fmt_vid_cap)(struct file *file, void *priv,
  369. struct v4l2_format *f);
  370. int (*vidioc_try_fmt_vid_overlay)(struct file *file, void *priv,
  371. struct v4l2_format *f);
  372. int (*vidioc_try_fmt_vid_out)(struct file *file, void *priv,
  373. struct v4l2_format *f);
  374. int (*vidioc_try_fmt_vid_out_overlay)(struct file *file, void *priv,
  375. struct v4l2_format *f);
  376. int (*vidioc_try_fmt_vbi_cap)(struct file *file, void *priv,
  377. struct v4l2_format *f);
  378. int (*vidioc_try_fmt_vbi_out)(struct file *file, void *priv,
  379. struct v4l2_format *f);
  380. int (*vidioc_try_fmt_sliced_vbi_cap)(struct file *file, void *priv,
  381. struct v4l2_format *f);
  382. int (*vidioc_try_fmt_sliced_vbi_out)(struct file *file, void *priv,
  383. struct v4l2_format *f);
  384. int (*vidioc_try_fmt_vid_cap_mplane)(struct file *file, void *priv,
  385. struct v4l2_format *f);
  386. int (*vidioc_try_fmt_vid_out_mplane)(struct file *file, void *priv,
  387. struct v4l2_format *f);
  388. int (*vidioc_try_fmt_sdr_cap)(struct file *file, void *priv,
  389. struct v4l2_format *f);
  390. int (*vidioc_try_fmt_sdr_out)(struct file *file, void *priv,
  391. struct v4l2_format *f);
  392. int (*vidioc_try_fmt_meta_cap)(struct file *file, void *priv,
  393. struct v4l2_format *f);
  394. int (*vidioc_try_fmt_meta_out)(struct file *file, void *priv,
  395. struct v4l2_format *f);
  396. /* Buffer handlers */
  397. int (*vidioc_reqbufs)(struct file *file, void *priv,
  398. struct v4l2_requestbuffers *b);
  399. int (*vidioc_querybuf)(struct file *file, void *priv,
  400. struct v4l2_buffer *b);
  401. int (*vidioc_qbuf)(struct file *file, void *priv,
  402. struct v4l2_buffer *b);
  403. int (*vidioc_expbuf)(struct file *file, void *priv,
  404. struct v4l2_exportbuffer *e);
  405. int (*vidioc_dqbuf)(struct file *file, void *priv,
  406. struct v4l2_buffer *b);
  407. int (*vidioc_create_bufs)(struct file *file, void *priv,
  408. struct v4l2_create_buffers *b);
  409. int (*vidioc_prepare_buf)(struct file *file, void *priv,
  410. struct v4l2_buffer *b);
  411. int (*vidioc_remove_bufs)(struct file *file, void *priv,
  412. struct v4l2_remove_buffers *d);
  413. int (*vidioc_overlay)(struct file *file, void *priv, unsigned int i);
  414. int (*vidioc_g_fbuf)(struct file *file, void *priv,
  415. struct v4l2_framebuffer *a);
  416. int (*vidioc_s_fbuf)(struct file *file, void *priv,
  417. const struct v4l2_framebuffer *a);
  418. /* Stream on/off */
  419. int (*vidioc_streamon)(struct file *file, void *priv,
  420. enum v4l2_buf_type i);
  421. int (*vidioc_streamoff)(struct file *file, void *priv,
  422. enum v4l2_buf_type i);
  423. /*
  424. * Standard handling
  425. *
  426. * Note: ENUMSTD is handled by videodev.c
  427. */
  428. int (*vidioc_g_std)(struct file *file, void *priv, v4l2_std_id *norm);
  429. int (*vidioc_s_std)(struct file *file, void *priv, v4l2_std_id norm);
  430. int (*vidioc_querystd)(struct file *file, void *priv, v4l2_std_id *a);
  431. /* Input handling */
  432. int (*vidioc_enum_input)(struct file *file, void *priv,
  433. struct v4l2_input *inp);
  434. int (*vidioc_g_input)(struct file *file, void *priv, unsigned int *i);
  435. int (*vidioc_s_input)(struct file *file, void *priv, unsigned int i);
  436. /* Output handling */
  437. int (*vidioc_enum_output)(struct file *file, void *priv,
  438. struct v4l2_output *a);
  439. int (*vidioc_g_output)(struct file *file, void *priv, unsigned int *i);
  440. int (*vidioc_s_output)(struct file *file, void *priv, unsigned int i);
  441. /* Control handling */
  442. int (*vidioc_query_ext_ctrl)(struct file *file, void *priv,
  443. struct v4l2_query_ext_ctrl *a);
  444. int (*vidioc_g_ext_ctrls)(struct file *file, void *priv,
  445. struct v4l2_ext_controls *a);
  446. int (*vidioc_s_ext_ctrls)(struct file *file, void *priv,
  447. struct v4l2_ext_controls *a);
  448. int (*vidioc_try_ext_ctrls)(struct file *file, void *priv,
  449. struct v4l2_ext_controls *a);
  450. int (*vidioc_querymenu)(struct file *file, void *priv,
  451. struct v4l2_querymenu *a);
  452. /* Audio ioctls */
  453. int (*vidioc_enumaudio)(struct file *file, void *priv,
  454. struct v4l2_audio *a);
  455. int (*vidioc_g_audio)(struct file *file, void *priv,
  456. struct v4l2_audio *a);
  457. int (*vidioc_s_audio)(struct file *file, void *priv,
  458. const struct v4l2_audio *a);
  459. /* Audio out ioctls */
  460. int (*vidioc_enumaudout)(struct file *file, void *priv,
  461. struct v4l2_audioout *a);
  462. int (*vidioc_g_audout)(struct file *file, void *priv,
  463. struct v4l2_audioout *a);
  464. int (*vidioc_s_audout)(struct file *file, void *priv,
  465. const struct v4l2_audioout *a);
  466. int (*vidioc_g_modulator)(struct file *file, void *priv,
  467. struct v4l2_modulator *a);
  468. int (*vidioc_s_modulator)(struct file *file, void *priv,
  469. const struct v4l2_modulator *a);
  470. /* Crop ioctls */
  471. int (*vidioc_g_pixelaspect)(struct file *file, void *priv,
  472. int buf_type, struct v4l2_fract *aspect);
  473. int (*vidioc_g_selection)(struct file *file, void *priv,
  474. struct v4l2_selection *s);
  475. int (*vidioc_s_selection)(struct file *file, void *priv,
  476. struct v4l2_selection *s);
  477. /* Compression ioctls */
  478. int (*vidioc_g_jpegcomp)(struct file *file, void *priv,
  479. struct v4l2_jpegcompression *a);
  480. int (*vidioc_s_jpegcomp)(struct file *file, void *priv,
  481. const struct v4l2_jpegcompression *a);
  482. int (*vidioc_g_enc_index)(struct file *file, void *priv,
  483. struct v4l2_enc_idx *a);
  484. int (*vidioc_encoder_cmd)(struct file *file, void *priv,
  485. struct v4l2_encoder_cmd *a);
  486. int (*vidioc_try_encoder_cmd)(struct file *file, void *priv,
  487. struct v4l2_encoder_cmd *a);
  488. int (*vidioc_decoder_cmd)(struct file *file, void *priv,
  489. struct v4l2_decoder_cmd *a);
  490. int (*vidioc_try_decoder_cmd)(struct file *file, void *priv,
  491. struct v4l2_decoder_cmd *a);
  492. /* Stream type-dependent parameter ioctls */
  493. int (*vidioc_g_parm)(struct file *file, void *priv,
  494. struct v4l2_streamparm *a);
  495. int (*vidioc_s_parm)(struct file *file, void *priv,
  496. struct v4l2_streamparm *a);
  497. /* Tuner ioctls */
  498. int (*vidioc_g_tuner)(struct file *file, void *priv,
  499. struct v4l2_tuner *a);
  500. int (*vidioc_s_tuner)(struct file *file, void *priv,
  501. const struct v4l2_tuner *a);
  502. int (*vidioc_g_frequency)(struct file *file, void *priv,
  503. struct v4l2_frequency *a);
  504. int (*vidioc_s_frequency)(struct file *file, void *priv,
  505. const struct v4l2_frequency *a);
  506. int (*vidioc_enum_freq_bands)(struct file *file, void *priv,
  507. struct v4l2_frequency_band *band);
  508. /* Sliced VBI cap */
  509. int (*vidioc_g_sliced_vbi_cap)(struct file *file, void *priv,
  510. struct v4l2_sliced_vbi_cap *a);
  511. /* Log status ioctl */
  512. int (*vidioc_log_status)(struct file *file, void *priv);
  513. int (*vidioc_s_hw_freq_seek)(struct file *file, void *priv,
  514. const struct v4l2_hw_freq_seek *a);
  515. /* Debugging ioctls */
  516. #ifdef CONFIG_VIDEO_ADV_DEBUG
  517. int (*vidioc_g_register)(struct file *file, void *priv,
  518. struct v4l2_dbg_register *reg);
  519. int (*vidioc_s_register)(struct file *file, void *priv,
  520. const struct v4l2_dbg_register *reg);
  521. int (*vidioc_g_chip_info)(struct file *file, void *priv,
  522. struct v4l2_dbg_chip_info *chip);
  523. #endif
  524. int (*vidioc_enum_framesizes)(struct file *file, void *priv,
  525. struct v4l2_frmsizeenum *fsize);
  526. int (*vidioc_enum_frameintervals)(struct file *file, void *priv,
  527. struct v4l2_frmivalenum *fival);
  528. /* DV Timings IOCTLs */
  529. int (*vidioc_s_dv_timings)(struct file *file, void *priv,
  530. struct v4l2_dv_timings *timings);
  531. int (*vidioc_g_dv_timings)(struct file *file, void *priv,
  532. struct v4l2_dv_timings *timings);
  533. int (*vidioc_query_dv_timings)(struct file *file, void *priv,
  534. struct v4l2_dv_timings *timings);
  535. int (*vidioc_enum_dv_timings)(struct file *file, void *priv,
  536. struct v4l2_enum_dv_timings *timings);
  537. int (*vidioc_dv_timings_cap)(struct file *file, void *priv,
  538. struct v4l2_dv_timings_cap *cap);
  539. int (*vidioc_g_edid)(struct file *file, void *priv,
  540. struct v4l2_edid *edid);
  541. int (*vidioc_s_edid)(struct file *file, void *priv,
  542. struct v4l2_edid *edid);
  543. int (*vidioc_subscribe_event)(struct v4l2_fh *fh,
  544. const struct v4l2_event_subscription *sub);
  545. int (*vidioc_unsubscribe_event)(struct v4l2_fh *fh,
  546. const struct v4l2_event_subscription *sub);
  547. /* For other private ioctls */
  548. long (*vidioc_default)(struct file *file, void *priv,
  549. bool valid_prio, unsigned int cmd, void *arg);
  550. };
  551. /* v4l debugging and diagnostics */
  552. /* Device debug flags to be used with the video device debug attribute */
  553. /* Just log the ioctl name + error code */
  554. #define V4L2_DEV_DEBUG_IOCTL 0x01
  555. /* Log the ioctl name arguments + error code */
  556. #define V4L2_DEV_DEBUG_IOCTL_ARG 0x02
  557. /* Log the file operations open, release, mmap and get_unmapped_area */
  558. #define V4L2_DEV_DEBUG_FOP 0x04
  559. /* Log the read and write file operations and the VIDIOC_(D)QBUF ioctls */
  560. #define V4L2_DEV_DEBUG_STREAMING 0x08
  561. /* Log poll() */
  562. #define V4L2_DEV_DEBUG_POLL 0x10
  563. /* Log controls */
  564. #define V4L2_DEV_DEBUG_CTRL 0x20
  565. /* Video standard functions */
  566. /**
  567. * v4l2_norm_to_name - Ancillary routine to analog TV standard name from its ID.
  568. *
  569. * @id: analog TV standard ID.
  570. *
  571. * Return: returns a string with the name of the analog TV standard.
  572. * If the standard is not found or if @id points to multiple standard,
  573. * it returns "Unknown".
  574. */
  575. const char *v4l2_norm_to_name(v4l2_std_id id);
  576. /**
  577. * v4l2_video_std_frame_period - Ancillary routine that fills a
  578. * struct &v4l2_fract pointer with the default framerate fraction.
  579. *
  580. * @id: analog TV standard ID.
  581. * @frameperiod: struct &v4l2_fract pointer to be filled
  582. *
  583. */
  584. void v4l2_video_std_frame_period(int id, struct v4l2_fract *frameperiod);
  585. /**
  586. * v4l2_video_std_construct - Ancillary routine that fills in the fields of
  587. * a &v4l2_standard structure according to the @id parameter.
  588. *
  589. * @vs: struct &v4l2_standard pointer to be filled
  590. * @id: analog TV standard ID.
  591. * @name: name of the standard to be used
  592. *
  593. * .. note::
  594. *
  595. * This ancillary routine is obsolete. Shouldn't be used on newer drivers.
  596. */
  597. int v4l2_video_std_construct(struct v4l2_standard *vs,
  598. int id, const char *name);
  599. /**
  600. * v4l_video_std_enumstd - Ancillary routine that fills in the fields of
  601. * a &v4l2_standard structure according to the @id and @vs->index
  602. * parameters.
  603. *
  604. * @vs: struct &v4l2_standard pointer to be filled.
  605. * @id: analog TV standard ID.
  606. *
  607. */
  608. int v4l_video_std_enumstd(struct v4l2_standard *vs, v4l2_std_id id);
  609. /**
  610. * v4l_printk_ioctl - Ancillary routine that prints the ioctl in a
  611. * human-readable format.
  612. *
  613. * @prefix: prefix to be added at the ioctl prints.
  614. * @cmd: ioctl name
  615. *
  616. * .. note::
  617. *
  618. * If prefix != %NULL, then it will issue a
  619. * ``printk(KERN_DEBUG "%s: ", prefix)`` first.
  620. */
  621. void v4l_printk_ioctl(const char *prefix, unsigned int cmd);
  622. struct video_device;
  623. /* names for fancy debug output */
  624. /**
  625. * var v4l2_field_names - Helper array mapping ``V4L2_FIELD_*`` to strings.
  626. *
  627. * Specially when printing debug messages, it is interesting to output
  628. * the field order at the V4L2 buffers. This array associates all possible
  629. * values of field pix format from V4L2 API into a string.
  630. */
  631. extern const char *v4l2_field_names[];
  632. /**
  633. * var v4l2_type_names - Helper array mapping ``V4L2_BUF_TYPE_*`` to strings.
  634. *
  635. * When printing debug messages, it is interesting to output the V4L2 buffer
  636. * type number with a name that represents its content.
  637. */
  638. extern const char *v4l2_type_names[];
  639. #ifdef CONFIG_COMPAT
  640. /**
  641. * v4l2_compat_ioctl32 -32 Bits compatibility layer for 64 bits processors
  642. *
  643. * @file: Pointer to struct &file.
  644. * @cmd: Ioctl name.
  645. * @arg: Ioctl argument.
  646. */
  647. long int v4l2_compat_ioctl32(struct file *file, unsigned int cmd,
  648. unsigned long arg);
  649. #endif
  650. unsigned int v4l2_compat_translate_cmd(unsigned int cmd);
  651. unsigned int v4l2_translate_cmd(unsigned int cmd);
  652. int v4l2_compat_get_user(void __user *arg, void *parg, unsigned int cmd);
  653. int v4l2_compat_put_user(void __user *arg, void *parg, unsigned int cmd);
  654. int v4l2_compat_get_array_args(struct file *file, void *mbuf,
  655. void __user *user_ptr, size_t array_size,
  656. unsigned int cmd, void *arg);
  657. int v4l2_compat_put_array_args(struct file *file, void __user *user_ptr,
  658. void *mbuf, size_t array_size,
  659. unsigned int cmd, void *arg);
  660. /**
  661. * typedef v4l2_kioctl - Typedef used to pass an ioctl handler.
  662. *
  663. * @file: Pointer to struct &file.
  664. * @cmd: Ioctl name.
  665. * @arg: Ioctl argument.
  666. */
  667. typedef long (*v4l2_kioctl)(struct file *file, unsigned int cmd, void *arg);
  668. /**
  669. * video_usercopy - copies data from/to userspace memory when an ioctl is
  670. * issued.
  671. *
  672. * @file: Pointer to struct &file.
  673. * @cmd: Ioctl name.
  674. * @arg: Ioctl argument.
  675. * @func: function that will handle the ioctl
  676. *
  677. * .. note::
  678. *
  679. * This routine should be used only inside the V4L2 core.
  680. */
  681. long int video_usercopy(struct file *file, unsigned int cmd,
  682. unsigned long int arg, v4l2_kioctl func);
  683. /**
  684. * video_ioctl2 - Handles a V4L2 ioctl.
  685. *
  686. * @file: Pointer to struct &file.
  687. * @cmd: Ioctl name.
  688. * @arg: Ioctl argument.
  689. *
  690. * Method used to hancle an ioctl. Should be used to fill the
  691. * &v4l2_ioctl_ops.unlocked_ioctl on all V4L2 drivers.
  692. */
  693. long int video_ioctl2(struct file *file,
  694. unsigned int cmd, unsigned long int arg);
  695. /*
  696. * The user space interpretation of the 'v4l2_event' differs
  697. * based on the 'time_t' definition on 32-bit architectures, so
  698. * the kernel has to handle both.
  699. * This is the old version for 32-bit architectures.
  700. */
  701. struct v4l2_event_time32 {
  702. __u32 type;
  703. union {
  704. struct v4l2_event_vsync vsync;
  705. struct v4l2_event_ctrl ctrl;
  706. struct v4l2_event_frame_sync frame_sync;
  707. struct v4l2_event_src_change src_change;
  708. struct v4l2_event_motion_det motion_det;
  709. __u8 data[64];
  710. } u;
  711. __u32 pending;
  712. __u32 sequence;
  713. struct old_timespec32 timestamp;
  714. __u32 id;
  715. __u32 reserved[8];
  716. };
  717. #define VIDIOC_DQEVENT_TIME32 _IOR('V', 89, struct v4l2_event_time32)
  718. struct v4l2_buffer_time32 {
  719. __u32 index;
  720. __u32 type;
  721. __u32 bytesused;
  722. __u32 flags;
  723. __u32 field;
  724. struct old_timeval32 timestamp;
  725. struct v4l2_timecode timecode;
  726. __u32 sequence;
  727. /* memory location */
  728. __u32 memory;
  729. union {
  730. __u32 offset;
  731. unsigned long userptr;
  732. struct v4l2_plane *planes;
  733. __s32 fd;
  734. } m;
  735. __u32 length;
  736. __u32 reserved2;
  737. union {
  738. __s32 request_fd;
  739. __u32 reserved;
  740. };
  741. };
  742. #define VIDIOC_QUERYBUF_TIME32 _IOWR('V', 9, struct v4l2_buffer_time32)
  743. #define VIDIOC_QBUF_TIME32 _IOWR('V', 15, struct v4l2_buffer_time32)
  744. #define VIDIOC_DQBUF_TIME32 _IOWR('V', 17, struct v4l2_buffer_time32)
  745. #define VIDIOC_PREPARE_BUF_TIME32 _IOWR('V', 93, struct v4l2_buffer_time32)
  746. #endif /* _V4L2_IOCTL_H */