aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2006-06-04 09:06:18 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-06-25 01:05:04 -0400
commit401998fa96fe18b057af3f906527196522dd2d9d (patch)
tree32d656e18410ab05204c83b57969db23665e4fe9 /include/linux
parent7565ab082de88ec274283d6b83980144e520a2fc (diff)
V4L/DVB (4065): Several improvements at videodev.c
Videodev now is capable of better handling V4L2 api, by processing V4L2 ioctls and using callbacks to the driver. The drivers should be migrated to the newer way and the older one will be obsoleted soon. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/videodev.h58
-rw-r--r--include/linux/videodev2.h135
2 files changed, 30 insertions, 163 deletions
diff --git a/include/linux/videodev.h b/include/linux/videodev.h
index 91140091ced2..5b6205544a7a 100644
--- a/include/linux/videodev.h
+++ b/include/linux/videodev.h
@@ -1,49 +1,28 @@
1/*
2 * Video for Linux version 1 - OBSOLETE
3 *
4 * Header file for v4l1 drivers and applications, for
5 * Linux kernels 2.2.x or 2.4.x.
6 *
7 * Provides header for legacy drivers and applications
8 *
9 * See http://linuxtv.org for more info
10 *
11 */
1#ifndef __LINUX_VIDEODEV_H 12#ifndef __LINUX_VIDEODEV_H
2#define __LINUX_VIDEODEV_H 13#define __LINUX_VIDEODEV_H
3 14
4#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/poll.h>
17#include <linux/fs.h>
18#include <linux/device.h>
19#include <linux/mutex.h>
20#include <linux/compiler.h> /* need __user */
5 21
6#define HAVE_V4L1 1 22#define HAVE_V4L1 1
7 23
8#include <linux/videodev2.h> 24#include <linux/videodev2.h>
9 25
10#ifdef __KERNEL__
11
12#include <linux/mm.h>
13
14extern struct video_device* video_devdata(struct file*);
15
16#define to_video_device(cd) container_of(cd, struct video_device, class_dev)
17static inline void
18video_device_create_file(struct video_device *vfd,
19 struct class_device_attribute *attr)
20{
21 class_device_create_file(&vfd->class_dev, attr);
22}
23static inline void
24video_device_remove_file(struct video_device *vfd,
25 struct class_device_attribute *attr)
26{
27 class_device_remove_file(&vfd->class_dev, attr);
28}
29
30#if OBSOLETE_OWNER /* to be removed in 2.6.15 */
31/* helper functions to access driver private data. */
32static inline void *video_get_drvdata(struct video_device *dev)
33{
34 return dev->priv;
35}
36
37static inline void video_set_drvdata(struct video_device *dev, void *data)
38{
39 dev->priv = data;
40}
41#endif
42
43extern int video_exclusive_open(struct inode *inode, struct file *file);
44extern int video_exclusive_release(struct inode *inode, struct file *file);
45#endif /* __KERNEL__ */
46
47struct video_capability 26struct video_capability
48{ 27{
49 char name[32]; 28 char name[32];
@@ -363,6 +342,11 @@ struct video_code
363#define VID_HARDWARE_SAA7114H 37 342#define VID_HARDWARE_SAA7114H 37
364#define VID_HARDWARE_SN9C102 38 343#define VID_HARDWARE_SN9C102 38
365#define VID_HARDWARE_ARV 39 344#define VID_HARDWARE_ARV 39
345
346#ifdef __KERNEL__
347#include <media/v4l2-dev.h>
348#endif /* __KERNEL__ */
349
366#endif /* __LINUX_VIDEODEV_H */ 350#endif /* __LINUX_VIDEODEV_H */
367 351
368/* 352/*
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index b3a848b6fb1c..bb58197ab6b9 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -1,29 +1,23 @@
1#ifndef __LINUX_VIDEODEV2_H
2#define __LINUX_VIDEODEV2_H
3/* 1/*
4 * Video for Linux Two 2 * Video for Linux Two
5 * 3 *
6 * Header file for v4l or V4L2 drivers and applications, for 4 * Header file for v4l or V4L2 drivers and applications
7 * Linux kernels 2.2.x or 2.4.x. 5 * with public API.
6 * All kernel-specific stuff were moved to media/v4l2-dev.h, so
7 * no #if __KERNEL tests are allowed here
8 * 8 *
9 * See http://bytesex.org/v4l/ for API specs and other 9 * See http://linuxtv.org for more info
10 * v4l2 documentation.
11 * 10 *
12 * Author: Bill Dirks <bdirks@pacbell.net> 11 * Author: Bill Dirks <bdirks@pacbell.net>
13 * Justin Schoeman 12 * Justin Schoeman
14 * et al. 13 * et al.
15 */ 14 */
16#ifdef __KERNEL__ 15#ifndef __LINUX_VIDEODEV2_H
16#define __LINUX_VIDEODEV2_H
17#include <linux/time.h> /* need struct timeval */ 17#include <linux/time.h> /* need struct timeval */
18#include <linux/poll.h>
19#include <linux/device.h>
20#include <linux/mutex.h>
21#endif
22#include <linux/types.h> 18#include <linux/types.h>
23#include <linux/compiler.h> /* need __user */ 19#include <linux/compiler.h> /* need __user */
24 20
25
26#define OBSOLETE_OWNER 1 /* It will be removed for 2.6.17 */
27#define HAVE_V4L2 1 21#define HAVE_V4L2 1
28 22
29/* 23/*
@@ -48,71 +42,6 @@
48#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */ 42#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */
49#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */ 43#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */
50 44
51#ifdef __KERNEL__
52
53/* Minor device allocation */
54#define MINOR_VFL_TYPE_GRABBER_MIN 0
55#define MINOR_VFL_TYPE_GRABBER_MAX 63
56#define MINOR_VFL_TYPE_RADIO_MIN 64
57#define MINOR_VFL_TYPE_RADIO_MAX 127
58#define MINOR_VFL_TYPE_VTX_MIN 192
59#define MINOR_VFL_TYPE_VTX_MAX 223
60#define MINOR_VFL_TYPE_VBI_MIN 224
61#define MINOR_VFL_TYPE_VBI_MAX 255
62
63#define VFL_TYPE_GRABBER 0
64#define VFL_TYPE_VBI 1
65#define VFL_TYPE_RADIO 2
66#define VFL_TYPE_VTX 3
67
68struct video_device
69{
70 /* device info */
71 struct device *dev;
72 char name[32];
73 int type; /* v4l1 */
74 int type2; /* v4l2 */
75 int hardware;
76 int minor;
77
78 /* device ops + callbacks */
79 const struct file_operations *fops;
80 void (*release)(struct video_device *vfd);
81
82
83#if OBSOLETE_OWNER /* to be removed in 2.6.15 */
84 /* obsolete -- fops->owner is used instead */
85 struct module *owner;
86 /* dev->driver_data will be used instead some day.
87 * Use the video_{get|set}_drvdata() helper functions,
88 * so the switch over will be transparent for you.
89 * Or use {pci|usb}_{get|set}_drvdata() directly. */
90 void *priv;
91#endif
92
93 /* for videodev.c intenal usage -- please don't touch */
94 int users; /* video_exclusive_{open|close} ... */
95 struct mutex lock; /* ... helper function uses these */
96 char devfs_name[64]; /* devfs */
97 struct class_device class_dev; /* sysfs */
98};
99
100#define VIDEO_MAJOR 81
101
102extern int video_register_device(struct video_device *, int type, int nr);
103extern void video_unregister_device(struct video_device *);
104extern int video_usercopy(struct inode *inode, struct file *file,
105 unsigned int cmd, unsigned long arg,
106 int (*func)(struct inode *inode, struct file *file,
107 unsigned int cmd, void *arg));
108
109/* helper functions to alloc / release struct video_device, the
110 later can be used for video_device->release() */
111struct video_device *video_device_alloc(void);
112void video_device_release(struct video_device *vfd);
113
114#endif
115
116/* 45/*
117 * M I S C E L L A N E O U S 46 * M I S C E L L A N E O U S
118 */ 47 */
@@ -1098,6 +1027,7 @@ struct v4l2_streamparm
1098#endif 1027#endif
1099#define VIDIOC_LOG_STATUS _IO ('V', 70) 1028#define VIDIOC_LOG_STATUS _IO ('V', 70)
1100 1029
1030#ifdef __OLD_VIDIOC_
1101/* for compatibility, will go away some day */ 1031/* for compatibility, will go away some day */
1102#define VIDIOC_OVERLAY_OLD _IOWR ('V', 14, int) 1032#define VIDIOC_OVERLAY_OLD _IOWR ('V', 14, int)
1103#define VIDIOC_S_PARM_OLD _IOW ('V', 22, struct v4l2_streamparm) 1033#define VIDIOC_S_PARM_OLD _IOW ('V', 22, struct v4l2_streamparm)
@@ -1105,57 +1035,10 @@ struct v4l2_streamparm
1105#define VIDIOC_G_AUDIO_OLD _IOWR ('V', 33, struct v4l2_audio) 1035#define VIDIOC_G_AUDIO_OLD _IOWR ('V', 33, struct v4l2_audio)
1106#define VIDIOC_G_AUDOUT_OLD _IOWR ('V', 49, struct v4l2_audioout) 1036#define VIDIOC_G_AUDOUT_OLD _IOWR ('V', 49, struct v4l2_audioout)
1107#define VIDIOC_CROPCAP_OLD _IOR ('V', 58, struct v4l2_cropcap) 1037#define VIDIOC_CROPCAP_OLD _IOR ('V', 58, struct v4l2_cropcap)
1108
1109#define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */
1110
1111
1112#ifdef __KERNEL__
1113/*
1114 *
1115 * V 4 L 2 D R I V E R H E L P E R A P I
1116 *
1117 * Some commonly needed functions for drivers (v4l2-common.o module)
1118 */
1119#include <linux/fs.h>
1120
1121/* Video standard functions */
1122extern unsigned int v4l2_video_std_fps(struct v4l2_standard *vs);
1123extern int v4l2_video_std_construct(struct v4l2_standard *vs,
1124 int id, char *name);
1125
1126/* prority handling */
1127struct v4l2_prio_state {
1128 atomic_t prios[4];
1129};
1130int v4l2_prio_init(struct v4l2_prio_state *global);
1131int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local,
1132 enum v4l2_priority new);
1133int v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local);
1134int v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority *local);
1135enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global);
1136int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local);
1137
1138/* names for fancy debug output */
1139extern char *v4l2_field_names[];
1140extern char *v4l2_type_names[];
1141
1142/* Compatibility layer interface -- v4l1-compat module */
1143typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file,
1144 unsigned int cmd, void *arg);
1145
1146#ifdef CONFIG_VIDEO_V4L1_COMPAT
1147int v4l_compat_translate_ioctl(struct inode *inode, struct file *file,
1148 int cmd, void *arg, v4l2_kioctl driver_ioctl);
1149#else
1150#define v4l_compat_translate_ioctl(inode,file,cmd,arg,ioctl) -EINVAL
1151#endif 1038#endif
1152 1039
1153/* 32 Bits compatibility layer for 64 bits processors */ 1040#define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */
1154extern long v4l_compat_ioctl32(struct file *file, unsigned int cmd,
1155 unsigned long arg);
1156
1157 1041
1158#endif /* __KERNEL__ */
1159#endif /* __LINUX_VIDEODEV2_H */ 1042#endif /* __LINUX_VIDEODEV2_H */
1160 1043
1161/* 1044/*