v4l2-ioctl.h 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726
  1. /*
  2. *
  3. * V 4 L 2 D R I V E R H E L P E R A P I
  4. *
  5. * Moved from videodev2.h
  6. *
  7. * Some commonly needed functions for drivers (v4l2-common.o module)
  8. */
  9. #ifndef _V4L2_IOCTL_H
  10. #define _V4L2_IOCTL_H
  11. #include <linux/poll.h>
  12. #include <linux/fs.h>
  13. #include <linux/mutex.h>
  14. #include <linux/sched/signal.h>
  15. #include <linux/compiler.h> /* need __user */
  16. #include <linux/videodev2.h>
  17. struct v4l2_fh;
  18. /**
  19. * struct v4l2_ioctl_ops - describe operations for each V4L2 ioctl
  20. *
  21. * @vidioc_querycap: pointer to the function that implements
  22. * :ref:`VIDIOC_QUERYCAP <vidioc_querycap>` ioctl
  23. * @vidioc_enum_fmt_vid_cap: pointer to the function that implements
  24. * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
  25. * for video capture in single plane mode
  26. * @vidioc_enum_fmt_vid_overlay: pointer to the function that implements
  27. * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
  28. * for video overlay
  29. * @vidioc_enum_fmt_vid_out: pointer to the function that implements
  30. * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
  31. * for video output in single plane mode
  32. * @vidioc_enum_fmt_vid_cap_mplane: pointer to the function that implements
  33. * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
  34. * for video capture in multiplane mode
  35. * @vidioc_enum_fmt_vid_out_mplane: pointer to the function that implements
  36. * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
  37. * for video output in multiplane mode
  38. * @vidioc_enum_fmt_sdr_cap: pointer to the function that implements
  39. * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
  40. * for Software Defined Radio capture
  41. * @vidioc_enum_fmt_sdr_out: pointer to the function that implements
  42. * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
  43. * for Software Defined Radio output
  44. * @vidioc_enum_fmt_meta_cap: pointer to the function that implements
  45. * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
  46. * for metadata capture
  47. * @vidioc_g_fmt_vid_cap: pointer to the function that implements
  48. * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for video capture
  49. * in single plane mode
  50. * @vidioc_g_fmt_vid_overlay: pointer to the function that implements
  51. * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for video overlay
  52. * @vidioc_g_fmt_vid_out: pointer to the function that implements
  53. * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for video out
  54. * in single plane mode
  55. * @vidioc_g_fmt_vid_out_overlay: pointer to the function that implements
  56. * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for video overlay output
  57. * @vidioc_g_fmt_vbi_cap: pointer to the function that implements
  58. * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for raw VBI capture
  59. * @vidioc_g_fmt_vbi_out: pointer to the function that implements
  60. * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for raw VBI output
  61. * @vidioc_g_fmt_sliced_vbi_cap: pointer to the function that implements
  62. * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for sliced VBI capture
  63. * @vidioc_g_fmt_sliced_vbi_out: pointer to the function that implements
  64. * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for sliced VBI output
  65. * @vidioc_g_fmt_vid_cap_mplane: pointer to the function that implements
  66. * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for video capture
  67. * in multiple plane mode
  68. * @vidioc_g_fmt_vid_out_mplane: pointer to the function that implements
  69. * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for video out
  70. * in multiplane plane mode
  71. * @vidioc_g_fmt_sdr_cap: pointer to the function that implements
  72. * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for Software Defined
  73. * Radio capture
  74. * @vidioc_g_fmt_sdr_out: pointer to the function that implements
  75. * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for Software Defined
  76. * Radio output
  77. * @vidioc_g_fmt_meta_cap: pointer to the function that implements
  78. * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for metadata capture
  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_try_fmt_vid_cap: pointer to the function that implements
  112. * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for video capture
  113. * in single plane mode
  114. * @vidioc_try_fmt_vid_overlay: pointer to the function that implements
  115. * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for video overlay
  116. * @vidioc_try_fmt_vid_out: pointer to the function that implements
  117. * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for video out
  118. * in single plane mode
  119. * @vidioc_try_fmt_vid_out_overlay: pointer to the function that implements
  120. * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for video overlay
  121. * output
  122. * @vidioc_try_fmt_vbi_cap: pointer to the function that implements
  123. * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for raw VBI capture
  124. * @vidioc_try_fmt_vbi_out: pointer to the function that implements
  125. * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for raw VBI output
  126. * @vidioc_try_fmt_sliced_vbi_cap: pointer to the function that implements
  127. * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for sliced VBI
  128. * capture
  129. * @vidioc_try_fmt_sliced_vbi_out: pointer to the function that implements
  130. * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for sliced VBI output
  131. * @vidioc_try_fmt_vid_cap_mplane: pointer to the function that implements
  132. * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for video capture
  133. * in multiple plane mode
  134. * @vidioc_try_fmt_vid_out_mplane: pointer to the function that implements
  135. * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for video out
  136. * in multiplane plane mode
  137. * @vidioc_try_fmt_sdr_cap: pointer to the function that implements
  138. * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for Software Defined
  139. * Radio capture
  140. * @vidioc_try_fmt_sdr_out: pointer to the function that implements
  141. * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for Software Defined
  142. * Radio output
  143. * @vidioc_try_fmt_meta_cap: pointer to the function that implements
  144. * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for metadata capture
  145. * @vidioc_reqbufs: pointer to the function that implements
  146. * :ref:`VIDIOC_REQBUFS <vidioc_reqbufs>` ioctl
  147. * @vidioc_querybuf: pointer to the function that implements
  148. * :ref:`VIDIOC_QUERYBUF <vidioc_querybuf>` ioctl
  149. * @vidioc_qbuf: pointer to the function that implements
  150. * :ref:`VIDIOC_QBUF <vidioc_qbuf>` ioctl
  151. * @vidioc_expbuf: pointer to the function that implements
  152. * :ref:`VIDIOC_EXPBUF <vidioc_expbuf>` ioctl
  153. * @vidioc_dqbuf: pointer to the function that implements
  154. * :ref:`VIDIOC_DQBUF <vidioc_qbuf>` ioctl
  155. * @vidioc_create_bufs: pointer to the function that implements
  156. * :ref:`VIDIOC_CREATE_BUFS <vidioc_create_bufs>` ioctl
  157. * @vidioc_prepare_buf: pointer to the function that implements
  158. * :ref:`VIDIOC_PREPARE_BUF <vidioc_prepare_buf>` ioctl
  159. * @vidioc_overlay: pointer to the function that implements
  160. * :ref:`VIDIOC_OVERLAY <vidioc_overlay>` ioctl
  161. * @vidioc_g_fbuf: pointer to the function that implements
  162. * :ref:`VIDIOC_G_FBUF <vidioc_g_fbuf>` ioctl
  163. * @vidioc_s_fbuf: pointer to the function that implements
  164. * :ref:`VIDIOC_S_FBUF <vidioc_g_fbuf>` ioctl
  165. * @vidioc_streamon: pointer to the function that implements
  166. * :ref:`VIDIOC_STREAMON <vidioc_streamon>` ioctl
  167. * @vidioc_streamoff: pointer to the function that implements
  168. * :ref:`VIDIOC_STREAMOFF <vidioc_streamon>` ioctl
  169. * @vidioc_g_std: pointer to the function that implements
  170. * :ref:`VIDIOC_G_STD <vidioc_g_std>` ioctl
  171. * @vidioc_s_std: pointer to the function that implements
  172. * :ref:`VIDIOC_S_STD <vidioc_g_std>` ioctl
  173. * @vidioc_querystd: pointer to the function that implements
  174. * :ref:`VIDIOC_QUERYSTD <vidioc_querystd>` ioctl
  175. * @vidioc_enum_input: pointer to the function that implements
  176. * :ref:`VIDIOC_ENUM_INPUT <vidioc_g_input>` ioctl
  177. * @vidioc_g_input: pointer to the function that implements
  178. * :ref:`VIDIOC_G_INPUT <vidioc_g_input>` ioctl
  179. * @vidioc_s_input: pointer to the function that implements
  180. * :ref:`VIDIOC_S_INPUT <vidioc_g_input>` ioctl
  181. * @vidioc_enum_output: pointer to the function that implements
  182. * :ref:`VIDIOC_ENUM_OUTPUT <vidioc_g_output>` ioctl
  183. * @vidioc_g_output: pointer to the function that implements
  184. * :ref:`VIDIOC_G_OUTPUT <vidioc_g_output>` ioctl
  185. * @vidioc_s_output: pointer to the function that implements
  186. * :ref:`VIDIOC_S_OUTPUT <vidioc_g_output>` ioctl
  187. * @vidioc_queryctrl: pointer to the function that implements
  188. * :ref:`VIDIOC_QUERYCTRL <vidioc_queryctrl>` ioctl
  189. * @vidioc_query_ext_ctrl: pointer to the function that implements
  190. * :ref:`VIDIOC_QUERY_EXT_CTRL <vidioc_queryctrl>` ioctl
  191. * @vidioc_g_ctrl: pointer to the function that implements
  192. * :ref:`VIDIOC_G_CTRL <vidioc_g_ctrl>` ioctl
  193. * @vidioc_s_ctrl: pointer to the function that implements
  194. * :ref:`VIDIOC_S_CTRL <vidioc_g_ctrl>` 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_cropcap: pointer to the function that implements
  220. * :ref:`VIDIOC_CROPCAP <vidioc_cropcap>` ioctl
  221. * @vidioc_g_crop: pointer to the function that implements
  222. * :ref:`VIDIOC_G_CROP <vidioc_g_crop>` ioctl
  223. * @vidioc_s_crop: pointer to the function that implements
  224. * :ref:`VIDIOC_S_CROP <vidioc_g_crop>` 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_vid_cap_mplane)(struct file *file, void *fh,
  306. struct v4l2_fmtdesc *f);
  307. int (*vidioc_enum_fmt_vid_out_mplane)(struct file *file, void *fh,
  308. struct v4l2_fmtdesc *f);
  309. int (*vidioc_enum_fmt_sdr_cap)(struct file *file, void *fh,
  310. struct v4l2_fmtdesc *f);
  311. int (*vidioc_enum_fmt_sdr_out)(struct file *file, void *fh,
  312. struct v4l2_fmtdesc *f);
  313. int (*vidioc_enum_fmt_meta_cap)(struct file *file, void *fh,
  314. struct v4l2_fmtdesc *f);
  315. /* VIDIOC_G_FMT handlers */
  316. int (*vidioc_g_fmt_vid_cap)(struct file *file, void *fh,
  317. struct v4l2_format *f);
  318. int (*vidioc_g_fmt_vid_overlay)(struct file *file, void *fh,
  319. struct v4l2_format *f);
  320. int (*vidioc_g_fmt_vid_out)(struct file *file, void *fh,
  321. struct v4l2_format *f);
  322. int (*vidioc_g_fmt_vid_out_overlay)(struct file *file, void *fh,
  323. struct v4l2_format *f);
  324. int (*vidioc_g_fmt_vbi_cap)(struct file *file, void *fh,
  325. struct v4l2_format *f);
  326. int (*vidioc_g_fmt_vbi_out)(struct file *file, void *fh,
  327. struct v4l2_format *f);
  328. int (*vidioc_g_fmt_sliced_vbi_cap)(struct file *file, void *fh,
  329. struct v4l2_format *f);
  330. int (*vidioc_g_fmt_sliced_vbi_out)(struct file *file, void *fh,
  331. struct v4l2_format *f);
  332. int (*vidioc_g_fmt_vid_cap_mplane)(struct file *file, void *fh,
  333. struct v4l2_format *f);
  334. int (*vidioc_g_fmt_vid_out_mplane)(struct file *file, void *fh,
  335. struct v4l2_format *f);
  336. int (*vidioc_g_fmt_sdr_cap)(struct file *file, void *fh,
  337. struct v4l2_format *f);
  338. int (*vidioc_g_fmt_sdr_out)(struct file *file, void *fh,
  339. struct v4l2_format *f);
  340. int (*vidioc_g_fmt_meta_cap)(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. /* VIDIOC_TRY_FMT handlers */
  370. int (*vidioc_try_fmt_vid_cap)(struct file *file, void *fh,
  371. struct v4l2_format *f);
  372. int (*vidioc_try_fmt_vid_overlay)(struct file *file, void *fh,
  373. struct v4l2_format *f);
  374. int (*vidioc_try_fmt_vid_out)(struct file *file, void *fh,
  375. struct v4l2_format *f);
  376. int (*vidioc_try_fmt_vid_out_overlay)(struct file *file, void *fh,
  377. struct v4l2_format *f);
  378. int (*vidioc_try_fmt_vbi_cap)(struct file *file, void *fh,
  379. struct v4l2_format *f);
  380. int (*vidioc_try_fmt_vbi_out)(struct file *file, void *fh,
  381. struct v4l2_format *f);
  382. int (*vidioc_try_fmt_sliced_vbi_cap)(struct file *file, void *fh,
  383. struct v4l2_format *f);
  384. int (*vidioc_try_fmt_sliced_vbi_out)(struct file *file, void *fh,
  385. struct v4l2_format *f);
  386. int (*vidioc_try_fmt_vid_cap_mplane)(struct file *file, void *fh,
  387. struct v4l2_format *f);
  388. int (*vidioc_try_fmt_vid_out_mplane)(struct file *file, void *fh,
  389. struct v4l2_format *f);
  390. int (*vidioc_try_fmt_sdr_cap)(struct file *file, void *fh,
  391. struct v4l2_format *f);
  392. int (*vidioc_try_fmt_sdr_out)(struct file *file, void *fh,
  393. struct v4l2_format *f);
  394. int (*vidioc_try_fmt_meta_cap)(struct file *file, void *fh,
  395. struct v4l2_format *f);
  396. /* Buffer handlers */
  397. int (*vidioc_reqbufs)(struct file *file, void *fh,
  398. struct v4l2_requestbuffers *b);
  399. int (*vidioc_querybuf)(struct file *file, void *fh,
  400. struct v4l2_buffer *b);
  401. int (*vidioc_qbuf)(struct file *file, void *fh,
  402. struct v4l2_buffer *b);
  403. int (*vidioc_expbuf)(struct file *file, void *fh,
  404. struct v4l2_exportbuffer *e);
  405. int (*vidioc_dqbuf)(struct file *file, void *fh,
  406. struct v4l2_buffer *b);
  407. int (*vidioc_create_bufs)(struct file *file, void *fh,
  408. struct v4l2_create_buffers *b);
  409. int (*vidioc_prepare_buf)(struct file *file, void *fh,
  410. struct v4l2_buffer *b);
  411. int (*vidioc_overlay)(struct file *file, void *fh, unsigned int i);
  412. int (*vidioc_g_fbuf)(struct file *file, void *fh,
  413. struct v4l2_framebuffer *a);
  414. int (*vidioc_s_fbuf)(struct file *file, void *fh,
  415. const struct v4l2_framebuffer *a);
  416. /* Stream on/off */
  417. int (*vidioc_streamon)(struct file *file, void *fh,
  418. enum v4l2_buf_type i);
  419. int (*vidioc_streamoff)(struct file *file, void *fh,
  420. enum v4l2_buf_type i);
  421. /*
  422. * Standard handling
  423. *
  424. * Note: ENUMSTD is handled by videodev.c
  425. */
  426. int (*vidioc_g_std)(struct file *file, void *fh, v4l2_std_id *norm);
  427. int (*vidioc_s_std)(struct file *file, void *fh, v4l2_std_id norm);
  428. int (*vidioc_querystd)(struct file *file, void *fh, v4l2_std_id *a);
  429. /* Input handling */
  430. int (*vidioc_enum_input)(struct file *file, void *fh,
  431. struct v4l2_input *inp);
  432. int (*vidioc_g_input)(struct file *file, void *fh, unsigned int *i);
  433. int (*vidioc_s_input)(struct file *file, void *fh, unsigned int i);
  434. /* Output handling */
  435. int (*vidioc_enum_output)(struct file *file, void *fh,
  436. struct v4l2_output *a);
  437. int (*vidioc_g_output)(struct file *file, void *fh, unsigned int *i);
  438. int (*vidioc_s_output)(struct file *file, void *fh, unsigned int i);
  439. /* Control handling */
  440. int (*vidioc_queryctrl)(struct file *file, void *fh,
  441. struct v4l2_queryctrl *a);
  442. int (*vidioc_query_ext_ctrl)(struct file *file, void *fh,
  443. struct v4l2_query_ext_ctrl *a);
  444. int (*vidioc_g_ctrl)(struct file *file, void *fh,
  445. struct v4l2_control *a);
  446. int (*vidioc_s_ctrl)(struct file *file, void *fh,
  447. struct v4l2_control *a);
  448. int (*vidioc_g_ext_ctrls)(struct file *file, void *fh,
  449. struct v4l2_ext_controls *a);
  450. int (*vidioc_s_ext_ctrls)(struct file *file, void *fh,
  451. struct v4l2_ext_controls *a);
  452. int (*vidioc_try_ext_ctrls)(struct file *file, void *fh,
  453. struct v4l2_ext_controls *a);
  454. int (*vidioc_querymenu)(struct file *file, void *fh,
  455. struct v4l2_querymenu *a);
  456. /* Audio ioctls */
  457. int (*vidioc_enumaudio)(struct file *file, void *fh,
  458. struct v4l2_audio *a);
  459. int (*vidioc_g_audio)(struct file *file, void *fh,
  460. struct v4l2_audio *a);
  461. int (*vidioc_s_audio)(struct file *file, void *fh,
  462. const struct v4l2_audio *a);
  463. /* Audio out ioctls */
  464. int (*vidioc_enumaudout)(struct file *file, void *fh,
  465. struct v4l2_audioout *a);
  466. int (*vidioc_g_audout)(struct file *file, void *fh,
  467. struct v4l2_audioout *a);
  468. int (*vidioc_s_audout)(struct file *file, void *fh,
  469. const struct v4l2_audioout *a);
  470. int (*vidioc_g_modulator)(struct file *file, void *fh,
  471. struct v4l2_modulator *a);
  472. int (*vidioc_s_modulator)(struct file *file, void *fh,
  473. const struct v4l2_modulator *a);
  474. /* Crop ioctls */
  475. int (*vidioc_cropcap)(struct file *file, void *fh,
  476. struct v4l2_cropcap *a);
  477. int (*vidioc_g_crop)(struct file *file, void *fh,
  478. struct v4l2_crop *a);
  479. int (*vidioc_s_crop)(struct file *file, void *fh,
  480. const struct v4l2_crop *a);
  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. /* Video standard functions */
  572. /**
  573. * v4l2_norm_to_name - Ancillary routine to analog TV standard name from its ID.
  574. *
  575. * @id: analog TV standard ID.
  576. *
  577. * Return: returns a string with the name of the analog TV standard.
  578. * If the standard is not found or if @id points to multiple standard,
  579. * it returns "Unknown".
  580. */
  581. const char *v4l2_norm_to_name(v4l2_std_id id);
  582. /**
  583. * v4l2_video_std_frame_period - Ancillary routine that fills a
  584. * struct &v4l2_fract pointer with the default framerate fraction.
  585. *
  586. * @id: analog TV sdandard ID.
  587. * @frameperiod: struct &v4l2_fract pointer to be filled
  588. *
  589. */
  590. void v4l2_video_std_frame_period(int id, struct v4l2_fract *frameperiod);
  591. /**
  592. * v4l2_video_std_construct - Ancillary routine that fills in the fields of
  593. * a &v4l2_standard structure according to the @id parameter.
  594. *
  595. * @vs: struct &v4l2_standard pointer to be filled
  596. * @id: analog TV sdandard ID.
  597. * @name: name of the standard to be used
  598. *
  599. * .. note::
  600. *
  601. * This ancillary routine is obsolete. Shouldn't be used on newer drivers.
  602. */
  603. int v4l2_video_std_construct(struct v4l2_standard *vs,
  604. int id, const char *name);
  605. /**
  606. * v4l_printk_ioctl - Ancillary routine that prints the ioctl in a
  607. * human-readable format.
  608. *
  609. * @prefix: prefix to be added at the ioctl prints.
  610. * @cmd: ioctl name
  611. *
  612. * .. note::
  613. *
  614. * If prefix != %NULL, then it will issue a
  615. * ``printk(KERN_DEBUG "%s: ", prefix)`` first.
  616. */
  617. void v4l_printk_ioctl(const char *prefix, unsigned int cmd);
  618. struct video_device;
  619. /**
  620. * v4l2_ioctl_get_lock - get the mutex (if any) that it is need to lock for
  621. * a given command.
  622. *
  623. * @vdev: Pointer to struct &video_device.
  624. * @cmd: Ioctl name.
  625. *
  626. * .. note:: Internal use only. Should not be used outside V4L2 core.
  627. */
  628. struct mutex *v4l2_ioctl_get_lock(struct video_device *vdev, unsigned int cmd);
  629. /* names for fancy debug output */
  630. extern const char *v4l2_field_names[];
  631. extern const char *v4l2_type_names[];
  632. #ifdef CONFIG_COMPAT
  633. /**
  634. * v4l2_compat_ioctl32 -32 Bits compatibility layer for 64 bits processors
  635. *
  636. * @file: Pointer to struct &file.
  637. * @cmd: Ioctl name.
  638. * @arg: Ioctl argument.
  639. */
  640. long int v4l2_compat_ioctl32(struct file *file, unsigned int cmd,
  641. unsigned long arg);
  642. #endif
  643. /**
  644. * typedef v4l2_kioctl - Typedef used to pass an ioctl handler.
  645. *
  646. * @file: Pointer to struct &file.
  647. * @cmd: Ioctl name.
  648. * @arg: Ioctl argument.
  649. */
  650. typedef long (*v4l2_kioctl)(struct file *file, unsigned int cmd, void *arg);
  651. /**
  652. * video_usercopy - copies data from/to userspace memory when an ioctl is
  653. * issued.
  654. *
  655. * @file: Pointer to struct &file.
  656. * @cmd: Ioctl name.
  657. * @arg: Ioctl argument.
  658. * @func: function that will handle the ioctl
  659. *
  660. * .. note::
  661. *
  662. * This routine should be used only inside the V4L2 core.
  663. */
  664. long int video_usercopy(struct file *file, unsigned int cmd,
  665. unsigned long int arg, v4l2_kioctl func);
  666. /**
  667. * video_ioctl2 - Handles a V4L2 ioctl.
  668. *
  669. * @file: Pointer to struct &file.
  670. * @cmd: Ioctl name.
  671. * @arg: Ioctl argument.
  672. *
  673. * Method used to hancle an ioctl. Should be used to fill the
  674. * &v4l2_ioctl_ops.unlocked_ioctl on all V4L2 drivers.
  675. */
  676. long int video_ioctl2(struct file *file,
  677. unsigned int cmd, unsigned long int arg);
  678. #endif /* _V4L2_IOCTL_H */