v4l2-ioctl.h 30 KB

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