diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-02-02 09:25:31 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-02-18 09:14:53 -0500 |
commit | 057596eea8402aa8f7a670bf3195665aa8267204 (patch) | |
tree | 1c42fca7337e9b4000cb5d2fc2f9f7b53c7de31e /drivers/media/video/videodev.c | |
parent | 1a4e30c3eaffb83218977477bb83d54316844acb (diff) |
V4L/DVB (7133): Fix Kconfig dependencies
As pointed by Adrian Bunk, with I2C=m and VIDEO_DEV=y, videodev brokes.
This patch moves the functions that videodev needs from v4l2-common. It also
fixes some Kconfig changes.
After this patch, I2C=m / VIDEO_DEV=y will make v4l2 core statically linked
into kernel. v4l2-common will be m, and all V4L drivers will also be m.
This approach is very conservative, since it is possible to have V4L drivers
that don't need I2C or v4l2-common. The better is to map what drivers really
need v4l2-common, making them to select v4l2-common, and allowing the others to
be 'y', 'm' and 'n'.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/videodev.c')
-rw-r--r-- | drivers/media/video/videodev.c | 444 |
1 files changed, 385 insertions, 59 deletions
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c index 28655f8983c6..0d9b63762a48 100644 --- a/drivers/media/video/videodev.c +++ b/drivers/media/video/videodev.c | |||
@@ -46,10 +46,373 @@ | |||
46 | #include <linux/videodev.h> | 46 | #include <linux/videodev.h> |
47 | #endif | 47 | #endif |
48 | #include <media/v4l2-common.h> | 48 | #include <media/v4l2-common.h> |
49 | #include <linux/video_decoder.h> | ||
49 | 50 | ||
50 | #define VIDEO_NUM_DEVICES 256 | 51 | #define VIDEO_NUM_DEVICES 256 |
51 | #define VIDEO_NAME "video4linux" | 52 | #define VIDEO_NAME "video4linux" |
52 | 53 | ||
54 | /* video4linux standard ID conversion to standard name | ||
55 | */ | ||
56 | char *v4l2_norm_to_name(v4l2_std_id id) | ||
57 | { | ||
58 | char *name; | ||
59 | u32 myid = id; | ||
60 | |||
61 | /* HACK: ppc32 architecture doesn't have __ucmpdi2 function to handle | ||
62 | 64 bit comparations. So, on that architecture, with some gcc | ||
63 | variants, compilation fails. Currently, the max value is 30bit wide. | ||
64 | */ | ||
65 | BUG_ON(myid != id); | ||
66 | |||
67 | switch (myid) { | ||
68 | case V4L2_STD_PAL: | ||
69 | name = "PAL"; | ||
70 | break; | ||
71 | case V4L2_STD_PAL_BG: | ||
72 | name = "PAL-BG"; | ||
73 | break; | ||
74 | case V4L2_STD_PAL_DK: | ||
75 | name = "PAL-DK"; | ||
76 | break; | ||
77 | case V4L2_STD_PAL_B: | ||
78 | name = "PAL-B"; | ||
79 | break; | ||
80 | case V4L2_STD_PAL_B1: | ||
81 | name = "PAL-B1"; | ||
82 | break; | ||
83 | case V4L2_STD_PAL_G: | ||
84 | name = "PAL-G"; | ||
85 | break; | ||
86 | case V4L2_STD_PAL_H: | ||
87 | name = "PAL-H"; | ||
88 | break; | ||
89 | case V4L2_STD_PAL_I: | ||
90 | name = "PAL-I"; | ||
91 | break; | ||
92 | case V4L2_STD_PAL_D: | ||
93 | name = "PAL-D"; | ||
94 | break; | ||
95 | case V4L2_STD_PAL_D1: | ||
96 | name = "PAL-D1"; | ||
97 | break; | ||
98 | case V4L2_STD_PAL_K: | ||
99 | name = "PAL-K"; | ||
100 | break; | ||
101 | case V4L2_STD_PAL_M: | ||
102 | name = "PAL-M"; | ||
103 | break; | ||
104 | case V4L2_STD_PAL_N: | ||
105 | name = "PAL-N"; | ||
106 | break; | ||
107 | case V4L2_STD_PAL_Nc: | ||
108 | name = "PAL-Nc"; | ||
109 | break; | ||
110 | case V4L2_STD_PAL_60: | ||
111 | name = "PAL-60"; | ||
112 | break; | ||
113 | case V4L2_STD_NTSC: | ||
114 | name = "NTSC"; | ||
115 | break; | ||
116 | case V4L2_STD_NTSC_M: | ||
117 | name = "NTSC-M"; | ||
118 | break; | ||
119 | case V4L2_STD_NTSC_M_JP: | ||
120 | name = "NTSC-M-JP"; | ||
121 | break; | ||
122 | case V4L2_STD_NTSC_443: | ||
123 | name = "NTSC-443"; | ||
124 | break; | ||
125 | case V4L2_STD_NTSC_M_KR: | ||
126 | name = "NTSC-M-KR"; | ||
127 | break; | ||
128 | case V4L2_STD_SECAM: | ||
129 | name = "SECAM"; | ||
130 | break; | ||
131 | case V4L2_STD_SECAM_DK: | ||
132 | name = "SECAM-DK"; | ||
133 | break; | ||
134 | case V4L2_STD_SECAM_B: | ||
135 | name = "SECAM-B"; | ||
136 | break; | ||
137 | case V4L2_STD_SECAM_D: | ||
138 | name = "SECAM-D"; | ||
139 | break; | ||
140 | case V4L2_STD_SECAM_G: | ||
141 | name = "SECAM-G"; | ||
142 | break; | ||
143 | case V4L2_STD_SECAM_H: | ||
144 | name = "SECAM-H"; | ||
145 | break; | ||
146 | case V4L2_STD_SECAM_K: | ||
147 | name = "SECAM-K"; | ||
148 | break; | ||
149 | case V4L2_STD_SECAM_K1: | ||
150 | name = "SECAM-K1"; | ||
151 | break; | ||
152 | case V4L2_STD_SECAM_L: | ||
153 | name = "SECAM-L"; | ||
154 | break; | ||
155 | case V4L2_STD_SECAM_LC: | ||
156 | name = "SECAM-LC"; | ||
157 | break; | ||
158 | default: | ||
159 | name = "Unknown"; | ||
160 | break; | ||
161 | } | ||
162 | |||
163 | return name; | ||
164 | } | ||
165 | EXPORT_SYMBOL(v4l2_norm_to_name); | ||
166 | |||
167 | /* Fill in the fields of a v4l2_standard structure according to the | ||
168 | 'id' and 'transmission' parameters. Returns negative on error. */ | ||
169 | int v4l2_video_std_construct(struct v4l2_standard *vs, | ||
170 | int id, char *name) | ||
171 | { | ||
172 | u32 index = vs->index; | ||
173 | |||
174 | memset(vs, 0, sizeof(struct v4l2_standard)); | ||
175 | vs->index = index; | ||
176 | vs->id = id; | ||
177 | if (id & V4L2_STD_525_60) { | ||
178 | vs->frameperiod.numerator = 1001; | ||
179 | vs->frameperiod.denominator = 30000; | ||
180 | vs->framelines = 525; | ||
181 | } else { | ||
182 | vs->frameperiod.numerator = 1; | ||
183 | vs->frameperiod.denominator = 25; | ||
184 | vs->framelines = 625; | ||
185 | } | ||
186 | strlcpy(vs->name, name, sizeof(vs->name)); | ||
187 | return 0; | ||
188 | } | ||
189 | EXPORT_SYMBOL(v4l2_video_std_construct); | ||
190 | |||
191 | /* ----------------------------------------------------------------- */ | ||
192 | /* some arrays for pretty-printing debug messages of enum types */ | ||
193 | |||
194 | char *v4l2_field_names[] = { | ||
195 | [V4L2_FIELD_ANY] = "any", | ||
196 | [V4L2_FIELD_NONE] = "none", | ||
197 | [V4L2_FIELD_TOP] = "top", | ||
198 | [V4L2_FIELD_BOTTOM] = "bottom", | ||
199 | [V4L2_FIELD_INTERLACED] = "interlaced", | ||
200 | [V4L2_FIELD_SEQ_TB] = "seq-tb", | ||
201 | [V4L2_FIELD_SEQ_BT] = "seq-bt", | ||
202 | [V4L2_FIELD_ALTERNATE] = "alternate", | ||
203 | [V4L2_FIELD_INTERLACED_TB] = "interlaced-tb", | ||
204 | [V4L2_FIELD_INTERLACED_BT] = "interlaced-bt", | ||
205 | }; | ||
206 | EXPORT_SYMBOL(v4l2_field_names); | ||
207 | |||
208 | char *v4l2_type_names[] = { | ||
209 | [V4L2_BUF_TYPE_VIDEO_CAPTURE] = "video-cap", | ||
210 | [V4L2_BUF_TYPE_VIDEO_OVERLAY] = "video-over", | ||
211 | [V4L2_BUF_TYPE_VIDEO_OUTPUT] = "video-out", | ||
212 | [V4L2_BUF_TYPE_VBI_CAPTURE] = "vbi-cap", | ||
213 | [V4L2_BUF_TYPE_VBI_OUTPUT] = "vbi-out", | ||
214 | [V4L2_BUF_TYPE_SLICED_VBI_CAPTURE] = "sliced-vbi-cap", | ||
215 | [V4L2_BUF_TYPE_SLICED_VBI_OUTPUT] = "sliced-vbi-out", | ||
216 | [V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY] = "video-out-over", | ||
217 | }; | ||
218 | EXPORT_SYMBOL(v4l2_type_names); | ||
219 | |||
220 | static char *v4l2_memory_names[] = { | ||
221 | [V4L2_MEMORY_MMAP] = "mmap", | ||
222 | [V4L2_MEMORY_USERPTR] = "userptr", | ||
223 | [V4L2_MEMORY_OVERLAY] = "overlay", | ||
224 | }; | ||
225 | |||
226 | #define prt_names(a, arr) ((((a) >= 0) && ((a) < ARRAY_SIZE(arr))) ? \ | ||
227 | arr[a] : "unknown") | ||
228 | |||
229 | /* ------------------------------------------------------------------ */ | ||
230 | /* debug help functions */ | ||
231 | |||
232 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
233 | static const char *v4l1_ioctls[] = { | ||
234 | [_IOC_NR(VIDIOCGCAP)] = "VIDIOCGCAP", | ||
235 | [_IOC_NR(VIDIOCGCHAN)] = "VIDIOCGCHAN", | ||
236 | [_IOC_NR(VIDIOCSCHAN)] = "VIDIOCSCHAN", | ||
237 | [_IOC_NR(VIDIOCGTUNER)] = "VIDIOCGTUNER", | ||
238 | [_IOC_NR(VIDIOCSTUNER)] = "VIDIOCSTUNER", | ||
239 | [_IOC_NR(VIDIOCGPICT)] = "VIDIOCGPICT", | ||
240 | [_IOC_NR(VIDIOCSPICT)] = "VIDIOCSPICT", | ||
241 | [_IOC_NR(VIDIOCCAPTURE)] = "VIDIOCCAPTURE", | ||
242 | [_IOC_NR(VIDIOCGWIN)] = "VIDIOCGWIN", | ||
243 | [_IOC_NR(VIDIOCSWIN)] = "VIDIOCSWIN", | ||
244 | [_IOC_NR(VIDIOCGFBUF)] = "VIDIOCGFBUF", | ||
245 | [_IOC_NR(VIDIOCSFBUF)] = "VIDIOCSFBUF", | ||
246 | [_IOC_NR(VIDIOCKEY)] = "VIDIOCKEY", | ||
247 | [_IOC_NR(VIDIOCGFREQ)] = "VIDIOCGFREQ", | ||
248 | [_IOC_NR(VIDIOCSFREQ)] = "VIDIOCSFREQ", | ||
249 | [_IOC_NR(VIDIOCGAUDIO)] = "VIDIOCGAUDIO", | ||
250 | [_IOC_NR(VIDIOCSAUDIO)] = "VIDIOCSAUDIO", | ||
251 | [_IOC_NR(VIDIOCSYNC)] = "VIDIOCSYNC", | ||
252 | [_IOC_NR(VIDIOCMCAPTURE)] = "VIDIOCMCAPTURE", | ||
253 | [_IOC_NR(VIDIOCGMBUF)] = "VIDIOCGMBUF", | ||
254 | [_IOC_NR(VIDIOCGUNIT)] = "VIDIOCGUNIT", | ||
255 | [_IOC_NR(VIDIOCGCAPTURE)] = "VIDIOCGCAPTURE", | ||
256 | [_IOC_NR(VIDIOCSCAPTURE)] = "VIDIOCSCAPTURE", | ||
257 | [_IOC_NR(VIDIOCSPLAYMODE)] = "VIDIOCSPLAYMODE", | ||
258 | [_IOC_NR(VIDIOCSWRITEMODE)] = "VIDIOCSWRITEMODE", | ||
259 | [_IOC_NR(VIDIOCGPLAYINFO)] = "VIDIOCGPLAYINFO", | ||
260 | [_IOC_NR(VIDIOCSMICROCODE)] = "VIDIOCSMICROCODE", | ||
261 | [_IOC_NR(VIDIOCGVBIFMT)] = "VIDIOCGVBIFMT", | ||
262 | [_IOC_NR(VIDIOCSVBIFMT)] = "VIDIOCSVBIFMT" | ||
263 | }; | ||
264 | #define V4L1_IOCTLS ARRAY_SIZE(v4l1_ioctls) | ||
265 | #endif | ||
266 | |||
267 | static const char *v4l2_ioctls[] = { | ||
268 | [_IOC_NR(VIDIOC_QUERYCAP)] = "VIDIOC_QUERYCAP", | ||
269 | [_IOC_NR(VIDIOC_RESERVED)] = "VIDIOC_RESERVED", | ||
270 | [_IOC_NR(VIDIOC_ENUM_FMT)] = "VIDIOC_ENUM_FMT", | ||
271 | [_IOC_NR(VIDIOC_G_FMT)] = "VIDIOC_G_FMT", | ||
272 | [_IOC_NR(VIDIOC_S_FMT)] = "VIDIOC_S_FMT", | ||
273 | [_IOC_NR(VIDIOC_REQBUFS)] = "VIDIOC_REQBUFS", | ||
274 | [_IOC_NR(VIDIOC_QUERYBUF)] = "VIDIOC_QUERYBUF", | ||
275 | [_IOC_NR(VIDIOC_G_FBUF)] = "VIDIOC_G_FBUF", | ||
276 | [_IOC_NR(VIDIOC_S_FBUF)] = "VIDIOC_S_FBUF", | ||
277 | [_IOC_NR(VIDIOC_OVERLAY)] = "VIDIOC_OVERLAY", | ||
278 | [_IOC_NR(VIDIOC_QBUF)] = "VIDIOC_QBUF", | ||
279 | [_IOC_NR(VIDIOC_DQBUF)] = "VIDIOC_DQBUF", | ||
280 | [_IOC_NR(VIDIOC_STREAMON)] = "VIDIOC_STREAMON", | ||
281 | [_IOC_NR(VIDIOC_STREAMOFF)] = "VIDIOC_STREAMOFF", | ||
282 | [_IOC_NR(VIDIOC_G_PARM)] = "VIDIOC_G_PARM", | ||
283 | [_IOC_NR(VIDIOC_S_PARM)] = "VIDIOC_S_PARM", | ||
284 | [_IOC_NR(VIDIOC_G_STD)] = "VIDIOC_G_STD", | ||
285 | [_IOC_NR(VIDIOC_S_STD)] = "VIDIOC_S_STD", | ||
286 | [_IOC_NR(VIDIOC_ENUMSTD)] = "VIDIOC_ENUMSTD", | ||
287 | [_IOC_NR(VIDIOC_ENUMINPUT)] = "VIDIOC_ENUMINPUT", | ||
288 | [_IOC_NR(VIDIOC_G_CTRL)] = "VIDIOC_G_CTRL", | ||
289 | [_IOC_NR(VIDIOC_S_CTRL)] = "VIDIOC_S_CTRL", | ||
290 | [_IOC_NR(VIDIOC_G_TUNER)] = "VIDIOC_G_TUNER", | ||
291 | [_IOC_NR(VIDIOC_S_TUNER)] = "VIDIOC_S_TUNER", | ||
292 | [_IOC_NR(VIDIOC_G_AUDIO)] = "VIDIOC_G_AUDIO", | ||
293 | [_IOC_NR(VIDIOC_S_AUDIO)] = "VIDIOC_S_AUDIO", | ||
294 | [_IOC_NR(VIDIOC_QUERYCTRL)] = "VIDIOC_QUERYCTRL", | ||
295 | [_IOC_NR(VIDIOC_QUERYMENU)] = "VIDIOC_QUERYMENU", | ||
296 | [_IOC_NR(VIDIOC_G_INPUT)] = "VIDIOC_G_INPUT", | ||
297 | [_IOC_NR(VIDIOC_S_INPUT)] = "VIDIOC_S_INPUT", | ||
298 | [_IOC_NR(VIDIOC_G_OUTPUT)] = "VIDIOC_G_OUTPUT", | ||
299 | [_IOC_NR(VIDIOC_S_OUTPUT)] = "VIDIOC_S_OUTPUT", | ||
300 | [_IOC_NR(VIDIOC_ENUMOUTPUT)] = "VIDIOC_ENUMOUTPUT", | ||
301 | [_IOC_NR(VIDIOC_G_AUDOUT)] = "VIDIOC_G_AUDOUT", | ||
302 | [_IOC_NR(VIDIOC_S_AUDOUT)] = "VIDIOC_S_AUDOUT", | ||
303 | [_IOC_NR(VIDIOC_G_MODULATOR)] = "VIDIOC_G_MODULATOR", | ||
304 | [_IOC_NR(VIDIOC_S_MODULATOR)] = "VIDIOC_S_MODULATOR", | ||
305 | [_IOC_NR(VIDIOC_G_FREQUENCY)] = "VIDIOC_G_FREQUENCY", | ||
306 | [_IOC_NR(VIDIOC_S_FREQUENCY)] = "VIDIOC_S_FREQUENCY", | ||
307 | [_IOC_NR(VIDIOC_CROPCAP)] = "VIDIOC_CROPCAP", | ||
308 | [_IOC_NR(VIDIOC_G_CROP)] = "VIDIOC_G_CROP", | ||
309 | [_IOC_NR(VIDIOC_S_CROP)] = "VIDIOC_S_CROP", | ||
310 | [_IOC_NR(VIDIOC_G_JPEGCOMP)] = "VIDIOC_G_JPEGCOMP", | ||
311 | [_IOC_NR(VIDIOC_S_JPEGCOMP)] = "VIDIOC_S_JPEGCOMP", | ||
312 | [_IOC_NR(VIDIOC_QUERYSTD)] = "VIDIOC_QUERYSTD", | ||
313 | [_IOC_NR(VIDIOC_TRY_FMT)] = "VIDIOC_TRY_FMT", | ||
314 | [_IOC_NR(VIDIOC_ENUMAUDIO)] = "VIDIOC_ENUMAUDIO", | ||
315 | [_IOC_NR(VIDIOC_ENUMAUDOUT)] = "VIDIOC_ENUMAUDOUT", | ||
316 | [_IOC_NR(VIDIOC_G_PRIORITY)] = "VIDIOC_G_PRIORITY", | ||
317 | [_IOC_NR(VIDIOC_S_PRIORITY)] = "VIDIOC_S_PRIORITY", | ||
318 | [_IOC_NR(VIDIOC_G_SLICED_VBI_CAP)] = "VIDIOC_G_SLICED_VBI_CAP", | ||
319 | [_IOC_NR(VIDIOC_LOG_STATUS)] = "VIDIOC_LOG_STATUS", | ||
320 | [_IOC_NR(VIDIOC_G_EXT_CTRLS)] = "VIDIOC_G_EXT_CTRLS", | ||
321 | [_IOC_NR(VIDIOC_S_EXT_CTRLS)] = "VIDIOC_S_EXT_CTRLS", | ||
322 | [_IOC_NR(VIDIOC_TRY_EXT_CTRLS)] = "VIDIOC_TRY_EXT_CTRLS", | ||
323 | #if 1 | ||
324 | [_IOC_NR(VIDIOC_ENUM_FRAMESIZES)] = "VIDIOC_ENUM_FRAMESIZES", | ||
325 | [_IOC_NR(VIDIOC_ENUM_FRAMEINTERVALS)] = "VIDIOC_ENUM_FRAMEINTERVALS", | ||
326 | [_IOC_NR(VIDIOC_G_ENC_INDEX)] = "VIDIOC_G_ENC_INDEX", | ||
327 | [_IOC_NR(VIDIOC_ENCODER_CMD)] = "VIDIOC_ENCODER_CMD", | ||
328 | [_IOC_NR(VIDIOC_TRY_ENCODER_CMD)] = "VIDIOC_TRY_ENCODER_CMD", | ||
329 | |||
330 | [_IOC_NR(VIDIOC_DBG_S_REGISTER)] = "VIDIOC_DBG_S_REGISTER", | ||
331 | [_IOC_NR(VIDIOC_DBG_G_REGISTER)] = "VIDIOC_DBG_G_REGISTER", | ||
332 | |||
333 | [_IOC_NR(VIDIOC_G_CHIP_IDENT)] = "VIDIOC_G_CHIP_IDENT", | ||
334 | #endif | ||
335 | }; | ||
336 | #define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls) | ||
337 | |||
338 | static const char *v4l2_int_ioctls[] = { | ||
339 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
340 | [_IOC_NR(DECODER_GET_CAPABILITIES)] = "DECODER_GET_CAPABILITIES", | ||
341 | [_IOC_NR(DECODER_GET_STATUS)] = "DECODER_GET_STATUS", | ||
342 | [_IOC_NR(DECODER_SET_NORM)] = "DECODER_SET_NORM", | ||
343 | [_IOC_NR(DECODER_SET_INPUT)] = "DECODER_SET_INPUT", | ||
344 | [_IOC_NR(DECODER_SET_OUTPUT)] = "DECODER_SET_OUTPUT", | ||
345 | [_IOC_NR(DECODER_ENABLE_OUTPUT)] = "DECODER_ENABLE_OUTPUT", | ||
346 | [_IOC_NR(DECODER_SET_PICTURE)] = "DECODER_SET_PICTURE", | ||
347 | [_IOC_NR(DECODER_SET_GPIO)] = "DECODER_SET_GPIO", | ||
348 | [_IOC_NR(DECODER_INIT)] = "DECODER_INIT", | ||
349 | [_IOC_NR(DECODER_SET_VBI_BYPASS)] = "DECODER_SET_VBI_BYPASS", | ||
350 | [_IOC_NR(DECODER_DUMP)] = "DECODER_DUMP", | ||
351 | #endif | ||
352 | [_IOC_NR(AUDC_SET_RADIO)] = "AUDC_SET_RADIO", | ||
353 | |||
354 | [_IOC_NR(TUNER_SET_TYPE_ADDR)] = "TUNER_SET_TYPE_ADDR", | ||
355 | [_IOC_NR(TUNER_SET_STANDBY)] = "TUNER_SET_STANDBY", | ||
356 | [_IOC_NR(TUNER_SET_CONFIG)] = "TUNER_SET_CONFIG", | ||
357 | |||
358 | [_IOC_NR(VIDIOC_INT_S_TUNER_MODE)] = "VIDIOC_INT_S_TUNER_MODE", | ||
359 | [_IOC_NR(VIDIOC_INT_RESET)] = "VIDIOC_INT_RESET", | ||
360 | [_IOC_NR(VIDIOC_INT_AUDIO_CLOCK_FREQ)] = "VIDIOC_INT_AUDIO_CLOCK_FREQ", | ||
361 | [_IOC_NR(VIDIOC_INT_DECODE_VBI_LINE)] = "VIDIOC_INT_DECODE_VBI_LINE", | ||
362 | [_IOC_NR(VIDIOC_INT_S_VBI_DATA)] = "VIDIOC_INT_S_VBI_DATA", | ||
363 | [_IOC_NR(VIDIOC_INT_G_VBI_DATA)] = "VIDIOC_INT_G_VBI_DATA", | ||
364 | [_IOC_NR(VIDIOC_INT_I2S_CLOCK_FREQ)] = "VIDIOC_INT_I2S_CLOCK_FREQ", | ||
365 | [_IOC_NR(VIDIOC_INT_S_STANDBY)] = "VIDIOC_INT_S_STANDBY", | ||
366 | [_IOC_NR(VIDIOC_INT_S_AUDIO_ROUTING)] = "VIDIOC_INT_S_AUDIO_ROUTING", | ||
367 | [_IOC_NR(VIDIOC_INT_G_AUDIO_ROUTING)] = "VIDIOC_INT_G_AUDIO_ROUTING", | ||
368 | [_IOC_NR(VIDIOC_INT_S_VIDEO_ROUTING)] = "VIDIOC_INT_S_VIDEO_ROUTING", | ||
369 | [_IOC_NR(VIDIOC_INT_G_VIDEO_ROUTING)] = "VIDIOC_INT_G_VIDEO_ROUTING", | ||
370 | [_IOC_NR(VIDIOC_INT_S_CRYSTAL_FREQ)] = "VIDIOC_INT_S_CRYSTAL_FREQ", | ||
371 | [_IOC_NR(VIDIOC_INT_INIT)] = "VIDIOC_INT_INIT", | ||
372 | [_IOC_NR(VIDIOC_INT_G_STD_OUTPUT)] = "VIDIOC_INT_G_STD_OUTPUT", | ||
373 | [_IOC_NR(VIDIOC_INT_S_STD_OUTPUT)] = "VIDIOC_INT_S_STD_OUTPUT", | ||
374 | }; | ||
375 | #define V4L2_INT_IOCTLS ARRAY_SIZE(v4l2_int_ioctls) | ||
376 | |||
377 | /* Common ioctl debug function. This function can be used by | ||
378 | external ioctl messages as well as internal V4L ioctl */ | ||
379 | void v4l_printk_ioctl(unsigned int cmd) | ||
380 | { | ||
381 | char *dir; | ||
382 | |||
383 | switch (_IOC_DIR(cmd)) { | ||
384 | case _IOC_NONE: dir = "--"; break; | ||
385 | case _IOC_READ: dir = "r-"; break; | ||
386 | case _IOC_WRITE: dir = "-w"; break; | ||
387 | case _IOC_READ | _IOC_WRITE: dir = "rw"; break; | ||
388 | default: dir = "*ERR*"; break; | ||
389 | } | ||
390 | switch (_IOC_TYPE(cmd)) { | ||
391 | case 'd': | ||
392 | printk("v4l2_int ioctl %s, dir=%s (0x%08x)\n", | ||
393 | (_IOC_NR(cmd) < V4L2_INT_IOCTLS) ? | ||
394 | v4l2_int_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd); | ||
395 | break; | ||
396 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
397 | case 'v': | ||
398 | printk("v4l1 ioctl %s, dir=%s (0x%08x)\n", | ||
399 | (_IOC_NR(cmd) < V4L1_IOCTLS) ? | ||
400 | v4l1_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd); | ||
401 | break; | ||
402 | #endif | ||
403 | case 'V': | ||
404 | printk("v4l2 ioctl %s, dir=%s (0x%08x)\n", | ||
405 | (_IOC_NR(cmd) < V4L2_IOCTLS) ? | ||
406 | v4l2_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd); | ||
407 | break; | ||
408 | |||
409 | default: | ||
410 | printk("unknown ioctl '%c', dir=%s, #%d (0x%08x)\n", | ||
411 | _IOC_TYPE(cmd), dir, _IOC_NR(cmd), cmd); | ||
412 | } | ||
413 | } | ||
414 | EXPORT_SYMBOL(v4l_printk_ioctl); | ||
415 | |||
53 | /* | 416 | /* |
54 | * sysfs stuff | 417 | * sysfs stuff |
55 | */ | 418 | */ |
@@ -69,11 +432,13 @@ struct video_device *video_device_alloc(void) | |||
69 | vfd = kzalloc(sizeof(*vfd),GFP_KERNEL); | 432 | vfd = kzalloc(sizeof(*vfd),GFP_KERNEL); |
70 | return vfd; | 433 | return vfd; |
71 | } | 434 | } |
435 | EXPORT_SYMBOL(video_device_alloc); | ||
72 | 436 | ||
73 | void video_device_release(struct video_device *vfd) | 437 | void video_device_release(struct video_device *vfd) |
74 | { | 438 | { |
75 | kfree(vfd); | 439 | kfree(vfd); |
76 | } | 440 | } |
441 | EXPORT_SYMBOL(video_device_release); | ||
77 | 442 | ||
78 | static void video_release(struct device *cd) | 443 | static void video_release(struct device *cd) |
79 | { | 444 | { |
@@ -110,6 +475,7 @@ struct video_device* video_devdata(struct file *file) | |||
110 | { | 475 | { |
111 | return video_device[iminor(file->f_path.dentry->d_inode)]; | 476 | return video_device[iminor(file->f_path.dentry->d_inode)]; |
112 | } | 477 | } |
478 | EXPORT_SYMBOL(video_devdata); | ||
113 | 479 | ||
114 | /* | 480 | /* |
115 | * Open a video device - FIXME: Obsoleted | 481 | * Open a video device - FIXME: Obsoleted |
@@ -278,6 +644,7 @@ out: | |||
278 | kfree(mbuf); | 644 | kfree(mbuf); |
279 | return err; | 645 | return err; |
280 | } | 646 | } |
647 | EXPORT_SYMBOL(video_usercopy); | ||
281 | 648 | ||
282 | /* | 649 | /* |
283 | * open/release helper functions -- handle exclusive opens | 650 | * open/release helper functions -- handle exclusive opens |
@@ -297,6 +664,7 @@ int video_exclusive_open(struct inode *inode, struct file *file) | |||
297 | mutex_unlock(&vfl->lock); | 664 | mutex_unlock(&vfl->lock); |
298 | return retval; | 665 | return retval; |
299 | } | 666 | } |
667 | EXPORT_SYMBOL(video_exclusive_open); | ||
300 | 668 | ||
301 | int video_exclusive_release(struct inode *inode, struct file *file) | 669 | int video_exclusive_release(struct inode *inode, struct file *file) |
302 | { | 670 | { |
@@ -305,41 +673,7 @@ int video_exclusive_release(struct inode *inode, struct file *file) | |||
305 | vfl->users--; | 673 | vfl->users--; |
306 | return 0; | 674 | return 0; |
307 | } | 675 | } |
308 | 676 | EXPORT_SYMBOL(video_exclusive_release); | |
309 | static char *v4l2_memory_names[] = { | ||
310 | [V4L2_MEMORY_MMAP] = "mmap", | ||
311 | [V4L2_MEMORY_USERPTR] = "userptr", | ||
312 | [V4L2_MEMORY_OVERLAY] = "overlay", | ||
313 | }; | ||
314 | |||
315 | |||
316 | /* FIXME: Those stuff are replicated also on v4l2-common.c */ | ||
317 | static char *v4l2_type_names_FIXME[] = { | ||
318 | [V4L2_BUF_TYPE_VIDEO_CAPTURE] = "video-cap", | ||
319 | [V4L2_BUF_TYPE_VIDEO_OVERLAY] = "video-over", | ||
320 | [V4L2_BUF_TYPE_VIDEO_OUTPUT] = "video-out", | ||
321 | [V4L2_BUF_TYPE_VBI_CAPTURE] = "vbi-cap", | ||
322 | [V4L2_BUF_TYPE_VBI_OUTPUT] = "vbi-out", | ||
323 | [V4L2_BUF_TYPE_SLICED_VBI_OUTPUT] = "sliced-vbi-out", | ||
324 | [V4L2_BUF_TYPE_SLICED_VBI_CAPTURE] = "sliced-vbi-capture", | ||
325 | [V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY] = "video-out-over", | ||
326 | [V4L2_BUF_TYPE_PRIVATE] = "private", | ||
327 | }; | ||
328 | |||
329 | static char *v4l2_field_names_FIXME[] = { | ||
330 | [V4L2_FIELD_ANY] = "any", | ||
331 | [V4L2_FIELD_NONE] = "none", | ||
332 | [V4L2_FIELD_TOP] = "top", | ||
333 | [V4L2_FIELD_BOTTOM] = "bottom", | ||
334 | [V4L2_FIELD_INTERLACED] = "interlaced", | ||
335 | [V4L2_FIELD_SEQ_TB] = "seq-tb", | ||
336 | [V4L2_FIELD_SEQ_BT] = "seq-bt", | ||
337 | [V4L2_FIELD_ALTERNATE] = "alternate", | ||
338 | [V4L2_FIELD_INTERLACED_TB] = "interlaced-tb", | ||
339 | [V4L2_FIELD_INTERLACED_BT] = "interlaced-bt", | ||
340 | }; | ||
341 | |||
342 | #define prt_names(a,arr) (((a)>=0)&&((a)<ARRAY_SIZE(arr)))?arr[a]:"unknown" | ||
343 | 677 | ||
344 | static void dbgbuf(unsigned int cmd, struct video_device *vfd, | 678 | static void dbgbuf(unsigned int cmd, struct video_device *vfd, |
345 | struct v4l2_buffer *p) | 679 | struct v4l2_buffer *p) |
@@ -354,10 +688,10 @@ static void dbgbuf(unsigned int cmd, struct video_device *vfd, | |||
354 | (int)(p->timestamp.tv_sec%60), | 688 | (int)(p->timestamp.tv_sec%60), |
355 | p->timestamp.tv_usec, | 689 | p->timestamp.tv_usec, |
356 | p->index, | 690 | p->index, |
357 | prt_names(p->type,v4l2_type_names_FIXME), | 691 | prt_names(p->type, v4l2_type_names), |
358 | p->bytesused,p->flags, | 692 | p->bytesused, p->flags, |
359 | p->field,p->sequence, | 693 | p->field, p->sequence, |
360 | prt_names(p->memory,v4l2_memory_names), | 694 | prt_names(p->memory, v4l2_memory_names), |
361 | p->m.userptr, p->length); | 695 | p->m.userptr, p->length); |
362 | dbgarg2 ("timecode= %02d:%02d:%02d type=%d, " | 696 | dbgarg2 ("timecode= %02d:%02d:%02d type=%d, " |
363 | "flags=0x%08d, frames=%d, userbits=0x%08x\n", | 697 | "flags=0x%08d, frames=%d, userbits=0x%08x\n", |
@@ -382,8 +716,8 @@ static inline void v4l_print_pix_fmt (struct video_device *vfd, | |||
382 | (fmt->pixelformat >> 8) & 0xff, | 716 | (fmt->pixelformat >> 8) & 0xff, |
383 | (fmt->pixelformat >> 16) & 0xff, | 717 | (fmt->pixelformat >> 16) & 0xff, |
384 | (fmt->pixelformat >> 24) & 0xff, | 718 | (fmt->pixelformat >> 24) & 0xff, |
385 | prt_names(fmt->field,v4l2_field_names_FIXME), | 719 | prt_names(fmt->field, v4l2_field_names), |
386 | fmt->bytesperline,fmt->sizeimage,fmt->colorspace); | 720 | fmt->bytesperline, fmt->sizeimage, fmt->colorspace); |
387 | }; | 721 | }; |
388 | 722 | ||
389 | 723 | ||
@@ -597,7 +931,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, | |||
597 | 931 | ||
598 | /* FIXME: Should be one dump per type */ | 932 | /* FIXME: Should be one dump per type */ |
599 | dbgarg (cmd, "type=%s\n", prt_names(type, | 933 | dbgarg (cmd, "type=%s\n", prt_names(type, |
600 | v4l2_type_names_FIXME)); | 934 | v4l2_type_names)); |
601 | 935 | ||
602 | switch (type) { | 936 | switch (type) { |
603 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: | 937 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: |
@@ -650,7 +984,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, | |||
650 | 984 | ||
651 | /* FIXME: Should be one dump per type */ | 985 | /* FIXME: Should be one dump per type */ |
652 | dbgarg (cmd, "type=%s\n", prt_names(f->type, | 986 | dbgarg (cmd, "type=%s\n", prt_names(f->type, |
653 | v4l2_type_names_FIXME)); | 987 | v4l2_type_names)); |
654 | 988 | ||
655 | switch (f->type) { | 989 | switch (f->type) { |
656 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: | 990 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: |
@@ -702,7 +1036,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, | |||
702 | 1036 | ||
703 | /* FIXME: Should be one dump per type */ | 1037 | /* FIXME: Should be one dump per type */ |
704 | dbgarg (cmd, "type=%s\n", prt_names(f->type, | 1038 | dbgarg (cmd, "type=%s\n", prt_names(f->type, |
705 | v4l2_type_names_FIXME)); | 1039 | v4l2_type_names)); |
706 | switch (f->type) { | 1040 | switch (f->type) { |
707 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: | 1041 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: |
708 | if (vfd->vidioc_try_fmt_cap) | 1042 | if (vfd->vidioc_try_fmt_cap) |
@@ -768,8 +1102,8 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, | |||
768 | ret=vfd->vidioc_reqbufs(file, fh, p); | 1102 | ret=vfd->vidioc_reqbufs(file, fh, p); |
769 | dbgarg (cmd, "count=%d, type=%s, memory=%s\n", | 1103 | dbgarg (cmd, "count=%d, type=%s, memory=%s\n", |
770 | p->count, | 1104 | p->count, |
771 | prt_names(p->type,v4l2_type_names_FIXME), | 1105 | prt_names(p->type, v4l2_type_names), |
772 | prt_names(p->memory,v4l2_memory_names)); | 1106 | prt_names(p->memory, v4l2_memory_names)); |
773 | break; | 1107 | break; |
774 | } | 1108 | } |
775 | case VIDIOC_QUERYBUF: | 1109 | case VIDIOC_QUERYBUF: |
@@ -858,7 +1192,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, | |||
858 | enum v4l2_buf_type i = *(int *)arg; | 1192 | enum v4l2_buf_type i = *(int *)arg; |
859 | if (!vfd->vidioc_streamon) | 1193 | if (!vfd->vidioc_streamon) |
860 | break; | 1194 | break; |
861 | dbgarg (cmd, "type=%s\n", prt_names(i,v4l2_type_names_FIXME)); | 1195 | dbgarg(cmd, "type=%s\n", prt_names(i, v4l2_type_names)); |
862 | ret=vfd->vidioc_streamon(file, fh,i); | 1196 | ret=vfd->vidioc_streamon(file, fh,i); |
863 | break; | 1197 | break; |
864 | } | 1198 | } |
@@ -868,7 +1202,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, | |||
868 | 1202 | ||
869 | if (!vfd->vidioc_streamoff) | 1203 | if (!vfd->vidioc_streamoff) |
870 | break; | 1204 | break; |
871 | dbgarg (cmd, "type=%s\n", prt_names(i,v4l2_type_names_FIXME)); | 1205 | dbgarg(cmd, "type=%s\n", prt_names(i, v4l2_type_names)); |
872 | ret=vfd->vidioc_streamoff(file, fh, i); | 1206 | ret=vfd->vidioc_streamoff(file, fh, i); |
873 | break; | 1207 | break; |
874 | } | 1208 | } |
@@ -1624,7 +1958,7 @@ out: | |||
1624 | kfree(mbuf); | 1958 | kfree(mbuf); |
1625 | return err; | 1959 | return err; |
1626 | } | 1960 | } |
1627 | 1961 | EXPORT_SYMBOL(video_ioctl2); | |
1628 | 1962 | ||
1629 | static const struct file_operations video_fops; | 1963 | static const struct file_operations video_fops; |
1630 | 1964 | ||
@@ -1743,6 +2077,7 @@ fail_minor: | |||
1743 | mutex_unlock(&videodev_lock); | 2077 | mutex_unlock(&videodev_lock); |
1744 | return ret; | 2078 | return ret; |
1745 | } | 2079 | } |
2080 | EXPORT_SYMBOL(video_register_device); | ||
1746 | 2081 | ||
1747 | /** | 2082 | /** |
1748 | * video_unregister_device - unregister a video4linux device | 2083 | * video_unregister_device - unregister a video4linux device |
@@ -1762,6 +2097,7 @@ void video_unregister_device(struct video_device *vfd) | |||
1762 | device_unregister(&vfd->class_dev); | 2097 | device_unregister(&vfd->class_dev); |
1763 | mutex_unlock(&videodev_lock); | 2098 | mutex_unlock(&videodev_lock); |
1764 | } | 2099 | } |
2100 | EXPORT_SYMBOL(video_unregister_device); | ||
1765 | 2101 | ||
1766 | /* | 2102 | /* |
1767 | * Video fs operations | 2103 | * Video fs operations |
@@ -1806,16 +2142,6 @@ static void __exit videodev_exit(void) | |||
1806 | module_init(videodev_init) | 2142 | module_init(videodev_init) |
1807 | module_exit(videodev_exit) | 2143 | module_exit(videodev_exit) |
1808 | 2144 | ||
1809 | EXPORT_SYMBOL(video_register_device); | ||
1810 | EXPORT_SYMBOL(video_unregister_device); | ||
1811 | EXPORT_SYMBOL(video_devdata); | ||
1812 | EXPORT_SYMBOL(video_usercopy); | ||
1813 | EXPORT_SYMBOL(video_exclusive_open); | ||
1814 | EXPORT_SYMBOL(video_exclusive_release); | ||
1815 | EXPORT_SYMBOL(video_ioctl2); | ||
1816 | EXPORT_SYMBOL(video_device_alloc); | ||
1817 | EXPORT_SYMBOL(video_device_release); | ||
1818 | |||
1819 | MODULE_AUTHOR("Alan Cox, Mauro Carvalho Chehab <mchehab@infradead.org>"); | 2145 | MODULE_AUTHOR("Alan Cox, Mauro Carvalho Chehab <mchehab@infradead.org>"); |
1820 | MODULE_DESCRIPTION("Device registrar for Video4Linux drivers v2"); | 2146 | MODULE_DESCRIPTION("Device registrar for Video4Linux drivers v2"); |
1821 | MODULE_LICENSE("GPL"); | 2147 | MODULE_LICENSE("GPL"); |