diff options
Diffstat (limited to 'drivers/media/video/tveeprom.c')
-rw-r--r-- | drivers/media/video/tveeprom.c | 362 |
1 files changed, 241 insertions, 121 deletions
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c index 3c3356a01cc6..5344d5592199 100644 --- a/drivers/media/video/tveeprom.c +++ b/drivers/media/video/tveeprom.c | |||
@@ -47,18 +47,21 @@ MODULE_LICENSE("GPL"); | |||
47 | 47 | ||
48 | static int debug = 0; | 48 | static int debug = 0; |
49 | module_param(debug, int, 0644); | 49 | module_param(debug, int, 0644); |
50 | MODULE_PARM_DESC(debug, "Debug level (0-2)"); | 50 | MODULE_PARM_DESC(debug, "Debug level (0-1)"); |
51 | 51 | ||
52 | #define STRM(array,i) (i < sizeof(array)/sizeof(char*) ? array[i] : "unknown") | 52 | #define STRM(array,i) (i < sizeof(array)/sizeof(char*) ? array[i] : "unknown") |
53 | 53 | ||
54 | #define dprintk(num, args...) \ | 54 | #define tveeprom_info(fmt, arg...) do {\ |
55 | do { \ | 55 | printk(KERN_INFO "tveeprom %d-%04x: " fmt, \ |
56 | if (debug >= num) \ | 56 | c->adapter->nr, c->addr , ##arg); } while (0) |
57 | printk(KERN_INFO "tveeprom: " args); \ | 57 | #define tveeprom_warn(fmt, arg...) do {\ |
58 | } while (0) | 58 | printk(KERN_WARNING "tveeprom %d-%04x: " fmt, \ |
59 | c->adapter->nr, c->addr , ##arg); } while (0) | ||
60 | #define tveeprom_dbg(fmt, arg...) do {\ | ||
61 | if (debug) \ | ||
62 | printk(KERN_INFO "tveeprom %d-%04x: " fmt, \ | ||
63 | c->adapter->nr, c->addr , ##arg); } while (0) | ||
59 | 64 | ||
60 | #define TVEEPROM_KERN_ERR(args...) printk(KERN_ERR "tveeprom: " args); | ||
61 | #define TVEEPROM_KERN_INFO(args...) printk(KERN_INFO "tveeprom: " args); | ||
62 | 65 | ||
63 | /* ----------------------------------------------------------------------- */ | 66 | /* ----------------------------------------------------------------------- */ |
64 | /* some hauppauge specific stuff */ | 67 | /* some hauppauge specific stuff */ |
@@ -70,14 +73,14 @@ static struct HAUPPAUGE_TUNER_FMT | |||
70 | } | 73 | } |
71 | hauppauge_tuner_fmt[] = | 74 | hauppauge_tuner_fmt[] = |
72 | { | 75 | { |
73 | { 0x00000000, "unknown1" }, | 76 | { 0x00000000, " unknown1" }, |
74 | { 0x00000000, "unknown2" }, | 77 | { 0x00000000, " unknown2" }, |
75 | { 0x00000007, "PAL(B/G)" }, | 78 | { 0x00000007, " PAL(B/G)" }, |
76 | { 0x00001000, "NTSC(M)" }, | 79 | { 0x00001000, " NTSC(M)" }, |
77 | { 0x00000010, "PAL(I)" }, | 80 | { 0x00000010, " PAL(I)" }, |
78 | { 0x00400000, "SECAM(L/L´)" }, | 81 | { 0x00400000, " SECAM(L/L')" }, |
79 | { 0x00000e00, "PAL(D/K)" }, | 82 | { 0x00000e00, " PAL(D/K)" }, |
80 | { 0x03000000, "ATSC Digital" }, | 83 | { 0x03000000, " ATSC Digital" }, |
81 | }; | 84 | }; |
82 | 85 | ||
83 | /* This is the full list of possible tuners. Many thanks to Hauppauge for | 86 | /* This is the full list of possible tuners. Many thanks to Hauppauge for |
@@ -152,13 +155,13 @@ hauppauge_tuner[] = | |||
152 | { TUNER_MICROTUNE_4049FM5, "Microtune 4049 FM5"}, | 155 | { TUNER_MICROTUNE_4049FM5, "Microtune 4049 FM5"}, |
153 | { TUNER_ABSENT, "LG TPI8NSR11F"}, | 156 | { TUNER_ABSENT, "LG TPI8NSR11F"}, |
154 | { TUNER_ABSENT, "Microtune 4049 FM5 Alt I2C"}, | 157 | { TUNER_ABSENT, "Microtune 4049 FM5 Alt I2C"}, |
155 | { TUNER_ABSENT, "Philips FQ1216ME MK3"}, | 158 | { TUNER_PHILIPS_FM1216ME_MK3, "Philips FQ1216ME MK3"}, |
156 | { TUNER_ABSENT, "Philips FI1236 MK3"}, | 159 | { TUNER_ABSENT, "Philips FI1236 MK3"}, |
157 | { TUNER_PHILIPS_FM1216ME_MK3, "Philips FM1216 ME MK3"}, | 160 | { TUNER_PHILIPS_FM1216ME_MK3, "Philips FM1216 ME MK3"}, |
158 | { TUNER_ABSENT, "Philips FM1236 MK3"}, | 161 | { TUNER_PHILIPS_FM1236_MK3, "Philips FM1236 MK3"}, |
159 | { TUNER_ABSENT, "Philips FM1216MP MK3"}, | 162 | { TUNER_ABSENT, "Philips FM1216MP MK3"}, |
160 | /* 60-69 */ | 163 | /* 60-69 */ |
161 | { TUNER_ABSENT, "LG S001D MK3"}, | 164 | { TUNER_PHILIPS_FM1216ME_MK3, "LG S001D MK3"}, |
162 | { TUNER_ABSENT, "LG M001D MK3"}, | 165 | { TUNER_ABSENT, "LG M001D MK3"}, |
163 | { TUNER_ABSENT, "LG S701D MK3"}, | 166 | { TUNER_ABSENT, "LG S701D MK3"}, |
164 | { TUNER_ABSENT, "LG M701D MK3"}, | 167 | { TUNER_ABSENT, "LG M701D MK3"}, |
@@ -167,7 +170,7 @@ hauppauge_tuner[] = | |||
167 | { TUNER_ABSENT, "Temic 4106FH5"}, | 170 | { TUNER_ABSENT, "Temic 4106FH5"}, |
168 | { TUNER_ABSENT, "Philips FQ1216LMP MK3"}, | 171 | { TUNER_ABSENT, "Philips FQ1216LMP MK3"}, |
169 | { TUNER_LG_NTSC_TAPE, "LG TAPE H001F MK3"}, | 172 | { TUNER_LG_NTSC_TAPE, "LG TAPE H001F MK3"}, |
170 | { TUNER_ABSENT, "LG TAPE H701F MK3"}, | 173 | { TUNER_LG_NTSC_TAPE, "LG TAPE H701F MK3"}, |
171 | /* 70-79 */ | 174 | /* 70-79 */ |
172 | { TUNER_ABSENT, "LG TALN H200T"}, | 175 | { TUNER_ABSENT, "LG TALN H200T"}, |
173 | { TUNER_ABSENT, "LG TALN H250T"}, | 176 | { TUNER_ABSENT, "LG TALN H250T"}, |
@@ -183,8 +186,8 @@ hauppauge_tuner[] = | |||
183 | { TUNER_ABSENT, "Philips FQ1216LME MK3"}, | 186 | { TUNER_ABSENT, "Philips FQ1216LME MK3"}, |
184 | { TUNER_ABSENT, "LG TAPC G701D"}, | 187 | { TUNER_ABSENT, "LG TAPC G701D"}, |
185 | { TUNER_LG_NTSC_NEW_TAPC, "LG TAPC H791F"}, | 188 | { TUNER_LG_NTSC_NEW_TAPC, "LG TAPC H791F"}, |
186 | { TUNER_ABSENT, "TCL 2002MB 3"}, | 189 | { TUNER_LG_PAL_NEW_TAPC, "TCL 2002MB 3"}, |
187 | { TUNER_ABSENT, "TCL 2002MI 3"}, | 190 | { TUNER_LG_PAL_NEW_TAPC, "TCL 2002MI 3"}, |
188 | { TUNER_TCL_2002N, "TCL 2002N 6A"}, | 191 | { TUNER_TCL_2002N, "TCL 2002N 6A"}, |
189 | { TUNER_ABSENT, "Philips FQ1236 MK3"}, | 192 | { TUNER_ABSENT, "Philips FQ1236 MK3"}, |
190 | { TUNER_ABSENT, "Samsung TCPN 2121P30A"}, | 193 | { TUNER_ABSENT, "Samsung TCPN 2121P30A"}, |
@@ -199,17 +202,51 @@ hauppauge_tuner[] = | |||
199 | { TUNER_ABSENT, "Philips FQ1236 MK5"}, | 202 | { TUNER_ABSENT, "Philips FQ1236 MK5"}, |
200 | { TUNER_ABSENT, "Unspecified"}, | 203 | { TUNER_ABSENT, "Unspecified"}, |
201 | { TUNER_LG_PAL_TAPE, "LG PAL (TAPE Series)"}, | 204 | { TUNER_LG_PAL_TAPE, "LG PAL (TAPE Series)"}, |
205 | { TUNER_ABSENT, "Unspecified"}, | ||
206 | { TUNER_TCL_2002N, "TCL 2002N 5H"}, | ||
207 | /* 100-103 */ | ||
208 | { TUNER_ABSENT, "Unspecified"}, | ||
209 | { TUNER_TEA5767, "Philips TEA5767HN FM Radio"}, | ||
210 | { TUNER_ABSENT, "Unspecified"}, | ||
211 | { TUNER_PHILIPS_FM1236_MK3, "TCL MFNM05 4"}, | ||
202 | }; | 212 | }; |
203 | 213 | ||
204 | static char *sndtype[] = { | 214 | /* This list is supplied by Hauppauge. Thanks! */ |
205 | "None", "TEA6300", "TEA6320", "TDA9850", "MSP3400C", "MSP3410D", | 215 | static const char *audioIC[] = { |
206 | "MSP3415", "MSP3430", "MSP3438", "CS5331", "MSP3435", "MSP3440", | 216 | /* 0-4 */ |
207 | "MSP3445", "MSP3411", "MSP3416", "MSP3425", | 217 | "None", "TEA6300", "TEA6320", "TDA9850", "MSP3400C", |
218 | /* 5-9 */ | ||
219 | "MSP3410D", "MSP3415", "MSP3430", "MSP3438", "CS5331", | ||
220 | /* 10-14 */ | ||
221 | "MSP3435", "MSP3440", "MSP3445", "MSP3411", "MSP3416", | ||
222 | /* 15-19 */ | ||
223 | "MSP3425", "MSP3451", "MSP3418", "Type 0x12", "OKI7716", | ||
224 | /* 20-24 */ | ||
225 | "MSP4410", "MSP4420", "MSP4440", "MSP4450", "MSP4408", | ||
226 | /* 25-29 */ | ||
227 | "MSP4418", "MSP4428", "MSP4448", "MSP4458", "Type 0x1d", | ||
228 | /* 30-34 */ | ||
229 | "CX880", "CX881", "CX883", "CX882", "CX25840", | ||
230 | /* 35-38 */ | ||
231 | "CX25841", "CX25842", "CX25843", "CX23418", | ||
232 | }; | ||
208 | 233 | ||
209 | "Type 0x10","Type 0x11","Type 0x12","Type 0x13", | 234 | /* This list is supplied by Hauppauge. Thanks! */ |
210 | "Type 0x14","Type 0x15","Type 0x16","Type 0x17", | 235 | static const char *decoderIC[] = { |
211 | "Type 0x18","MSP4418","Type 0x1a","MSP4448", | 236 | /* 0-4 */ |
212 | "Type 0x1c","Type 0x1d","Type 0x1e","Type 0x1f", | 237 | "None", "BT815", "BT817", "BT819", "BT815A", |
238 | /* 5-9 */ | ||
239 | "BT817A", "BT819A", "BT827", "BT829", "BT848", | ||
240 | /* 10-14 */ | ||
241 | "BT848A", "BT849A", "BT829A", "BT827A", "BT878", | ||
242 | /* 15-19 */ | ||
243 | "BT879", "BT880", "VPX3226E", "SAA7114", "SAA7115", | ||
244 | /* 20-24 */ | ||
245 | "CX880", "CX881", "CX883", "SAA7111", "SAA7113", | ||
246 | /* 25-29 */ | ||
247 | "CX882", "TVP5150A", "CX25840", "CX25841", "CX25842", | ||
248 | /* 30-31 */ | ||
249 | "CX25843", "CX23418", | ||
213 | }; | 250 | }; |
214 | 251 | ||
215 | static int hasRadioTuner(int tunerType) | 252 | static int hasRadioTuner(int tunerType) |
@@ -250,7 +287,8 @@ static int hasRadioTuner(int tunerType) | |||
250 | return 0; | 287 | return 0; |
251 | } | 288 | } |
252 | 289 | ||
253 | void tveeprom_hauppauge_analog(struct tveeprom *tvee, unsigned char *eeprom_data) | 290 | void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, |
291 | unsigned char *eeprom_data) | ||
254 | { | 292 | { |
255 | /* ---------------------------------------------- | 293 | /* ---------------------------------------------- |
256 | ** The hauppauge eeprom format is tagged | 294 | ** The hauppauge eeprom format is tagged |
@@ -260,10 +298,11 @@ void tveeprom_hauppauge_analog(struct tveeprom *tvee, unsigned char *eeprom_data | |||
260 | ** if packet[0] & f8 == f8, then EOD and packet[1] == checksum | 298 | ** if packet[0] & f8 == f8, then EOD and packet[1] == checksum |
261 | ** | 299 | ** |
262 | ** In our (ivtv) case we're interested in the following: | 300 | ** In our (ivtv) case we're interested in the following: |
263 | ** tuner type: tag [00].05 or [0a].01 (index into hauppauge_tuner) | 301 | ** tuner type: tag [00].05 or [0a].01 (index into hauppauge_tuner) |
264 | ** tuner fmts: tag [00].04 or [0a].00 (bitmask index into hauppauge_tuner_fmt) | 302 | ** tuner fmts: tag [00].04 or [0a].00 (bitmask index into hauppauge_tuner_fmt) |
265 | ** radio: tag [00].{last} or [0e].00 (bitmask. bit2=FM) | 303 | ** radio: tag [00].{last} or [0e].00 (bitmask. bit2=FM) |
266 | ** audio proc: tag [02].01 or [05].00 (lower nibble indexes lut?) | 304 | ** audio proc: tag [02].01 or [05].00 (mask with 0x7f) |
305 | ** decoder proc: tag [09].01) | ||
267 | 306 | ||
268 | ** Fun info: | 307 | ** Fun info: |
269 | ** model: tag [00].07-08 or [06].00-01 | 308 | ** model: tag [00].07-08 or [06].00-01 |
@@ -273,20 +312,24 @@ void tveeprom_hauppauge_analog(struct tveeprom *tvee, unsigned char *eeprom_data | |||
273 | ** # of inputs/outputs ??? | 312 | ** # of inputs/outputs ??? |
274 | */ | 313 | */ |
275 | 314 | ||
276 | int i, j, len, done, beenhere, tag, tuner = 0, t_format = 0; | 315 | int i, j, len, done, beenhere, tag; |
277 | char *t_name = NULL, *t_fmt_name = NULL; | ||
278 | 316 | ||
279 | dprintk(1, "%s\n",__FUNCTION__); | 317 | int tuner1 = 0, t_format1 = 0; |
280 | tvee->revision = done = len = beenhere = 0; | 318 | char *t_name1 = NULL; |
281 | for (i = 0; !done && i < 256; i += len) { | 319 | const char *t_fmt_name1[8] = { " none", "", "", "", "", "", "", "" }; |
282 | dprintk(2, "processing pos = %02x (%02x, %02x)\n", | ||
283 | i, eeprom_data[i], eeprom_data[i + 1]); | ||
284 | 320 | ||
321 | int tuner2 = 0, t_format2 = 0; | ||
322 | char *t_name2 = NULL; | ||
323 | const char *t_fmt_name2[8] = { " none", "", "", "", "", "", "", "" }; | ||
324 | |||
325 | memset(tvee, 0, sizeof(*tvee)); | ||
326 | done = len = beenhere = 0; | ||
327 | for (i = 0; !done && i < 256; i += len) { | ||
285 | if (eeprom_data[i] == 0x84) { | 328 | if (eeprom_data[i] == 0x84) { |
286 | len = eeprom_data[i + 1] + (eeprom_data[i + 2] << 8); | 329 | len = eeprom_data[i + 1] + (eeprom_data[i + 2] << 8); |
287 | i+=3; | 330 | i += 3; |
288 | } else if ((eeprom_data[i] & 0xf0) == 0x70) { | 331 | } else if ((eeprom_data[i] & 0xf0) == 0x70) { |
289 | if ((eeprom_data[i] & 0x08)) { | 332 | if (eeprom_data[i] & 0x08) { |
290 | /* verify checksum! */ | 333 | /* verify checksum! */ |
291 | done = 1; | 334 | done = 1; |
292 | break; | 335 | break; |
@@ -294,24 +337,30 @@ void tveeprom_hauppauge_analog(struct tveeprom *tvee, unsigned char *eeprom_data | |||
294 | len = eeprom_data[i] & 0x07; | 337 | len = eeprom_data[i] & 0x07; |
295 | ++i; | 338 | ++i; |
296 | } else { | 339 | } else { |
297 | TVEEPROM_KERN_ERR("Encountered bad packet header [%02x]. " | 340 | tveeprom_warn("Encountered bad packet header [%02x]. " |
298 | "Corrupt or not a Hauppauge eeprom.\n", eeprom_data[i]); | 341 | "Corrupt or not a Hauppauge eeprom.\n", eeprom_data[i]); |
299 | return; | 342 | return; |
300 | } | 343 | } |
301 | 344 | ||
302 | dprintk(1, "%3d [%02x] ", len, eeprom_data[i]); | 345 | if (debug) { |
303 | for(j = 1; j < len; j++) { | 346 | tveeprom_info("Tag [%02x] + %d bytes:", eeprom_data[i], len - 1); |
304 | dprintk(1, "%02x ", eeprom_data[i + j]); | 347 | for(j = 1; j < len; j++) { |
305 | } | 348 | printk(" %02x", eeprom_data[i + j]); |
306 | dprintk(1, "\n"); | 349 | } |
350 | printk("\n"); | ||
351 | } | ||
307 | 352 | ||
308 | /* process by tag */ | 353 | /* process by tag */ |
309 | tag = eeprom_data[i]; | 354 | tag = eeprom_data[i]; |
310 | switch (tag) { | 355 | switch (tag) { |
311 | case 0x00: | 356 | case 0x00: |
312 | tuner = eeprom_data[i+6]; | 357 | /* tag: 'Comprehensive' */ |
313 | t_format = eeprom_data[i+5]; | 358 | tuner1 = eeprom_data[i+6]; |
359 | t_format1 = eeprom_data[i+5]; | ||
314 | tvee->has_radio = eeprom_data[i+len-1]; | 360 | tvee->has_radio = eeprom_data[i+len-1]; |
361 | /* old style tag, don't know how to detect | ||
362 | IR presence, mark as unknown. */ | ||
363 | tvee->has_ir = 2; | ||
315 | tvee->model = | 364 | tvee->model = |
316 | eeprom_data[i+8] + | 365 | eeprom_data[i+8] + |
317 | (eeprom_data[i+9] << 8); | 366 | (eeprom_data[i+9] << 8); |
@@ -319,25 +368,43 @@ void tveeprom_hauppauge_analog(struct tveeprom *tvee, unsigned char *eeprom_data | |||
319 | (eeprom_data[i+11] << 8) + | 368 | (eeprom_data[i+11] << 8) + |
320 | (eeprom_data[i+12] << 16); | 369 | (eeprom_data[i+12] << 16); |
321 | break; | 370 | break; |
371 | |||
322 | case 0x01: | 372 | case 0x01: |
373 | /* tag: 'SerialID' */ | ||
323 | tvee->serial_number = | 374 | tvee->serial_number = |
324 | eeprom_data[i+6] + | 375 | eeprom_data[i+6] + |
325 | (eeprom_data[i+7] << 8) + | 376 | (eeprom_data[i+7] << 8) + |
326 | (eeprom_data[i+8] << 16); | 377 | (eeprom_data[i+8] << 16); |
327 | break; | 378 | break; |
379 | |||
328 | case 0x02: | 380 | case 0x02: |
329 | tvee->audio_processor = eeprom_data[i+2] & 0x0f; | 381 | /* tag 'AudioInfo' |
382 | Note mask with 0x7F, high bit used on some older models | ||
383 | to indicate 4052 mux was removed in favor of using MSP | ||
384 | inputs directly. */ | ||
385 | tvee->audio_processor = eeprom_data[i+2] & 0x7f; | ||
330 | break; | 386 | break; |
387 | |||
388 | /* case 0x03: tag 'EEInfo' */ | ||
389 | |||
331 | case 0x04: | 390 | case 0x04: |
391 | /* tag 'SerialID2' */ | ||
332 | tvee->serial_number = | 392 | tvee->serial_number = |
333 | eeprom_data[i+5] + | 393 | eeprom_data[i+5] + |
334 | (eeprom_data[i+6] << 8) + | 394 | (eeprom_data[i+6] << 8) + |
335 | (eeprom_data[i+7] << 16); | 395 | (eeprom_data[i+7] << 16); |
336 | break; | 396 | break; |
397 | |||
337 | case 0x05: | 398 | case 0x05: |
338 | tvee->audio_processor = eeprom_data[i+1] & 0x0f; | 399 | /* tag 'Audio2' |
400 | Note mask with 0x7F, high bit used on some older models | ||
401 | to indicate 4052 mux was removed in favor of using MSP | ||
402 | inputs directly. */ | ||
403 | tvee->audio_processor = eeprom_data[i+1] & 0x7f; | ||
339 | break; | 404 | break; |
405 | |||
340 | case 0x06: | 406 | case 0x06: |
407 | /* tag 'ModelRev' */ | ||
341 | tvee->model = | 408 | tvee->model = |
342 | eeprom_data[i+1] + | 409 | eeprom_data[i+1] + |
343 | (eeprom_data[i+2] << 8); | 410 | (eeprom_data[i+2] << 8); |
@@ -345,27 +412,66 @@ void tveeprom_hauppauge_analog(struct tveeprom *tvee, unsigned char *eeprom_data | |||
345 | (eeprom_data[i+6] << 8) + | 412 | (eeprom_data[i+6] << 8) + |
346 | (eeprom_data[i+7] << 16); | 413 | (eeprom_data[i+7] << 16); |
347 | break; | 414 | break; |
415 | |||
416 | case 0x07: | ||
417 | /* tag 'Details': according to Hauppauge not interesting | ||
418 | on any PCI-era or later boards. */ | ||
419 | break; | ||
420 | |||
421 | /* there is no tag 0x08 defined */ | ||
422 | |||
423 | case 0x09: | ||
424 | /* tag 'Video' */ | ||
425 | tvee->decoder_processor = eeprom_data[i + 1]; | ||
426 | break; | ||
427 | |||
348 | case 0x0a: | 428 | case 0x0a: |
349 | if(beenhere == 0) { | 429 | /* tag 'Tuner' */ |
350 | tuner = eeprom_data[i+2]; | 430 | if (beenhere == 0) { |
351 | t_format = eeprom_data[i+1]; | 431 | tuner1 = eeprom_data[i+2]; |
432 | t_format1 = eeprom_data[i+1]; | ||
352 | beenhere = 1; | 433 | beenhere = 1; |
353 | break; | ||
354 | } else { | 434 | } else { |
355 | break; | 435 | /* a second (radio) tuner may be present */ |
356 | } | 436 | tuner2 = eeprom_data[i+2]; |
437 | t_format2 = eeprom_data[i+1]; | ||
438 | if (t_format2 == 0) { /* not a TV tuner? */ | ||
439 | tvee->has_radio = 1; /* must be radio */ | ||
440 | } | ||
441 | } | ||
442 | break; | ||
443 | |||
444 | case 0x0b: | ||
445 | /* tag 'Inputs': according to Hauppauge this is specific | ||
446 | to each driver family, so no good assumptions can be | ||
447 | made. */ | ||
448 | break; | ||
449 | |||
450 | /* case 0x0c: tag 'Balun' */ | ||
451 | /* case 0x0d: tag 'Teletext' */ | ||
452 | |||
357 | case 0x0e: | 453 | case 0x0e: |
454 | /* tag: 'Radio' */ | ||
358 | tvee->has_radio = eeprom_data[i+1]; | 455 | tvee->has_radio = eeprom_data[i+1]; |
359 | break; | 456 | break; |
457 | |||
458 | case 0x0f: | ||
459 | /* tag 'IRInfo' */ | ||
460 | tvee->has_ir = eeprom_data[i+1]; | ||
461 | break; | ||
462 | |||
463 | /* case 0x10: tag 'VBIInfo' */ | ||
464 | /* case 0x11: tag 'QCInfo' */ | ||
465 | /* case 0x12: tag 'InfoBits' */ | ||
466 | |||
360 | default: | 467 | default: |
361 | dprintk(1, "Not sure what to do with tag [%02x]\n", tag); | 468 | tveeprom_dbg("Not sure what to do with tag [%02x]\n", tag); |
362 | /* dump the rest of the packet? */ | 469 | /* dump the rest of the packet? */ |
363 | } | 470 | } |
364 | |||
365 | } | 471 | } |
366 | 472 | ||
367 | if (!done) { | 473 | if (!done) { |
368 | TVEEPROM_KERN_ERR("Ran out of data!\n"); | 474 | tveeprom_warn("Ran out of data!\n"); |
369 | return; | 475 | return; |
370 | } | 476 | } |
371 | 477 | ||
@@ -377,47 +483,72 @@ void tveeprom_hauppauge_analog(struct tveeprom *tvee, unsigned char *eeprom_data | |||
377 | tvee->rev_str[4] = 0; | 483 | tvee->rev_str[4] = 0; |
378 | } | 484 | } |
379 | 485 | ||
380 | if (hasRadioTuner(tuner) && !tvee->has_radio) { | 486 | if (hasRadioTuner(tuner1) && !tvee->has_radio) { |
381 | TVEEPROM_KERN_INFO("The eeprom says no radio is present, but the tuner type\n"); | 487 | tveeprom_info("The eeprom says no radio is present, but the tuner type\n"); |
382 | TVEEPROM_KERN_INFO("indicates otherwise. I will assume that radio is present.\n"); | 488 | tveeprom_info("indicates otherwise. I will assume that radio is present.\n"); |
383 | tvee->has_radio = 1; | 489 | tvee->has_radio = 1; |
384 | } | 490 | } |
385 | 491 | ||
386 | if (tuner < sizeof(hauppauge_tuner)/sizeof(struct HAUPPAUGE_TUNER)) { | 492 | if (tuner1 < sizeof(hauppauge_tuner)/sizeof(struct HAUPPAUGE_TUNER)) { |
387 | tvee->tuner_type = hauppauge_tuner[tuner].id; | 493 | tvee->tuner_type = hauppauge_tuner[tuner1].id; |
388 | t_name = hauppauge_tuner[tuner].name; | 494 | t_name1 = hauppauge_tuner[tuner1].name; |
389 | } else { | 495 | } else { |
390 | t_name = "<unknown>"; | 496 | t_name1 = "unknown"; |
497 | } | ||
498 | |||
499 | if (tuner2 < sizeof(hauppauge_tuner)/sizeof(struct HAUPPAUGE_TUNER)) { | ||
500 | tvee->tuner2_type = hauppauge_tuner[tuner2].id; | ||
501 | t_name2 = hauppauge_tuner[tuner2].name; | ||
502 | } else { | ||
503 | t_name2 = "unknown"; | ||
391 | } | 504 | } |
392 | 505 | ||
393 | tvee->tuner_formats = 0; | 506 | tvee->tuner_formats = 0; |
394 | t_fmt_name = "<none>"; | 507 | tvee->tuner2_formats = 0; |
395 | for (i = 0; i < 8; i++) { | 508 | for (i = j = 0; i < 8; i++) { |
396 | if (t_format & (1<<i)) { | 509 | if (t_format1 & (1 << i)) { |
397 | tvee->tuner_formats |= hauppauge_tuner_fmt[i].id; | 510 | tvee->tuner_formats |= hauppauge_tuner_fmt[i].id; |
398 | /* yuck */ | 511 | t_fmt_name1[j++] = hauppauge_tuner_fmt[i].name; |
399 | t_fmt_name = hauppauge_tuner_fmt[i].name; | ||
400 | } | 512 | } |
513 | if (t_format2 & (1 << i)) { | ||
514 | tvee->tuner2_formats |= hauppauge_tuner_fmt[i].id; | ||
515 | t_fmt_name2[j++] = hauppauge_tuner_fmt[i].name; | ||
516 | } | ||
401 | } | 517 | } |
402 | 518 | ||
403 | 519 | tveeprom_info("Hauppauge model %d, rev %s, serial# %d\n", | |
404 | TVEEPROM_KERN_INFO("Hauppauge: model = %d, rev = %s, serial# = %d\n", | 520 | tvee->model, tvee->rev_str, tvee->serial_number); |
405 | tvee->model, | 521 | tveeprom_info("tuner model is %s (idx %d, type %d)\n", |
406 | tvee->rev_str, | 522 | t_name1, tuner1, tvee->tuner_type); |
407 | tvee->serial_number); | 523 | tveeprom_info("TV standards%s%s%s%s%s%s%s%s (eeprom 0x%02x)\n", |
408 | TVEEPROM_KERN_INFO("tuner = %s (idx = %d, type = %d)\n", | 524 | t_fmt_name1[0], t_fmt_name1[1], t_fmt_name1[2], t_fmt_name1[3], |
409 | t_name, | 525 | t_fmt_name1[4], t_fmt_name1[5], t_fmt_name1[6], t_fmt_name1[7], |
410 | tuner, | 526 | t_format1); |
411 | tvee->tuner_type); | 527 | if (tuner2) { |
412 | TVEEPROM_KERN_INFO("tuner fmt = %s (eeprom = 0x%02x, v4l2 = 0x%08x)\n", | 528 | tveeprom_info("second tuner model is %s (idx %d, type %d)\n", |
413 | t_fmt_name, | 529 | t_name2, tuner2, tvee->tuner2_type); |
414 | t_format, | 530 | } |
415 | tvee->tuner_formats); | 531 | if (t_format2) { |
416 | 532 | tveeprom_info("TV standards%s%s%s%s%s%s%s%s (eeprom 0x%02x)\n", | |
417 | TVEEPROM_KERN_INFO("audio_processor = %s (type = %d)\n", | 533 | t_fmt_name2[0], t_fmt_name2[1], t_fmt_name2[2], t_fmt_name2[3], |
418 | STRM(sndtype,tvee->audio_processor), | 534 | t_fmt_name2[4], t_fmt_name2[5], t_fmt_name2[6], t_fmt_name2[7], |
535 | t_format2); | ||
536 | } | ||
537 | tveeprom_info("audio processor is %s (idx %d)\n", | ||
538 | STRM(audioIC, tvee->audio_processor), | ||
419 | tvee->audio_processor); | 539 | tvee->audio_processor); |
420 | 540 | if (tvee->decoder_processor) { | |
541 | tveeprom_info("decoder processor is %s (idx %d)\n", | ||
542 | STRM(decoderIC, tvee->decoder_processor), | ||
543 | tvee->decoder_processor); | ||
544 | } | ||
545 | if (tvee->has_ir == 2) | ||
546 | tveeprom_info("has %sradio\n", | ||
547 | tvee->has_radio ? "" : "no "); | ||
548 | else | ||
549 | tveeprom_info("has %sradio, has %sIR remote\n", | ||
550 | tvee->has_radio ? "" : "no ", | ||
551 | tvee->has_ir ? "" : "no "); | ||
421 | } | 552 | } |
422 | EXPORT_SYMBOL(tveeprom_hauppauge_analog); | 553 | EXPORT_SYMBOL(tveeprom_hauppauge_analog); |
423 | 554 | ||
@@ -429,40 +560,31 @@ int tveeprom_read(struct i2c_client *c, unsigned char *eedata, int len) | |||
429 | unsigned char buf; | 560 | unsigned char buf; |
430 | int err; | 561 | int err; |
431 | 562 | ||
432 | dprintk(1, "%s\n",__FUNCTION__); | ||
433 | buf = 0; | 563 | buf = 0; |
434 | if (1 != (err = i2c_master_send(c,&buf,1))) { | 564 | if (1 != (err = i2c_master_send(c, &buf, 1))) { |
435 | printk(KERN_INFO "tveeprom(%s): Huh, no eeprom present (err=%d)?\n", | 565 | tveeprom_info("Huh, no eeprom present (err=%d)?\n", err); |
436 | c->name,err); | ||
437 | return -1; | 566 | return -1; |
438 | } | 567 | } |
439 | if (len != (err = i2c_master_recv(c,eedata,len))) { | 568 | if (len != (err = i2c_master_recv(c, eedata, len))) { |
440 | printk(KERN_WARNING "tveeprom(%s): i2c eeprom read error (err=%d)\n", | 569 | tveeprom_warn("i2c eeprom read error (err=%d)\n", err); |
441 | c->name,err); | ||
442 | return -1; | 570 | return -1; |
443 | } | 571 | } |
572 | if (debug) { | ||
573 | int i; | ||
574 | |||
575 | tveeprom_info("full 256-byte eeprom dump:\n"); | ||
576 | for (i = 0; i < len; i++) { | ||
577 | if (0 == (i % 16)) | ||
578 | tveeprom_info("%02x:", i); | ||
579 | printk(" %02x", eedata[i]); | ||
580 | if (15 == (i % 16)) | ||
581 | printk("\n"); | ||
582 | } | ||
583 | } | ||
444 | return 0; | 584 | return 0; |
445 | } | 585 | } |
446 | EXPORT_SYMBOL(tveeprom_read); | 586 | EXPORT_SYMBOL(tveeprom_read); |
447 | 587 | ||
448 | #if 0 | ||
449 | int tveeprom_dump(unsigned char *eedata, int len) | ||
450 | { | ||
451 | int i; | ||
452 | |||
453 | dprintk(1, "%s\n",__FUNCTION__); | ||
454 | for (i = 0; i < len; i++) { | ||
455 | if (0 == (i % 16)) | ||
456 | printk(KERN_INFO "tveeprom: %02x:",i); | ||
457 | printk(" %02x",eedata[i]); | ||
458 | if (15 == (i % 16)) | ||
459 | printk("\n"); | ||
460 | } | ||
461 | return 0; | ||
462 | } | ||
463 | EXPORT_SYMBOL(tveeprom_dump); | ||
464 | #endif /* 0 */ | ||
465 | |||
466 | /* ----------------------------------------------------------------------- */ | 588 | /* ----------------------------------------------------------------------- */ |
467 | /* needed for ivtv.sf.net at the moment. Should go away in the long */ | 589 | /* needed for ivtv.sf.net at the moment. Should go away in the long */ |
468 | /* run, just call the exported tveeprom_* directly, there is no point in */ | 590 | /* run, just call the exported tveeprom_* directly, there is no point in */ |
@@ -495,12 +617,13 @@ tveeprom_command(struct i2c_client *client, | |||
495 | buf = kmalloc(256,GFP_KERNEL); | 617 | buf = kmalloc(256,GFP_KERNEL); |
496 | memset(buf,0,256); | 618 | memset(buf,0,256); |
497 | tveeprom_read(client,buf,256); | 619 | tveeprom_read(client,buf,256); |
498 | tveeprom_hauppauge_analog(&eeprom,buf); | 620 | tveeprom_hauppauge_analog(client, &eeprom,buf); |
499 | kfree(buf); | 621 | kfree(buf); |
500 | eeprom_props[0] = eeprom.tuner_type; | 622 | eeprom_props[0] = eeprom.tuner_type; |
501 | eeprom_props[1] = eeprom.tuner_formats; | 623 | eeprom_props[1] = eeprom.tuner_formats; |
502 | eeprom_props[2] = eeprom.model; | 624 | eeprom_props[2] = eeprom.model; |
503 | eeprom_props[3] = eeprom.revision; | 625 | eeprom_props[3] = eeprom.revision; |
626 | eeprom_props[4] = eeprom.has_radio; | ||
504 | break; | 627 | break; |
505 | default: | 628 | default: |
506 | return -EINVAL; | 629 | return -EINVAL; |
@@ -515,8 +638,6 @@ tveeprom_detect_client(struct i2c_adapter *adapter, | |||
515 | { | 638 | { |
516 | struct i2c_client *client; | 639 | struct i2c_client *client; |
517 | 640 | ||
518 | dprintk(1,"%s: id 0x%x @ 0x%x\n",__FUNCTION__, | ||
519 | adapter->id, address << 1); | ||
520 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | 641 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); |
521 | if (NULL == client) | 642 | if (NULL == client) |
522 | return -ENOMEM; | 643 | return -ENOMEM; |
@@ -533,7 +654,6 @@ tveeprom_detect_client(struct i2c_adapter *adapter, | |||
533 | static int | 654 | static int |
534 | tveeprom_attach_adapter (struct i2c_adapter *adapter) | 655 | tveeprom_attach_adapter (struct i2c_adapter *adapter) |
535 | { | 656 | { |
536 | dprintk(1,"%s: id 0x%x\n",__FUNCTION__,adapter->id); | ||
537 | if (adapter->id != I2C_HW_B_BT848) | 657 | if (adapter->id != I2C_HW_B_BT848) |
538 | return 0; | 658 | return 0; |
539 | return i2c_probe(adapter, &addr_data, tveeprom_detect_client); | 659 | return i2c_probe(adapter, &addr_data, tveeprom_detect_client); |