3 * V 4 L 2 D R I V E R H E L P E R A P I
5 * Moved from videodev2.h
7 * Some commonly needed functions for drivers (v4l2-common.o module)
12 #define OBSOLETE_DEVDATA 1 /* to be removed soon */
14 #include <linux/poll.h>
16 #include <linux/device.h>
17 #include <linux/mutex.h>
18 #include <linux/compiler.h> /* need __user */
19 #include <linux/videodev2.h>
21 #define VIDEO_MAJOR 81
22 /* Minor device allocation */
23 #define MINOR_VFL_TYPE_GRABBER_MIN 0
24 #define MINOR_VFL_TYPE_GRABBER_MAX 63
25 #define MINOR_VFL_TYPE_RADIO_MIN 64
26 #define MINOR_VFL_TYPE_RADIO_MAX 127
27 #define MINOR_VFL_TYPE_VTX_MIN 192
28 #define MINOR_VFL_TYPE_VTX_MAX 223
29 #define MINOR_VFL_TYPE_VBI_MIN 224
30 #define MINOR_VFL_TYPE_VBI_MAX 255
32 #define VFL_TYPE_GRABBER 0
33 #define VFL_TYPE_VBI 1
34 #define VFL_TYPE_RADIO 2
35 #define VFL_TYPE_VTX 3
37 struct v4l2_ioctl_callbacks;
40 * Newer version of video_device, handled by videodev2.c
41 * This version moves redundant code from video device code to
48 const struct file_operations *fops;
51 struct device dev; /* v4l device */
52 struct device *parent; /* device parent */
58 /* attribute to differentiate multiple indices on one physical device */
61 int debug; /* Activates debug level*/
63 /* Video standard vars */
64 v4l2_std_id tvnorms; /* Supported tv norms */
65 v4l2_std_id current_norm; /* Current tvnorm */
68 void (*release)(struct video_device *vfd);
71 const struct v4l2_ioctl_ops *ioctl_ops;
74 /* Class-dev to video-device */
75 #define to_video_device(cd) container_of(cd, struct video_device, dev)
77 /* Version 2 functions */
78 int __must_check video_register_device(struct video_device *vfd, int type, int nr);
79 int __must_check video_register_device_index(struct video_device *vfd, int type, int nr,
81 void video_unregister_device(struct video_device *);
83 /* helper functions to alloc / release struct video_device, the
84 later can be used for video_device->release() */
85 struct video_device * __must_check video_device_alloc(void);
86 /* this release function frees the vfd pointer */
87 void video_device_release(struct video_device *vfd);
88 /* this release function does nothing, use when the video_device is a
89 static global struct. Note that having a static video_device is
90 a dubious construction at best. */
91 void video_device_release_empty(struct video_device *vfd);
93 /* helper functions to access driver private data. */
94 static inline void *video_get_drvdata(struct video_device *dev)
96 return dev_get_drvdata(&dev->dev);
99 static inline void video_set_drvdata(struct video_device *dev, void *data)
101 dev_set_drvdata(&dev->dev, data);
104 #ifdef OBSOLETE_DEVDATA /* to be removed soon */
105 /* Obsolete stuff - Still needed for radio devices and obsolete drivers */
106 extern struct video_device* video_devdata(struct file*);
109 #endif /* _V4L2_DEV_H */