]>
Commit | Line | Data |
---|---|---|
6aad127d MCC |
1 | /* |
2 | * v4l2-mc.h - Media Controller V4L2 types and prototypes | |
3 | * | |
4 | * Copyright (C) 2016 Mauro Carvalho Chehab <mchehab@osg.samsung.com> | |
5 | * | |
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. | |
10 | * | |
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. | |
15 | */ | |
16 | ||
db152276 MCC |
17 | #ifndef _V4L2_MC_H |
18 | #define _V4L2_MC_H | |
19 | ||
54d0dbac | 20 | #include <media/media-device.h> |
d0a164f5 | 21 | #include <media/v4l2-dev.h> |
54d0dbac | 22 | |
6aad127d MCC |
23 | /** |
24 | * enum tuner_pad_index - tuner pad index for MEDIA_ENT_F_TUNER | |
25 | * | |
26 | * @TUNER_PAD_RF_INPUT: Radiofrequency (RF) sink pad, usually linked to a | |
27 | * RF connector entity. | |
5c9077ea MCC |
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 | |
42 | * audio sampled data. | |
6aad127d MCC |
43 | * @TUNER_NUM_PADS: Number of pads of the tuner. |
44 | */ | |
45 | enum tuner_pad_index { | |
46 | TUNER_PAD_RF_INPUT, | |
47 | TUNER_PAD_OUTPUT, | |
5c9077ea | 48 | TUNER_PAD_AUD_OUT, |
6aad127d | 49 | TUNER_NUM_PADS |
5c9077ea | 50 | }; |
953a457e MCC |
51 | |
52 | /** | |
53 | * enum if_vid_dec_index - video IF-PLL pad index for | |
54 | * MEDIA_ENT_F_IF_VID_DECODER | |
55 | * | |
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. | |
60 | */ | |
61 | enum if_vid_dec_pad_index { | |
62 | IF_VID_DEC_PAD_IF_INPUT, | |
63 | IF_VID_DEC_PAD_OUT, | |
64 | IF_VID_DEC_PAD_NUM_PADS | |
65 | }; | |
66 | ||
67 | /** | |
68 | * enum if_aud_dec_index - audio/sound IF-PLL pad index for | |
69 | * MEDIA_ENT_F_IF_AUD_DECODER | |
70 | * | |
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) | |
75 | * bus. | |
76 | * @IF_AUD_DEC_PAD_NUM_PADS: Number of pads of the audio IF-PLL. | |
77 | */ | |
78 | enum if_aud_dec_pad_index { | |
79 | IF_AUD_DEC_PAD_IF_INPUT, | |
80 | IF_AUD_DEC_PAD_OUT, | |
81 | IF_AUD_DEC_PAD_NUM_PADS | |
82 | }; | |
e4001e95 MCC |
83 | |
84 | /** | |
85 | * enum demod_pad_index - analog TV pad index for MEDIA_ENT_F_ATV_DECODER | |
86 | * | |
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. | |
bddc4187 | 90 | * @DEMOD_PAD_AUDIO_OUT: Audio output source pad. |
e4001e95 MCC |
91 | * @DEMOD_NUM_PADS: Maximum number of output pads. |
92 | */ | |
93 | enum demod_pad_index { | |
94 | DEMOD_PAD_IF_INPUT, | |
95 | DEMOD_PAD_VID_OUT, | |
96 | DEMOD_PAD_VBI_OUT, | |
bddc4187 | 97 | DEMOD_PAD_AUDIO_OUT, |
e4001e95 MCC |
98 | DEMOD_NUM_PADS |
99 | }; | |
54d0dbac | 100 | |
eee7d353 MCC |
101 | /* We don't need to include pci.h or usb.h here */ |
102 | struct pci_dev; | |
103 | struct usb_device; | |
7047f298 MCC |
104 | |
105 | #ifdef CONFIG_MEDIA_CONTROLLER | |
54d0dbac MCC |
106 | /** |
107 | * v4l2_mc_create_media_graph() - create Media Controller links at the graph. | |
108 | * | |
109 | * @mdev: pointer to the &media_device struct. | |
110 | * | |
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. | |
119 | */ | |
54d0dbac | 120 | int v4l2_mc_create_media_graph(struct media_device *mdev); |
7047f298 | 121 | |
d0a164f5 SK |
122 | /** |
123 | * v4l_enable_media_source() - Hold media source for exclusive use | |
124 | * if free | |
125 | * | |
4f27dba6 | 126 | * @vdev: pointer to struct video_device |
d0a164f5 SK |
127 | * |
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. | |
135 | * | |
136 | * Return: returns zero on success or a negative error code. | |
137 | */ | |
138 | int v4l_enable_media_source(struct video_device *vdev); | |
139 | ||
140 | /** | |
141 | * v4l_disable_media_source() - Release media source | |
142 | * | |
4f27dba6 | 143 | * @vdev: pointer to struct video_device |
d0a164f5 SK |
144 | * |
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. | |
149 | * | |
150 | * Return: returns zero on success or a negative error code. | |
151 | */ | |
152 | void v4l_disable_media_source(struct video_device *vdev); | |
153 | ||
154 | /* | |
155 | * v4l_vb2q_enable_media_tuner - Hold media source for exclusive use | |
156 | * if free. | |
157 | * @q - pointer to struct vb2_queue | |
158 | * | |
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(). | |
165 | */ | |
166 | int v4l_vb2q_enable_media_source(struct vb2_queue *q); | |
167 | ||
54d0dbac | 168 | #else |
d0a164f5 | 169 | |
54d0dbac MCC |
170 | static inline int v4l2_mc_create_media_graph(struct media_device *mdev) |
171 | { | |
172 | return 0; | |
173 | } | |
7047f298 | 174 | |
d0a164f5 SK |
175 | static int v4l_enable_media_source(struct video_device *vdev) |
176 | { | |
177 | return 0; | |
178 | } | |
179 | ||
180 | static void v4l_disable_media_source(struct video_device *vdev) | |
181 | { | |
182 | return; | |
183 | } | |
184 | ||
185 | static int v4l_vb2q_enable_media_source(struct vb2_queue *q) | |
186 | { | |
187 | return 0; | |
188 | } | |
189 | ||
54d0dbac | 190 | #endif |
d0a164f5 | 191 | #endif /* _V4L2_MC_H */ |