Merge with /pub/scm/linux/kernel/git/torvalds/linux-2.6.git
[pandora-kernel.git] / include / media / v4l2-common.h
1 /*
2     v4l2 common internal API header
3
4     This header contains internal shared ioctl definitions for use by the
5     internal low-level v4l2 drivers.
6     Each ioctl begins with VIDIOC_INT_ to clearly mark that it is an internal
7     define,
8
9     Copyright (C) 2005  Hans Verkuil <hverkuil@xs4all.nl>
10
11     This program is free software; you can redistribute it and/or modify
12     it under the terms of the GNU General Public License as published by
13     the Free Software Foundation; either version 2 of the License, or
14     (at your option) any later version.
15
16     This program is distributed in the hope that it will be useful,
17     but WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19     GNU General Public License for more details.
20
21     You should have received a copy of the GNU General Public License
22     along with this program; if not, write to the Free Software
23     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24  */
25
26 #ifndef V4L2_COMMON_H_
27 #define V4L2_COMMON_H_
28
29 /* VIDIOC_INT_AUDIO_CLOCK_FREQ */
30 enum v4l2_audio_clock_freq {
31         V4L2_AUDCLK_32_KHZ  = 32000,
32         V4L2_AUDCLK_441_KHZ = 44100,
33         V4L2_AUDCLK_48_KHZ  = 48000,
34 };
35
36 /* VIDIOC_INT_G_REGISTER and VIDIOC_INT_S_REGISTER */
37 struct v4l2_register {
38         u32 i2c_id;             /* I2C driver ID of the I2C chip. 0 for the I2C adapter. */
39         unsigned long reg;
40         u32 val;
41 };
42
43 /* VIDIOC_INT_DECODE_VBI_LINE */
44 struct v4l2_decode_vbi_line {
45         u32 is_second_field;    /* Set to 0 for the first (odd) field,
46                                    set to 1 for the second (even) field. */
47         u8 *p;                  /* Pointer to the sliced VBI data from the decoder.
48                                    On exit points to the start of the payload. */
49         u32 line;               /* Line number of the sliced VBI data (1-23) */
50         u32 type;               /* VBI service type (V4L2_SLICED_*). 0 if no service found */
51 };
52
53 /* VIDIOC_INT_G_CHIP_IDENT: identifies the actual chip installed on the board */
54 enum v4l2_chip_ident {
55         /* general idents: reserved range 0-49 */
56         V4L2_IDENT_UNKNOWN = 0,
57
58         /* module saa7115: reserved range 100-149 */
59         V4L2_IDENT_SAA7114 = 104,
60         V4L2_IDENT_SAA7115 = 105,
61
62         /* module saa7127: reserved range 150-199 */
63         V4L2_IDENT_SAA7127 = 157,
64         V4L2_IDENT_SAA7129 = 159,
65
66         /* module cx25840: reserved range 200-249 */
67         V4L2_IDENT_CX25840 = 240,
68         V4L2_IDENT_CX25841 = 241,
69         V4L2_IDENT_CX25842 = 242,
70         V4L2_IDENT_CX25843 = 243,
71 };
72
73 /* only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */
74 #define VIDIOC_INT_S_REGISTER           _IOR ('d', 100, struct v4l2_register)
75 #define VIDIOC_INT_G_REGISTER           _IOWR('d', 101, struct v4l2_register)
76
77 /* Reset the I2C chip */
78 #define VIDIOC_INT_RESET                _IO  ('d', 102)
79
80 /* Set the frequency of the audio clock output.
81    Used to slave an audio processor to the video decoder, ensuring that audio
82    and video remain synchronized. */
83 #define VIDIOC_INT_AUDIO_CLOCK_FREQ     _IOR ('d', 103, enum v4l2_audio_clock_freq)
84
85 /* 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
87    data that was generated by the decoder. The driver then parses the sliced
88    VBI data and sets the other fields in the struct accordingly. The pointer p
89    is updated to point to the start of the payload which can be copied
90    verbatim into the data field of the v4l2_sliced_vbi_data struct. If no
91    valid VBI data was found, then the type field is set to 0 on return. */
92 #define VIDIOC_INT_DECODE_VBI_LINE      _IOWR('d', 104, struct v4l2_decode_vbi_line)
93
94 /* Used to generate VBI signals on a video signal. v4l2_sliced_vbi_data is
95    filled with the data packets that should be output. Note that if you set
96    the line field to 0, then that VBI signal is disabled. */
97 #define VIDIOC_INT_S_VBI_DATA           _IOW ('d', 105, struct v4l2_sliced_vbi_data)
98
99 /* Used to obtain the sliced VBI packet from a readback register. Not all
100    video decoders support this. If no data is available because the readback
101    register contains invalid or erroneous data -EIO is returned. Note that
102    you must fill in the 'id' member and the 'field' member (to determine
103    whether CC data from the first or second field should be obtained). */
104 #define VIDIOC_INT_G_VBI_DATA           _IOWR('d', 106, struct v4l2_sliced_vbi_data *)
105
106 /* Returns the chip identifier or V4L2_IDENT_UNKNOWN if no identification can
107    be made. */
108 #define VIDIOC_INT_G_CHIP_IDENT         _IOR ('d', 107, enum v4l2_chip_ident *)
109
110 #endif /* V4L2_COMMON_H_ */