v4l2-ioctl.h 33 KB

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