aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@m1k.net>2006-01-09 12:32:31 -0500
committerMauro Carvalho Chehab <mchehab@brturbo.com.br>2006-01-09 12:32:31 -0500
commit5e453dc757385ec892a818e4e3b5de027987ced9 (patch)
treec6e5c4ffeb7557c6f3861f39cb4d28532dc3fe39
parent37bdfa06b6bbf085b55d64eb5d9ed112418ed5ad (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>
-rw-r--r--drivers/media/video/bttv-cards.c1
-rw-r--r--drivers/media/video/bttv-driver.c28
-rw-r--r--drivers/media/video/bttv-i2c.c1
-rw-r--r--drivers/media/video/cx88/cx88-blackbird.c3
-rw-r--r--drivers/media/video/cx88/cx88-core.c56
-rw-r--r--drivers/media/video/cx88/cx88-dvb.c1
-rw-r--r--drivers/media/video/cx88/cx88-i2c.c1
-rw-r--r--drivers/media/video/cx88/cx88-video.c7
-rw-r--r--drivers/media/video/cx88/cx88.h1
-rw-r--r--drivers/media/video/em28xx/em28xx-core.c53
-rw-r--r--drivers/media/video/em28xx/em28xx-i2c.c1
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c2
-rw-r--r--drivers/media/video/em28xx/em28xx.h2
-rw-r--r--drivers/media/video/mxb.c1
-rw-r--r--drivers/media/video/saa7134/saa7134-cards.c1
-rw-r--r--drivers/media/video/saa7134/saa7134-core.c72
-rw-r--r--drivers/media/video/saa7134/saa7134-dvb.c1
-rw-r--r--drivers/media/video/saa7134/saa7134-empress.c3
-rw-r--r--drivers/media/video/saa7134/saa7134-i2c.c1
-rw-r--r--drivers/media/video/saa7134/saa7134-oss.c40
-rw-r--r--drivers/media/video/saa7134/saa7134-video.c5
-rw-r--r--drivers/media/video/saa7134/saa7134.h1
-rw-r--r--drivers/media/video/tda9887.c2
-rw-r--r--drivers/media/video/tuner-core.c12
-rw-r--r--drivers/media/video/tvaudio.c1
-rw-r--r--drivers/media/video/v4l2-common.c219
-rw-r--r--include/linux/video_decoder.h2
-rw-r--r--include/linux/videodev2.h1
-rw-r--r--include/media/audiochip.h5
-rw-r--r--include/media/tuner.h4
-rw-r--r--include/media/v4l2-common.h25
31 files changed, 267 insertions, 286 deletions
diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c
index 440f635e020f..1621ab133d23 100644
--- a/drivers/media/video/bttv-cards.c
+++ b/drivers/media/video/bttv-cards.c
@@ -38,6 +38,7 @@
38#include <asm/io.h> 38#include <asm/io.h>
39 39
40#include "bttvp.h" 40#include "bttvp.h"
41#include <media/v4l2-common.h>
41 42
42/* fwd decl */ 43/* fwd decl */
43static void boot_msp34xx(struct bttv *btv, int pin); 44static void boot_msp34xx(struct bttv *btv, int pin);
diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c
index 69a147b85f1a..f3de85251719 100644
--- a/drivers/media/video/bttv-driver.c
+++ b/drivers/media/video/bttv-driver.c
@@ -35,6 +35,7 @@
35#include <linux/interrupt.h> 35#include <linux/interrupt.h>
36#include <linux/kdev_t.h> 36#include <linux/kdev_t.h>
37#include "bttvp.h" 37#include "bttvp.h"
38#include <media/v4l2-common.h>
38 39
39#include <linux/dma-mapping.h> 40#include <linux/dma-mapping.h>
40 41
@@ -1520,14 +1521,6 @@ static struct videobuf_queue_ops bttv_video_qops = {
1520 .buf_release = buffer_release, 1521 .buf_release = buffer_release,
1521}; 1522};
1522 1523
1523static const char *v4l1_ioctls[] = {
1524 "?", "CGAP", "GCHAN", "SCHAN", "GTUNER", "STUNER", "GPICT", "SPICT",
1525 "CCAPTURE", "GWIN", "SWIN", "GFBUF", "SFBUF", "KEY", "GFREQ",
1526 "SFREQ", "GAUDIO", "SAUDIO", "SYNC", "MCAPTURE", "GMBUF", "GUNIT",
1527 "GCAPTURE", "SCAPTURE", "SPLAYMODE", "SWRITEMODE", "GPLAYINFO",
1528 "SMICROCODE", "GVBIFMT", "SVBIFMT" };
1529#define V4L1_IOCTLS ARRAY_SIZE(v4l1_ioctls)
1530
1531static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) 1524static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1532{ 1525{
1533 switch (cmd) { 1526 switch (cmd) {
@@ -2216,22 +2209,9 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
2216 unsigned long flags; 2209 unsigned long flags;
2217 int retval = 0; 2210 int retval = 0;
2218 2211
2219 if (bttv_debug > 1) { 2212 if (bttv_debug > 1)
2220 switch (_IOC_TYPE(cmd)) { 2213 v4l_print_ioctl(btv->c.name, cmd);
2221 case 'v': 2214
2222 printk("bttv%d: ioctl 0x%x (v4l1, VIDIOC%s)\n",
2223 btv->c.nr, cmd, (_IOC_NR(cmd) < V4L1_IOCTLS) ?
2224 v4l1_ioctls[_IOC_NR(cmd)] : "???");
2225 break;
2226 case 'V':
2227 printk("bttv%d: ioctl 0x%x (v4l2, %s)\n",
2228 btv->c.nr, cmd, v4l2_ioctl_names[_IOC_NR(cmd)]);
2229 break;
2230 default:
2231 printk("bttv%d: ioctl 0x%x (???)\n",
2232 btv->c.nr, cmd);
2233 }
2234 }
2235 if (btv->errors) 2215 if (btv->errors)
2236 bttv_reinit_bt848(btv); 2216 bttv_reinit_bt848(btv);
2237 2217
diff --git a/drivers/media/video/bttv-i2c.c b/drivers/media/video/bttv-i2c.c
index a8873f48c808..fd66d386fa7d 100644
--- a/drivers/media/video/bttv-i2c.c
+++ b/drivers/media/video/bttv-i2c.c
@@ -30,6 +30,7 @@
30#include <linux/delay.h> 30#include <linux/delay.h>
31 31
32#include "bttvp.h" 32#include "bttvp.h"
33#include <media/v4l2-common.h>
33#include <linux/jiffies.h> 34#include <linux/jiffies.h>
34#include <asm/io.h> 35#include <asm/io.h>
35 36
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c
index 5a7f940565cc..a49062119313 100644
--- a/drivers/media/video/cx88/cx88-blackbird.c
+++ b/drivers/media/video/cx88/cx88-blackbird.c
@@ -32,6 +32,7 @@
32#include <linux/firmware.h> 32#include <linux/firmware.h>
33 33
34#include "cx88.h" 34#include "cx88.h"
35#include <media/v4l2-common.h>
35 36
36MODULE_DESCRIPTION("driver for cx2388x/cx23416 based mpeg encoder cards"); 37MODULE_DESCRIPTION("driver for cx2388x/cx23416 based mpeg encoder cards");
37MODULE_AUTHOR("Jelle Foks <jelle@foks.8m.com>, Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); 38MODULE_AUTHOR("Jelle Foks <jelle@foks.8m.com>, Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
@@ -1374,7 +1375,7 @@ static int mpeg_do_ioctl(struct inode *inode, struct file *file,
1374 struct cx88_core *core = dev->core; 1375 struct cx88_core *core = dev->core;
1375 1376
1376 if (debug > 1) 1377 if (debug > 1)
1377 cx88_print_ioctl(core->name,cmd); 1378 v4l_print_ioctl(core->name,cmd);
1378 1379
1379 switch (cmd) { 1380 switch (cmd) {
1380 1381
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c
index bb6eb54e19ce..fc814d198694 100644
--- a/drivers/media/video/cx88/cx88-core.c
+++ b/drivers/media/video/cx88/cx88-core.c
@@ -34,6 +34,7 @@
34#include <linux/videodev2.h> 34#include <linux/videodev2.h>
35 35
36#include "cx88.h" 36#include "cx88.h"
37#include <media/v4l2-common.h>
37 38
38MODULE_DESCRIPTION("v4l2 driver module for cx2388x based TV cards"); 39MODULE_DESCRIPTION("v4l2 driver module for cx2388x based TV cards");
39MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); 40MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
@@ -76,60 +77,6 @@ static unsigned int cx88_devcount;
76static LIST_HEAD(cx88_devlist); 77static LIST_HEAD(cx88_devlist);
77static DECLARE_MUTEX(devlist); 78static DECLARE_MUTEX(devlist);
78 79
79/* ------------------------------------------------------------------ */
80/* debug help functions */
81
82static const char *v4l1_ioctls[] = {
83 "0", "CGAP", "GCHAN", "SCHAN", "GTUNER", "STUNER", "GPICT", "SPICT",
84 "CCAPTURE", "GWIN", "SWIN", "GFBUF", "SFBUF", "KEY", "GFREQ",
85 "SFREQ", "GAUDIO", "SAUDIO", "SYNC", "MCAPTURE", "GMBUF", "GUNIT",
86 "GCAPTURE", "SCAPTURE", "SPLAYMODE", "SWRITEMODE", "GPLAYINFO",
87 "SMICROCODE", "GVBIFMT", "SVBIFMT" };
88#define V4L1_IOCTLS ARRAY_SIZE(v4l1_ioctls)
89
90static const char *v4l2_ioctls[] = {
91 "QUERYCAP", "1", "ENUM_PIXFMT", "ENUM_FBUFFMT", "G_FMT", "S_FMT",
92 "G_COMP", "S_COMP", "REQBUFS", "QUERYBUF", "G_FBUF", "S_FBUF",
93 "G_WIN", "S_WIN", "PREVIEW", "QBUF", "16", "DQBUF", "STREAMON",
94 "STREAMOFF", "G_PERF", "G_PARM", "S_PARM", "G_STD", "S_STD",
95 "ENUMSTD", "ENUMINPUT", "G_CTRL", "S_CTRL", "G_TUNER", "S_TUNER",
96 "G_FREQ", "S_FREQ", "G_AUDIO", "S_AUDIO", "35", "QUERYCTRL",
97 "QUERYMENU", "G_INPUT", "S_INPUT", "ENUMCVT", "41", "42", "43",
98 "44", "45", "G_OUTPUT", "S_OUTPUT", "ENUMOUTPUT", "G_AUDOUT",
99 "S_AUDOUT", "ENUMFX", "G_EFFECT", "S_EFFECT", "G_MODULATOR",
100 "S_MODULATOR"
101};
102#define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls)
103
104void cx88_print_ioctl(char *name, unsigned int cmd)
105{
106 char *dir;
107
108 switch (_IOC_DIR(cmd)) {
109 case _IOC_NONE: dir = "--"; break;
110 case _IOC_READ: dir = "r-"; break;
111 case _IOC_WRITE: dir = "-w"; break;
112 case _IOC_READ | _IOC_WRITE: dir = "rw"; break;
113 default: dir = "??"; break;
114 }
115 switch (_IOC_TYPE(cmd)) {
116 case 'v':
117 printk(KERN_DEBUG "%s: ioctl 0x%08x (v4l1, %s, VIDIOC%s)\n",
118 name, cmd, dir, (_IOC_NR(cmd) < V4L1_IOCTLS) ?
119 v4l1_ioctls[_IOC_NR(cmd)] : "???");
120 break;
121 case 'V':
122 printk(KERN_DEBUG "%s: ioctl 0x%08x (v4l2, %s, VIDIOC_%s)\n",
123 name, cmd, dir, (_IOC_NR(cmd) < V4L2_IOCTLS) ?
124 v4l2_ioctls[_IOC_NR(cmd)] : "???");
125 break;
126 default:
127 printk(KERN_DEBUG "%s: ioctl 0x%08x (???, %s, #%d)\n",
128 name, cmd, dir, _IOC_NR(cmd));
129 }
130}
131
132/* ------------------------------------------------------------------ */
133#define NO_SYNC_LINE (-1U) 80#define NO_SYNC_LINE (-1U)
134 81
135static u32* cx88_risc_field(u32 *rp, struct scatterlist *sglist, 82static u32* cx88_risc_field(u32 *rp, struct scatterlist *sglist,
@@ -1208,7 +1155,6 @@ void cx88_core_put(struct cx88_core *core, struct pci_dev *pci)
1208 1155
1209/* ------------------------------------------------------------------ */ 1156/* ------------------------------------------------------------------ */
1210 1157
1211EXPORT_SYMBOL(cx88_print_ioctl);
1212EXPORT_SYMBOL(cx88_print_irqbits); 1158EXPORT_SYMBOL(cx88_print_irqbits);
1213 1159
1214EXPORT_SYMBOL(cx88_core_irq); 1160EXPORT_SYMBOL(cx88_core_irq);
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c
index 201050478711..c63f20fdff48 100644
--- a/drivers/media/video/cx88/cx88-dvb.c
+++ b/drivers/media/video/cx88/cx88-dvb.c
@@ -31,6 +31,7 @@
31 31
32#include "cx88.h" 32#include "cx88.h"
33#include "dvb-pll.h" 33#include "dvb-pll.h"
34#include <media/v4l2-common.h>
34 35
35#ifdef HAVE_MT352 36#ifdef HAVE_MT352
36# include "mt352.h" 37# include "mt352.h"
diff --git a/drivers/media/video/cx88/cx88-i2c.c b/drivers/media/video/cx88/cx88-i2c.c
index c6492089ee1a..f720901e9638 100644
--- a/drivers/media/video/cx88/cx88-i2c.c
+++ b/drivers/media/video/cx88/cx88-i2c.c
@@ -30,6 +30,7 @@
30#include <asm/io.h> 30#include <asm/io.h>
31 31
32#include "cx88.h" 32#include "cx88.h"
33#include <media/v4l2-common.h>
33 34
34static unsigned int i2c_debug = 0; 35static unsigned int i2c_debug = 0;
35module_param(i2c_debug, int, 0644); 36module_param(i2c_debug, int, 0644);
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index b76abb9b8961..9a02515fe18b 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -33,6 +33,7 @@
33#include <asm/div64.h> 33#include <asm/div64.h>
34 34
35#include "cx88.h" 35#include "cx88.h"
36#include <media/v4l2-common.h>
36 37
37/* Include V4L1 specific functions. Should be removed soon */ 38/* Include V4L1 specific functions. Should be removed soon */
38#include <linux/videodev.h> 39#include <linux/videodev.h>
@@ -1118,7 +1119,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
1118 int err; 1119 int err;
1119 1120
1120 if (video_debug > 1) 1121 if (video_debug > 1)
1121 cx88_print_ioctl(core->name,cmd); 1122 v4l_print_ioctl(core->name,cmd);
1122 switch (cmd) { 1123 switch (cmd) {
1123 1124
1124 /* --- capabilities ------------------------------------------ */ 1125 /* --- capabilities ------------------------------------------ */
@@ -1254,7 +1255,7 @@ int cx88_do_ioctl(struct inode *inode, struct file *file, int radio,
1254 1255
1255 dprintk( 1, "CORE IOCTL: 0x%x\n", cmd ); 1256 dprintk( 1, "CORE IOCTL: 0x%x\n", cmd );
1256 if (video_debug > 1) 1257 if (video_debug > 1)
1257 cx88_print_ioctl(core->name,cmd); 1258 v4l_print_ioctl(core->name,cmd);
1258 1259
1259 switch (cmd) { 1260 switch (cmd) {
1260 /* ---------- tv norms ---------- */ 1261 /* ---------- tv norms ---------- */
@@ -1474,7 +1475,7 @@ static int radio_do_ioctl(struct inode *inode, struct file *file,
1474 struct cx88_core *core = dev->core; 1475 struct cx88_core *core = dev->core;
1475 1476
1476 if (video_debug > 1) 1477 if (video_debug > 1)
1477 cx88_print_ioctl(core->name,cmd); 1478 v4l_print_ioctl(core->name,cmd);
1478 1479
1479 switch (cmd) { 1480 switch (cmd) {
1480 case VIDIOC_QUERYCAP: 1481 case VIDIOC_QUERYCAP:
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index 6d370d1b333f..022ef13c45bc 100644
--- a/drivers/media/video/cx88/cx88.h
+++ b/drivers/media/video/cx88/cx88.h
@@ -461,7 +461,6 @@ struct cx8802_dev {
461 461
462extern void cx88_print_irqbits(char *name, char *tag, char **strings, 462extern void cx88_print_irqbits(char *name, char *tag, char **strings,
463 u32 bits, u32 mask); 463 u32 bits, u32 mask);
464extern void cx88_print_ioctl(char *name, unsigned int cmd);
465 464
466extern int cx88_core_irq(struct cx88_core *core, u32 status); 465extern int cx88_core_irq(struct cx88_core *core, u32 status);
467extern void cx88_wakeup(struct cx88_core *core, 466extern void cx88_wakeup(struct cx88_core *core,
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c
index c0db0e9d2cea..dff3893f32fd 100644
--- a/drivers/media/video/em28xx/em28xx-core.c
+++ b/drivers/media/video/em28xx/em28xx-core.c
@@ -63,59 +63,6 @@ static int alt = EM28XX_PINOUT;
63module_param(alt, int, 0644); 63module_param(alt, int, 0644);
64MODULE_PARM_DESC(alt, "alternate setting to use for video endpoint"); 64MODULE_PARM_DESC(alt, "alternate setting to use for video endpoint");
65 65
66/* ------------------------------------------------------------------ */
67/* debug help functions */
68
69static const char *v4l1_ioctls[] = {
70 "0", "CGAP", "GCHAN", "SCHAN", "GTUNER", "STUNER", "GPICT", "SPICT",
71 "CCAPTURE", "GWIN", "SWIN", "GFBUF", "SFBUF", "KEY", "GFREQ",
72 "SFREQ", "GAUDIO", "SAUDIO", "SYNC", "MCAPTURE", "GMBUF", "GUNIT",
73 "GCAPTURE", "SCAPTURE", "SPLAYMODE", "SWRITEMODE", "GPLAYINFO",
74 "SMICROCODE", "GVBIFMT", "SVBIFMT" };
75#define V4L1_IOCTLS ARRAY_SIZE(v4l1_ioctls)
76
77static const char *v4l2_ioctls[] = {
78 "QUERYCAP", "1", "ENUM_PIXFMT", "ENUM_FBUFFMT", "G_FMT", "S_FMT",
79 "G_COMP", "S_COMP", "REQBUFS", "QUERYBUF", "G_FBUF", "S_FBUF",
80 "G_WIN", "S_WIN", "PREVIEW", "QBUF", "16", "DQBUF", "STREAMON",
81 "STREAMOFF", "G_PERF", "G_PARM", "S_PARM", "G_STD", "S_STD",
82 "ENUMSTD", "ENUMINPUT", "G_CTRL", "S_CTRL", "G_TUNER", "S_TUNER",
83 "G_FREQ", "S_FREQ", "G_AUDIO", "S_AUDIO", "35", "QUERYCTRL",
84 "QUERYMENU", "G_INPUT", "S_INPUT", "ENUMCVT", "41", "42", "43",
85 "44", "45", "G_OUTPUT", "S_OUTPUT", "ENUMOUTPUT", "G_AUDOUT",
86 "S_AUDOUT", "ENUMFX", "G_EFFECT", "S_EFFECT", "G_MODULATOR",
87 "S_MODULATOR"
88};
89#define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls)
90
91void em28xx_print_ioctl(char *name, unsigned int cmd)
92{
93 char *dir;
94
95 switch (_IOC_DIR(cmd)) {
96 case _IOC_NONE: dir = "--"; break;
97 case _IOC_READ: dir = "r-"; break;
98 case _IOC_WRITE: dir = "-w"; break;
99 case _IOC_READ | _IOC_WRITE: dir = "rw"; break;
100 default: dir = "??"; break;
101 }
102 switch (_IOC_TYPE(cmd)) {
103 case 'v':
104 printk(KERN_DEBUG "%s: ioctl 0x%08x (v4l1, %s, VIDIOC%s)\n",
105 name, cmd, dir, (_IOC_NR(cmd) < V4L1_IOCTLS) ?
106 v4l1_ioctls[_IOC_NR(cmd)] : "???");
107 break;
108 case 'V':
109 printk(KERN_DEBUG "%s: ioctl 0x%08x (v4l2, %s, VIDIOC_%s)\n",
110 name, cmd, dir, (_IOC_NR(cmd) < V4L2_IOCTLS) ?
111 v4l2_ioctls[_IOC_NR(cmd)] : "???");
112 break;
113 default:
114 printk(KERN_DEBUG "%s: ioctl 0x%08x (???, %s, #%d)\n",
115 name, cmd, dir, _IOC_NR(cmd));
116 }
117}
118
119 66
120/* 67/*
121 * em28xx_request_buffers() 68 * em28xx_request_buffers()
diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c
index 5385338efbf4..0591a705b7a1 100644
--- a/drivers/media/video/em28xx/em28xx-i2c.c
+++ b/drivers/media/video/em28xx/em28xx-i2c.c
@@ -28,6 +28,7 @@
28#include <linux/video_decoder.h> 28#include <linux/video_decoder.h>
29 29
30#include "em28xx.h" 30#include "em28xx.h"
31#include <media/v4l2-common.h>
31#include <media/tuner.h> 32#include <media/tuner.h>
32 33
33/* ----------------------------------------------------------- */ 34/* ----------------------------------------------------------- */
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 0b5557c479ae..fdc255918dde 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -1269,7 +1269,7 @@ static int em28xx_video_do_ioctl(struct inode *inode, struct file *filp,
1269 return -ENODEV; 1269 return -ENODEV;
1270 1270
1271 if (video_debug > 1) 1271 if (video_debug > 1)
1272 em28xx_print_ioctl(dev->name,cmd); 1272 v4l_print_ioctl(dev->name,cmd);
1273 1273
1274 switch (cmd) { 1274 switch (cmd) {
1275 1275
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h
index ffa9acc9be37..f99ee8eb5577 100644
--- a/drivers/media/video/em28xx/em28xx.h
+++ b/drivers/media/video/em28xx/em28xx.h
@@ -295,8 +295,6 @@ void em28xx_set_ir(struct em28xx * dev,struct IR_i2c *ir);
295 295
296/* Provided by em28xx-core.c */ 296/* Provided by em28xx-core.c */
297 297
298void em28xx_print_ioctl(char *name, unsigned int cmd);
299
300u32 em28xx_request_buffers(struct em28xx *dev, u32 count); 298u32 em28xx_request_buffers(struct em28xx *dev, u32 count);
301void em28xx_queue_unusedframes(struct em28xx *dev); 299void em28xx_queue_unusedframes(struct em28xx *dev);
302void em28xx_release_buffers(struct em28xx *dev); 300void em28xx_release_buffers(struct em28xx *dev);
diff --git a/drivers/media/video/mxb.c b/drivers/media/video/mxb.c
index d04793fb80fc..91681aa6c657 100644
--- a/drivers/media/video/mxb.c
+++ b/drivers/media/video/mxb.c
@@ -26,6 +26,7 @@
26#include <media/saa7146_vv.h> 26#include <media/saa7146_vv.h>
27#include <media/tuner.h> 27#include <media/tuner.h>
28#include <linux/video_decoder.h> 28#include <linux/video_decoder.h>
29#include <media/v4l2-common.h>
29 30
30#include "mxb.h" 31#include "mxb.h"
31#include "tea6415c.h" 32#include "tea6415c.h"
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
index 73f2525bc764..991829eb15da 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -25,6 +25,7 @@
25 25
26#include "saa7134-reg.h" 26#include "saa7134-reg.h"
27#include "saa7134.h" 27#include "saa7134.h"
28#include <media/v4l2-common.h>
28 29
29/* commly used strings */ 30/* commly used strings */
30static char name_mute[] = "mute"; 31static char name_mute[] = "mute";
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c
index 0bdbd99d0ae6..d4be1fd20a36 100644
--- a/drivers/media/video/saa7134/saa7134-core.c
+++ b/drivers/media/video/saa7134/saa7134-core.c
@@ -95,77 +95,6 @@ int (*dmasound_exit)(struct saa7134_dev *dev);
95#define dprintk(fmt, arg...) if (core_debug) \ 95#define dprintk(fmt, arg...) if (core_debug) \
96 printk(KERN_DEBUG "%s/core: " fmt, dev->name , ## arg) 96 printk(KERN_DEBUG "%s/core: " fmt, dev->name , ## arg)
97 97
98/* ------------------------------------------------------------------ */
99/* debug help functions */
100
101static const char *v4l1_ioctls[] = {
102 "0", "GCAP", "GCHAN", "SCHAN", "GTUNER", "STUNER", "GPICT", "SPICT",
103 "CCAPTURE", "GWIN", "SWIN", "GFBUF", "SFBUF", "KEY", "GFREQ",
104 "SFREQ", "GAUDIO", "SAUDIO", "SYNC", "MCAPTURE", "GMBUF", "GUNIT",
105 "GCAPTURE", "SCAPTURE", "SPLAYMODE", "SWRITEMODE", "GPLAYINFO",
106 "SMICROCODE", "GVBIFMT", "SVBIFMT" };
107#define V4L1_IOCTLS ARRAY_SIZE(v4l1_ioctls)
108
109static const char *v4l2_ioctls[] = {
110 "QUERYCAP", "1", "ENUM_PIXFMT", "ENUM_FBUFFMT", "G_FMT", "S_FMT",
111 "G_COMP", "S_COMP", "REQBUFS", "QUERYBUF", "G_FBUF", "S_FBUF",
112 "G_WIN", "S_WIN", "PREVIEW", "QBUF", "16", "DQBUF", "STREAMON",
113 "STREAMOFF", "G_PERF", "G_PARM", "S_PARM", "G_STD", "S_STD",
114 "ENUMSTD", "ENUMINPUT", "G_CTRL", "S_CTRL", "G_TUNER", "S_TUNER",
115 "G_FREQ", "S_FREQ", "G_AUDIO", "S_AUDIO", "35", "QUERYCTRL",
116 "QUERYMENU", "G_INPUT", "S_INPUT", "ENUMCVT", "41", "42", "43",
117 "44", "45", "G_OUTPUT", "S_OUTPUT", "ENUMOUTPUT", "G_AUDOUT",
118 "S_AUDOUT", "ENUMFX", "G_EFFECT", "S_EFFECT", "G_MODULATOR",
119 "S_MODULATOR"
120};
121#define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls)
122
123static const char *osspcm_ioctls[] = {
124 "RESET", "SYNC", "SPEED", "STEREO", "GETBLKSIZE", "SETFMT",
125 "CHANNELS", "?", "POST", "SUBDIVIDE", "SETFRAGMENT", "GETFMTS",
126 "GETOSPACE", "GETISPACE", "NONBLOCK", "GETCAPS", "GET/SETTRIGGER",
127 "GETIPTR", "GETOPTR", "MAPINBUF", "MAPOUTBUF", "SETSYNCRO",
128 "SETDUPLEX", "GETODELAY"
129};
130#define OSSPCM_IOCTLS ARRAY_SIZE(v4l2_ioctls)
131
132void saa7134_print_ioctl(char *name, unsigned int cmd)
133{
134 char *dir;
135
136 switch (_IOC_DIR(cmd)) {
137 case _IOC_NONE: dir = "--"; break;
138 case _IOC_READ: dir = "r-"; break;
139 case _IOC_WRITE: dir = "-w"; break;
140 case _IOC_READ | _IOC_WRITE: dir = "rw"; break;
141 default: dir = "??"; break;
142 }
143 switch (_IOC_TYPE(cmd)) {
144 case 'v':
145 printk(KERN_DEBUG "%s: ioctl 0x%08x (v4l1, %s, VIDIOC%s)\n",
146 name, cmd, dir, (_IOC_NR(cmd) < V4L1_IOCTLS) ?
147 v4l1_ioctls[_IOC_NR(cmd)] : "???");
148 break;
149 case 'V':
150 printk(KERN_DEBUG "%s: ioctl 0x%08x (v4l2, %s, VIDIOC_%s)\n",
151 name, cmd, dir, (_IOC_NR(cmd) < V4L2_IOCTLS) ?
152 v4l2_ioctls[_IOC_NR(cmd)] : "???");
153 break;
154 case 'P':
155 printk(KERN_DEBUG "%s: ioctl 0x%08x (oss dsp, %s, SNDCTL_DSP_%s)\n",
156 name, cmd, dir, (_IOC_NR(cmd) < OSSPCM_IOCTLS) ?
157 osspcm_ioctls[_IOC_NR(cmd)] : "???");
158 break;
159 case 'M':
160 printk(KERN_DEBUG "%s: ioctl 0x%08x (oss mixer, %s, #%d)\n",
161 name, cmd, dir, _IOC_NR(cmd));
162 break;
163 default:
164 printk(KERN_DEBUG "%s: ioctl 0x%08x (???, %s, #%d)\n",
165 name, cmd, dir, _IOC_NR(cmd));
166 }
167}
168
169void saa7134_track_gpio(struct saa7134_dev *dev, char *msg) 98void saa7134_track_gpio(struct saa7134_dev *dev, char *msg)
170{ 99{
171 unsigned long mode,status; 100 unsigned long mode,status;
@@ -1173,7 +1102,6 @@ module_exit(saa7134_fini);
1173 1102
1174/* ----------------------------------------------------------- */ 1103/* ----------------------------------------------------------- */
1175 1104
1176EXPORT_SYMBOL(saa7134_print_ioctl);
1177EXPORT_SYMBOL(saa7134_i2c_call_clients); 1105EXPORT_SYMBOL(saa7134_i2c_call_clients);
1178EXPORT_SYMBOL(saa7134_devlist); 1106EXPORT_SYMBOL(saa7134_devlist);
1179EXPORT_SYMBOL(saa7134_boards); 1107EXPORT_SYMBOL(saa7134_boards);
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
index e016480c3468..399f9952596c 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -31,6 +31,7 @@
31 31
32#include "saa7134-reg.h" 32#include "saa7134-reg.h"
33#include "saa7134.h" 33#include "saa7134.h"
34#include <media/v4l2-common.h>
34 35
35#ifdef HAVE_MT352 36#ifdef HAVE_MT352
36# include "mt352.h" 37# include "mt352.h"
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c
index 575f3e835f91..bd4c389d4c37 100644
--- a/drivers/media/video/saa7134/saa7134-empress.c
+++ b/drivers/media/video/saa7134/saa7134-empress.c
@@ -29,6 +29,7 @@
29#include "saa7134.h" 29#include "saa7134.h"
30 30
31#include <media/saa6752hs.h> 31#include <media/saa6752hs.h>
32#include <media/v4l2-common.h>
32 33
33/* ------------------------------------------------------------------ */ 34/* ------------------------------------------------------------------ */
34 35
@@ -163,7 +164,7 @@ static int ts_do_ioctl(struct inode *inode, struct file *file,
163 struct saa7134_dev *dev = file->private_data; 164 struct saa7134_dev *dev = file->private_data;
164 165
165 if (debug > 1) 166 if (debug > 1)
166 saa7134_print_ioctl(dev->name,cmd); 167 v4l_print_ioctl(dev->name,cmd);
167 switch (cmd) { 168 switch (cmd) {
168 case VIDIOC_QUERYCAP: 169 case VIDIOC_QUERYCAP:
169 { 170 {
diff --git a/drivers/media/video/saa7134/saa7134-i2c.c b/drivers/media/video/saa7134/saa7134-i2c.c
index 7283caa0484b..6162550c4136 100644
--- a/drivers/media/video/saa7134/saa7134-i2c.c
+++ b/drivers/media/video/saa7134/saa7134-i2c.c
@@ -30,6 +30,7 @@
30 30
31#include "saa7134-reg.h" 31#include "saa7134-reg.h"
32#include "saa7134.h" 32#include "saa7134.h"
33#include <media/v4l2-common.h>
33 34
34/* ----------------------------------------------------------- */ 35/* ----------------------------------------------------------- */
35 36
diff --git a/drivers/media/video/saa7134/saa7134-oss.c b/drivers/media/video/saa7134/saa7134-oss.c
index 8badd2a9cb2f..7448e386a804 100644
--- a/drivers/media/video/saa7134/saa7134-oss.c
+++ b/drivers/media/video/saa7134/saa7134-oss.c
@@ -373,6 +373,42 @@ static ssize_t dsp_write(struct file *file, const char __user *buffer,
373 return -EINVAL; 373 return -EINVAL;
374} 374}
375 375
376static const char *osspcm_ioctls[] = {
377 "RESET", "SYNC", "SPEED", "STEREO", "GETBLKSIZE", "SETFMT",
378 "CHANNELS", "?", "POST", "SUBDIVIDE", "SETFRAGMENT", "GETFMTS",
379 "GETOSPACE", "GETISPACE", "NONBLOCK", "GETCAPS", "GET/SETTRIGGER",
380 "GETIPTR", "GETOPTR", "MAPINBUF", "MAPOUTBUF", "SETSYNCRO",
381 "SETDUPLEX", "GETODELAY"
382};
383#define OSSPCM_IOCTLS ARRAY_SIZE(osspcm_ioctls)
384
385static void saa7134_oss_print_ioctl(char *name, unsigned int cmd)
386{
387 char *dir;
388
389 switch (_IOC_DIR(cmd)) {
390 case _IOC_NONE: dir = "--"; break;
391 case _IOC_READ: dir = "r-"; break;
392 case _IOC_WRITE: dir = "-w"; break;
393 case _IOC_READ | _IOC_WRITE: dir = "rw"; break;
394 default: dir = "??"; break;
395 }
396 switch (_IOC_TYPE(cmd)) {
397 case 'P':
398 printk(KERN_DEBUG "%s: ioctl 0x%08x (oss dsp, %s, SNDCTL_DSP_%s)\n",
399 name, cmd, dir, (_IOC_NR(cmd) < OSSPCM_IOCTLS) ?
400 osspcm_ioctls[_IOC_NR(cmd)] : "???");
401 break;
402 case 'M':
403 printk(KERN_DEBUG "%s: ioctl 0x%08x (oss mixer, %s, #%d)\n",
404 name, cmd, dir, _IOC_NR(cmd));
405 break;
406 default:
407 printk(KERN_DEBUG "%s: ioctl 0x%08x (???, %s, #%d)\n",
408 name, cmd, dir, _IOC_NR(cmd));
409 }
410}
411
376static int dsp_ioctl(struct inode *inode, struct file *file, 412static int dsp_ioctl(struct inode *inode, struct file *file,
377 unsigned int cmd, unsigned long arg) 413 unsigned int cmd, unsigned long arg)
378{ 414{
@@ -382,7 +418,7 @@ static int dsp_ioctl(struct inode *inode, struct file *file,
382 int val = 0; 418 int val = 0;
383 419
384 if (debug > 1) 420 if (debug > 1)
385 saa7134_print_ioctl(dev->name,cmd); 421 saa7134_oss_print_ioctl(dev->name,cmd);
386 switch (cmd) { 422 switch (cmd) {
387 case OSS_GETVERSION: 423 case OSS_GETVERSION:
388 return put_user(SOUND_VERSION, p); 424 return put_user(SOUND_VERSION, p);
@@ -678,7 +714,7 @@ static int mixer_ioctl(struct inode *inode, struct file *file,
678 int __user *p = argp; 714 int __user *p = argp;
679 715
680 if (debug > 1) 716 if (debug > 1)
681 saa7134_print_ioctl(dev->name,cmd); 717 saa7134_oss_print_ioctl(dev->name,cmd);
682 switch (cmd) { 718 switch (cmd) {
683 case OSS_GETVERSION: 719 case OSS_GETVERSION:
684 return put_user(SOUND_VERSION, p); 720 return put_user(SOUND_VERSION, p);
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c
index 9b9e1e7f05ef..adfa8fe49a11 100644
--- a/drivers/media/video/saa7134/saa7134-video.c
+++ b/drivers/media/video/saa7134/saa7134-video.c
@@ -29,6 +29,7 @@
29 29
30#include "saa7134-reg.h" 30#include "saa7134-reg.h"
31#include "saa7134.h" 31#include "saa7134.h"
32#include <media/v4l2-common.h>
32 33
33/* Include V4L1 specific functions. Should be removed soon */ 34/* Include V4L1 specific functions. Should be removed soon */
34#include <linux/videodev.h> 35#include <linux/videodev.h>
@@ -1689,7 +1690,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
1689 int err; 1690 int err;
1690 1691
1691 if (video_debug > 1) 1692 if (video_debug > 1)
1692 saa7134_print_ioctl(dev->name,cmd); 1693 v4l_print_ioctl(dev->name,cmd);
1693 1694
1694 switch (cmd) { 1695 switch (cmd) {
1695 case VIDIOC_S_CTRL: 1696 case VIDIOC_S_CTRL:
@@ -2142,7 +2143,7 @@ static int radio_do_ioctl(struct inode *inode, struct file *file,
2142 struct saa7134_dev *dev = fh->dev; 2143 struct saa7134_dev *dev = fh->dev;
2143 2144
2144 if (video_debug > 1) 2145 if (video_debug > 1)
2145 saa7134_print_ioctl(dev->name,cmd); 2146 v4l_print_ioctl(dev->name,cmd);
2146 switch (cmd) { 2147 switch (cmd) {
2147 case VIDIOC_QUERYCAP: 2148 case VIDIOC_QUERYCAP:
2148 { 2149 {
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h
index 2f28e83102fd..18978a484ddb 100644
--- a/drivers/media/video/saa7134/saa7134.h
+++ b/drivers/media/video/saa7134/saa7134.h
@@ -546,7 +546,6 @@ struct saa7134_dev {
546 546
547extern struct list_head saa7134_devlist; 547extern struct list_head saa7134_devlist;
548 548
549void saa7134_print_ioctl(char *name, unsigned int cmd);
550void saa7134_track_gpio(struct saa7134_dev *dev, char *msg); 549void saa7134_track_gpio(struct saa7134_dev *dev, char *msg);
551 550
552#define SAA7134_PGTABLE_SIZE 4096 551#define SAA7134_PGTABLE_SIZE 4096
diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c
index 9ae43a8cea52..f64baa4b0025 100644
--- a/drivers/media/video/tda9887.c
+++ b/drivers/media/video/tda9887.c
@@ -9,7 +9,7 @@
9#include <linux/slab.h> 9#include <linux/slab.h>
10#include <linux/delay.h> 10#include <linux/delay.h>
11 11
12#include <media/audiochip.h> 12#include <media/v4l2-common.h>
13#include <media/tuner.h> 13#include <media/tuner.h>
14 14
15 15
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index df994311251e..fd18a882668e 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -20,6 +20,7 @@
20#include <linux/init.h> 20#include <linux/init.h>
21 21
22#include <media/tuner.h> 22#include <media/tuner.h>
23#include <media/v4l2-common.h>
23#include <media/audiochip.h> 24#include <media/audiochip.h>
24 25
25#include "msp3400.h" 26#include "msp3400.h"
@@ -545,6 +546,9 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
545{ 546{
546 struct tuner *t = i2c_get_clientdata(client); 547 struct tuner *t = i2c_get_clientdata(client);
547 548
549 if (tuner_debug>1)
550 v4l_i2c_print_ioctl(&(t->i2c),cmd);
551
548 switch (cmd) { 552 switch (cmd) {
549 /* --- configuration --- */ 553 /* --- configuration --- */
550 case TUNER_SET_TYPE_ADDR: 554 case TUNER_SET_TYPE_ADDR:
@@ -576,9 +580,6 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
576 tuner_dbg("VIDIOCSAUDIO not implemented.\n"); 580 tuner_dbg("VIDIOCSAUDIO not implemented.\n");
577 581
578 break; 582 break;
579 case MSP_SET_MATRIX:
580 case TDA9887_SET_CONFIG:
581 break;
582 /* --- v4l ioctls --- */ 583 /* --- v4l ioctls --- */
583 /* take care: bttv does userspace copying, we'll get a 584 /* take care: bttv does userspace copying, we'll get a
584 kernel pointer here... */ 585 kernel pointer here... */
@@ -764,11 +765,6 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
764 case VIDIOC_LOG_STATUS: 765 case VIDIOC_LOG_STATUS:
765 tuner_status(client); 766 tuner_status(client);
766 break; 767 break;
767 default:
768 tuner_dbg("Unimplemented IOCTL 0x%08x(dir=%d,tp='%c',nr=%d,sz=%d)\n",
769 cmd, _IOC_DIR(cmd), _IOC_TYPE(cmd),
770 _IOC_NR(cmd), _IOC_SIZE(cmd));
771 break;
772 } 768 }
773 769
774 return 0; 770 return 0;
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
index ed6a843dd34a..fec620073aa3 100644
--- a/drivers/media/video/tvaudio.c
+++ b/drivers/media/video/tvaudio.c
@@ -31,6 +31,7 @@
31#include <linux/smp_lock.h> 31#include <linux/smp_lock.h>
32 32
33#include <media/audiochip.h> 33#include <media/audiochip.h>
34#include <media/v4l2-common.h>
34 35
35#include "tvaudio.h" 36#include "tvaudio.h"
36 37
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
193char *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", 199static 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
233static 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
293static 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 */
328void 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
254EXPORT_SYMBOL(v4l2_field_names); 375EXPORT_SYMBOL(v4l2_field_names);
255EXPORT_SYMBOL(v4l2_type_names); 376EXPORT_SYMBOL(v4l2_type_names);
256EXPORT_SYMBOL(v4l2_ioctl_names); 377EXPORT_SYMBOL(v4l_printk_ioctl);
257 378
258/* 379/*
259 * Local variables: 380 * Local variables:
diff --git a/include/linux/video_decoder.h b/include/linux/video_decoder.h
index 0e9e48b83e3b..121e26da2c18 100644
--- a/include/linux/video_decoder.h
+++ b/include/linux/video_decoder.h
@@ -1,6 +1,8 @@
1#ifndef _LINUX_VIDEO_DECODER_H 1#ifndef _LINUX_VIDEO_DECODER_H
2#define _LINUX_VIDEO_DECODER_H 2#define _LINUX_VIDEO_DECODER_H
3 3
4#define HAVE_VIDEO_DECODER 1
5
4struct video_decoder_capability { /* this name is too long */ 6struct video_decoder_capability { /* this name is too long */
5 __u32 flags; 7 __u32 flags;
6#define VIDEO_DECODER_PAL 1 /* can decode PAL signal */ 8#define VIDEO_DECODER_PAL 1 /* can decode PAL signal */
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 6ac7c1f7902f..ce40675324bd 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -1116,7 +1116,6 @@ int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local);
1116/* names for fancy debug output */ 1116/* names for fancy debug output */
1117extern char *v4l2_field_names[]; 1117extern char *v4l2_field_names[];
1118extern char *v4l2_type_names[]; 1118extern char *v4l2_type_names[];
1119extern char *v4l2_ioctl_names[];
1120 1119
1121/* Compatibility layer interface -- v4l1-compat module */ 1120/* Compatibility layer interface -- v4l1-compat module */
1122typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file, 1121typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file,
diff --git a/include/media/audiochip.h b/include/media/audiochip.h
index 411f09fc4574..295d256ee811 100644
--- a/include/media/audiochip.h
+++ b/include/media/audiochip.h
@@ -23,11 +23,6 @@ enum audiochip {
23 23
24/* ---------------------------------------------------------------------- */ 24/* ---------------------------------------------------------------------- */
25 25
26/* v4l device was opened in Radio mode */
27#define AUDC_SET_RADIO _IO('m',2)
28/* select from TV,radio,extern,MUTE */
29#define AUDC_SET_INPUT _IOW('m',17,int)
30
31/* audio inputs */ 26/* audio inputs */
32#define AUDIO_TUNER 0x00 27#define AUDIO_TUNER 0x00
33#define AUDIO_RADIO 0x01 28#define AUDIO_RADIO 0x01
diff --git a/include/media/tuner.h b/include/media/tuner.h
index c5f034ecb002..6a8ef189e5fa 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -115,10 +115,6 @@
115#define TUNER_PHILIPS_TUV1236D 68 /* ATI HDTV Wonder */ 115#define TUNER_PHILIPS_TUV1236D 68 /* ATI HDTV Wonder */
116#define TUNER_TNF_5335MF 69 /* Sabrent Bt848 */ 116#define TUNER_TNF_5335MF 69 /* Sabrent Bt848 */
117 117
118#define TUNER_SET_TYPE_ADDR _IOW('T',3,int)
119#define TUNER_SET_STANDBY _IOW('T',4,int)
120#define TDA9887_SET_CONFIG _IOW('t',5,int)
121
122/* tv card specific */ 118/* tv card specific */
123#define TDA9887_PRESENT (1<<0) 119#define TDA9887_PRESENT (1<<0)
124#define TDA9887_PORT1_INACTIVE (1<<1) 120#define TDA9887_PORT1_INACTIVE (1<<1)
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 90248d29ed0a..9ee616261d66 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -63,6 +63,20 @@ enum v4l2_chip_ident {
63 V4L2_IDENT_CX25843 = 243, 63 V4L2_IDENT_CX25843 = 243,
64}; 64};
65 65
66/* audio ioctls */
67/* v4l device was opened in Radio mode */
68#define AUDC_SET_RADIO _IO('d',88)
69/* select from TV,radio,extern,MUTE */
70#define AUDC_SET_INPUT _IOW('d',89,int)
71
72/* tuner ioctls */
73/* Sets tuner type and its I2C addr */
74#define TUNER_SET_TYPE_ADDR _IOW('d',90,int)
75/* Puts tuner on powersaving state, disabling it, except for i2c */
76#define TUNER_SET_STANDBY _IOW('d',91,int)
77/* Sets tda9887 specific stuff, like port1, port2 and qss */
78#define TDA9887_SET_CONFIG _IOW('d',92,int)
79
66/* only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */ 80/* only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */
67#define VIDIOC_INT_S_REGISTER _IOR ('d', 100, struct v4l2_register) 81#define VIDIOC_INT_S_REGISTER _IOR ('d', 100, struct v4l2_register)
68#define VIDIOC_INT_G_REGISTER _IOWR('d', 101, struct v4l2_register) 82#define VIDIOC_INT_G_REGISTER _IOWR('d', 101, struct v4l2_register)
@@ -108,5 +122,16 @@ enum v4l2_chip_ident {
108 If the frequency is not supported, then -EINVAL is returned. */ 122 If the frequency is not supported, then -EINVAL is returned. */
109#define VIDIOC_INT_I2S_CLOCK_FREQ _IOW ('d', 108, u32) 123#define VIDIOC_INT_I2S_CLOCK_FREQ _IOW ('d', 108, u32)
110 124
125/* Prints used ioctl */
126extern void v4l_printk_ioctl(unsigned int cmd);
127
128#define v4l_print_ioctl(name,cmd) do {\
129 printk(KERN_DEBUG "%s: ", name); \
130 v4l_printk_ioctl(cmd); } while (0)
131
132#define v4l_i2c_print_ioctl(client,cmd) do {\
133 printk(KERN_DEBUG "%s %d-%04x: ", (client)->driver->name, \
134 i2c_adapter_id((client)->adapter),(client)->addr); \
135 v4l_printk_ioctl(cmd); } while (0)
111 136
112#endif /* V4L2_COMMON_H_ */ 137#endif /* V4L2_COMMON_H_ */