dm writecache: correct uncommitted_block when discarding uncommitted entry
[linux/fpc-iii.git] / include / media / v4l2-mc.h
blob5e73eb8e28f6343ea98c85b9014e7d89299a5d91
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3 * v4l2-mc.h - Media Controller V4L2 types and prototypes
5 * Copyright (C) 2016 Mauro Carvalho Chehab <mchehab@kernel.org>
6 * Copyright (C) 2006-2010 Nokia Corporation
7 * Copyright (c) 2016 Intel Corporation.
8 */
10 #ifndef _V4L2_MC_H
11 #define _V4L2_MC_H
13 #include <media/media-device.h>
14 #include <media/v4l2-dev.h>
15 #include <linux/types.h>
17 /* We don't need to include pci.h or usb.h here */
18 struct pci_dev;
19 struct usb_device;
21 #ifdef CONFIG_MEDIA_CONTROLLER
22 /**
23 * v4l2_mc_create_media_graph() - create Media Controller links at the graph.
25 * @mdev: pointer to the &media_device struct.
27 * Add links between the entities commonly found on PC customer's hardware at
28 * the V4L2 side: camera sensors, audio and video PLL-IF decoders, tuners,
29 * analog TV decoder and I/O entities (video, VBI and Software Defined Radio).
31 * .. note::
33 * Webcams are modelled on a very simple way: the sensor is
34 * connected directly to the I/O entity. All dirty details, like
35 * scaler and crop HW are hidden. While such mapping is enough for v4l2
36 * interface centric PC-consumer's hardware, V4L2 subdev centric camera
37 * hardware should not use this routine, as it will not build the right graph.
39 int v4l2_mc_create_media_graph(struct media_device *mdev);
41 /**
42 * v4l_enable_media_source() - Hold media source for exclusive use
43 * if free
45 * @vdev: pointer to struct video_device
47 * This interface calls enable_source handler to determine if
48 * media source is free for use. The enable_source handler is
49 * responsible for checking is the media source is free and
50 * start a pipeline between the media source and the media
51 * entity associated with the video device. This interface
52 * should be called from v4l2-core and dvb-core interfaces
53 * that change the source configuration.
55 * Return: returns zero on success or a negative error code.
57 int v4l_enable_media_source(struct video_device *vdev);
59 /**
60 * v4l_disable_media_source() - Release media source
62 * @vdev: pointer to struct video_device
64 * This interface calls disable_source handler to release
65 * the media source. The disable_source handler stops the
66 * active media pipeline between the media source and the
67 * media entity associated with the video device.
69 * Return: returns zero on success or a negative error code.
71 void v4l_disable_media_source(struct video_device *vdev);
74 * v4l_vb2q_enable_media_tuner - Hold media source for exclusive use
75 * if free.
76 * @q - pointer to struct vb2_queue
78 * Wrapper for v4l_enable_media_source(). This function should
79 * be called from v4l2-core to enable the media source with
80 * pointer to struct vb2_queue as the input argument. Some
81 * v4l2-core interfaces don't have access to video device and
82 * this interface finds the struct video_device for the q and
83 * calls v4l_enable_media_source().
85 int v4l_vb2q_enable_media_source(struct vb2_queue *q);
88 /**
89 * v4l2_pipeline_pm_get - Increase the use count of a pipeline
90 * @entity: The root entity of a pipeline
92 * Update the use count of all entities in the pipeline and power entities on.
94 * This function is intended to be called in video node open. It uses
95 * struct media_entity.use_count to track the power status. The use
96 * of this function should be paired with v4l2_pipeline_link_notify().
98 * Return 0 on success or a negative error code on failure.
100 int v4l2_pipeline_pm_get(struct media_entity *entity);
103 * v4l2_pipeline_pm_put - Decrease the use count of a pipeline
104 * @entity: The root entity of a pipeline
106 * Update the use count of all entities in the pipeline and power entities off.
108 * This function is intended to be called in video node release. It uses
109 * struct media_entity.use_count to track the power status. The use
110 * of this function should be paired with v4l2_pipeline_link_notify().
112 void v4l2_pipeline_pm_put(struct media_entity *entity);
116 * v4l2_pipeline_link_notify - Link management notification callback
117 * @link: The link
118 * @flags: New link flags that will be applied
119 * @notification: The link's state change notification type (MEDIA_DEV_NOTIFY_*)
121 * React to link management on powered pipelines by updating the use count of
122 * all entities in the source and sink sides of the link. Entities are powered
123 * on or off accordingly. The use of this function should be paired
124 * with v4l2_pipeline_pm_{get,put}().
126 * Return 0 on success or a negative error code on failure. Powering entities
127 * off is assumed to never fail. This function will not fail for disconnection
128 * events.
130 int v4l2_pipeline_link_notify(struct media_link *link, u32 flags,
131 unsigned int notification);
133 #else /* CONFIG_MEDIA_CONTROLLER */
135 static inline int v4l2_mc_create_media_graph(struct media_device *mdev)
137 return 0;
140 static inline int v4l_enable_media_source(struct video_device *vdev)
142 return 0;
145 static inline void v4l_disable_media_source(struct video_device *vdev)
149 static inline int v4l_vb2q_enable_media_source(struct vb2_queue *q)
151 return 0;
154 static inline int v4l2_pipeline_pm_get(struct media_entity *entity)
156 return 0;
159 static inline void v4l2_pipeline_pm_put(struct media_entity *entity)
162 static inline int v4l2_pipeline_link_notify(struct media_link *link, u32 flags,
163 unsigned int notification)
165 return 0;
168 #endif /* CONFIG_MEDIA_CONTROLLER */
169 #endif /* _V4L2_MC_H */