#include <linux/semaphore.h>
 #include <linux/uaccess.h>
 #include <asm/system.h>
-#include <linux/videodev.h>
+#include <linux/videodev2.h>
 #include <media/tuner.h>
 #include <media/v4l2-common.h>
 
 
 #include <linux/time.h>
 #include <linux/vmalloc.h>
 #include <linux/pagemap.h>
-#include <linux/videodev.h>
-#include <linux/video_decoder.h>
+#include <linux/videodev2.h>
 #include <media/v4l2-common.h>
 #include <media/v4l2-ioctl.h>
 #include <linux/i2c.h>
        case VIDIOC_S_STD:
        {
                v4l2_std_id *std = arg;
-               int norm;
 
                if (go->streaming)
                        return -EBUSY;
                if (*std & V4L2_STD_NTSC) {
                        go->standard = GO7007_STD_NTSC;
                        go->sensor_framerate = 30000;
-                       norm = VIDEO_MODE_NTSC;
                } else if (*std & V4L2_STD_PAL) {
                        go->standard = GO7007_STD_PAL;
                        go->sensor_framerate = 25025;
-                       norm = VIDEO_MODE_PAL;
                } else if (*std & V4L2_STD_SECAM) {
                        go->standard = GO7007_STD_PAL;
                        go->sensor_framerate = 25025;
-                       norm = VIDEO_MODE_SECAM;
                } else
                        return -EINVAL;
                if (go->i2c_adapter_online)
                        i2c_clients_command(&go->i2c_adapter,
-                                               DECODER_SET_NORM, &norm);
+                                           VIDIOC_S_STD, std);
                set_capture_size(go, NULL, 0);
                return 0;
        }
                        return -EBUSY;
                go->input = *input;
                if (go->i2c_adapter_online) {
-                       i2c_clients_command(&go->i2c_adapter, DECODER_SET_INPUT,
+                       i2c_clients_command(&go->i2c_adapter, VIDIOC_S_INPUT,
                                &go->board_info->inputs[*input].video_input);
                        i2c_clients_command(&go->i2c_adapter, VIDIOC_S_AUDIO,
                                &go->board_info->inputs[*input].audio_input);
 
 static struct video_device go7007_template = {
        .name           = "go7007",
+       .vfl_type       = VID_TYPE_CAPTURE,
        .fops           = &go7007_fops,
        .minor          = -1,
        .release        = go7007_vfl_release,
 
 module_param_array(id, charp, NULL, 0444);
 module_param_array(enable, bool, NULL, 0444);
 MODULE_PARM_DESC(index, "Index value for the go7007 audio driver");
-MODULE_PARM_DESC(index, "ID string for the go7007 audio driver");
-MODULE_PARM_DESC(index, "Enable for the go7007 audio driver");
+MODULE_PARM_DESC(id, "ID string for the go7007 audio driver");
+MODULE_PARM_DESC(enable, "Enable for the go7007 audio driver");
 
 struct go7007_snd {
        struct snd_card *card;
 
 #include <linux/init.h>
 #include <linux/version.h>
 #include <linux/i2c.h>
-#include <linux/videodev.h>
-#include <linux/video_decoder.h>
+#include <linux/videodev2.h>
 
 #include "wis-i2c.h"
 
 
 #include <linux/init.h>
 #include <linux/version.h>
 #include <linux/i2c.h>
-#include <linux/videodev.h>
-#include <linux/video_decoder.h>
+#include <linux/videodev2.h>
 #include <linux/ioctl.h>
 
 #include "wis-i2c.h"
        struct wis_saa7113 *dec = i2c_get_clientdata(client);
 
        switch (cmd) {
-       case DECODER_SET_INPUT:
+       case VIDIOC_S_INPUT:
        {
                int *input = arg;
 
                                *input < 6 ? 0x40 : 0x80);
                break;
        }
-       case DECODER_SET_NORM:
+       case VIDIOC_S_STD:
        {
-               int *input = arg;
+               v4l2_std_id *input = arg;
                dec->norm = *input;
-               switch (dec->norm) {
-               case VIDEO_MODE_PAL:
-                       write_reg(client, 0x0e, 0x01);
-                       write_reg(client, 0x10, 0x48);
-                       break;
-               case VIDEO_MODE_NTSC:
+               if (dec->norm & V4L2_STD_NTSC) {
                        write_reg(client, 0x0e, 0x01);
                        write_reg(client, 0x10, 0x40);
-                       break;
-               case VIDEO_MODE_SECAM:
+               } else if (dec->norm & V4L2_STD_PAL) {
+                       write_reg(client, 0x0e, 0x01);
+                       write_reg(client, 0x10, 0x48);
+               } else if (dec->norm * V4L2_STD_SECAM) {
                        write_reg(client, 0x0e, 0x50);
                        write_reg(client, 0x10, 0x48);
-                       break;
                }
                break;
        }
                kfree(client);
                return -ENOMEM;
        }
-       dec->norm = VIDEO_MODE_NTSC;
+       dec->norm = V4L2_STD_NTSC;
        dec->brightness = 128;
        dec->contrast = 71;
        dec->saturation = 64;
 
 #include <linux/init.h>
 #include <linux/version.h>
 #include <linux/i2c.h>
-#include <linux/videodev.h>
-#include <linux/video_decoder.h>
+#include <linux/videodev2.h>
 #include <linux/ioctl.h>
 
 #include "wis-i2c.h"
        struct wis_saa7115 *dec = i2c_get_clientdata(client);
 
        switch (cmd) {
-       case DECODER_SET_INPUT:
+       case VIDIOC_S_INPUT:
        {
                int *input = arg;
 
                int h_scaling_increment = (704 / h_integer_scaler) *
                                        1024 / res->width;
                /* Fine-grained scaler only */
-               int v_scaling_increment = (dec->norm == VIDEO_MODE_NTSC ?
+               int v_scaling_increment = (dec->norm & V4L2_STD_NTSC ?
                                240 : 288) * 1024 / res->height;
                u8 regs[] = {
                        0x88,   0xc0,
                write_regs(client, regs);
                break;
        }
-       case DECODER_SET_NORM:
+       case VIDIOC_S_STD:
        {
-               int *input = arg;
+               v4l2_std_id *input = arg;
                u8 regs[] = {
                        0x88,   0xc0,
-                       0x98,   *input == VIDEO_MODE_NTSC ? 0x12 : 0x16,
-                       0x9a,   *input == VIDEO_MODE_NTSC ? 0xf2 : 0x20,
-                       0x9b,   *input == VIDEO_MODE_NTSC ? 0x00 : 0x01,
-                       0xc8,   *input == VIDEO_MODE_NTSC ? 0x12 : 0x16,
-                       0xca,   *input == VIDEO_MODE_NTSC ? 0xf2 : 0x20,
-                       0xcb,   *input == VIDEO_MODE_NTSC ? 0x00 : 0x01,
+                       0x98,   *input & V4L2_STD_NTSC ? 0x12 : 0x16,
+                       0x9a,   *input & V4L2_STD_NTSC ? 0xf2 : 0x20,
+                       0x9b,   *input & V4L2_STD_NTSC ? 0x00 : 0x01,
+                       0xc8,   *input & V4L2_STD_NTSC ? 0x12 : 0x16,
+                       0xca,   *input & V4L2_STD_NTSC ? 0xf2 : 0x20,
+                       0xcb,   *input & V4L2_STD_NTSC ? 0x00 : 0x01,
                        0x88,   0xf0,
-                       0x30,   *input == VIDEO_MODE_NTSC ? 0x66 : 0x00,
-                       0x31,   *input == VIDEO_MODE_NTSC ? 0x90 : 0xe0,
+                       0x30,   *input & V4L2_STD_NTSC ? 0x66 : 0x00,
+                       0x31,   *input & V4L2_STD_NTSC ? 0x90 : 0xe0,
                        0,      0,
                };
                write_regs(client, regs);
                kfree(client);
                return -ENOMEM;
        }
-       dec->norm = VIDEO_MODE_NTSC;
+       dec->norm = V4L2_STD_NTSC;
        dec->brightness = 128;
        dec->contrast = 64;
        dec->saturation = 64;
 
 #include <linux/init.h>
 #include <linux/version.h>
 #include <linux/i2c.h>
-#include <linux/videodev.h>
+#include <linux/videodev2.h>
 #include <media/tuner.h>
 #include <media/v4l2-common.h>
+#include <media/v4l2-ioctl.h>
 
 #include "wis-i2c.h"
 
 
 #include <linux/init.h>
 #include <linux/version.h>
 #include <linux/i2c.h>
-#include <linux/videodev.h>
-#include <linux/video_decoder.h>
+#include <linux/videodev2.h>
 #include <linux/ioctl.h>
 
 #include "wis-i2c.h"
        }
 
        switch (cmd) {
-       case DECODER_SET_NORM:
+       case VIDIOC_S_STD:
        {
-               int *input = arg;
+               v4l2_std_id *input = arg;
                u8 regs[] = {
-                       0x01, *input == VIDEO_MODE_NTSC ? 0xc4 : 0x84,
-                       0x09, *input == VIDEO_MODE_NTSC ? 0x07 : 0x04,
-                       0x0a, *input == VIDEO_MODE_NTSC ? 0xf0 : 0x20,
-                       0x0b, *input == VIDEO_MODE_NTSC ? 0x07 : 0x04,
-                       0x0c, *input == VIDEO_MODE_NTSC ? 0xf0 : 0x20,
-                       0x0d, *input == VIDEO_MODE_NTSC ? 0x40 : 0x4a,
-                       0x16, *input == VIDEO_MODE_NTSC ? 0x00 : 0x40,
-                       0x17, *input == VIDEO_MODE_NTSC ? 0x00 : 0x40,
-                       0x20, *input == VIDEO_MODE_NTSC ? 0x07 : 0x0f,
-                       0x21, *input == VIDEO_MODE_NTSC ? 0x07 : 0x0f,
+                       0x01, *input & V4L2_STD_NTSC ? 0xc4 : 0x84,
+                       0x09, *input & V4L2_STD_NTSC ? 0x07 : 0x04,
+                       0x0a, *input & V4L2_STD_NTSC ? 0xf0 : 0x20,
+                       0x0b, *input & V4L2_STD_NTSC ? 0x07 : 0x04,
+                       0x0c, *input & V4L2_STD_NTSC ? 0xf0 : 0x20,
+                       0x0d, *input & V4L2_STD_NTSC ? 0x40 : 0x4a,
+                       0x16, *input & V4L2_STD_NTSC ? 0x00 : 0x40,
+                       0x17, *input & V4L2_STD_NTSC ? 0x00 : 0x40,
+                       0x20, *input & V4L2_STD_NTSC ? 0x07 : 0x0f,
+                       0x21, *input & V4L2_STD_NTSC ? 0x07 : 0x0f,
                        0xff,   0xff,
                };
                write_regs(client, regs, dec->channel);
                return -ENOMEM;
        }
        dec->channel = -1;
-       dec->norm = VIDEO_MODE_NTSC;
+       dec->norm = V4L2_STD_NTSC;
        dec->brightness = 128;
        dec->contrast = 128;
        dec->saturation = 128;
 
 #include <linux/init.h>
 #include <linux/version.h>
 #include <linux/i2c.h>
-#include <linux/videodev.h>
-#include <linux/video_decoder.h>
+#include <linux/videodev2.h>
 #include <linux/ioctl.h>
 
 #include "wis-i2c.h"
        struct wis_tw9903 *dec = i2c_get_clientdata(client);
 
        switch (cmd) {
-       case DECODER_SET_INPUT:
+       case VIDIOC_S_INPUT:
        {
                int *input = arg;
 
                struct video_decoder_resolution *res = arg;
                /*int hscale = 256 * 720 / res->width;*/
                int hscale = 256 * 720 / (res->width - (res->width > 704 ? 0 : 8));
-               int vscale = 256 * (dec->norm == VIDEO_MODE_NTSC ?  240 : 288)
+               int vscale = 256 * (dec->norm & V4L2_STD_NTSC ?  240 : 288)
                                / res->height;
                u8 regs[] = {
                        0x0d, vscale & 0xff,
                break;
        }
 #endif
-       case DECODER_SET_NORM:
+       case VIDIOC_S_STD:
        {
-               int *input = arg;
+               v4l2_std_id *input = arg;
                u8 regs[] = {
-                       0x05, *input == VIDEO_MODE_NTSC ? 0x80 : 0x00,
-                       0x07, *input == VIDEO_MODE_NTSC ? 0x02 : 0x12,
-                       0x08, *input == VIDEO_MODE_NTSC ? 0x14 : 0x18,
-                       0x09, *input == VIDEO_MODE_NTSC ? 0xf0 : 0x20,
+                       0x05, *input & V4L2_STD_NTSC ? 0x80 : 0x00,
+                       0x07, *input & V4L2_STD_NTSC ? 0x02 : 0x12,
+                       0x08, *input & V4L2_STD_NTSC ? 0x14 : 0x18,
+                       0x09, *input & V4L2_STD_NTSC ? 0xf0 : 0x20,
                        0,      0,
                };
                write_regs(client, regs);
                kfree(client);
                return -ENOMEM;
        }
-       dec->norm = VIDEO_MODE_NTSC;
+       dec->norm = V4L2_STD_NTSC;
        dec->brightness = 0;
        dec->contrast = 0x60;
        dec->hue = 0;
 
 #include <linux/init.h>
 #include <linux/version.h>
 #include <linux/i2c.h>
-#include <linux/videodev.h>
+#include <linux/videodev2.h>
 #include <media/tvaudio.h>
 #include <media/v4l2-common.h>