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