diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2007-04-27 11:31:08 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-04-27 14:43:27 -0400 |
commit | 3434eb7e14d9587ee56f3462bcfa5726b62dadb9 (patch) | |
tree | 49afb0915dac8e7864f89582ddbb7a6453982e2c /include | |
parent | ced80c67cd1ed503c6fb72f02ac7342ab4ebf67a (diff) |
V4L/DVB (5306): Add support for VIDIOC_G_CHIP_IDENT
VIDIOC_G_CHIP_IDENT improves debugging of card problems: it can be
used to detect which chips are on the board and based on that information
selected register dumps can be made, making it easy to debug complicated
media chips containing tens or hundreds of registers.
This ioctl replaces the internal VIDIOC_INT_G_CHIP_IDENT ioctl.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/videodev2.h | 10 | ||||
-rw-r--r-- | include/media/v4l2-chip-ident.h | 62 | ||||
-rw-r--r-- | include/media/v4l2-common.h | 39 | ||||
-rw-r--r-- | include/media/v4l2-dev.h | 2 |
4 files changed, 76 insertions, 37 deletions
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index a08ef2c16300..a25c2afa67e1 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h | |||
@@ -1398,6 +1398,14 @@ struct v4l2_register { | |||
1398 | __u64 val; | 1398 | __u64 val; |
1399 | }; | 1399 | }; |
1400 | 1400 | ||
1401 | /* VIDIOC_G_CHIP_IDENT */ | ||
1402 | struct v4l2_chip_ident { | ||
1403 | __u32 match_type; /* Match type */ | ||
1404 | __u32 match_chip; /* Match this chip, meaning determined by match_type */ | ||
1405 | __u32 ident; /* chip identifier as specified in <media/v4l2-chip-ident.h> */ | ||
1406 | __u32 revision; /* chip revision, chip specific */ | ||
1407 | }; | ||
1408 | |||
1401 | /* | 1409 | /* |
1402 | * I O C T L C O D E S F O R V I D E O D E V I C E S | 1410 | * I O C T L C O D E S F O R V I D E O D E V I C E S |
1403 | * | 1411 | * |
@@ -1471,6 +1479,8 @@ struct v4l2_register { | |||
1471 | /* Experimental, only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */ | 1479 | /* Experimental, only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */ |
1472 | #define VIDIOC_DBG_S_REGISTER _IOW ('V', 79, struct v4l2_register) | 1480 | #define VIDIOC_DBG_S_REGISTER _IOW ('V', 79, struct v4l2_register) |
1473 | #define VIDIOC_DBG_G_REGISTER _IOWR ('V', 80, struct v4l2_register) | 1481 | #define VIDIOC_DBG_G_REGISTER _IOWR ('V', 80, struct v4l2_register) |
1482 | |||
1483 | #define VIDIOC_G_CHIP_IDENT _IOWR ('V', 81, struct v4l2_chip_ident) | ||
1474 | #endif | 1484 | #endif |
1475 | 1485 | ||
1476 | #ifdef __OLD_VIDIOC_ | 1486 | #ifdef __OLD_VIDIOC_ |
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h new file mode 100644 index 000000000000..f6686ce133d8 --- /dev/null +++ b/include/media/v4l2-chip-ident.h | |||
@@ -0,0 +1,62 @@ | |||
1 | /* | ||
2 | v4l2 chip identifiers header | ||
3 | |||
4 | This header provides a list of chip identifiers that can be returned | ||
5 | through the VIDIOC_G_CHIP_IDENT ioctl. | ||
6 | |||
7 | Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> | ||
8 | |||
9 | This program is free software; you can redistribute it and/or modify | ||
10 | it under the terms of the GNU General Public License as published by | ||
11 | the Free Software Foundation; either version 2 of the License, or | ||
12 | (at your option) any later version. | ||
13 | |||
14 | This program is distributed in the hope that it will be useful, | ||
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | GNU General Public License for more details. | ||
18 | |||
19 | You should have received a copy of the GNU General Public License | ||
20 | along with this program; if not, write to the Free Software | ||
21 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
22 | */ | ||
23 | |||
24 | #ifndef V4L2_CHIP_IDENT_H_ | ||
25 | #define V4L2_CHIP_IDENT_H_ | ||
26 | |||
27 | /* VIDIOC_G_CHIP_IDENT: identifies the actual chip installed on the board */ | ||
28 | enum { | ||
29 | /* general idents: reserved range 0-49 */ | ||
30 | V4L2_IDENT_NONE = 0, /* No chip matched */ | ||
31 | V4L2_IDENT_AMBIGUOUS = 1, /* Match too general, multiple chips matched */ | ||
32 | V4L2_IDENT_UNKNOWN = 2, /* Chip found, but cannot identify */ | ||
33 | |||
34 | /* module saa7110: just ident= 100 */ | ||
35 | V4L2_IDENT_SAA7110 = 100, | ||
36 | |||
37 | /* module saa7111: just ident= 101 */ | ||
38 | V4L2_IDENT_SAA7111 = 101, | ||
39 | |||
40 | /* module saa7115: reserved range 102-149 */ | ||
41 | V4L2_IDENT_SAA7113 = 103, | ||
42 | V4L2_IDENT_SAA7114 = 104, | ||
43 | V4L2_IDENT_SAA7115 = 105, | ||
44 | V4L2_IDENT_SAA7118 = 108, | ||
45 | |||
46 | /* module saa7127: reserved range 150-199 */ | ||
47 | V4L2_IDENT_SAA7127 = 157, | ||
48 | V4L2_IDENT_SAA7129 = 159, | ||
49 | |||
50 | /* module cx25840: reserved range 200-249 */ | ||
51 | V4L2_IDENT_CX25836 = 236, | ||
52 | V4L2_IDENT_CX25837 = 237, | ||
53 | V4L2_IDENT_CX25840 = 240, | ||
54 | V4L2_IDENT_CX25841 = 241, | ||
55 | V4L2_IDENT_CX25842 = 242, | ||
56 | V4L2_IDENT_CX25843 = 243, | ||
57 | |||
58 | /* OmniVision sensors - range 250-299 */ | ||
59 | V4L2_IDENT_OV7670 = 250, | ||
60 | }; | ||
61 | |||
62 | #endif | ||
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index abb9ce9b21b8..181a40c46a52 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h | |||
@@ -98,6 +98,8 @@ u32 v4l2_ctrl_next(const u32 * const *ctrl_classes, u32 id); | |||
98 | 98 | ||
99 | struct i2c_client; /* forward reference */ | 99 | struct i2c_client; /* forward reference */ |
100 | int v4l2_chip_match_i2c_client(struct i2c_client *c, u32 id_type, u32 chip_id); | 100 | int v4l2_chip_match_i2c_client(struct i2c_client *c, u32 id_type, u32 chip_id); |
101 | int v4l2_chip_ident_i2c_client(struct i2c_client *c, struct v4l2_chip_ident *chip, | ||
102 | u32 ident, u32 revision); | ||
101 | int v4l2_chip_match_host(u32 id_type, u32 chip_id); | 103 | int v4l2_chip_match_host(u32 id_type, u32 chip_id); |
102 | 104 | ||
103 | /* ------------------------------------------------------------------------- */ | 105 | /* ------------------------------------------------------------------------- */ |
@@ -114,39 +116,6 @@ struct v4l2_decode_vbi_line { | |||
114 | u32 type; /* VBI service type (V4L2_SLICED_*). 0 if no service found */ | 116 | u32 type; /* VBI service type (V4L2_SLICED_*). 0 if no service found */ |
115 | }; | 117 | }; |
116 | 118 | ||
117 | /* VIDIOC_INT_G_CHIP_IDENT: identifies the actual chip installed on the board */ | ||
118 | enum v4l2_chip_ident { | ||
119 | /* general idents: reserved range 0-49 */ | ||
120 | V4L2_IDENT_UNKNOWN = 0, | ||
121 | |||
122 | /* module saa7110: just ident= 100 */ | ||
123 | V4L2_IDENT_SAA7110 = 100, | ||
124 | |||
125 | /* module saa7111: just ident= 101 */ | ||
126 | V4L2_IDENT_SAA7111 = 101, | ||
127 | |||
128 | /* module saa7115: reserved range 102-149 */ | ||
129 | V4L2_IDENT_SAA7113 = 103, | ||
130 | V4L2_IDENT_SAA7114 = 104, | ||
131 | V4L2_IDENT_SAA7115 = 105, | ||
132 | V4L2_IDENT_SAA7118 = 108, | ||
133 | |||
134 | /* module saa7127: reserved range 150-199 */ | ||
135 | V4L2_IDENT_SAA7127 = 157, | ||
136 | V4L2_IDENT_SAA7129 = 159, | ||
137 | |||
138 | /* module cx25840: reserved range 200-249 */ | ||
139 | V4L2_IDENT_CX25836 = 236, | ||
140 | V4L2_IDENT_CX25837 = 237, | ||
141 | V4L2_IDENT_CX25840 = 240, | ||
142 | V4L2_IDENT_CX25841 = 241, | ||
143 | V4L2_IDENT_CX25842 = 242, | ||
144 | V4L2_IDENT_CX25843 = 243, | ||
145 | |||
146 | /* OmniVision sensors - range 250-299 */ | ||
147 | V4L2_IDENT_OV7670 = 250, | ||
148 | }; | ||
149 | |||
150 | /* audio ioctls */ | 119 | /* audio ioctls */ |
151 | 120 | ||
152 | /* v4l device was opened in Radio mode, to be replaced by VIDIOC_INT_S_TUNER_MODE */ | 121 | /* v4l device was opened in Radio mode, to be replaced by VIDIOC_INT_S_TUNER_MODE */ |
@@ -208,10 +177,6 @@ enum v4l2_chip_ident { | |||
208 | whether CC data from the first or second field should be obtained). */ | 177 | whether CC data from the first or second field should be obtained). */ |
209 | #define VIDIOC_INT_G_VBI_DATA _IOWR('d', 106, struct v4l2_sliced_vbi_data) | 178 | #define VIDIOC_INT_G_VBI_DATA _IOWR('d', 106, struct v4l2_sliced_vbi_data) |
210 | 179 | ||
211 | /* Returns the chip identifier or V4L2_IDENT_UNKNOWN if no identification can | ||
212 | be made. */ | ||
213 | #define VIDIOC_INT_G_CHIP_IDENT _IOR ('d', 107, enum v4l2_chip_ident) | ||
214 | |||
215 | /* Sets I2S speed in bps. This is used to provide a standard way to select I2S | 180 | /* Sets I2S speed in bps. This is used to provide a standard way to select I2S |
216 | clock used by driving digital audio streams at some board designs. | 181 | clock used by driving digital audio streams at some board designs. |
217 | Usual values for the frequency are 1024000 and 2048000. | 182 | Usual values for the frequency are 1024000 and 2048000. |
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index 2693f3ae6ffb..d62847f846c2 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h | |||
@@ -317,6 +317,8 @@ struct video_device | |||
317 | int (*vidioc_s_register) (struct file *file, void *fh, | 317 | int (*vidioc_s_register) (struct file *file, void *fh, |
318 | struct v4l2_register *reg); | 318 | struct v4l2_register *reg); |
319 | #endif | 319 | #endif |
320 | int (*vidioc_g_chip_ident) (struct file *file, void *fh, | ||
321 | struct v4l2_chip_ident *chip); | ||
320 | 322 | ||
321 | 323 | ||
322 | #ifdef OBSOLETE_OWNER /* to be removed soon */ | 324 | #ifdef OBSOLETE_OWNER /* to be removed soon */ |