v4l2-dev.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  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_DEV_H
  11. #define _V4L2_DEV_H
  12. #include <linux/poll.h>
  13. #include <linux/fs.h>
  14. #include <linux/device.h>
  15. #include <linux/cdev.h>
  16. #include <linux/mutex.h>
  17. #include <linux/videodev2.h>
  18. #include <media/media-entity.h>
  19. #define VIDEO_MAJOR 81
  20. /**
  21. * enum vfl_devnode_type - type of V4L2 device node
  22. *
  23. * @VFL_TYPE_VIDEO: for video input/output devices
  24. * @VFL_TYPE_VBI: for vertical blank data (i.e. closed captions, teletext)
  25. * @VFL_TYPE_RADIO: for radio tuners
  26. * @VFL_TYPE_SUBDEV: for V4L2 subdevices
  27. * @VFL_TYPE_SDR: for Software Defined Radio tuners
  28. * @VFL_TYPE_TOUCH: for touch sensors
  29. * @VFL_TYPE_MAX: number of VFL types, must always be last in the enum
  30. */
  31. enum vfl_devnode_type {
  32. VFL_TYPE_VIDEO,
  33. VFL_TYPE_VBI,
  34. VFL_TYPE_RADIO,
  35. VFL_TYPE_SUBDEV,
  36. VFL_TYPE_SDR,
  37. VFL_TYPE_TOUCH,
  38. VFL_TYPE_MAX /* Shall be the last one */
  39. };
  40. /**
  41. * enum vfl_devnode_direction - Identifies if a &struct video_device
  42. * corresponds to a receiver, a transmitter or a mem-to-mem device.
  43. *
  44. * @VFL_DIR_RX: device is a receiver.
  45. * @VFL_DIR_TX: device is a transmitter.
  46. * @VFL_DIR_M2M: device is a memory to memory device.
  47. *
  48. * Note: Ignored if &enum vfl_devnode_type is %VFL_TYPE_SUBDEV.
  49. */
  50. enum vfl_devnode_direction {
  51. VFL_DIR_RX,
  52. VFL_DIR_TX,
  53. VFL_DIR_M2M,
  54. };
  55. struct v4l2_ioctl_callbacks;
  56. struct video_device;
  57. struct v4l2_device;
  58. struct v4l2_ctrl_handler;
  59. /**
  60. * enum v4l2_video_device_flags - Flags used by &struct video_device
  61. *
  62. * @V4L2_FL_REGISTERED:
  63. * indicates that a &struct video_device is registered.
  64. * Drivers can clear this flag if they want to block all future
  65. * device access. It is cleared by video_unregister_device.
  66. * @V4L2_FL_USES_V4L2_FH:
  67. * indicates that file->private_data points to &struct v4l2_fh.
  68. * This flag is set by the core when v4l2_fh_init() is called.
  69. * All new drivers should use it.
  70. * @V4L2_FL_QUIRK_INVERTED_CROP:
  71. * some old M2M drivers use g/s_crop/cropcap incorrectly: crop and
  72. * compose are swapped. If this flag is set, then the selection
  73. * targets are swapped in the g/s_crop/cropcap functions in v4l2-ioctl.c.
  74. * This allows those drivers to correctly implement the selection API,
  75. * but the old crop API will still work as expected in order to preserve
  76. * backwards compatibility.
  77. * Never set this flag for new drivers.
  78. * @V4L2_FL_SUBDEV_RO_DEVNODE:
  79. * indicates that the video device node is registered in read-only mode.
  80. * The flag only applies to device nodes registered for sub-devices, it is
  81. * set by the core when the sub-devices device nodes are registered with
  82. * v4l2_device_register_ro_subdev_nodes() and used by the sub-device ioctl
  83. * handler to restrict access to some ioctl calls.
  84. */
  85. enum v4l2_video_device_flags {
  86. V4L2_FL_REGISTERED = 0,
  87. V4L2_FL_USES_V4L2_FH = 1,
  88. V4L2_FL_QUIRK_INVERTED_CROP = 2,
  89. V4L2_FL_SUBDEV_RO_DEVNODE = 3,
  90. };
  91. /* Priority helper functions */
  92. /**
  93. * struct v4l2_prio_state - stores the priority states
  94. *
  95. * @prios: array with elements to store the array priorities
  96. *
  97. *
  98. * .. note::
  99. * The size of @prios array matches the number of priority types defined
  100. * by enum &v4l2_priority.
  101. */
  102. struct v4l2_prio_state {
  103. atomic_t prios[4];
  104. };
  105. /**
  106. * v4l2_prio_init - initializes a struct v4l2_prio_state
  107. *
  108. * @global: pointer to &struct v4l2_prio_state
  109. */
  110. void v4l2_prio_init(struct v4l2_prio_state *global);
  111. /**
  112. * v4l2_prio_change - changes the v4l2 file handler priority
  113. *
  114. * @global: pointer to the &struct v4l2_prio_state of the device node.
  115. * @local: pointer to the desired priority, as defined by enum &v4l2_priority
  116. * @new: Priority type requested, as defined by enum &v4l2_priority.
  117. *
  118. * .. note::
  119. * This function should be used only by the V4L2 core.
  120. */
  121. int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local,
  122. enum v4l2_priority new);
  123. /**
  124. * v4l2_prio_open - Implements the priority logic for a file handler open
  125. *
  126. * @global: pointer to the &struct v4l2_prio_state of the device node.
  127. * @local: pointer to the desired priority, as defined by enum &v4l2_priority
  128. *
  129. * .. note::
  130. * This function should be used only by the V4L2 core.
  131. */
  132. void v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local);
  133. /**
  134. * v4l2_prio_close - Implements the priority logic for a file handler close
  135. *
  136. * @global: pointer to the &struct v4l2_prio_state of the device node.
  137. * @local: priority to be released, as defined by enum &v4l2_priority
  138. *
  139. * .. note::
  140. * This function should be used only by the V4L2 core.
  141. */
  142. void v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority local);
  143. /**
  144. * v4l2_prio_max - Return the maximum priority, as stored at the @global array.
  145. *
  146. * @global: pointer to the &struct v4l2_prio_state of the device node.
  147. *
  148. * .. note::
  149. * This function should be used only by the V4L2 core.
  150. */
  151. enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global);
  152. /**
  153. * v4l2_prio_check - Implements the priority logic for a file handler close
  154. *
  155. * @global: pointer to the &struct v4l2_prio_state of the device node.
  156. * @local: desired priority, as defined by enum &v4l2_priority local
  157. *
  158. * .. note::
  159. * This function should be used only by the V4L2 core.
  160. */
  161. int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority local);
  162. /**
  163. * struct v4l2_file_operations - fs operations used by a V4L2 device
  164. *
  165. * @owner: pointer to struct module
  166. * @read: operations needed to implement the read() syscall
  167. * @write: operations needed to implement the write() syscall
  168. * @poll: operations needed to implement the poll() syscall
  169. * @unlocked_ioctl: operations needed to implement the ioctl() syscall
  170. * @compat_ioctl32: operations needed to implement the ioctl() syscall for
  171. * the special case where the Kernel uses 64 bits instructions, but
  172. * the userspace uses 32 bits.
  173. * @get_unmapped_area: called by the mmap() syscall, used when %!CONFIG_MMU
  174. * @mmap: operations needed to implement the mmap() syscall
  175. * @open: operations needed to implement the open() syscall
  176. * @release: operations needed to implement the release() syscall
  177. *
  178. * .. note::
  179. *
  180. * Those operations are used to implemente the fs struct file_operations
  181. * at the V4L2 drivers. The V4L2 core overrides the fs ops with some
  182. * extra logic needed by the subsystem.
  183. */
  184. struct v4l2_file_operations {
  185. struct module *owner;
  186. ssize_t (*read) (struct file *, char __user *, size_t, loff_t *);
  187. ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
  188. __poll_t (*poll) (struct file *, struct poll_table_struct *);
  189. long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
  190. #ifdef CONFIG_COMPAT
  191. long (*compat_ioctl32) (struct file *, unsigned int, unsigned long);
  192. #endif
  193. unsigned long (*get_unmapped_area) (struct file *, unsigned long,
  194. unsigned long, unsigned long, unsigned long);
  195. int (*mmap) (struct file *, struct vm_area_struct *);
  196. int (*open) (struct file *);
  197. int (*release) (struct file *);
  198. };
  199. /*
  200. * Newer version of video_device, handled by videodev2.c
  201. * This version moves redundant code from video device code to
  202. * the common handler
  203. */
  204. /**
  205. * struct video_device - Structure used to create and manage the V4L2 device
  206. * nodes.
  207. *
  208. * @entity: &struct media_entity
  209. * @intf_devnode: pointer to &struct media_intf_devnode
  210. * @pipe: &struct media_pipeline
  211. * @fops: pointer to &struct v4l2_file_operations for the video device
  212. * @device_caps: device capabilities as used in v4l2_capabilities
  213. * @dev: &struct device for the video device
  214. * @cdev: character device
  215. * @v4l2_dev: pointer to &struct v4l2_device parent
  216. * @dev_parent: pointer to &struct device parent
  217. * @ctrl_handler: Control handler associated with this device node.
  218. * May be NULL.
  219. * @queue: &struct vb2_queue associated with this device node. May be NULL.
  220. * @prio: pointer to &struct v4l2_prio_state with device's Priority state.
  221. * If NULL, then v4l2_dev->prio will be used.
  222. * @name: video device name
  223. * @vfl_type: V4L device type, as defined by &enum vfl_devnode_type
  224. * @vfl_dir: V4L receiver, transmitter or m2m
  225. * @minor: device node 'minor'. It is set to -1 if the registration failed
  226. * @num: number of the video device node
  227. * @flags: video device flags. Use bitops to set/clear/test flags.
  228. * Contains a set of &enum v4l2_video_device_flags.
  229. * @index: attribute to differentiate multiple indices on one physical device
  230. * @fh_lock: Lock for all v4l2_fhs
  231. * @fh_list: List of &struct v4l2_fh
  232. * @dev_debug: Internal device debug flags, not for use by drivers
  233. * @tvnorms: Supported tv norms
  234. *
  235. * @release: video device release() callback
  236. * @ioctl_ops: pointer to &struct v4l2_ioctl_ops with ioctl callbacks
  237. *
  238. * @valid_ioctls: bitmap with the valid ioctls for this device
  239. * @lock: pointer to &struct mutex serialization lock
  240. *
  241. * .. note::
  242. * Only set @dev_parent if that can't be deduced from @v4l2_dev.
  243. */
  244. struct video_device {
  245. #if defined(CONFIG_MEDIA_CONTROLLER)
  246. struct media_entity entity;
  247. struct media_intf_devnode *intf_devnode;
  248. struct media_pipeline pipe;
  249. #endif
  250. const struct v4l2_file_operations *fops;
  251. u32 device_caps;
  252. /* sysfs */
  253. struct device dev;
  254. struct cdev *cdev;
  255. struct v4l2_device *v4l2_dev;
  256. struct device *dev_parent;
  257. struct v4l2_ctrl_handler *ctrl_handler;
  258. struct vb2_queue *queue;
  259. struct v4l2_prio_state *prio;
  260. /* device info */
  261. char name[64];
  262. enum vfl_devnode_type vfl_type;
  263. enum vfl_devnode_direction vfl_dir;
  264. int minor;
  265. u16 num;
  266. unsigned long flags;
  267. int index;
  268. /* V4L2 file handles */
  269. spinlock_t fh_lock;
  270. struct list_head fh_list;
  271. int dev_debug;
  272. v4l2_std_id tvnorms;
  273. /* callbacks */
  274. void (*release)(struct video_device *vdev);
  275. const struct v4l2_ioctl_ops *ioctl_ops;
  276. DECLARE_BITMAP(valid_ioctls, BASE_VIDIOC_PRIVATE);
  277. struct mutex *lock;
  278. };
  279. /**
  280. * media_entity_to_video_device - Returns a &struct video_device from
  281. * the &struct media_entity embedded on it.
  282. *
  283. * @__entity: pointer to &struct media_entity
  284. */
  285. #define media_entity_to_video_device(__entity) \
  286. container_of(__entity, struct video_device, entity)
  287. /**
  288. * to_video_device - Returns a &struct video_device from the
  289. * &struct device embedded on it.
  290. *
  291. * @cd: pointer to &struct device
  292. */
  293. #define to_video_device(cd) container_of(cd, struct video_device, dev)
  294. /**
  295. * __video_register_device - register video4linux devices
  296. *
  297. * @vdev: struct video_device to register
  298. * @type: type of device to register, as defined by &enum vfl_devnode_type
  299. * @nr: which device node number is desired:
  300. * (0 == /dev/video0, 1 == /dev/video1, ..., -1 == first free)
  301. * @warn_if_nr_in_use: warn if the desired device node number
  302. * was already in use and another number was chosen instead.
  303. * @owner: module that owns the video device node
  304. *
  305. * The registration code assigns minor numbers and device node numbers
  306. * based on the requested type and registers the new device node with
  307. * the kernel.
  308. *
  309. * This function assumes that struct video_device was zeroed when it
  310. * was allocated and does not contain any stale date.
  311. *
  312. * An error is returned if no free minor or device node number could be
  313. * found, or if the registration of the device node failed.
  314. *
  315. * Returns 0 on success.
  316. *
  317. * .. note::
  318. *
  319. * This function is meant to be used only inside the V4L2 core.
  320. * Drivers should use video_register_device() or
  321. * video_register_device_no_warn().
  322. */
  323. int __must_check __video_register_device(struct video_device *vdev,
  324. enum vfl_devnode_type type,
  325. int nr, int warn_if_nr_in_use,
  326. struct module *owner);
  327. /**
  328. * video_register_device - register video4linux devices
  329. *
  330. * @vdev: struct video_device to register
  331. * @type: type of device to register, as defined by &enum vfl_devnode_type
  332. * @nr: which device node number is desired:
  333. * (0 == /dev/video0, 1 == /dev/video1, ..., -1 == first free)
  334. *
  335. * Internally, it calls __video_register_device(). Please see its
  336. * documentation for more details.
  337. *
  338. * .. note::
  339. * if video_register_device fails, the release() callback of
  340. * &struct video_device structure is *not* called, so the caller
  341. * is responsible for freeing any data. Usually that means that
  342. * you video_device_release() should be called on failure.
  343. */
  344. static inline int __must_check video_register_device(struct video_device *vdev,
  345. enum vfl_devnode_type type,
  346. int nr)
  347. {
  348. return __video_register_device(vdev, type, nr, 1, vdev->fops->owner);
  349. }
  350. /**
  351. * video_register_device_no_warn - register video4linux devices
  352. *
  353. * @vdev: struct video_device to register
  354. * @type: type of device to register, as defined by &enum vfl_devnode_type
  355. * @nr: which device node number is desired:
  356. * (0 == /dev/video0, 1 == /dev/video1, ..., -1 == first free)
  357. *
  358. * This function is identical to video_register_device() except that no
  359. * warning is issued if the desired device node number was already in use.
  360. *
  361. * Internally, it calls __video_register_device(). Please see its
  362. * documentation for more details.
  363. *
  364. * .. note::
  365. * if video_register_device fails, the release() callback of
  366. * &struct video_device structure is *not* called, so the caller
  367. * is responsible for freeing any data. Usually that means that
  368. * you video_device_release() should be called on failure.
  369. */
  370. static inline int __must_check
  371. video_register_device_no_warn(struct video_device *vdev,
  372. enum vfl_devnode_type type, int nr)
  373. {
  374. return __video_register_device(vdev, type, nr, 0, vdev->fops->owner);
  375. }
  376. /**
  377. * video_unregister_device - Unregister video devices.
  378. *
  379. * @vdev: &struct video_device to register
  380. *
  381. * Does nothing if vdev == NULL or if video_is_registered() returns false.
  382. */
  383. void video_unregister_device(struct video_device *vdev);
  384. /**
  385. * video_device_alloc - helper function to alloc &struct video_device
  386. *
  387. * Returns NULL if %-ENOMEM or a &struct video_device on success.
  388. */
  389. struct video_device * __must_check video_device_alloc(void);
  390. /**
  391. * video_device_release - helper function to release &struct video_device
  392. *
  393. * @vdev: pointer to &struct video_device
  394. *
  395. * Can also be used for video_device->release\(\).
  396. */
  397. void video_device_release(struct video_device *vdev);
  398. /**
  399. * video_device_release_empty - helper function to implement the
  400. * video_device->release\(\) callback.
  401. *
  402. * @vdev: pointer to &struct video_device
  403. *
  404. * This release function does nothing.
  405. *
  406. * It should be used when the video_device is a static global struct.
  407. *
  408. * .. note::
  409. * Having a static video_device is a dubious construction at best.
  410. */
  411. void video_device_release_empty(struct video_device *vdev);
  412. /**
  413. * v4l2_disable_ioctl- mark that a given command isn't implemented.
  414. * shouldn't use core locking
  415. *
  416. * @vdev: pointer to &struct video_device
  417. * @cmd: ioctl command
  418. *
  419. * This function allows drivers to provide just one v4l2_ioctl_ops struct, but
  420. * disable ioctls based on the specific card that is actually found.
  421. *
  422. * .. note::
  423. *
  424. * This must be called before video_register_device.
  425. * See also the comments for determine_valid_ioctls().
  426. */
  427. static inline void v4l2_disable_ioctl(struct video_device *vdev,
  428. unsigned int cmd)
  429. {
  430. if (_IOC_NR(cmd) < BASE_VIDIOC_PRIVATE)
  431. set_bit(_IOC_NR(cmd), vdev->valid_ioctls);
  432. }
  433. /**
  434. * video_get_drvdata - gets private data from &struct video_device.
  435. *
  436. * @vdev: pointer to &struct video_device
  437. *
  438. * returns a pointer to the private data
  439. */
  440. static inline void *video_get_drvdata(struct video_device *vdev)
  441. {
  442. return dev_get_drvdata(&vdev->dev);
  443. }
  444. /**
  445. * video_set_drvdata - sets private data from &struct video_device.
  446. *
  447. * @vdev: pointer to &struct video_device
  448. * @data: private data pointer
  449. */
  450. static inline void video_set_drvdata(struct video_device *vdev, void *data)
  451. {
  452. dev_set_drvdata(&vdev->dev, data);
  453. }
  454. /**
  455. * video_devdata - gets &struct video_device from struct file.
  456. *
  457. * @file: pointer to struct file
  458. */
  459. struct video_device *video_devdata(struct file *file);
  460. /**
  461. * video_drvdata - gets private data from &struct video_device using the
  462. * struct file.
  463. *
  464. * @file: pointer to struct file
  465. *
  466. * This is function combines both video_get_drvdata() and video_devdata()
  467. * as this is used very often.
  468. */
  469. static inline void *video_drvdata(struct file *file)
  470. {
  471. return video_get_drvdata(video_devdata(file));
  472. }
  473. /**
  474. * video_device_node_name - returns the video device name
  475. *
  476. * @vdev: pointer to &struct video_device
  477. *
  478. * Returns the device name string
  479. */
  480. static inline const char *video_device_node_name(struct video_device *vdev)
  481. {
  482. return dev_name(&vdev->dev);
  483. }
  484. /**
  485. * video_is_registered - returns true if the &struct video_device is registered.
  486. *
  487. *
  488. * @vdev: pointer to &struct video_device
  489. */
  490. static inline int video_is_registered(struct video_device *vdev)
  491. {
  492. return test_bit(V4L2_FL_REGISTERED, &vdev->flags);
  493. }
  494. #if defined(CONFIG_MEDIA_CONTROLLER)
  495. /**
  496. * video_device_pipeline_start - Mark a pipeline as streaming
  497. * @vdev: Starting video device
  498. * @pipe: Media pipeline to be assigned to all entities in the pipeline.
  499. *
  500. * Mark all entities connected to a given video device through enabled links,
  501. * either directly or indirectly, as streaming. The given pipeline object is
  502. * assigned to every pad in the pipeline and stored in the media_pad pipe
  503. * field.
  504. *
  505. * Calls to this function can be nested, in which case the same number of
  506. * video_device_pipeline_stop() calls will be required to stop streaming. The
  507. * pipeline pointer must be identical for all nested calls to
  508. * video_device_pipeline_start().
  509. *
  510. * The video device must contain a single pad.
  511. *
  512. * This is a convenience wrapper around media_pipeline_start().
  513. */
  514. __must_check int video_device_pipeline_start(struct video_device *vdev,
  515. struct media_pipeline *pipe);
  516. /**
  517. * __video_device_pipeline_start - Mark a pipeline as streaming
  518. * @vdev: Starting video device
  519. * @pipe: Media pipeline to be assigned to all entities in the pipeline.
  520. *
  521. * ..note:: This is the non-locking version of video_device_pipeline_start()
  522. *
  523. * The video device must contain a single pad.
  524. *
  525. * This is a convenience wrapper around __media_pipeline_start().
  526. */
  527. __must_check int __video_device_pipeline_start(struct video_device *vdev,
  528. struct media_pipeline *pipe);
  529. /**
  530. * video_device_pipeline_stop - Mark a pipeline as not streaming
  531. * @vdev: Starting video device
  532. *
  533. * Mark all entities connected to a given video device through enabled links,
  534. * either directly or indirectly, as not streaming. The media_pad pipe field
  535. * is reset to %NULL.
  536. *
  537. * If multiple calls to media_pipeline_start() have been made, the same
  538. * number of calls to this function are required to mark the pipeline as not
  539. * streaming.
  540. *
  541. * The video device must contain a single pad.
  542. *
  543. * This is a convenience wrapper around media_pipeline_stop().
  544. */
  545. void video_device_pipeline_stop(struct video_device *vdev);
  546. /**
  547. * __video_device_pipeline_stop - Mark a pipeline as not streaming
  548. * @vdev: Starting video device
  549. *
  550. * .. note:: This is the non-locking version of media_pipeline_stop()
  551. *
  552. * The video device must contain a single pad.
  553. *
  554. * This is a convenience wrapper around __media_pipeline_stop().
  555. */
  556. void __video_device_pipeline_stop(struct video_device *vdev);
  557. /**
  558. * video_device_pipeline_alloc_start - Mark a pipeline as streaming
  559. * @vdev: Starting video device
  560. *
  561. * video_device_pipeline_alloc_start() is similar to video_device_pipeline_start()
  562. * but instead of working on a given pipeline the function will use an
  563. * existing pipeline if the video device is already part of a pipeline, or
  564. * allocate a new pipeline.
  565. *
  566. * Calls to video_device_pipeline_alloc_start() must be matched with
  567. * video_device_pipeline_stop().
  568. */
  569. __must_check int video_device_pipeline_alloc_start(struct video_device *vdev);
  570. /**
  571. * video_device_pipeline - Get the media pipeline a video device is part of
  572. * @vdev: The video device
  573. *
  574. * This function returns the media pipeline that a video device has been
  575. * associated with when constructing the pipeline with
  576. * video_device_pipeline_start(). The pointer remains valid until
  577. * video_device_pipeline_stop() is called.
  578. *
  579. * Return: The media_pipeline the video device is part of, or NULL if the video
  580. * device is not part of any pipeline.
  581. *
  582. * The video device must contain a single pad.
  583. *
  584. * This is a convenience wrapper around media_entity_pipeline().
  585. */
  586. struct media_pipeline *video_device_pipeline(struct video_device *vdev);
  587. #endif /* CONFIG_MEDIA_CONTROLLER */
  588. #endif /* _V4L2_DEV_H */