Hans Verkuil | 35ea11f | 2008-07-20 08:12:02 -0300 | [diff] [blame] | 1 | /* |
| 2 | * |
| 3 | * V 4 L 2 D R I V E R H E L P E R A P I |
| 4 | * |
| 5 | * Moved from videodev2.h |
| 6 | * |
| 7 | * Some commonly needed functions for drivers (v4l2-common.o module) |
| 8 | */ |
| 9 | #ifndef _V4L2_IOCTL_H |
| 10 | #define _V4L2_IOCTL_H |
| 11 | |
| 12 | #include <linux/poll.h> |
| 13 | #include <linux/fs.h> |
| 14 | #include <linux/device.h> |
| 15 | #include <linux/mutex.h> |
| 16 | #include <linux/compiler.h> /* need __user */ |
| 17 | #ifdef CONFIG_VIDEO_V4L1_COMPAT |
| 18 | #include <linux/videodev.h> |
| 19 | #else |
| 20 | #include <linux/videodev2.h> |
| 21 | #endif |
| 22 | |
Mauro Carvalho Chehab | 2864462 | 2008-07-20 20:26:54 -0300 | [diff] [blame] | 23 | /* v4l debugging and diagnostics */ |
| 24 | |
| 25 | /* Debug bitmask flags to be used on V4L2 */ |
| 26 | #define V4L2_DEBUG_IOCTL 0x01 |
| 27 | #define V4L2_DEBUG_IOCTL_ARG 0x02 |
| 28 | |
| 29 | /* Use this macro for non-I2C drivers. Pass the driver name as the first arg. */ |
| 30 | #define v4l_print_ioctl(name, cmd) \ |
| 31 | do { \ |
| 32 | printk(KERN_DEBUG "%s: ", name); \ |
| 33 | v4l_printk_ioctl(cmd); \ |
| 34 | } while (0) |
| 35 | |
| 36 | /* Use this macro in I2C drivers where 'client' is the struct i2c_client |
| 37 | pointer */ |
| 38 | #define v4l_i2c_print_ioctl(client, cmd) \ |
| 39 | do { \ |
| 40 | v4l_client_printk(KERN_DEBUG, client, ""); \ |
| 41 | v4l_printk_ioctl(cmd); \ |
| 42 | } while (0) |
| 43 | |
Hans Verkuil | 35ea11f | 2008-07-20 08:12:02 -0300 | [diff] [blame] | 44 | /* Video standard functions */ |
| 45 | extern const char *v4l2_norm_to_name(v4l2_std_id id); |
| 46 | extern int v4l2_video_std_construct(struct v4l2_standard *vs, |
| 47 | int id, const char *name); |
| 48 | /* Prints the ioctl in a human-readable format */ |
| 49 | extern void v4l_printk_ioctl(unsigned int cmd); |
| 50 | |
| 51 | /* names for fancy debug output */ |
| 52 | extern const char *v4l2_field_names[]; |
| 53 | extern const char *v4l2_type_names[]; |
| 54 | |
| 55 | /* Compatibility layer interface -- v4l1-compat module */ |
| 56 | typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file, |
| 57 | unsigned int cmd, void *arg); |
| 58 | #ifdef CONFIG_VIDEO_V4L1_COMPAT |
| 59 | int v4l_compat_translate_ioctl(struct inode *inode, struct file *file, |
| 60 | int cmd, void *arg, v4l2_kioctl driver_ioctl); |
| 61 | #else |
| 62 | #define v4l_compat_translate_ioctl(inode, file, cmd, arg, ioctl) (-EINVAL) |
| 63 | #endif |
| 64 | |
| 65 | /* 32 Bits compatibility layer for 64 bits processors */ |
| 66 | extern long v4l_compat_ioctl32(struct file *file, unsigned int cmd, |
| 67 | unsigned long arg); |
| 68 | |
| 69 | extern int video_ioctl2(struct inode *inode, struct file *file, |
| 70 | unsigned int cmd, unsigned long arg); |
| 71 | |
| 72 | /* Include support for obsoleted stuff */ |
| 73 | extern int video_usercopy(struct inode *inode, struct file *file, |
| 74 | unsigned int cmd, unsigned long arg, |
| 75 | int (*func)(struct inode *inode, struct file *file, |
| 76 | unsigned int cmd, void *arg)); |
| 77 | |
| 78 | #endif /* _V4L2_IOCTL_H */ |