Commit 79436633 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab Committed by Linus Torvalds

[PATCH] v4l: 809: some changes to allow compiling cx88 and saa7134

- Some changes to allow compiling cx88 and saa7134 without V4L1 support.
- This patch will help obsoleting V4L1 API.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@brturbo.com.br>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent de48eebc
...@@ -34,6 +34,9 @@ ...@@ -34,6 +34,9 @@
#include "cx88.h" #include "cx88.h"
/* Include V4L1 specific functions. Should be removed soon */
#include <linux/videodev.h>
MODULE_DESCRIPTION("v4l2 driver module for cx2388x based TV cards"); MODULE_DESCRIPTION("v4l2 driver module for cx2388x based TV cards");
MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -1187,7 +1190,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file, ...@@ -1187,7 +1190,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
struct v4l2_format *f = arg; struct v4l2_format *f = arg;
return cx8800_try_fmt(dev,fh,f); return cx8800_try_fmt(dev,fh,f);
} }
#ifdef HAVE_V4L1
/* --- streaming capture ------------------------------------- */ /* --- streaming capture ------------------------------------- */
case VIDIOCGMBUF: case VIDIOCGMBUF:
{ {
...@@ -1213,6 +1216,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file, ...@@ -1213,6 +1216,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
} }
return 0; return 0;
} }
#endif
case VIDIOC_REQBUFS: case VIDIOC_REQBUFS:
return videobuf_reqbufs(get_queue(fh), arg); return videobuf_reqbufs(get_queue(fh), arg);
...@@ -1244,7 +1248,6 @@ static int video_do_ioctl(struct inode *inode, struct file *file, ...@@ -1244,7 +1248,6 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
res_free(dev,fh,res); res_free(dev,fh,res);
return 0; return 0;
} }
default: default:
return cx88_do_ioctl( inode, file, fh->radio, core, cmd, arg, video_do_ioctl ); return cx88_do_ioctl( inode, file, fh->radio, core, cmd, arg, video_do_ioctl );
} }
...@@ -1537,6 +1540,7 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, ...@@ -1537,6 +1540,7 @@ static int radio_do_ioctl(struct inode *inode, struct file *file,
*id = 0; *id = 0;
return 0; return 0;
} }
#ifdef HAVE_V4L1
case VIDIOCSTUNER: case VIDIOCSTUNER:
{ {
struct video_tuner *v = arg; struct video_tuner *v = arg;
...@@ -1547,6 +1551,7 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, ...@@ -1547,6 +1551,7 @@ static int radio_do_ioctl(struct inode *inode, struct file *file,
cx88_call_i2c_clients(core,VIDIOCSTUNER,v); cx88_call_i2c_clients(core,VIDIOCSTUNER,v);
return 0; return 0;
} }
#endif
case VIDIOC_S_TUNER: case VIDIOC_S_TUNER:
{ {
struct v4l2_tuner *t = arg; struct v4l2_tuner *t = arg;
......
...@@ -30,6 +30,9 @@ ...@@ -30,6 +30,9 @@
#include "saa7134-reg.h" #include "saa7134-reg.h"
#include "saa7134.h" #include "saa7134.h"
/* Include V4L1 specific functions. Should be removed soon */
#include <linux/videodev.h>
/* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */
static unsigned int video_debug = 0; static unsigned int video_debug = 0;
...@@ -2060,7 +2063,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file, ...@@ -2060,7 +2063,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
struct v4l2_format *f = arg; struct v4l2_format *f = arg;
return saa7134_try_fmt(dev,fh,f); return saa7134_try_fmt(dev,fh,f);
} }
#ifdef HAVE_V4L1
case VIDIOCGMBUF: case VIDIOCGMBUF:
{ {
struct video_mbuf *mbuf = arg; struct video_mbuf *mbuf = arg;
...@@ -2085,6 +2088,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file, ...@@ -2085,6 +2088,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
} }
return 0; return 0;
} }
#endif
case VIDIOC_REQBUFS: case VIDIOC_REQBUFS:
return videobuf_reqbufs(saa7134_queue(fh),arg); return videobuf_reqbufs(saa7134_queue(fh),arg);
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/videodev.h> #include <linux/videodev2.h>
#include <linux/kdev_t.h> #include <linux/kdev_t.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/notifier.h> #include <linux/notifier.h>
......
#ifndef __LINUX_VIDEODEV_H #ifndef __LINUX_VIDEODEV_H
#define __LINUX_VIDEODEV_H #define __LINUX_VIDEODEV_H
#include <linux/compiler.h>
#include <linux/types.h> #include <linux/types.h>
#define HAVE_V4L2 1 #define HAVE_V4L1 1
#include <linux/videodev2.h> #include <linux/videodev2.h>
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <linux/poll.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/device.h>
struct video_device
{
/* device info */
struct device *dev;
char name[32];
int type; /* v4l1 */
int type2; /* v4l2 */
int hardware;
int minor;
/* device ops + callbacks */
struct file_operations *fops;
void (*release)(struct video_device *vfd);
/* obsolete -- fops->owner is used instead */
struct module *owner;
/* dev->driver_data will be used instead some day.
* Use the video_{get|set}_drvdata() helper functions,
* so the switch over will be transparent for you.
* Or use {pci|usb}_{get|set}_drvdata() directly. */
void *priv;
/* for videodev.c intenal usage -- please don't touch */
int users; /* video_exclusive_{open|close} ... */
struct semaphore lock; /* ... helper function uses these */
char devfs_name[64]; /* devfs */
struct class_device class_dev; /* sysfs */
};
#define VIDEO_MAJOR 81
#define VFL_TYPE_GRABBER 0
#define VFL_TYPE_VBI 1
#define VFL_TYPE_RADIO 2
#define VFL_TYPE_VTX 3
extern int video_register_device(struct video_device *, int type, int nr);
extern void video_unregister_device(struct video_device *);
extern struct video_device* video_devdata(struct file*); extern struct video_device* video_devdata(struct file*);
#define to_video_device(cd) container_of(cd, struct video_device, class_dev) #define to_video_device(cd) container_of(cd, struct video_device, class_dev)
...@@ -68,11 +27,6 @@ video_device_remove_file(struct video_device *vfd, ...@@ -68,11 +27,6 @@ video_device_remove_file(struct video_device *vfd,
class_device_remove_file(&vfd->class_dev, attr); class_device_remove_file(&vfd->class_dev, attr);
} }
/* helper functions to alloc / release struct video_device, the
later can be used for video_device->release() */
struct video_device *video_device_alloc(void);
void video_device_release(struct video_device *vfd);
/* helper functions to access driver private data. */ /* helper functions to access driver private data. */
static inline void *video_get_drvdata(struct video_device *dev) static inline void *video_get_drvdata(struct video_device *dev)
{ {
...@@ -86,27 +40,8 @@ static inline void video_set_drvdata(struct video_device *dev, void *data) ...@@ -86,27 +40,8 @@ static inline void video_set_drvdata(struct video_device *dev, void *data)
extern int video_exclusive_open(struct inode *inode, struct file *file); extern int video_exclusive_open(struct inode *inode, struct file *file);
extern int video_exclusive_release(struct inode *inode, struct file *file); extern int video_exclusive_release(struct inode *inode, struct file *file);
extern int video_usercopy(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg,
int (*func)(struct inode *inode, struct file *file,
unsigned int cmd, void *arg));
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#define VID_TYPE_CAPTURE 1 /* Can capture */
#define VID_TYPE_TUNER 2 /* Can tune */
#define VID_TYPE_TELETEXT 4 /* Does teletext */
#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */
#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */
#define VID_TYPE_CLIPPING 32 /* Can clip */
#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */
#define VID_TYPE_SCALES 128 /* Scalable */
#define VID_TYPE_MONOCHROME 256 /* Monochrome only */
#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */
#define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */
#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */
#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */
#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */
struct video_capability struct video_capability
{ {
char name[32]; char name[32];
...@@ -260,9 +195,6 @@ struct video_key ...@@ -260,9 +195,6 @@ struct video_key
__u32 flags; __u32 flags;
}; };
#define VIDEO_MAX_FRAME 32
struct video_mbuf struct video_mbuf
{ {
int size; /* Total memory to map */ int size; /* Total memory to map */
...@@ -270,10 +202,8 @@ struct video_mbuf ...@@ -270,10 +202,8 @@ struct video_mbuf
int offsets[VIDEO_MAX_FRAME]; int offsets[VIDEO_MAX_FRAME];
}; };
#define VIDEO_NO_UNIT (-1) #define VIDEO_NO_UNIT (-1)
struct video_unit struct video_unit
{ {
int video; /* Video minor */ int video; /* Video minor */
......
...@@ -18,6 +18,82 @@ ...@@ -18,6 +18,82 @@
#endif #endif
#include <linux/compiler.h> /* need __user */ #include <linux/compiler.h> /* need __user */
#include <linux/poll.h>
#include <linux/device.h>
#define HAVE_V4L2 1
/*
* Common stuff for both V4L1 and V4L2
* Moved from videodev.h
*/
#define VIDEO_MAX_FRAME 32
#define VFL_TYPE_GRABBER 0
#define VFL_TYPE_VBI 1
#define VFL_TYPE_RADIO 2
#define VFL_TYPE_VTX 3
struct video_device
{
/* device info */
struct device *dev;
char name[32];
int type; /* v4l1 */
int type2; /* v4l2 */
int hardware;
int minor;
/* device ops + callbacks */
struct file_operations *fops;
void (*release)(struct video_device *vfd);
/* obsolete -- fops->owner is used instead */
struct module *owner;
/* dev->driver_data will be used instead some day.
* Use the video_{get|set}_drvdata() helper functions,
* so the switch over will be transparent for you.
* Or use {pci|usb}_{get|set}_drvdata() directly. */
void *priv;
/* for videodev.c intenal usage -- please don't touch */
int users; /* video_exclusive_{open|close} ... */
struct semaphore lock; /* ... helper function uses these */
char devfs_name[64]; /* devfs */
struct class_device class_dev; /* sysfs */
};
#define VIDEO_MAJOR 81
#define VID_TYPE_CAPTURE 1 /* Can capture */
#define VID_TYPE_TUNER 2 /* Can tune */
#define VID_TYPE_TELETEXT 4 /* Does teletext */
#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */
#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */
#define VID_TYPE_CLIPPING 32 /* Can clip */
#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */
#define VID_TYPE_SCALES 128 /* Scalable */
#define VID_TYPE_MONOCHROME 256 /* Monochrome only */
#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */
#define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */
#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */
#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */
#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */
extern int video_register_device(struct video_device *, int type, int nr);
extern void video_unregister_device(struct video_device *);
extern int video_usercopy(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg,
int (*func)(struct inode *inode, struct file *file,
unsigned int cmd, void *arg));
/* helper functions to alloc / release struct video_device, the
later can be used for video_device->release() */
struct video_device *video_device_alloc(void);
void video_device_release(struct video_device *vfd);
/* /*
* M I S C E L L A N E O U S * M I S C E L L A N E O U S
*/ */
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* (at your option) any later version. * (at your option) any later version.
*/ */
#include <linux/videodev.h> #include <linux/videodev2.h>
#define UNSET (-1U) #define UNSET (-1U)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment