aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2007-04-27 11:31:26 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-04-27 14:43:50 -0400
commit74cab31c413c8615efe818d44ff4ac83e2a138be (patch)
tree036e32f1b1a928901f6f2ab4b9921c39aa8de82c
parent1a0adaf37c30e89e44d1470ef604a930999a5826 (diff)
V4L/DVB (5355): Add VIDIOC_G_CHIP_IDENT to various i2c modules
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/video/cs53l32a.c4
-rw-r--r--drivers/media/video/msp3400-driver.c5
-rw-r--r--drivers/media/video/msp3400-driver.h1
-rw-r--r--drivers/media/video/tvaudio.c4
-rw-r--r--drivers/media/video/upd64031a.c4
-rw-r--r--drivers/media/video/upd64083.c5
-rw-r--r--drivers/media/video/wm8739.c4
-rw-r--r--drivers/media/video/wm8775.c4
-rw-r--r--include/media/v4l2-chip-ident.h91
9 files changed, 118 insertions, 4 deletions
diff --git a/drivers/media/video/cs53l32a.c b/drivers/media/video/cs53l32a.c
index de87247c74ee..a73e285af730 100644
--- a/drivers/media/video/cs53l32a.c
+++ b/drivers/media/video/cs53l32a.c
@@ -28,6 +28,7 @@
28#include <linux/i2c-id.h> 28#include <linux/i2c-id.h>
29#include <linux/videodev.h> 29#include <linux/videodev.h>
30#include <media/v4l2-common.h> 30#include <media/v4l2-common.h>
31#include <media/v4l2-chip-ident.h>
31 32
32MODULE_DESCRIPTION("i2c device driver for cs53l32a Audio ADC"); 33MODULE_DESCRIPTION("i2c device driver for cs53l32a Audio ADC");
33MODULE_AUTHOR("Martin Vaughan"); 34MODULE_AUTHOR("Martin Vaughan");
@@ -103,6 +104,9 @@ static int cs53l32a_command(struct i2c_client *client, unsigned int cmd,
103 cs53l32a_write(client, 0x05, (u8) ctrl->value); 104 cs53l32a_write(client, 0x05, (u8) ctrl->value);
104 break; 105 break;
105 106
107 case VIDIOC_G_CHIP_IDENT:
108 return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_CS53l32A, 0);
109
106 case VIDIOC_LOG_STATUS: 110 case VIDIOC_LOG_STATUS:
107 { 111 {
108 u8 v = cs53l32a_read(client, 0x01); 112 u8 v = cs53l32a_read(client, 0x01);
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c
index ba1af3c8525e..3bb7d6634862 100644
--- a/drivers/media/video/msp3400-driver.c
+++ b/drivers/media/video/msp3400-driver.c
@@ -773,6 +773,9 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
773 break; 773 break;
774 } 774 }
775 775
776 case VIDIOC_G_CHIP_IDENT:
777 return v4l2_chip_ident_i2c_client(client, arg, state->ident, (state->rev1 << 16) | state->rev2);
778
776 default: 779 default:
777 /* unknown */ 780 /* unknown */
778 return -EINVAL; 781 return -EINVAL;
@@ -872,6 +875,8 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind)
872 snprintf(client->name, sizeof(client->name), "MSP%d4%02d%c-%c%d", 875 snprintf(client->name, sizeof(client->name), "MSP%d4%02d%c-%c%d",
873 msp_family, msp_product, 876 msp_family, msp_product,
874 msp_revision, msp_hard, msp_rom); 877 msp_revision, msp_hard, msp_rom);
878 /* Rev B=2, C=3, D=4, G=7 */
879 state->ident = msp_family * 10000 + 4000 + msp_product * 10 + msp_revision - '@';
875 880
876 /* Has NICAM support: all mspx41x and mspx45x products have NICAM */ 881 /* Has NICAM support: all mspx41x and mspx45x products have NICAM */
877 state->has_nicam = msp_prod_hi == 1 || msp_prod_hi == 5; 882 state->has_nicam = msp_prod_hi == 1 || msp_prod_hi == 5;
diff --git a/drivers/media/video/msp3400-driver.h b/drivers/media/video/msp3400-driver.h
index 7531efa1615e..ab69a290e5dc 100644
--- a/drivers/media/video/msp3400-driver.h
+++ b/drivers/media/video/msp3400-driver.h
@@ -50,6 +50,7 @@ extern int msp_stereo_thresh;
50 50
51struct msp_state { 51struct msp_state {
52 int rev1, rev2; 52 int rev1, rev2;
53 int ident;
53 u8 has_nicam; 54 u8 has_nicam;
54 u8 has_radio; 55 u8 has_radio;
55 u8 has_headphones; 56 u8 has_headphones;
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
index d506dfaa45a9..426083c08986 100644
--- a/drivers/media/video/tvaudio.c
+++ b/drivers/media/video/tvaudio.c
@@ -33,6 +33,7 @@
33 33
34#include <media/tvaudio.h> 34#include <media/tvaudio.h>
35#include <media/v4l2-common.h> 35#include <media/v4l2-common.h>
36#include <media/v4l2-chip-ident.h>
36 37
37#include <media/i2c-addr.h> 38#include <media/i2c-addr.h>
38 39
@@ -1775,6 +1776,9 @@ static int chip_command(struct i2c_client *client,
1775 /* the thread will call checkmode() later */ 1776 /* the thread will call checkmode() later */
1776 } 1777 }
1777 break; 1778 break;
1779
1780 case VIDIOC_G_CHIP_IDENT:
1781 return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_TVAUDIO, 0);
1778 } 1782 }
1779 return 0; 1783 return 0;
1780} 1784}
diff --git a/drivers/media/video/upd64031a.c b/drivers/media/video/upd64031a.c
index 28d1133a3b7a..0b2a961efd22 100644
--- a/drivers/media/video/upd64031a.c
+++ b/drivers/media/video/upd64031a.c
@@ -27,6 +27,7 @@
27#include <linux/i2c.h> 27#include <linux/i2c.h>
28#include <linux/videodev2.h> 28#include <linux/videodev2.h>
29#include <media/v4l2-common.h> 29#include <media/v4l2-common.h>
30#include <media/v4l2-chip-ident.h>
30#include <media/upd64031a.h> 31#include <media/upd64031a.h>
31 32
32// --------------------- read registers functions define ----------------------- 33// --------------------- read registers functions define -----------------------
@@ -179,6 +180,9 @@ static int upd64031a_command(struct i2c_client *client, unsigned int cmd, void *
179 } 180 }
180#endif 181#endif
181 182
183 case VIDIOC_G_CHIP_IDENT:
184 return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_UPD64031A, 0);
185
182 default: 186 default:
183 break; 187 break;
184 } 188 }
diff --git a/drivers/media/video/upd64083.c b/drivers/media/video/upd64083.c
index fe38224150d8..401bd21f46eb 100644
--- a/drivers/media/video/upd64083.c
+++ b/drivers/media/video/upd64083.c
@@ -26,6 +26,7 @@
26#include <linux/i2c.h> 26#include <linux/i2c.h>
27#include <linux/videodev2.h> 27#include <linux/videodev2.h>
28#include <media/v4l2-common.h> 28#include <media/v4l2-common.h>
29#include <media/v4l2-chip-ident.h>
29#include <media/upd64083.h> 30#include <media/upd64083.h>
30 31
31MODULE_DESCRIPTION("uPD64083 driver"); 32MODULE_DESCRIPTION("uPD64083 driver");
@@ -155,6 +156,10 @@ static int upd64083_command(struct i2c_client *client, unsigned int cmd, void *a
155 break; 156 break;
156 } 157 }
157#endif 158#endif
159
160 case VIDIOC_G_CHIP_IDENT:
161 return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_UPD64083, 0);
162
158 default: 163 default:
159 break; 164 break;
160 } 165 }
diff --git a/drivers/media/video/wm8739.c b/drivers/media/video/wm8739.c
index a9b59c35cd67..8f6741a28a47 100644
--- a/drivers/media/video/wm8739.c
+++ b/drivers/media/video/wm8739.c
@@ -29,6 +29,7 @@
29#include <linux/i2c-id.h> 29#include <linux/i2c-id.h>
30#include <linux/videodev.h> 30#include <linux/videodev.h>
31#include <media/v4l2-common.h> 31#include <media/v4l2-common.h>
32#include <media/v4l2-chip-ident.h>
32 33
33MODULE_DESCRIPTION("wm8739 driver"); 34MODULE_DESCRIPTION("wm8739 driver");
34MODULE_AUTHOR("T. Adachi, Hans Verkuil"); 35MODULE_AUTHOR("T. Adachi, Hans Verkuil");
@@ -236,6 +237,9 @@ static int wm8739_command(struct i2c_client *client, unsigned int cmd, void *arg
236 return -EINVAL; 237 return -EINVAL;
237 } 238 }
238 239
240 case VIDIOC_G_CHIP_IDENT:
241 return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_WM8739, 0);
242
239 case VIDIOC_LOG_STATUS: 243 case VIDIOC_LOG_STATUS:
240 v4l_info(client, "Frequency: %u Hz\n", state->clock_freq); 244 v4l_info(client, "Frequency: %u Hz\n", state->clock_freq);
241 v4l_info(client, "Volume L: %02x%s\n", state->vol_l & 0x1f, 245 v4l_info(client, "Volume L: %02x%s\n", state->vol_l & 0x1f,
diff --git a/drivers/media/video/wm8775.c b/drivers/media/video/wm8775.c
index d81a88bbe43d..4df5d30d4d09 100644
--- a/drivers/media/video/wm8775.c
+++ b/drivers/media/video/wm8775.c
@@ -33,6 +33,7 @@
33#include <linux/i2c-id.h> 33#include <linux/i2c-id.h>
34#include <linux/videodev.h> 34#include <linux/videodev.h>
35#include <media/v4l2-common.h> 35#include <media/v4l2-common.h>
36#include <media/v4l2-chip-ident.h>
36 37
37MODULE_DESCRIPTION("wm8775 driver"); 38MODULE_DESCRIPTION("wm8775 driver");
38MODULE_AUTHOR("Ulf Eklund, Hans Verkuil"); 39MODULE_AUTHOR("Ulf Eklund, Hans Verkuil");
@@ -124,6 +125,9 @@ static int wm8775_command(struct i2c_client *client, unsigned int cmd,
124 wm8775_write(client, R21, 0x100 + state->input); 125 wm8775_write(client, R21, 0x100 + state->input);
125 break; 126 break;
126 127
128 case VIDIOC_G_CHIP_IDENT:
129 return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_WM8775, 0);
130
127 case VIDIOC_LOG_STATUS: 131 case VIDIOC_LOG_STATUS:
128 v4l_info(client, "Input: %d%s\n", state->input, 132 v4l_info(client, "Input: %d%s\n", state->input,
129 state->muted ? " (muted)" : ""); 133 state->muted ? " (muted)" : "");
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
index 7d0c65413981..09d16c4f00f7 100644
--- a/include/media/v4l2-chip-ident.h
+++ b/include/media/v4l2-chip-ident.h
@@ -31,10 +31,13 @@ enum {
31 V4L2_IDENT_AMBIGUOUS = 1, /* Match too general, multiple chips matched */ 31 V4L2_IDENT_AMBIGUOUS = 1, /* Match too general, multiple chips matched */
32 V4L2_IDENT_UNKNOWN = 2, /* Chip found, but cannot identify */ 32 V4L2_IDENT_UNKNOWN = 2, /* Chip found, but cannot identify */
33 33
34 /* module saa7110: just ident= 100 */ 34 /* module tvaudio: reserved range 50-99 */
35 V4L2_IDENT_TVAUDIO = 50, /* A tvaudio chip, unknown which it is exactly */
36
37 /* module saa7110: just ident 100 */
35 V4L2_IDENT_SAA7110 = 100, 38 V4L2_IDENT_SAA7110 = 100,
36 39
37 /* module saa7111: just ident= 101 */ 40 /* module saa7111: just ident 101 */
38 V4L2_IDENT_SAA7111 = 101, 41 V4L2_IDENT_SAA7111 = 101,
39 42
40 /* module saa7115: reserved range 102-149 */ 43 /* module saa7115: reserved range 102-149 */
@@ -55,12 +58,92 @@ enum {
55 V4L2_IDENT_CX25842 = 242, 58 V4L2_IDENT_CX25842 = 242,
56 V4L2_IDENT_CX25843 = 243, 59 V4L2_IDENT_CX25843 = 243,
57 60
58 /* OmniVision sensors - range 250-299 */ 61 /* OmniVision sensors: reserved range 250-299 */
59 V4L2_IDENT_OV7670 = 250, 62 V4L2_IDENT_OV7670 = 250,
60 63
61 /* Conexant MPEG encoder/decoders: range 410-420 */ 64 /* Conexant MPEG encoder/decoders: reserved range 410-420 */
62 V4L2_IDENT_CX23415 = 415, 65 V4L2_IDENT_CX23415 = 415,
63 V4L2_IDENT_CX23416 = 416, 66 V4L2_IDENT_CX23416 = 416,
67
68 /* module wm8739: just ident 8739 */
69 V4L2_IDENT_WM8739 = 8739,
70
71 /* module wm8775: just ident 8775 */
72 V4L2_IDENT_WM8775 = 8775,
73
74 /* module cs53132a: just ident 53132 */
75 V4L2_IDENT_CS53l32A = 53132,
76
77 /* module upd64031a: just ident 64031 */
78 V4L2_IDENT_UPD64031A = 64031,
79
80 /* module upd64083: just ident 64083 */
81 V4L2_IDENT_UPD64083 = 64083,
82
83 /* module msp34xx: reserved range 34000-34999 */
84 V4L2_IDENT_MSP3400B = 34002,
85 V4L2_IDENT_MSP3410B = 34102,
86
87 V4L2_IDENT_MSP3400C = 34003,
88 V4L2_IDENT_MSP3410C = 34103,
89
90 V4L2_IDENT_MSP3400D = 34004,
91 V4L2_IDENT_MSP3410D = 34104,
92 V4L2_IDENT_MSP3405D = 34054,
93 V4L2_IDENT_MSP3415D = 34154,
94 V4L2_IDENT_MSP3407D = 34074,
95 V4L2_IDENT_MSP3417D = 34174,
96
97 V4L2_IDENT_MSP3400G = 34007,
98 V4L2_IDENT_MSP3410G = 34107,
99 V4L2_IDENT_MSP3420G = 34207,
100 V4L2_IDENT_MSP3430G = 34307,
101 V4L2_IDENT_MSP3440G = 34407,
102 V4L2_IDENT_MSP3450G = 34507,
103 V4L2_IDENT_MSP3460G = 34607,
104
105 V4L2_IDENT_MSP3401G = 34017,
106 V4L2_IDENT_MSP3411G = 34117,
107 V4L2_IDENT_MSP3421G = 34217,
108 V4L2_IDENT_MSP3431G = 34317,
109 V4L2_IDENT_MSP3441G = 34417,
110 V4L2_IDENT_MSP3451G = 34517,
111 V4L2_IDENT_MSP3461G = 34617,
112
113 V4L2_IDENT_MSP3402G = 34027,
114 V4L2_IDENT_MSP3412G = 34127,
115 V4L2_IDENT_MSP3422G = 34227,
116 V4L2_IDENT_MSP3442G = 34427,
117 V4L2_IDENT_MSP3452G = 34527,
118
119 V4L2_IDENT_MSP3405G = 34057,
120 V4L2_IDENT_MSP3415G = 34157,
121 V4L2_IDENT_MSP3425G = 34257,
122 V4L2_IDENT_MSP3435G = 34357,
123 V4L2_IDENT_MSP3445G = 34457,
124 V4L2_IDENT_MSP3455G = 34557,
125 V4L2_IDENT_MSP3465G = 34657,
126
127 V4L2_IDENT_MSP3407G = 34077,
128 V4L2_IDENT_MSP3417G = 34177,
129 V4L2_IDENT_MSP3427G = 34277,
130 V4L2_IDENT_MSP3437G = 34377,
131 V4L2_IDENT_MSP3447G = 34477,
132 V4L2_IDENT_MSP3457G = 34577,
133 V4L2_IDENT_MSP3467G = 34677,
134
135 /* module msp44xx: reserved range 44000-44999 */
136 V4L2_IDENT_MSP4400G = 44007,
137 V4L2_IDENT_MSP4410G = 44107,
138 V4L2_IDENT_MSP4420G = 44207,
139 V4L2_IDENT_MSP4440G = 44407,
140 V4L2_IDENT_MSP4450G = 44507,
141
142 V4L2_IDENT_MSP4408G = 44087,
143 V4L2_IDENT_MSP4418G = 44187,
144 V4L2_IDENT_MSP4428G = 44287,
145 V4L2_IDENT_MSP4448G = 44487,
146 V4L2_IDENT_MSP4458G = 44587,
64}; 147};
65 148
66#endif 149#endif