diff options
Diffstat (limited to 'include/media/v4l2-common.h')
-rw-r--r-- | include/media/v4l2-common.h | 91 |
1 files changed, 82 insertions, 9 deletions
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index d3fd48157eb8..d4030a7e16e0 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h | |||
@@ -26,12 +26,56 @@ | |||
26 | #ifndef V4L2_COMMON_H_ | 26 | #ifndef V4L2_COMMON_H_ |
27 | #define V4L2_COMMON_H_ | 27 | #define V4L2_COMMON_H_ |
28 | 28 | ||
29 | /* VIDIOC_INT_AUDIO_CLOCK_FREQ */ | 29 | /* v4l debugging and diagnostics */ |
30 | enum v4l2_audio_clock_freq { | 30 | |
31 | V4L2_AUDCLK_32_KHZ = 32000, | 31 | /* Common printk constucts for v4l-i2c drivers. These macros create a unique |
32 | V4L2_AUDCLK_441_KHZ = 44100, | 32 | prefix consisting of the driver name, the adapter number and the i2c |
33 | V4L2_AUDCLK_48_KHZ = 48000, | 33 | address. */ |
34 | }; | 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, debug, 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 */ | ||
59 | extern 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 */ | ||
35 | 79 | ||
36 | /* VIDIOC_INT_G_REGISTER and VIDIOC_INT_S_REGISTER */ | 80 | /* VIDIOC_INT_G_REGISTER and VIDIOC_INT_S_REGISTER */ |
37 | struct v4l2_register { | 81 | struct v4l2_register { |
@@ -70,6 +114,27 @@ enum v4l2_chip_ident { | |||
70 | V4L2_IDENT_CX25843 = 243, | 114 | V4L2_IDENT_CX25843 = 243, |
71 | }; | 115 | }; |
72 | 116 | ||
117 | /* audio ioctls */ | ||
118 | /* v4l device was opened in Radio mode */ | ||
119 | #define AUDC_SET_RADIO _IO('d',88) | ||
120 | /* select from TV,radio,extern,MUTE */ | ||
121 | #define AUDC_SET_INPUT _IOW('d',89,int) | ||
122 | |||
123 | /* msp3400 ioctl: will be removed in the near future */ | ||
124 | struct msp_matrix { | ||
125 | int input; | ||
126 | int output; | ||
127 | }; | ||
128 | #define MSP_SET_MATRIX _IOW('m',17,struct msp_matrix) | ||
129 | |||
130 | /* tuner ioctls */ | ||
131 | /* Sets tuner type and its I2C addr */ | ||
132 | #define TUNER_SET_TYPE_ADDR _IOW('d',90,int) | ||
133 | /* Puts tuner on powersaving state, disabling it, except for i2c */ | ||
134 | #define TUNER_SET_STANDBY _IOW('d',91,int) | ||
135 | /* Sets tda9887 specific stuff, like port1, port2 and qss */ | ||
136 | #define TDA9887_SET_CONFIG _IOW('d',92,int) | ||
137 | |||
73 | /* only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */ | 138 | /* only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */ |
74 | #define VIDIOC_INT_S_REGISTER _IOR ('d', 100, struct v4l2_register) | 139 | #define VIDIOC_INT_S_REGISTER _IOR ('d', 100, struct v4l2_register) |
75 | #define VIDIOC_INT_G_REGISTER _IOWR('d', 101, struct v4l2_register) | 140 | #define VIDIOC_INT_G_REGISTER _IOWR('d', 101, struct v4l2_register) |
@@ -77,10 +142,12 @@ enum v4l2_chip_ident { | |||
77 | /* Reset the I2C chip */ | 142 | /* Reset the I2C chip */ |
78 | #define VIDIOC_INT_RESET _IO ('d', 102) | 143 | #define VIDIOC_INT_RESET _IO ('d', 102) |
79 | 144 | ||
80 | /* Set the frequency of the audio clock output. | 145 | /* Set the frequency (in Hz) of the audio clock output. |
81 | Used to slave an audio processor to the video decoder, ensuring that audio | 146 | Used to slave an audio processor to the video decoder, ensuring that audio |
82 | and video remain synchronized. */ | 147 | and video remain synchronized. |
83 | #define VIDIOC_INT_AUDIO_CLOCK_FREQ _IOR ('d', 103, enum v4l2_audio_clock_freq) | 148 | Usual values for the frequency are 48000, 44100 or 32000 Hz. |
149 | If the frequency is not supported, then -EINVAL is returned. */ | ||
150 | #define VIDIOC_INT_AUDIO_CLOCK_FREQ _IOW ('d', 103, u32) | ||
84 | 151 | ||
85 | /* Video decoders that support sliced VBI need to implement this ioctl. | 152 | /* Video decoders that support sliced VBI need to implement this ioctl. |
86 | Field p of the v4l2_sliced_vbi_line struct is set to the start of the VBI | 153 | Field p of the v4l2_sliced_vbi_line struct is set to the start of the VBI |
@@ -107,4 +174,10 @@ enum v4l2_chip_ident { | |||
107 | be made. */ | 174 | be made. */ |
108 | #define VIDIOC_INT_G_CHIP_IDENT _IOR ('d', 107, enum v4l2_chip_ident *) | 175 | #define VIDIOC_INT_G_CHIP_IDENT _IOR ('d', 107, enum v4l2_chip_ident *) |
109 | 176 | ||
177 | /* Sets I2S speed in bps. This is used to provide a standard way to select I2S | ||
178 | clock used by driving digital audio streams at some board designs. | ||
179 | Usual values for the frequency are 1024000 and 2048000. | ||
180 | If the frequency is not supported, then -EINVAL is returned. */ | ||
181 | #define VIDIOC_INT_I2S_CLOCK_FREQ _IOW ('d', 108, u32) | ||
182 | |||
110 | #endif /* V4L2_COMMON_H_ */ | 183 | #endif /* V4L2_COMMON_H_ */ |