diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-06-04 09:06:18 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-06-25 01:05:04 -0400 |
commit | 401998fa96fe18b057af3f906527196522dd2d9d (patch) | |
tree | 32d656e18410ab05204c83b57969db23665e4fe9 /include/linux/videodev2.h | |
parent | 7565ab082de88ec274283d6b83980144e520a2fc (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/videodev2.h')
-rw-r--r-- | include/linux/videodev2.h | 135 |
1 files changed, 9 insertions, 126 deletions
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 | |||
68 | struct 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 | |||
102 | extern int video_register_device(struct video_device *, int type, int nr); | ||
103 | extern void video_unregister_device(struct video_device *); | ||
104 | extern 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() */ | ||
111 | struct video_device *video_device_alloc(void); | ||
112 | void 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 */ | ||
1122 | extern unsigned int v4l2_video_std_fps(struct v4l2_standard *vs); | ||
1123 | extern int v4l2_video_std_construct(struct v4l2_standard *vs, | ||
1124 | int id, char *name); | ||
1125 | |||
1126 | /* prority handling */ | ||
1127 | struct v4l2_prio_state { | ||
1128 | atomic_t prios[4]; | ||
1129 | }; | ||
1130 | int v4l2_prio_init(struct v4l2_prio_state *global); | ||
1131 | int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local, | ||
1132 | enum v4l2_priority new); | ||
1133 | int v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local); | ||
1134 | int v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority *local); | ||
1135 | enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global); | ||
1136 | int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local); | ||
1137 | |||
1138 | /* names for fancy debug output */ | ||
1139 | extern char *v4l2_field_names[]; | ||
1140 | extern char *v4l2_type_names[]; | ||
1141 | |||
1142 | /* Compatibility layer interface -- v4l1-compat module */ | ||
1143 | typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file, | ||
1144 | unsigned int cmd, void *arg); | ||
1145 | |||
1146 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
1147 | int 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 */ |
1154 | extern 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 | /* |