aboutsummaryrefslogtreecommitdiffstats
path: root/include/media
diff options
context:
space:
mode:
Diffstat (limited to 'include/media')
-rw-r--r--include/media/v4l2-common.h63
1 files changed, 51 insertions, 12 deletions
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 9ee616261d66..c5ca993679ec 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -26,6 +26,57 @@
26#ifndef V4L2_COMMON_H_ 26#ifndef V4L2_COMMON_H_
27#define V4L2_COMMON_H_ 27#define V4L2_COMMON_H_
28 28
29/* v4l debugging and diagnostics */
30
31/* Common printk constucts for v4l-i2c drivers. These macros create a unique
32 prefix consisting of the driver name, the adapter number and the i2c
33 address. */
34#define v4l_printk(level, name, adapter, addr, fmt, arg...) \
35 printk(level "%s %d-%04x: " fmt, name, i2c_adapter_id(adapter), addr , ## arg)
36
37#define v4l_client_printk(level, client, fmt, arg...) \
38 v4l_printk(level, (client)->driver->driver.name, (client)->adapter, \
39 (client)->addr, fmt , ## arg)
40
41#define v4l_err(client, fmt, arg...) \
42 v4l_client_printk(KERN_ERR, client, fmt , ## arg)
43
44#define v4l_warn(client, fmt, arg...) \
45 v4l_client_printk(KERN_WARNING, client, fmt , ## arg)
46
47#define v4l_info(client, fmt, arg...) \
48 v4l_client_printk(KERN_INFO, client, fmt , ## arg)
49
50/* These three macros assume that the debug level is set with a module
51 parameter called 'debug'. */
52#define v4l_dbg(level, client, fmt, arg...) \
53 do { \
54 if (debug >= (level)) \
55 v4l_client_printk(KERN_DEBUG, client, fmt , ## arg); \
56 } while (0)
57
58/* Prints the ioctl in a human-readable format */
59extern void v4l_printk_ioctl(unsigned int cmd);
60
61/* Use this macro for non-I2C drivers. Pass the driver name as the first arg. */
62#define v4l_print_ioctl(name, cmd) \
63 do { \
64 printk(KERN_DEBUG "%s: ", name); \
65 v4l_printk_ioctl(cmd); \
66 } while (0)
67
68/* Use this macro in I2C drivers where 'client' is the struct i2c_client
69 pointer */
70#define v4l_i2c_print_ioctl(client, cmd) \
71 do { \
72 v4l_client_printk(KERN_DEBUG, client, ""); \
73 v4l_printk_ioctl(cmd); \
74 } while (0)
75
76/* ------------------------------------------------------------------------- */
77
78/* Internal ioctls */
79
29/* VIDIOC_INT_G_REGISTER and VIDIOC_INT_S_REGISTER */ 80/* VIDIOC_INT_G_REGISTER and VIDIOC_INT_S_REGISTER */
30struct v4l2_register { 81struct v4l2_register {
31 u32 i2c_id; /* I2C driver ID of the I2C chip. 0 for the I2C adapter. */ 82 u32 i2c_id; /* I2C driver ID of the I2C chip. 0 for the I2C adapter. */
@@ -122,16 +173,4 @@ enum v4l2_chip_ident {
122 If the frequency is not supported, then -EINVAL is returned. */ 173 If the frequency is not supported, then -EINVAL is returned. */
123#define VIDIOC_INT_I2S_CLOCK_FREQ _IOW ('d', 108, u32) 174#define VIDIOC_INT_I2S_CLOCK_FREQ _IOW ('d', 108, u32)
124 175
125/* Prints used ioctl */
126extern void v4l_printk_ioctl(unsigned int cmd);
127
128#define v4l_print_ioctl(name,cmd) do {\
129 printk(KERN_DEBUG "%s: ", name); \
130 v4l_printk_ioctl(cmd); } while (0)
131
132#define v4l_i2c_print_ioctl(client,cmd) do {\
133 printk(KERN_DEBUG "%s %d-%04x: ", (client)->driver->name, \
134 i2c_adapter_id((client)->adapter),(client)->addr); \
135 v4l_printk_ioctl(cmd); } while (0)
136
137#endif /* V4L2_COMMON_H_ */ 176#endif /* V4L2_COMMON_H_ */