diff options
author | Michael Krufky <mkrufky@m1k.net> | 2006-01-09 12:32:31 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@brturbo.com.br> | 2006-01-09 12:32:31 -0500 |
commit | 5e453dc757385ec892a818e4e3b5de027987ced9 (patch) | |
tree | c6e5c4ffeb7557c6f3861f39cb4d28532dc3fe39 /drivers/media/video/v4l2-common.c | |
parent | 37bdfa06b6bbf085b55d64eb5d9ed112418ed5ad (diff) |
V4L/DVB (3269): ioctls cleanups.
- Now, all internal ioctls are at v4l2-common.h
- removed unused ioctl at saa6752hs.h
- all debug ioctl code moved to v4l2-common.c
- removed duplicated stuff from other cards
Signed-off-by: Michael Krufky <mkrufky@m1k.net>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Diffstat (limited to 'drivers/media/video/v4l2-common.c')
-rw-r--r-- | drivers/media/video/v4l2-common.c | 219 |
1 files changed, 170 insertions, 49 deletions
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index 62a7d636ef11..5dbd7c1b362a 100644 --- a/drivers/media/video/v4l2-common.c +++ b/drivers/media/video/v4l2-common.c | |||
@@ -58,6 +58,8 @@ | |||
58 | #include <asm/pgtable.h> | 58 | #include <asm/pgtable.h> |
59 | #include <asm/io.h> | 59 | #include <asm/io.h> |
60 | #include <asm/div64.h> | 60 | #include <asm/div64.h> |
61 | #include <linux/video_decoder.h> | ||
62 | #include <media/v4l2-common.h> | ||
61 | 63 | ||
62 | #ifdef CONFIG_KMOD | 64 | #ifdef CONFIG_KMOD |
63 | #include <linux/kmod.h> | 65 | #include <linux/kmod.h> |
@@ -190,55 +192,174 @@ char *v4l2_type_names[] = { | |||
190 | [V4L2_BUF_TYPE_VBI_OUTPUT] = "vbi-out", | 192 | [V4L2_BUF_TYPE_VBI_OUTPUT] = "vbi-out", |
191 | }; | 193 | }; |
192 | 194 | ||
193 | char *v4l2_ioctl_names[256] = { | 195 | /* ------------------------------------------------------------------ */ |
194 | [0 ... 255] = "UNKNOWN", | 196 | /* debug help functions */ |
195 | [_IOC_NR(VIDIOC_QUERYCAP)] = "VIDIOC_QUERYCAP", | 197 | |
196 | [_IOC_NR(VIDIOC_RESERVED)] = "VIDIOC_RESERVED", | 198 | #ifdef HAVE_V4L1 |
197 | [_IOC_NR(VIDIOC_ENUM_FMT)] = "VIDIOC_ENUM_FMT", | 199 | static const char *v4l1_ioctls[] = { |
198 | [_IOC_NR(VIDIOC_G_FMT)] = "VIDIOC_G_FMT", | 200 | [_IOC_NR(VIDIOCGCAP)] = "VIDIOCGCAP", |
199 | [_IOC_NR(VIDIOC_S_FMT)] = "VIDIOC_S_FMT", | 201 | [_IOC_NR(VIDIOCGCHAN)] = "VIDIOCGCHAN", |
200 | [_IOC_NR(VIDIOC_REQBUFS)] = "VIDIOC_REQBUFS", | 202 | [_IOC_NR(VIDIOCSCHAN)] = "VIDIOCSCHAN", |
201 | [_IOC_NR(VIDIOC_QUERYBUF)] = "VIDIOC_QUERYBUF", | 203 | [_IOC_NR(VIDIOCGTUNER)] = "VIDIOCGTUNER", |
202 | [_IOC_NR(VIDIOC_G_FBUF)] = "VIDIOC_G_FBUF", | 204 | [_IOC_NR(VIDIOCSTUNER)] = "VIDIOCSTUNER", |
203 | [_IOC_NR(VIDIOC_S_FBUF)] = "VIDIOC_S_FBUF", | 205 | [_IOC_NR(VIDIOCGPICT)] = "VIDIOCGPICT", |
204 | [_IOC_NR(VIDIOC_OVERLAY)] = "VIDIOC_OVERLAY", | 206 | [_IOC_NR(VIDIOCSPICT)] = "VIDIOCSPICT", |
205 | [_IOC_NR(VIDIOC_QBUF)] = "VIDIOC_QBUF", | 207 | [_IOC_NR(VIDIOCCAPTURE)] = "VIDIOCCAPTURE", |
206 | [_IOC_NR(VIDIOC_DQBUF)] = "VIDIOC_DQBUF", | 208 | [_IOC_NR(VIDIOCGWIN)] = "VIDIOCGWIN", |
207 | [_IOC_NR(VIDIOC_STREAMON)] = "VIDIOC_STREAMON", | 209 | [_IOC_NR(VIDIOCSWIN)] = "VIDIOCSWIN", |
208 | [_IOC_NR(VIDIOC_STREAMOFF)] = "VIDIOC_STREAMOFF", | 210 | [_IOC_NR(VIDIOCGFBUF)] = "VIDIOCGFBUF", |
209 | [_IOC_NR(VIDIOC_G_PARM)] = "VIDIOC_G_PARM", | 211 | [_IOC_NR(VIDIOCSFBUF)] = "VIDIOCSFBUF", |
210 | [_IOC_NR(VIDIOC_S_PARM)] = "VIDIOC_S_PARM", | 212 | [_IOC_NR(VIDIOCKEY)] = "VIDIOCKEY", |
211 | [_IOC_NR(VIDIOC_G_STD)] = "VIDIOC_G_STD", | 213 | [_IOC_NR(VIDIOCGFREQ)] = "VIDIOCGFREQ", |
212 | [_IOC_NR(VIDIOC_S_STD)] = "VIDIOC_S_STD", | 214 | [_IOC_NR(VIDIOCSFREQ)] = "VIDIOCSFREQ", |
213 | [_IOC_NR(VIDIOC_ENUMSTD)] = "VIDIOC_ENUMSTD", | 215 | [_IOC_NR(VIDIOCGAUDIO)] = "VIDIOCGAUDIO", |
214 | [_IOC_NR(VIDIOC_ENUMINPUT)] = "VIDIOC_ENUMINPUT", | 216 | [_IOC_NR(VIDIOCSAUDIO)] = "VIDIOCSAUDIO", |
215 | [_IOC_NR(VIDIOC_G_CTRL)] = "VIDIOC_G_CTRL", | 217 | [_IOC_NR(VIDIOCSYNC)] = "VIDIOCSYNC", |
216 | [_IOC_NR(VIDIOC_S_CTRL)] = "VIDIOC_S_CTRL", | 218 | [_IOC_NR(VIDIOCMCAPTURE)] = "VIDIOCMCAPTURE", |
217 | [_IOC_NR(VIDIOC_G_TUNER)] = "VIDIOC_G_TUNER", | 219 | [_IOC_NR(VIDIOCGMBUF)] = "VIDIOCGMBUF", |
218 | [_IOC_NR(VIDIOC_S_TUNER)] = "VIDIOC_S_TUNER", | 220 | [_IOC_NR(VIDIOCGUNIT)] = "VIDIOCGUNIT", |
219 | [_IOC_NR(VIDIOC_G_AUDIO)] = "VIDIOC_G_AUDIO", | 221 | [_IOC_NR(VIDIOCGCAPTURE)] = "VIDIOCGCAPTURE", |
220 | [_IOC_NR(VIDIOC_S_AUDIO)] = "VIDIOC_S_AUDIO", | 222 | [_IOC_NR(VIDIOCSCAPTURE)] = "VIDIOCSCAPTURE", |
221 | [_IOC_NR(VIDIOC_QUERYCTRL)] = "VIDIOC_QUERYCTRL", | 223 | [_IOC_NR(VIDIOCSPLAYMODE)] = "VIDIOCSPLAYMODE", |
222 | [_IOC_NR(VIDIOC_QUERYMENU)] = "VIDIOC_QUERYMENU", | 224 | [_IOC_NR(VIDIOCSWRITEMODE)] = "VIDIOCSWRITEMODE", |
223 | [_IOC_NR(VIDIOC_G_INPUT)] = "VIDIOC_G_INPUT", | 225 | [_IOC_NR(VIDIOCGPLAYINFO)] = "VIDIOCGPLAYINFO", |
224 | [_IOC_NR(VIDIOC_S_INPUT)] = "VIDIOC_S_INPUT", | 226 | [_IOC_NR(VIDIOCSMICROCODE)] = "VIDIOCSMICROCODE", |
225 | [_IOC_NR(VIDIOC_G_OUTPUT)] = "VIDIOC_G_OUTPUT", | 227 | [_IOC_NR(VIDIOCGVBIFMT)] = "VIDIOCGVBIFMT", |
226 | [_IOC_NR(VIDIOC_S_OUTPUT)] = "VIDIOC_S_OUTPUT", | 228 | [_IOC_NR(VIDIOCSVBIFMT)] = "VIDIOCSVBIFMT" |
227 | [_IOC_NR(VIDIOC_ENUMOUTPUT)] = "VIDIOC_ENUMOUTPUT", | ||
228 | [_IOC_NR(VIDIOC_G_AUDOUT)] = "VIDIOC_G_AUDOUT", | ||
229 | [_IOC_NR(VIDIOC_S_AUDOUT)] = "VIDIOC_S_AUDOUT", | ||
230 | [_IOC_NR(VIDIOC_G_MODULATOR)] = "VIDIOC_G_MODULATOR", | ||
231 | [_IOC_NR(VIDIOC_S_MODULATOR)] = "VIDIOC_S_MODULATOR", | ||
232 | [_IOC_NR(VIDIOC_G_FREQUENCY)] = "VIDIOC_G_FREQUENCY", | ||
233 | [_IOC_NR(VIDIOC_S_FREQUENCY)] = "VIDIOC_S_FREQUENCY", | ||
234 | [_IOC_NR(VIDIOC_CROPCAP)] = "VIDIOC_CROPCAP", | ||
235 | [_IOC_NR(VIDIOC_G_CROP)] = "VIDIOC_G_CROP", | ||
236 | [_IOC_NR(VIDIOC_S_CROP)] = "VIDIOC_S_CROP", | ||
237 | [_IOC_NR(VIDIOC_G_JPEGCOMP)] = "VIDIOC_G_JPEGCOMP", | ||
238 | [_IOC_NR(VIDIOC_S_JPEGCOMP)] = "VIDIOC_S_JPEGCOMP", | ||
239 | [_IOC_NR(VIDIOC_QUERYSTD)] = "VIDIOC_QUERYSTD", | ||
240 | [_IOC_NR(VIDIOC_TRY_FMT)] = "VIDIOC_TRY_FMT", | ||
241 | }; | 229 | }; |
230 | #define V4L1_IOCTLS ARRAY_SIZE(v4l1_ioctls) | ||
231 | #endif | ||
232 | |||
233 | static const char *v4l2_ioctls[] = { | ||
234 | [_IOC_NR(VIDIOC_QUERYCAP)] = "VIDIOC_QUERYCAP", | ||
235 | [_IOC_NR(VIDIOC_RESERVED)] = "VIDIOC_RESERVED", | ||
236 | [_IOC_NR(VIDIOC_ENUM_FMT)] = "VIDIOC_ENUM_FMT", | ||
237 | [_IOC_NR(VIDIOC_G_FMT)] = "VIDIOC_G_FMT", | ||
238 | [_IOC_NR(VIDIOC_S_FMT)] = "VIDIOC_S_FMT", | ||
239 | [_IOC_NR(VIDIOC_G_MPEGCOMP)] = "VIDIOC_G_MPEGCOMP", | ||
240 | [_IOC_NR(VIDIOC_S_MPEGCOMP)] = "VIDIOC_S_MPEGCOMP", | ||
241 | [_IOC_NR(VIDIOC_REQBUFS)] = "VIDIOC_REQBUFS", | ||
242 | [_IOC_NR(VIDIOC_QUERYBUF)] = "VIDIOC_QUERYBUF", | ||
243 | [_IOC_NR(VIDIOC_G_FBUF)] = "VIDIOC_G_FBUF", | ||
244 | [_IOC_NR(VIDIOC_S_FBUF)] = "VIDIOC_S_FBUF", | ||
245 | [_IOC_NR(VIDIOC_OVERLAY)] = "VIDIOC_OVERLAY", | ||
246 | [_IOC_NR(VIDIOC_QBUF)] = "VIDIOC_QBUF", | ||
247 | [_IOC_NR(VIDIOC_DQBUF)] = "VIDIOC_DQBUF", | ||
248 | [_IOC_NR(VIDIOC_STREAMON)] = "VIDIOC_STREAMON", | ||
249 | [_IOC_NR(VIDIOC_STREAMOFF)] = "VIDIOC_STREAMOFF", | ||
250 | [_IOC_NR(VIDIOC_G_PARM)] = "VIDIOC_G_PARM", | ||
251 | [_IOC_NR(VIDIOC_S_PARM)] = "VIDIOC_S_PARM", | ||
252 | [_IOC_NR(VIDIOC_G_STD)] = "VIDIOC_G_STD", | ||
253 | [_IOC_NR(VIDIOC_S_STD)] = "VIDIOC_S_STD", | ||
254 | [_IOC_NR(VIDIOC_ENUMSTD)] = "VIDIOC_ENUMSTD", | ||
255 | [_IOC_NR(VIDIOC_ENUMINPUT)] = "VIDIOC_ENUMINPUT", | ||
256 | [_IOC_NR(VIDIOC_G_CTRL)] = "VIDIOC_G_CTRL", | ||
257 | [_IOC_NR(VIDIOC_S_CTRL)] = "VIDIOC_S_CTRL", | ||
258 | [_IOC_NR(VIDIOC_G_TUNER)] = "VIDIOC_G_TUNER", | ||
259 | [_IOC_NR(VIDIOC_S_TUNER)] = "VIDIOC_S_TUNER", | ||
260 | [_IOC_NR(VIDIOC_G_AUDIO)] = "VIDIOC_G_AUDIO", | ||
261 | [_IOC_NR(VIDIOC_S_AUDIO)] = "VIDIOC_S_AUDIO", | ||
262 | [_IOC_NR(VIDIOC_QUERYCTRL)] = "VIDIOC_QUERYCTRL", | ||
263 | [_IOC_NR(VIDIOC_QUERYMENU)] = "VIDIOC_QUERYMENU", | ||
264 | [_IOC_NR(VIDIOC_G_INPUT)] = "VIDIOC_G_INPUT", | ||
265 | [_IOC_NR(VIDIOC_S_INPUT)] = "VIDIOC_S_INPUT", | ||
266 | [_IOC_NR(VIDIOC_G_OUTPUT)] = "VIDIOC_G_OUTPUT", | ||
267 | [_IOC_NR(VIDIOC_S_OUTPUT)] = "VIDIOC_S_OUTPUT", | ||
268 | [_IOC_NR(VIDIOC_ENUMOUTPUT)] = "VIDIOC_ENUMOUTPUT", | ||
269 | [_IOC_NR(VIDIOC_G_AUDOUT)] = "VIDIOC_G_AUDOUT", | ||
270 | [_IOC_NR(VIDIOC_S_AUDOUT)] = "VIDIOC_S_AUDOUT", | ||
271 | [_IOC_NR(VIDIOC_G_MODULATOR)] = "VIDIOC_G_MODULATOR", | ||
272 | [_IOC_NR(VIDIOC_S_MODULATOR)] = "VIDIOC_S_MODULATOR", | ||
273 | [_IOC_NR(VIDIOC_G_FREQUENCY)] = "VIDIOC_G_FREQUENCY", | ||
274 | [_IOC_NR(VIDIOC_S_FREQUENCY)] = "VIDIOC_S_FREQUENCY", | ||
275 | [_IOC_NR(VIDIOC_CROPCAP)] = "VIDIOC_CROPCAP", | ||
276 | [_IOC_NR(VIDIOC_G_CROP)] = "VIDIOC_G_CROP", | ||
277 | [_IOC_NR(VIDIOC_S_CROP)] = "VIDIOC_S_CROP", | ||
278 | [_IOC_NR(VIDIOC_G_JPEGCOMP)] = "VIDIOC_G_JPEGCOMP", | ||
279 | [_IOC_NR(VIDIOC_S_JPEGCOMP)] = "VIDIOC_S_JPEGCOMP", | ||
280 | [_IOC_NR(VIDIOC_QUERYSTD)] = "VIDIOC_QUERYSTD", | ||
281 | [_IOC_NR(VIDIOC_TRY_FMT)] = "VIDIOC_TRY_FMT", | ||
282 | [_IOC_NR(VIDIOC_ENUMAUDIO)] = "VIDIOC_ENUMAUDIO", | ||
283 | [_IOC_NR(VIDIOC_ENUMAUDOUT)] = "VIDIOC_ENUMAUDOUT", | ||
284 | [_IOC_NR(VIDIOC_G_PRIORITY)] = "VIDIOC_G_PRIORITY", | ||
285 | [_IOC_NR(VIDIOC_S_PRIORITY)] = "VIDIOC_S_PRIORITY", | ||
286 | #if 1 | ||
287 | [_IOC_NR(VIDIOC_G_SLICED_VBI_CAP)] = "VIDIOC_G_SLICED_VBI_CAP", | ||
288 | #endif | ||
289 | [_IOC_NR(VIDIOC_LOG_STATUS)] = "VIDIOC_LOG_STATUS" | ||
290 | }; | ||
291 | #define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls) | ||
292 | |||
293 | static const char *v4l2_int_ioctls[] = { | ||
294 | #ifdef HAVE_VIDEO_DECODER | ||
295 | [_IOC_NR(DECODER_GET_CAPABILITIES)] = "DECODER_GET_CAPABILITIES", | ||
296 | [_IOC_NR(DECODER_GET_STATUS)] = "DECODER_GET_STATUS", | ||
297 | [_IOC_NR(DECODER_SET_NORM)] = "DECODER_SET_NORM", | ||
298 | [_IOC_NR(DECODER_SET_INPUT)] = "DECODER_SET_INPUT", | ||
299 | [_IOC_NR(DECODER_SET_OUTPUT)] = "DECODER_SET_OUTPUT", | ||
300 | [_IOC_NR(DECODER_ENABLE_OUTPUT)] = "DECODER_ENABLE_OUTPUT", | ||
301 | [_IOC_NR(DECODER_SET_PICTURE)] = "DECODER_SET_PICTURE", | ||
302 | [_IOC_NR(DECODER_SET_GPIO)] = "DECODER_SET_GPIO", | ||
303 | [_IOC_NR(DECODER_INIT)] = "DECODER_INIT", | ||
304 | [_IOC_NR(DECODER_SET_VBI_BYPASS)] = "DECODER_SET_VBI_BYPASS", | ||
305 | [_IOC_NR(DECODER_DUMP)] = "DECODER_DUMP", | ||
306 | #endif | ||
307 | [_IOC_NR(AUDC_SET_RADIO)] = "AUDC_SET_RADIO", | ||
308 | [_IOC_NR(AUDC_SET_INPUT)] = "AUDC_SET_INPUT", | ||
309 | |||
310 | [_IOC_NR(TUNER_SET_TYPE_ADDR)] = "TUNER_SET_TYPE_ADDR", | ||
311 | [_IOC_NR(TUNER_SET_STANDBY)] = "TUNER_SET_STANDBY", | ||
312 | [_IOC_NR(TDA9887_SET_CONFIG)] = "TDA9887_SET_CONFIG", | ||
313 | |||
314 | [_IOC_NR(VIDIOC_INT_S_REGISTER)] = "VIDIOC_INT_S_REGISTER", | ||
315 | [_IOC_NR(VIDIOC_INT_G_REGISTER)] = "VIDIOC_INT_G_REGISTER", | ||
316 | [_IOC_NR(VIDIOC_INT_RESET)] = "VIDIOC_INT_RESET", | ||
317 | [_IOC_NR(VIDIOC_INT_AUDIO_CLOCK_FREQ)] = "VIDIOC_INT_AUDIO_CLOCK_FREQ", | ||
318 | [_IOC_NR(VIDIOC_INT_DECODE_VBI_LINE)] = "VIDIOC_INT_DECODE_VBI_LINE", | ||
319 | [_IOC_NR(VIDIOC_INT_S_VBI_DATA)] = "VIDIOC_INT_S_VBI_DATA", | ||
320 | [_IOC_NR(VIDIOC_INT_G_VBI_DATA)] = "VIDIOC_INT_G_VBI_DATA", | ||
321 | [_IOC_NR(VIDIOC_INT_G_CHIP_IDENT)] = "VIDIOC_INT_G_CHIP_IDENT", | ||
322 | [_IOC_NR(VIDIOC_INT_I2S_CLOCK_FREQ)] = "VIDIOC_INT_I2S_CLOCK_FREQ" | ||
323 | }; | ||
324 | #define V4L2_INT_IOCTLS ARRAY_SIZE(v4l2_int_ioctls) | ||
325 | |||
326 | /* Common ioctl debug function. This function can be used by | ||
327 | external ioctl messages as well as internal V4L ioctl */ | ||
328 | void v4l_printk_ioctl(unsigned int cmd) | ||
329 | { | ||
330 | char *dir; | ||
331 | |||
332 | switch (_IOC_DIR(cmd)) { | ||
333 | case _IOC_NONE: dir = "--"; break; | ||
334 | case _IOC_READ: dir = "r-"; break; | ||
335 | case _IOC_WRITE: dir = "-w"; break; | ||
336 | case _IOC_READ | _IOC_WRITE: dir = "rw"; break; | ||
337 | default: dir = "*ERR*"; break; | ||
338 | } | ||
339 | switch (_IOC_TYPE(cmd)) { | ||
340 | case 'd': | ||
341 | printk("v4l2_int ioctl %s, dir=%s (0x%08x)\n", | ||
342 | (_IOC_NR(cmd) < V4L2_INT_IOCTLS) ? | ||
343 | v4l2_int_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd); | ||
344 | break; | ||
345 | #ifdef HAVE_V4L1 | ||
346 | case 'v': | ||
347 | printk("v4l1 ioctl %s, dir=%s (0x%08x)\n", | ||
348 | (_IOC_NR(cmd) < V4L1_IOCTLS) ? | ||
349 | v4l1_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd); | ||
350 | break; | ||
351 | #endif | ||
352 | case 'V': | ||
353 | printk("v4l2 ioctl %s, dir=%s (0x%08x)\n", | ||
354 | (_IOC_NR(cmd) < V4L2_IOCTLS) ? | ||
355 | v4l2_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd); | ||
356 | break; | ||
357 | |||
358 | default: | ||
359 | printk("unknown ioctl '%c', dir=%s, #%d (0x%08x)\n", | ||
360 | _IOC_TYPE(cmd), dir, _IOC_NR(cmd), cmd); | ||
361 | } | ||
362 | } | ||
242 | 363 | ||
243 | /* ----------------------------------------------------------------- */ | 364 | /* ----------------------------------------------------------------- */ |
244 | 365 | ||
@@ -253,7 +374,7 @@ EXPORT_SYMBOL(v4l2_prio_check); | |||
253 | 374 | ||
254 | EXPORT_SYMBOL(v4l2_field_names); | 375 | EXPORT_SYMBOL(v4l2_field_names); |
255 | EXPORT_SYMBOL(v4l2_type_names); | 376 | EXPORT_SYMBOL(v4l2_type_names); |
256 | EXPORT_SYMBOL(v4l2_ioctl_names); | 377 | EXPORT_SYMBOL(v4l_printk_ioctl); |
257 | 378 | ||
258 | /* | 379 | /* |
259 | * Local variables: | 380 | * Local variables: |