2 * v4l2-mc.h - Media Controller V4L2 types and prototypes
4 * Copyright (C) 2016 Mauro Carvalho Chehab <mchehab@osg.samsung.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
20 #include <media/media-device.h>
21 #include <media/v4l2-dev.h>
24 * enum tuner_pad_index - tuner pad index for MEDIA_ENT_F_TUNER
26 * @TUNER_PAD_RF_INPUT: Radiofrequency (RF) sink pad, usually linked to a
27 * RF connector entity.
28 * @TUNER_PAD_OUTPUT: Tuner video output source pad. Contains the video
29 * chrominance and luminance or the hole bandwidth
30 * of the signal converted to an Intermediate Frequency
31 * (IF) or to baseband (on zero-IF tuners).
32 * @TUNER_PAD_AUD_OUT: Tuner audio output source pad. Tuners used to decode
33 * analog TV signals have an extra pad for audio output.
34 * Old tuners use an analog stage with a saw filter for
35 * the audio IF frequency. The output of the pad is, in
36 * this case, the audio IF, with should be decoded either
37 * by the bridge chipset (that's the case of cx2388x
38 * chipsets) or may require an external IF sound
39 * processor, like msp34xx. On modern silicon tuners,
40 * the audio IF decoder is usually incorporated at the
41 * tuner. On such case, the output of this pad is an
43 * @TUNER_NUM_PADS: Number of pads of the tuner.
45 enum tuner_pad_index {
53 * enum if_vid_dec_index - video IF-PLL pad index for
54 * MEDIA_ENT_F_IF_VID_DECODER
56 * @IF_VID_DEC_PAD_IF_INPUT: video Intermediate Frequency (IF) sink pad
57 * @IF_VID_DEC_PAD_OUT: IF-PLL video output source pad. Contains the
58 * video chrominance and luminance IF signals.
59 * @IF_VID_DEC_PAD_NUM_PADS: Number of pads of the video IF-PLL.
61 enum if_vid_dec_pad_index {
62 IF_VID_DEC_PAD_IF_INPUT,
64 IF_VID_DEC_PAD_NUM_PADS
68 * enum if_aud_dec_index - audio/sound IF-PLL pad index for
69 * MEDIA_ENT_F_IF_AUD_DECODER
71 * @IF_AUD_DEC_PAD_IF_INPUT: audio Intermediate Frequency (IF) sink pad
72 * @IF_AUD_DEC_PAD_OUT: IF-PLL audio output source pad. Contains the
73 * audio sampled stream data, usually connected
74 * to the bridge bus via an Inter-IC Sound (I2S)
76 * @IF_AUD_DEC_PAD_NUM_PADS: Number of pads of the audio IF-PLL.
78 enum if_aud_dec_pad_index {
79 IF_AUD_DEC_PAD_IF_INPUT,
81 IF_AUD_DEC_PAD_NUM_PADS
85 * enum demod_pad_index - analog TV pad index for MEDIA_ENT_F_ATV_DECODER
87 * @DEMOD_PAD_IF_INPUT: IF input sink pad.
88 * @DEMOD_PAD_VID_OUT: Video output source pad.
89 * @DEMOD_PAD_VBI_OUT: Vertical Blank Interface (VBI) output source pad.
90 * @DEMOD_PAD_AUDIO_OUT: Audio output source pad.
91 * @DEMOD_NUM_PADS: Maximum number of output pads.
93 enum demod_pad_index {
101 /* We don't need to include pci.h or usb.h here */
105 #ifdef CONFIG_MEDIA_CONTROLLER
107 * v4l2_mc_create_media_graph() - create Media Controller links at the graph.
109 * @mdev: pointer to the &media_device struct.
111 * Add links between the entities commonly found on PC customer's hardware at
112 * the V4L2 side: camera sensors, audio and video PLL-IF decoders, tuners,
113 * analog TV decoder and I/O entities (video, VBI and Software Defined Radio).
114 * NOTE: webcams are modelled on a very simple way: the sensor is
115 * connected directly to the I/O entity. All dirty details, like
116 * scaler and crop HW are hidden. While such mapping is enough for v4l2
117 * interface centric PC-consumer's hardware, V4L2 subdev centric camera
118 * hardware should not use this routine, as it will not build the right graph.
120 int v4l2_mc_create_media_graph(struct media_device *mdev);
123 * v4l_enable_media_source() - Hold media source for exclusive use
126 * @vdev: pointer to struct video_device
128 * This interface calls enable_source handler to determine if
129 * media source is free for use. The enable_source handler is
130 * responsible for checking is the media source is free and
131 * start a pipeline between the media source and the media
132 * entity associated with the video device. This interface
133 * should be called from v4l2-core and dvb-core interfaces
134 * that change the source configuration.
136 * Return: returns zero on success or a negative error code.
138 int v4l_enable_media_source(struct video_device *vdev);
141 * v4l_disable_media_source() - Release media source
143 * @vdev: pointer to struct video_device
145 * This interface calls disable_source handler to release
146 * the media source. The disable_source handler stops the
147 * active media pipeline between the media source and the
148 * media entity associated with the video device.
150 * Return: returns zero on success or a negative error code.
152 void v4l_disable_media_source(struct video_device *vdev);
155 * v4l_vb2q_enable_media_tuner - Hold media source for exclusive use
157 * @q - pointer to struct vb2_queue
159 * Wrapper for v4l_enable_media_source(). This function should
160 * be called from v4l2-core to enable the media source with
161 * pointer to struct vb2_queue as the input argument. Some
162 * v4l2-core interfaces don't have access to video device and
163 * this interface finds the struct video_device for the q and
164 * calls v4l_enable_media_source().
166 int v4l_vb2q_enable_media_source(struct vb2_queue *q);
170 static inline int v4l2_mc_create_media_graph(struct media_device *mdev)
175 static int v4l_enable_media_source(struct video_device *vdev)
180 static void v4l_disable_media_source(struct video_device *vdev)
185 static int v4l_vb2q_enable_media_source(struct vb2_queue *q)
191 #endif /* _V4L2_MC_H */