V4L/DVB (3269): ioctls cleanups.
[pandora-kernel.git] / drivers / media / video / bttv-driver.c
index 8bee7d5..f3de852 100644 (file)
@@ -35,6 +35,7 @@
 #include <linux/interrupt.h>
 #include <linux/kdev_t.h>
 #include "bttvp.h"
+#include <media/v4l2-common.h>
 
 #include <linux/dma-mapping.h>
 
@@ -210,6 +211,9 @@ const struct bttv_tvnorm bttv_tvnorms[] = {
                .vdelay         = 0x20,
                .vbipack        = 255,
                .sram           = 0,
+               /* ITU-R frame line number of the first VBI line
+                  we can capture, of the first and second field. */
+               .vbistart       = { 7,320 },
        },{
                .v4l2_id        = V4L2_STD_NTSC_M,
                .name           = "NTSC",
@@ -226,6 +230,7 @@ const struct bttv_tvnorm bttv_tvnorms[] = {
                .vdelay         = 0x1a,
                .vbipack        = 144,
                .sram           = 1,
+               .vbistart       = { 10, 273 },
        },{
                .v4l2_id        = V4L2_STD_SECAM,
                .name           = "SECAM",
@@ -242,6 +247,7 @@ const struct bttv_tvnorm bttv_tvnorms[] = {
                .vdelay         = 0x20,
                .vbipack        = 255,
                .sram           = 0, /* like PAL, correct? */
+               .vbistart       = { 7, 320 },
        },{
                .v4l2_id        = V4L2_STD_PAL_Nc,
                .name           = "PAL-Nc",
@@ -258,6 +264,7 @@ const struct bttv_tvnorm bttv_tvnorms[] = {
                .vdelay         = 0x1a,
                .vbipack        = 144,
                .sram           = -1,
+               .vbistart       = { 7, 320 },
        },{
                .v4l2_id        = V4L2_STD_PAL_M,
                .name           = "PAL-M",
@@ -274,6 +281,7 @@ const struct bttv_tvnorm bttv_tvnorms[] = {
                .vdelay         = 0x1a,
                .vbipack        = 144,
                .sram           = -1,
+               .vbistart       = { 10, 273 },
        },{
                .v4l2_id        = V4L2_STD_PAL_N,
                .name           = "PAL-N",
@@ -290,6 +298,7 @@ const struct bttv_tvnorm bttv_tvnorms[] = {
                .vdelay         = 0x20,
                .vbipack        = 144,
                .sram           = -1,
+               .vbistart       = { 7, 320},
        },{
                .v4l2_id        = V4L2_STD_NTSC_M_JP,
                .name           = "NTSC-JP",
@@ -306,6 +315,7 @@ const struct bttv_tvnorm bttv_tvnorms[] = {
                .vdelay         = 0x16,
                .vbipack        = 144,
                .sram           = -1,
+               .vbistart       = {10, 273},
        },{
                /* that one hopefully works with the strange timing
                 * which video recorders produce when playing a NTSC
@@ -326,6 +336,7 @@ const struct bttv_tvnorm bttv_tvnorms[] = {
                .vbipack        = 255,
                .vtotal         = 524,
                .sram           = -1,
+               .vbistart       = { 10, 273 },
        }
 };
 static const unsigned int BTTV_TVNORMS = ARRAY_SIZE(bttv_tvnorms);
@@ -1510,14 +1521,6 @@ static struct videobuf_queue_ops bttv_video_qops = {
        .buf_release  = buffer_release,
 };
 
-static const char *v4l1_ioctls[] = {
-       "?", "CGAP", "GCHAN", "SCHAN", "GTUNER", "STUNER", "GPICT", "SPICT",
-       "CCAPTURE", "GWIN", "SWIN", "GFBUF", "SFBUF", "KEY", "GFREQ",
-       "SFREQ", "GAUDIO", "SAUDIO", "SYNC", "MCAPTURE", "GMBUF", "GUNIT",
-       "GCAPTURE", "SCAPTURE", "SPLAYMODE", "SWRITEMODE", "GPLAYINFO",
-       "SMICROCODE", "GVBIFMT", "SVBIFMT" };
-#define V4L1_IOCTLS ARRAY_SIZE(v4l1_ioctls)
-
 static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
 {
        switch (cmd) {
@@ -2206,22 +2209,9 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
        unsigned long flags;
        int retval = 0;
 
-       if (bttv_debug > 1) {
-               switch (_IOC_TYPE(cmd)) {
-               case 'v':
-                       printk("bttv%d: ioctl 0x%x (v4l1, VIDIOC%s)\n",
-                              btv->c.nr, cmd, (_IOC_NR(cmd) < V4L1_IOCTLS) ?
-                              v4l1_ioctls[_IOC_NR(cmd)] : "???");
-                       break;
-               case 'V':
-                       printk("bttv%d: ioctl 0x%x (v4l2, %s)\n",
-                              btv->c.nr, cmd,  v4l2_ioctl_names[_IOC_NR(cmd)]);
-                       break;
-               default:
-                       printk("bttv%d: ioctl 0x%x (???)\n",
-                              btv->c.nr, cmd);
-               }
-       }
+       if (bttv_debug > 1)
+               v4l_print_ioctl(btv->c.name, cmd);
+
        if (btv->errors)
                bttv_reinit_bt848(btv);
 
@@ -2570,10 +2560,10 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
                fmt->count[0]         = fmt2.fmt.vbi.count[0];
                fmt->start[1]         = fmt2.fmt.vbi.start[1];
                fmt->count[1]         = fmt2.fmt.vbi.count[1];
-               if (fmt2.fmt.vbi.flags & VBI_UNSYNC)
-                       fmt->flags   |= V4L2_VBI_UNSYNC;
-               if (fmt2.fmt.vbi.flags & VBI_INTERLACED)
-                       fmt->flags   |= V4L2_VBI_INTERLACED;
+               if (fmt2.fmt.vbi.flags & V4L2_VBI_UNSYNC)
+                       fmt->flags   |= VBI_UNSYNC;
+               if (fmt2.fmt.vbi.flags & V4L2_VBI_INTERLACED)
+                       fmt->flags   |= VBI_INTERLACED;
                return 0;
        }
        case VIDIOCSVBIFMT:
@@ -4065,8 +4055,6 @@ static int __devinit bttv_probe(struct pci_dev *dev,
        }
 
        /* add subdevices */
-       if (btv->has_remote)
-               bttv_sub_add_device(&btv->c, "remote");
        if (bttv_tvcards[btv->c.type].has_dvb)
                bttv_sub_add_device(&btv->c, "dvb");
 
@@ -4107,7 +4095,7 @@ static void __devexit bttv_remove(struct pci_dev *pci_dev)
        btv->shutdown=1;
        wake_up(&btv->gpioq);
        bttv_input_fini(btv);
-       //bttv_sub_del_devices(&btv->c);
+       bttv_sub_del_devices(&btv->c);
 
        /* unregister i2c_bus + input */
        fini_bttv_i2c(btv);