v4l2-ioctl.h 31 KB

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