*/
 #include <linux/delay.h>
 #include <linux/i2c.h>
-#include <linux/videodev.h>
+#include <linux/videodev2.h>
 #include "tuner-i2c.h"
 #include "mt20xx.h"
 
 
 
 #include <linux/i2c.h>
 #include <linux/delay.h>
-#include <linux/videodev.h>
+#include <linux/videodev2.h>
 #include "tuner-i2c.h"
 #include "tda8290.h"
 #include "tda827x.h"
 
 
 #include <linux/i2c.h>
 #include <linux/delay.h>
-#include <linux/videodev.h>
+#include <linux/videodev2.h>
 #include <media/tuner.h>
 #include "tuner-i2c.h"
 #include "tea5761.h"
 
 
 #include <linux/i2c.h>
 #include <linux/delay.h>
-#include <linux/videodev.h>
+#include <linux/videodev2.h>
 #include "tuner-i2c.h"
 #include "tea5767.h"
 
 
 #ifndef KS0127_H
 #define KS0127_H
 
-#include <linux/videodev.h>
-
 /* input channels */
 #define KS_INPUT_COMPOSITE_1    0
 #define KS_INPUT_COMPOSITE_2    1
 
 #include <linux/kernel.h>
 #include <linux/i2c.h>
 #include <linux/types.h>
-#include <linux/videodev.h>
+#include <linux/videodev2.h>
 #include <linux/init.h>
 #include <linux/errno.h>
 #include <linux/slab.h>
 
 #include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/slab.h>
-#include <linux/videodev.h>
+#include <linux/videodev2.h>
 #include <linux/i2c.h>
 #include <linux/init.h>
 #include <linux/kthread.h>
 
               available) - it returns 0 if the mode is possible
    set_size -> this fn-ref. sets the norm and image size for
               compression/decompression (returns 0 on success)
-              the norm param is defined in videodev.h (VIDEO_MODE_*)
+              the norm param is defined in videodev2.h (V4L2_STD_*)
 
    additional setup may be available, too - but the codec should work with
    some default values even without this
 #ifndef __LINUX_VIDEOCODEC_H
 #define __LINUX_VIDEOCODEC_H
 
-#include <linux/videodev.h>
+#include <linux/videodev2.h>
 
-//should be in videodev.h ??? (VID_DO_....)
 #define CODEC_DO_COMPRESSION 0
 #define CODEC_DO_EXPANSION   1
 
        __u32 width, height;    /* Area to capture */
        __u16 decimation;       /* Decimation divider */
        __u16 flags;            /* Flags for capture */
-/* flags are the same as in struct video_capture - see videodev.h:
-#define VIDEO_CAPTURE_ODD              0
-#define VIDEO_CAPTURE_EVEN             1
-*/
        __u16 quality;          /* quality of the video */
 };
 
 
        /* Video for Linux parameters */
        int input;      /* card's norm and input - norm=VIDEO_MODE_* */
        v4l2_std_id norm;
-       struct video_buffer buffer;     /* Current buffer params */
+
+       /* Current buffer params */
+       void    *vbuf_base;
+       int     vbuf_height, vbuf_width;
+       int     vbuf_depth;
+       int     vbuf_bytesperline;
+
        struct zoran_overlay_settings overlay_settings;
        u32 *overlay_mask;      /* overlay mask */
        enum zoran_lock_activity overlay_active;        /* feature currently in use? */
 
 #include <linux/proc_fs.h>
 #include <linux/i2c.h>
 #include <linux/i2c-algo-bit.h>
-#include <linux/videodev.h>
+#include <linux/videodev2.h>
 #include <media/v4l2-common.h>
 #include <linux/spinlock.h>
 #include <linux/sem.h>
 
 #include <linux/pci.h>
 #include <linux/interrupt.h>
-#include <linux/video_decoder.h>
-#include <linux/video_encoder.h>
 #include <linux/mutex.h>
 
 #include <asm/io.h>
 module_param_array(video_nr, int, NULL, 0444);
 MODULE_PARM_DESC(video_nr, "Video device number (-1=Auto)");
 
-/*
-   Number and size of grab buffers for Video 4 Linux
-   The vast majority of applications should not need more than 2,
-   the very popular BTTV driver actually does ONLY have 2.
-   Time sensitive applications might need more, the maximum
-   is VIDEO_MAX_FRAME (defined in <linux/videodev.h>).
-
-   The size is set so that the maximum possible request
-   can be satisfied. Decrease  it, if bigphys_area alloc'd
-   memory is low. If you don't have the bigphys_area patch,
-   set it to 128 KB. Will you allow only to grab small
-   images with V4L, but that's better than nothing.
-
-   v4l_bufsize has to be given in KB !
-
-*/
-
 int v4l_nbufs = 4;
 int v4l_bufsize = 810;         /* Everybody should be able to work with this setting */
 module_param(v4l_nbufs, int, 0644);
        zr->jpg_buffers.allocated = 0;
        zr->v4l_buffers.allocated = 0;
 
-       zr->buffer.base = (void *) vidmem;
-       zr->buffer.width = 0;
-       zr->buffer.height = 0;
-       zr->buffer.depth = 0;
-       zr->buffer.bytesperline = 0;
+       zr->vbuf_base = (void *) vidmem;
+       zr->vbuf_width = 0;
+       zr->vbuf_height = 0;
+       zr->vbuf_depth = 0;
+       zr->vbuf_bytesperline = 0;
 
        /* Avoid nonsense settings from user for default input/norm */
-       if (default_norm < VIDEO_MODE_PAL &&
-           default_norm > VIDEO_MODE_SECAM)
-               default_norm = VIDEO_MODE_PAL;
-       if (default_norm == VIDEO_MODE_PAL) {
+       if (default_norm < 0 && default_norm > 2)
+               default_norm = 0;
+       if (default_norm == 0) {
                zr->norm = V4L2_STD_PAL;
                zr->timing = zr->card.tvn[0];
-       } else if (default_norm == VIDEO_MODE_NTSC) {
+       } else if (default_norm == 1) {
                zr->norm = V4L2_STD_NTSC;
                zr->timing = zr->card.tvn[1];
        } else {
                        ZORAN_NAME, vidmem);
        }
 
-       /* random nonsense */
-       dprintk(6, KERN_DEBUG "Jotti is een held!\n");
-
        /* some mainboards might not do PCI-PCI data transfer well */
        if (pci_pci_problems & (PCIPCI_FAIL|PCIAGP_FAIL|PCIPCI_ALIMAGIK)) {
                dprintk(1,
 
                 * All error messages are internal driver checking only! */
 
                /* video display top and bottom registers */
-               reg = (long) zr->buffer.base +
+               reg = (long) zr->vbuf_base +
                    zr->overlay_settings.x *
                    ((zr->overlay_settings.format->depth + 7) / 8) +
                    zr->overlay_settings.y *
-                   zr->buffer.bytesperline;
+                   zr->vbuf_bytesperline;
                btwrite(reg, ZR36057_VDTR);
                if (reg & 3)
                        dprintk(1,
                                "%s: zr36057_overlay() - video_address not aligned\n",
                                ZR_DEVNAME(zr));
                if (zr->overlay_settings.height > BUZ_MAX_HEIGHT / 2)
-                       reg += zr->buffer.bytesperline;
+                       reg += zr->vbuf_bytesperline;
                btwrite(reg, ZR36057_VDBR);
 
                /* video stride, status, and frame grab register */
-               reg = zr->buffer.bytesperline -
+               reg = zr->vbuf_bytesperline -
                    zr->overlay_settings.width *
                    ((zr->overlay_settings.format->depth + 7) / 8);
                if (zr->overlay_settings.height > BUZ_MAX_HEIGHT / 2)
-                       reg += zr->buffer.bytesperline;
+                       reg += zr->vbuf_bytesperline;
                if (reg & 3)
                        dprintk(1,
                                KERN_ERR
 
 void
 write_overlay_mask (struct file       *file,
-                   struct video_clip *vp,
+                   struct v4l2_clip *vp,
                    int                count)
 {
        struct zoran_fh *fh = file->private_data;
 
        for (i = 0; i < count; ++i) {
                /* pick up local copy of clip */
-               x = vp[i].x;
-               y = vp[i].y;
-               width = vp[i].width;
-               height = vp[i].height;
+               x = vp[i].c.left;
+               y = vp[i].c.top;
+               width = vp[i].c.width;
+               height = vp[i].c.height;
 
                /* trim clips that extend beyond the window */
                if (x < 0) {
 
 extern void zr36057_overlay(struct zoran *zr,
                            int on);
 extern void write_overlay_mask(struct file *file,
-                              struct video_clip *vp,
+                              struct v4l2_clip *vp,
                               int count);
 extern void zr36057_set_memgrab(struct zoran *zr,
                                int mode);
 
 
 #include <linux/spinlock.h>
 
-#include <linux/videodev.h>
+#include <linux/videodev2.h>
 #include <media/v4l2-common.h>
 #include <media/v4l2-ioctl.h>
 #include "videocodec.h"
 #include <asm/uaccess.h>
 #include <linux/proc_fs.h>
 
-#include <linux/video_decoder.h>
-#include <linux/video_encoder.h>
 #include <linux/mutex.h>
 #include "zoran.h"
 #include "zoran_device.h"
                return -EINVAL;
        }
 
-       zr->buffer.base = (void *) ((unsigned long) base & ~3);
-       zr->buffer.height = height;
-       zr->buffer.width = width;
-       zr->buffer.depth = fmt->depth;
+       zr->vbuf_base = (void *) ((unsigned long) base & ~3);
+       zr->vbuf_height = height;
+       zr->vbuf_width = width;
+       zr->vbuf_depth = fmt->depth;
        zr->overlay_settings.format = fmt;
-       zr->buffer.bytesperline = bytesperline;
+       zr->vbuf_bytesperline = bytesperline;
 
        /* The user should set new window parameters */
        zr->overlay_settings.is_set = 0;
              int                y,
              int                width,
              int                height,
-             struct video_clip __user *clips,
+             struct v4l2_clip __user *clips,
              int                clipcount,
              void              __user *bitmap)
 {
        struct zoran_fh *fh = file->private_data;
        struct zoran *zr = fh->zr;
-       struct video_clip *vcp = NULL;
+       struct v4l2_clip *vcp = NULL;
        int on, end;
 
 
-       if (!zr->buffer.base) {
+       if (!zr->vbuf_base) {
                dprintk(1,
                        KERN_ERR
                        "%s: setup_window() - frame buffer has to be set first\n",
         * The video front end needs 4-byte alinged line sizes, we correct that
         * silently here if necessary
         */
-       if (zr->buffer.depth == 15 || zr->buffer.depth == 16) {
+       if (zr->vbuf_depth == 15 || zr->vbuf_depth == 16) {
                end = (x + width) & ~1; /* round down */
                x = (x + 1) & ~1;       /* round up */
                width = end - x;
        }
 
-       if (zr->buffer.depth == 24) {
+       if (zr->vbuf_depth == 24) {
                end = (x + width) & ~3; /* round down */
                x = (x + 3) & ~3;       /* round up */
                width = end - x;
                }
        } else if (clipcount > 0) {
                /* write our own bitmap from the clips */
-               vcp = vmalloc(sizeof(struct video_clip) * (clipcount + 4));
+               vcp = vmalloc(sizeof(struct v4l2_clip) * (clipcount + 4));
                if (vcp == NULL) {
                        dprintk(1,
                                KERN_ERR
                        return -ENOMEM;
                }
                if (copy_from_user
-                   (vcp, clips, sizeof(struct video_clip) * clipcount)) {
+                   (vcp, clips, sizeof(struct v4l2_clip) * clipcount)) {
                        vfree(vcp);
                        return -EFAULT;
                }
                        zr36057_overlay(zr, 0);
                zr->overlay_mask = NULL;
        } else {
-               if (!zr->buffer.base || !fh->overlay_settings.is_set) {
+               if (!zr->vbuf_base || !fh->overlay_settings.is_set) {
                        dprintk(1,
                                KERN_ERR
                                "%s: setup_overlay() - buffer or window not set\n",
                        fmt->fmt.win.w.top,
                        fmt->fmt.win.w.width,
                        fmt->fmt.win.w.height,
-                       (struct video_clip __user *)
+                       (struct v4l2_clip __user *)
                        fmt->fmt.win.clips,
                        fmt->fmt.win.clipcount,
                        fmt->fmt.win.bitmap);
 
        memset(fb, 0, sizeof(*fb));
        mutex_lock(&zr->resource_lock);
-       fb->base = zr->buffer.base;
-       fb->fmt.width = zr->buffer.width;
-       fb->fmt.height = zr->buffer.height;
+       fb->base = zr->vbuf_base;
+       fb->fmt.width = zr->vbuf_width;
+       fb->fmt.height = zr->vbuf_height;
        if (zr->overlay_settings.format)
                fb->fmt.pixelformat = fh->overlay_settings.format->fourcc;
-       fb->fmt.bytesperline = zr->buffer.bytesperline;
+       fb->fmt.bytesperline = zr->vbuf_bytesperline;
        mutex_unlock(&zr->resource_lock);
        fb->fmt.colorspace = V4L2_COLORSPACE_SRGB;
        fb->fmt.field = V4L2_FIELD_INTERLACED;
 
 #include <linux/pci.h>
 #include <linux/i2c.h>
 #include <linux/i2c-algo-bit.h>
-#include <linux/videodev.h>
+#include <linux/videodev2.h>
 #include <linux/spinlock.h>
 #include <linux/sem.h>
 #include <linux/seq_file.h>
 
 #include <linux/types.h>
 #include <linux/wait.h>
 
-/* includes for structures and defines regarding video
-   #include<linux/videodev.h> */
-
 /* I/O commands, error codes */
 #include <asm/io.h>
-//#include<errno.h>
 
 /* v4l  API */
-#include <linux/videodev.h>
 
 /* headerfile of this module */
 #include"zr36016.h"
 
 #include <linux/types.h>
 #include <linux/wait.h>
 
-/* includes for structures and defines regarding video
-   #include<linux/videodev.h> */
-
 /* I/O commands, error codes */
 #include <asm/io.h>
-//#include<errno.h>
 
 /* headerfile of this module */
 #include "zr36050.h"
 
 #include <linux/types.h>
 #include <linux/wait.h>
 
-/* includes for structures and defines regarding video
-   #include<linux/videodev.h> */
-
 /* I/O commands, error codes */
 #include <asm/io.h>
-//#include<errno.h>
 
 /* headerfile of this module */
 #include "zr36060.h"