diff options
Diffstat (limited to 'drivers/media')
127 files changed, 5773 insertions, 3414 deletions
diff --git a/drivers/media/Makefile b/drivers/media/Makefile index 772d6112fb3b..c578a529e7a8 100644 --- a/drivers/media/Makefile +++ b/drivers/media/Makefile | |||
@@ -2,4 +2,7 @@ | |||
2 | # Makefile for the kernel multimedia device drivers. | 2 | # Makefile for the kernel multimedia device drivers. |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := video/ radio/ dvb/ common/ | 5 | obj-y := common/ |
6 | obj-$(CONFIG_VIDEO_DEV) += video/ | ||
7 | obj-$(CONFIG_VIDEO_DEV) += radio/ | ||
8 | obj-$(CONFIG_DVB) += dvb/ | ||
diff --git a/drivers/media/common/ir-common.c b/drivers/media/common/ir-common.c index ab7a1fba4427..a0e700d7a4a4 100644 --- a/drivers/media/common/ir-common.c +++ b/drivers/media/common/ir-common.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: ir-common.c,v 1.11 2005/07/07 14:44:43 mchehab Exp $ | ||
3 | * | 2 | * |
4 | * some common structs and functions to handle infrared remotes via | 3 | * some common structs and functions to handle infrared remotes via |
5 | * input layer ... | 4 | * input layer ... |
@@ -335,6 +334,72 @@ int ir_dump_samples(u32 *samples, int count) | |||
335 | return 0; | 334 | return 0; |
336 | } | 335 | } |
337 | 336 | ||
337 | /* decode raw samples, pulse distance coding used by NEC remotes */ | ||
338 | int ir_decode_pulsedistance(u32 *samples, int count, int low, int high) | ||
339 | { | ||
340 | int i,last,bit,len; | ||
341 | u32 curBit; | ||
342 | u32 value; | ||
343 | |||
344 | /* find start burst */ | ||
345 | for (i = len = 0; i < count * 32; i++) { | ||
346 | bit = getbit(samples,i); | ||
347 | if (bit) { | ||
348 | len++; | ||
349 | } else { | ||
350 | if (len >= 29) | ||
351 | break; | ||
352 | len = 0; | ||
353 | } | ||
354 | } | ||
355 | |||
356 | /* start burst to short */ | ||
357 | if (len < 29) | ||
358 | return 0xffffffff; | ||
359 | |||
360 | /* find start silence */ | ||
361 | for (len = 0; i < count * 32; i++) { | ||
362 | bit = getbit(samples,i); | ||
363 | if (bit) { | ||
364 | break; | ||
365 | } else { | ||
366 | len++; | ||
367 | } | ||
368 | } | ||
369 | |||
370 | /* silence to short */ | ||
371 | if (len < 7) | ||
372 | return 0xffffffff; | ||
373 | |||
374 | /* go decoding */ | ||
375 | len = 0; | ||
376 | last = 1; | ||
377 | value = 0; curBit = 1; | ||
378 | for (; i < count * 32; i++) { | ||
379 | bit = getbit(samples,i); | ||
380 | if (last) { | ||
381 | if(bit) { | ||
382 | continue; | ||
383 | } else { | ||
384 | len = 1; | ||
385 | } | ||
386 | } else { | ||
387 | if (bit) { | ||
388 | if (len > (low + high) /2) | ||
389 | value |= curBit; | ||
390 | curBit <<= 1; | ||
391 | if (curBit == 1) | ||
392 | break; | ||
393 | } else { | ||
394 | len++; | ||
395 | } | ||
396 | } | ||
397 | last = bit; | ||
398 | } | ||
399 | |||
400 | return value; | ||
401 | } | ||
402 | |||
338 | /* decode raw samples, biphase coding, used by rc5 for example */ | 403 | /* decode raw samples, biphase coding, used by rc5 for example */ |
339 | int ir_decode_biphase(u32 *samples, int count, int low, int high) | 404 | int ir_decode_biphase(u32 *samples, int count, int low, int high) |
340 | { | 405 | { |
@@ -383,6 +448,7 @@ EXPORT_SYMBOL_GPL(ir_input_keydown); | |||
383 | EXPORT_SYMBOL_GPL(ir_extract_bits); | 448 | EXPORT_SYMBOL_GPL(ir_extract_bits); |
384 | EXPORT_SYMBOL_GPL(ir_dump_samples); | 449 | EXPORT_SYMBOL_GPL(ir_dump_samples); |
385 | EXPORT_SYMBOL_GPL(ir_decode_biphase); | 450 | EXPORT_SYMBOL_GPL(ir_decode_biphase); |
451 | EXPORT_SYMBOL_GPL(ir_decode_pulsedistance); | ||
386 | 452 | ||
387 | /* | 453 | /* |
388 | * Local variables: | 454 | * Local variables: |
diff --git a/drivers/media/common/saa7146_core.c b/drivers/media/common/saa7146_core.c index cd5828b5e9e3..206cc2f61f26 100644 --- a/drivers/media/common/saa7146_core.c +++ b/drivers/media/common/saa7146_core.c | |||
@@ -168,10 +168,8 @@ void saa7146_pgtable_free(struct pci_dev *pci, struct saa7146_pgtable *pt) | |||
168 | return; | 168 | return; |
169 | pci_free_consistent(pci, pt->size, pt->cpu, pt->dma); | 169 | pci_free_consistent(pci, pt->size, pt->cpu, pt->dma); |
170 | pt->cpu = NULL; | 170 | pt->cpu = NULL; |
171 | if (NULL != pt->slist) { | 171 | kfree(pt->slist); |
172 | kfree(pt->slist); | 172 | pt->slist = NULL; |
173 | pt->slist = NULL; | ||
174 | } | ||
175 | } | 173 | } |
176 | 174 | ||
177 | int saa7146_pgtable_alloc(struct pci_dev *pci, struct saa7146_pgtable *pt) | 175 | int saa7146_pgtable_alloc(struct pci_dev *pci, struct saa7146_pgtable *pt) |
diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c index c04fd11526e0..37888989ea2e 100644 --- a/drivers/media/common/saa7146_fops.c +++ b/drivers/media/common/saa7146_fops.c | |||
@@ -1,5 +1,4 @@ | |||
1 | #include <media/saa7146_vv.h> | 1 | #include <media/saa7146_vv.h> |
2 | #include <linux/version.h> | ||
3 | 2 | ||
4 | #define BOARD_CAN_DO_VBI(dev) (dev->revision != 0 && dev->vv_data->vbi_minor != -1) | 3 | #define BOARD_CAN_DO_VBI(dev) (dev->revision != 0 && dev->vv_data->vbi_minor != -1) |
5 | 4 | ||
diff --git a/drivers/media/common/saa7146_i2c.c b/drivers/media/common/saa7146_i2c.c index 6284894505c6..fec6beab8c28 100644 --- a/drivers/media/common/saa7146_i2c.c +++ b/drivers/media/common/saa7146_i2c.c | |||
@@ -1,4 +1,3 @@ | |||
1 | #include <linux/version.h> | ||
2 | #include <media/saa7146_vv.h> | 1 | #include <media/saa7146_vv.h> |
3 | 2 | ||
4 | static u32 saa7146_i2c_func(struct i2c_adapter *adapter) | 3 | static u32 saa7146_i2c_func(struct i2c_adapter *adapter) |
@@ -402,12 +401,9 @@ int saa7146_i2c_adapter_prepare(struct saa7146_dev *dev, struct i2c_adapter *i2c | |||
402 | saa7146_i2c_reset(dev); | 401 | saa7146_i2c_reset(dev); |
403 | 402 | ||
404 | if( NULL != i2c_adapter ) { | 403 | if( NULL != i2c_adapter ) { |
405 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) | ||
406 | i2c_adapter->data = dev; | ||
407 | #else | ||
408 | BUG_ON(!i2c_adapter->class); | 404 | BUG_ON(!i2c_adapter->class); |
409 | i2c_set_adapdata(i2c_adapter,dev); | 405 | i2c_set_adapdata(i2c_adapter,dev); |
410 | #endif | 406 | i2c_adapter->dev.parent = &dev->pci->dev; |
411 | i2c_adapter->algo = &saa7146_algo; | 407 | i2c_adapter->algo = &saa7146_algo; |
412 | i2c_adapter->algo_data = NULL; | 408 | i2c_adapter->algo_data = NULL; |
413 | i2c_adapter->id = I2C_HW_SAA7146; | 409 | i2c_adapter->id = I2C_HW_SAA7146; |
diff --git a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c index 0410cc96a48e..47e28b0ee951 100644 --- a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c +++ b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c | |||
@@ -164,12 +164,11 @@ static int samsung_tbmu24112_set_symbol_rate(struct dvb_frontend* fe, u32 srate, | |||
164 | return 0; | 164 | return 0; |
165 | } | 165 | } |
166 | 166 | ||
167 | static int samsung_tbmu24112_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 167 | static int samsung_tbmu24112_pll_set(struct dvb_frontend* fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters* params) |
168 | { | 168 | { |
169 | u8 buf[4]; | 169 | u8 buf[4]; |
170 | u32 div; | 170 | u32 div; |
171 | struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = buf, .len = sizeof(buf) }; | 171 | struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = buf, .len = sizeof(buf) }; |
172 | struct flexcop_device *fc = fe->dvb->priv; | ||
173 | 172 | ||
174 | div = params->frequency / 125; | 173 | div = params->frequency / 125; |
175 | 174 | ||
@@ -180,7 +179,7 @@ static int samsung_tbmu24112_pll_set(struct dvb_frontend* fe, struct dvb_fronten | |||
180 | 179 | ||
181 | if (params->frequency < 1500000) buf[3] |= 0x10; | 180 | if (params->frequency < 1500000) buf[3] |= 0x10; |
182 | 181 | ||
183 | if (i2c_transfer(&fc->i2c_adap, &msg, 1) != 1) | 182 | if (i2c_transfer(i2c, &msg, 1) != 1) |
184 | return -EIO; | 183 | return -EIO; |
185 | return 0; | 184 | return 0; |
186 | } | 185 | } |
@@ -335,8 +334,103 @@ static struct mt312_config skystar23_samsung_tbdu18132_config = { | |||
335 | .pll_set = skystar23_samsung_tbdu18132_pll_set, | 334 | .pll_set = skystar23_samsung_tbdu18132_pll_set, |
336 | }; | 335 | }; |
337 | 336 | ||
337 | |||
338 | static u8 alps_tdee4_stv0297_inittab[] = { | ||
339 | 0x80, 0x01, | ||
340 | 0x80, 0x00, | ||
341 | 0x81, 0x01, | ||
342 | 0x81, 0x00, | ||
343 | 0x00, 0x09, | ||
344 | 0x01, 0x69, | ||
345 | 0x03, 0x00, | ||
346 | 0x04, 0x00, | ||
347 | 0x07, 0x00, | ||
348 | 0x08, 0x00, | ||
349 | 0x20, 0x00, | ||
350 | 0x21, 0x40, | ||
351 | 0x22, 0x00, | ||
352 | 0x23, 0x00, | ||
353 | 0x24, 0x40, | ||
354 | 0x25, 0x88, | ||
355 | 0x30, 0xff, | ||
356 | 0x31, 0x00, | ||
357 | 0x32, 0xff, | ||
358 | 0x33, 0x00, | ||
359 | 0x34, 0x50, | ||
360 | 0x35, 0x7f, | ||
361 | 0x36, 0x00, | ||
362 | 0x37, 0x20, | ||
363 | 0x38, 0x00, | ||
364 | 0x40, 0x1c, | ||
365 | 0x41, 0xff, | ||
366 | 0x42, 0x29, | ||
367 | 0x43, 0x00, | ||
368 | 0x44, 0xff, | ||
369 | 0x45, 0x00, | ||
370 | 0x46, 0x00, | ||
371 | 0x49, 0x04, | ||
372 | 0x4a, 0x00, | ||
373 | 0x4b, 0xf8, | ||
374 | 0x52, 0x30, | ||
375 | 0x55, 0xae, | ||
376 | 0x56, 0x47, | ||
377 | 0x57, 0xe1, | ||
378 | 0x58, 0x3a, | ||
379 | 0x5a, 0x1e, | ||
380 | 0x5b, 0x34, | ||
381 | 0x60, 0x00, | ||
382 | 0x63, 0x00, | ||
383 | 0x64, 0x00, | ||
384 | 0x65, 0x00, | ||
385 | 0x66, 0x00, | ||
386 | 0x67, 0x00, | ||
387 | 0x68, 0x00, | ||
388 | 0x69, 0x00, | ||
389 | 0x6a, 0x02, | ||
390 | 0x6b, 0x00, | ||
391 | 0x70, 0xff, | ||
392 | 0x71, 0x00, | ||
393 | 0x72, 0x00, | ||
394 | 0x73, 0x00, | ||
395 | 0x74, 0x0c, | ||
396 | 0x80, 0x00, | ||
397 | 0x81, 0x00, | ||
398 | 0x82, 0x00, | ||
399 | 0x83, 0x00, | ||
400 | 0x84, 0x04, | ||
401 | 0x85, 0x80, | ||
402 | 0x86, 0x24, | ||
403 | 0x87, 0x78, | ||
404 | 0x88, 0x10, | ||
405 | 0x89, 0x00, | ||
406 | 0x90, 0x01, | ||
407 | 0x91, 0x01, | ||
408 | 0xa0, 0x04, | ||
409 | 0xa1, 0x00, | ||
410 | 0xa2, 0x00, | ||
411 | 0xb0, 0x91, | ||
412 | 0xb1, 0x0b, | ||
413 | 0xc0, 0x53, | ||
414 | 0xc1, 0x70, | ||
415 | 0xc2, 0x12, | ||
416 | 0xd0, 0x00, | ||
417 | 0xd1, 0x00, | ||
418 | 0xd2, 0x00, | ||
419 | 0xd3, 0x00, | ||
420 | 0xd4, 0x00, | ||
421 | 0xd5, 0x00, | ||
422 | 0xde, 0x00, | ||
423 | 0xdf, 0x00, | ||
424 | 0x61, 0x49, | ||
425 | 0x62, 0x0b, | ||
426 | 0x53, 0x08, | ||
427 | 0x59, 0x08, | ||
428 | 0xff, 0xff, | ||
429 | }; | ||
430 | |||
338 | static struct stv0297_config alps_tdee4_stv0297_config = { | 431 | static struct stv0297_config alps_tdee4_stv0297_config = { |
339 | .demod_address = 0x1c, | 432 | .demod_address = 0x1c, |
433 | .inittab = alps_tdee4_stv0297_inittab, | ||
340 | // .invert = 1, | 434 | // .invert = 1, |
341 | // .pll_set = alps_tdee4_stv0297_pll_set, | 435 | // .pll_set = alps_tdee4_stv0297_pll_set, |
342 | }; | 436 | }; |
@@ -370,7 +464,7 @@ int flexcop_frontend_init(struct flexcop_device *fc) | |||
370 | info("found the bcm3510 at i2c address: 0x%02x",air2pc_atsc_first_gen_config.demod_address); | 464 | info("found the bcm3510 at i2c address: 0x%02x",air2pc_atsc_first_gen_config.demod_address); |
371 | } else | 465 | } else |
372 | /* try the cable dvb (stv0297) */ | 466 | /* try the cable dvb (stv0297) */ |
373 | if ((fc->fe = stv0297_attach(&alps_tdee4_stv0297_config, &fc->i2c_adap, 0xf8)) != NULL) { | 467 | if ((fc->fe = stv0297_attach(&alps_tdee4_stv0297_config, &fc->i2c_adap)) != NULL) { |
374 | fc->dev_type = FC_CABLE; | 468 | fc->dev_type = FC_CABLE; |
375 | info("found the stv0297 at i2c address: 0x%02x",alps_tdee4_stv0297_config.demod_address); | 469 | info("found the stv0297 at i2c address: 0x%02x",alps_tdee4_stv0297_config.demod_address); |
376 | } else | 470 | } else |
diff --git a/drivers/media/dvb/bt8xx/bt878.c b/drivers/media/dvb/bt8xx/bt878.c index 3c5a8e273c4a..f29571450038 100644 --- a/drivers/media/dvb/bt8xx/bt878.c +++ b/drivers/media/dvb/bt8xx/bt878.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * bt878.c: part of the driver for the Pinnacle PCTV Sat DVB PCI card | 2 | * bt878.c: part of the driver for the Pinnacle PCTV Sat DVB PCI card |
3 | * | 3 | * |
4 | * Copyright (C) 2002 Peter Hettkamp <peter.hettkamp@t-online.de> | 4 | * Copyright (C) 2002 Peter Hettkamp <peter.hettkamp@htp-tel.de> |
5 | * | 5 | * |
6 | * large parts based on the bttv driver | 6 | * large parts based on the bttv driver |
7 | * Copyright (C) 1996,97,98 Ralph Metzler (rjkm@metzlerbros.de) | 7 | * Copyright (C) 1996,97,98 Ralph Metzler (rjkm@metzlerbros.de) |
@@ -219,7 +219,7 @@ void bt878_start(struct bt878 *bt, u32 controlreg, u32 op_sync_orin, | |||
219 | controlreg &= ~0x1f; | 219 | controlreg &= ~0x1f; |
220 | controlreg |= 0x1b; | 220 | controlreg |= 0x1b; |
221 | 221 | ||
222 | btwrite(cpu_to_le32(bt->risc_dma), BT878_ARISC_START); | 222 | btwrite(bt->risc_dma, BT878_ARISC_START); |
223 | 223 | ||
224 | /* original int mask had : | 224 | /* original int mask had : |
225 | * 6 2 8 4 0 | 225 | * 6 2 8 4 0 |
diff --git a/drivers/media/dvb/bt8xx/bt878.h b/drivers/media/dvb/bt8xx/bt878.h index 837623f7fcdf..a73baf00ca39 100644 --- a/drivers/media/dvb/bt8xx/bt878.h +++ b/drivers/media/dvb/bt8xx/bt878.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | bt878.h - Bt878 audio module (register offsets) | 2 | bt878.h - Bt878 audio module (register offsets) |
3 | 3 | ||
4 | Copyright (C) 2002 Peter Hettkamp <peter.hettkamp@t-online.de> | 4 | Copyright (C) 2002 Peter Hettkamp <peter.hettkamp@htp-tel.de> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
diff --git a/drivers/media/dvb/bt8xx/dst.c b/drivers/media/dvb/bt8xx/dst.c index 07a0b0a968a6..34a837a1abf4 100644 --- a/drivers/media/dvb/bt8xx/dst.c +++ b/drivers/media/dvb/bt8xx/dst.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | |||
3 | Frontend/Card driver for TwinHan DST Frontend | 2 | Frontend/Card driver for TwinHan DST Frontend |
4 | Copyright (C) 2003 Jamie Honan | 3 | Copyright (C) 2003 Jamie Honan |
5 | Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com) | 4 | Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com) |
@@ -19,7 +18,6 @@ | |||
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | */ | 19 | */ |
21 | 20 | ||
22 | |||
23 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
24 | #include <linux/module.h> | 22 | #include <linux/module.h> |
25 | #include <linux/init.h> | 23 | #include <linux/init.h> |
@@ -28,31 +26,45 @@ | |||
28 | #include <linux/vmalloc.h> | 26 | #include <linux/vmalloc.h> |
29 | #include <linux/delay.h> | 27 | #include <linux/delay.h> |
30 | #include <asm/div64.h> | 28 | #include <asm/div64.h> |
31 | |||
32 | #include "dvb_frontend.h" | 29 | #include "dvb_frontend.h" |
33 | #include "dst_priv.h" | 30 | #include "dst_priv.h" |
34 | #include "dst_common.h" | 31 | #include "dst_common.h" |
35 | 32 | ||
36 | |||
37 | static unsigned int verbose = 1; | 33 | static unsigned int verbose = 1; |
38 | module_param(verbose, int, 0644); | 34 | module_param(verbose, int, 0644); |
39 | MODULE_PARM_DESC(verbose, "verbose startup messages, default is 1 (yes)"); | 35 | MODULE_PARM_DESC(verbose, "verbose startup messages, default is 1 (yes)"); |
40 | 36 | ||
41 | static unsigned int debug = 1; | ||
42 | module_param(debug, int, 0644); | ||
43 | MODULE_PARM_DESC(debug, "debug messages, default is 0 (yes)"); | ||
44 | |||
45 | static unsigned int dst_addons; | 37 | static unsigned int dst_addons; |
46 | module_param(dst_addons, int, 0644); | 38 | module_param(dst_addons, int, 0644); |
47 | MODULE_PARM_DESC(dst_addons, "CA daughterboard, default is 0 (No addons)"); | 39 | MODULE_PARM_DESC(dst_addons, "CA daughterboard, default is 0 (No addons)"); |
48 | 40 | ||
49 | #define dprintk if (debug) printk | 41 | #define HAS_LOCK 1 |
50 | 42 | #define ATTEMPT_TUNE 2 | |
51 | #define HAS_LOCK 1 | 43 | #define HAS_POWER 4 |
52 | #define ATTEMPT_TUNE 2 | 44 | |
53 | #define HAS_POWER 4 | 45 | #define DST_ERROR 0 |
54 | 46 | #define DST_NOTICE 1 | |
55 | static void dst_packsize(struct dst_state* state, int psize) | 47 | #define DST_INFO 2 |
48 | #define DST_DEBUG 3 | ||
49 | |||
50 | #define dprintk(x, y, z, format, arg...) do { \ | ||
51 | if (z) { \ | ||
52 | if ((x > DST_ERROR) && (x > y)) \ | ||
53 | printk(KERN_ERR "%s: " format "\n", __FUNCTION__ , ##arg); \ | ||
54 | else if ((x > DST_NOTICE) && (x > y)) \ | ||
55 | printk(KERN_NOTICE "%s: " format "\n", __FUNCTION__ , ##arg); \ | ||
56 | else if ((x > DST_INFO) && (x > y)) \ | ||
57 | printk(KERN_INFO "%s: " format "\n", __FUNCTION__ , ##arg); \ | ||
58 | else if ((x > DST_DEBUG) && (x > y)) \ | ||
59 | printk(KERN_DEBUG "%s: " format "\n", __FUNCTION__ , ##arg); \ | ||
60 | } else { \ | ||
61 | if (x > y) \ | ||
62 | printk(format, ##arg); \ | ||
63 | } \ | ||
64 | } while(0) | ||
65 | |||
66 | |||
67 | static void dst_packsize(struct dst_state *state, int psize) | ||
56 | { | 68 | { |
57 | union dst_gpio_packet bits; | 69 | union dst_gpio_packet bits; |
58 | 70 | ||
@@ -60,7 +72,7 @@ static void dst_packsize(struct dst_state* state, int psize) | |||
60 | bt878_device_control(state->bt, DST_IG_TS, &bits); | 72 | bt878_device_control(state->bt, DST_IG_TS, &bits); |
61 | } | 73 | } |
62 | 74 | ||
63 | int dst_gpio_outb(struct dst_state* state, u32 mask, u32 enbb, u32 outhigh, int delay) | 75 | int dst_gpio_outb(struct dst_state *state, u32 mask, u32 enbb, u32 outhigh, int delay) |
64 | { | 76 | { |
65 | union dst_gpio_packet enb; | 77 | union dst_gpio_packet enb; |
66 | union dst_gpio_packet bits; | 78 | union dst_gpio_packet bits; |
@@ -68,63 +80,55 @@ int dst_gpio_outb(struct dst_state* state, u32 mask, u32 enbb, u32 outhigh, int | |||
68 | 80 | ||
69 | enb.enb.mask = mask; | 81 | enb.enb.mask = mask; |
70 | enb.enb.enable = enbb; | 82 | enb.enb.enable = enbb; |
71 | if (verbose > 4) | ||
72 | dprintk("%s: mask=[%04x], enbb=[%04x], outhigh=[%04x]\n", __FUNCTION__, mask, enbb, outhigh); | ||
73 | 83 | ||
84 | dprintk(verbose, DST_INFO, 1, "mask=[%04x], enbb=[%04x], outhigh=[%04x]", mask, enbb, outhigh); | ||
74 | if ((err = bt878_device_control(state->bt, DST_IG_ENABLE, &enb)) < 0) { | 85 | if ((err = bt878_device_control(state->bt, DST_IG_ENABLE, &enb)) < 0) { |
75 | dprintk("%s: dst_gpio_enb error (err == %i, mask == %02x, enb == %02x)\n", __FUNCTION__, err, mask, enbb); | 86 | dprintk(verbose, DST_INFO, 1, "dst_gpio_enb error (err == %i, mask == %02x, enb == %02x)", err, mask, enbb); |
76 | return -EREMOTEIO; | 87 | return -EREMOTEIO; |
77 | } | 88 | } |
78 | udelay(1000); | 89 | udelay(1000); |
79 | /* because complete disabling means no output, no need to do output packet */ | 90 | /* because complete disabling means no output, no need to do output packet */ |
80 | if (enbb == 0) | 91 | if (enbb == 0) |
81 | return 0; | 92 | return 0; |
82 | |||
83 | if (delay) | 93 | if (delay) |
84 | msleep(10); | 94 | msleep(10); |
85 | |||
86 | bits.outp.mask = enbb; | 95 | bits.outp.mask = enbb; |
87 | bits.outp.highvals = outhigh; | 96 | bits.outp.highvals = outhigh; |
88 | |||
89 | if ((err = bt878_device_control(state->bt, DST_IG_WRITE, &bits)) < 0) { | 97 | if ((err = bt878_device_control(state->bt, DST_IG_WRITE, &bits)) < 0) { |
90 | dprintk("%s: dst_gpio_outb error (err == %i, enbb == %02x, outhigh == %02x)\n", __FUNCTION__, err, enbb, outhigh); | 98 | dprintk(verbose, DST_INFO, 1, "dst_gpio_outb error (err == %i, enbb == %02x, outhigh == %02x)", err, enbb, outhigh); |
91 | return -EREMOTEIO; | 99 | return -EREMOTEIO; |
92 | } | 100 | } |
101 | |||
93 | return 0; | 102 | return 0; |
94 | } | 103 | } |
95 | EXPORT_SYMBOL(dst_gpio_outb); | 104 | EXPORT_SYMBOL(dst_gpio_outb); |
96 | 105 | ||
97 | int dst_gpio_inb(struct dst_state *state, u8 * result) | 106 | int dst_gpio_inb(struct dst_state *state, u8 *result) |
98 | { | 107 | { |
99 | union dst_gpio_packet rd_packet; | 108 | union dst_gpio_packet rd_packet; |
100 | int err; | 109 | int err; |
101 | 110 | ||
102 | *result = 0; | 111 | *result = 0; |
103 | |||
104 | if ((err = bt878_device_control(state->bt, DST_IG_READ, &rd_packet)) < 0) { | 112 | if ((err = bt878_device_control(state->bt, DST_IG_READ, &rd_packet)) < 0) { |
105 | dprintk("%s: dst_gpio_inb error (err == %i)\n", __FUNCTION__, err); | 113 | dprintk(verbose, DST_ERROR, 1, "dst_gpio_inb error (err == %i)\n", err); |
106 | return -EREMOTEIO; | 114 | return -EREMOTEIO; |
107 | } | 115 | } |
108 | |||
109 | *result = (u8) rd_packet.rd.value; | 116 | *result = (u8) rd_packet.rd.value; |
117 | |||
110 | return 0; | 118 | return 0; |
111 | } | 119 | } |
112 | EXPORT_SYMBOL(dst_gpio_inb); | 120 | EXPORT_SYMBOL(dst_gpio_inb); |
113 | 121 | ||
114 | int rdc_reset_state(struct dst_state *state) | 122 | int rdc_reset_state(struct dst_state *state) |
115 | { | 123 | { |
116 | if (verbose > 1) | 124 | dprintk(verbose, DST_INFO, 1, "Resetting state machine"); |
117 | dprintk("%s: Resetting state machine\n", __FUNCTION__); | ||
118 | |||
119 | if (dst_gpio_outb(state, RDC_8820_INT, RDC_8820_INT, 0, NO_DELAY) < 0) { | 125 | if (dst_gpio_outb(state, RDC_8820_INT, RDC_8820_INT, 0, NO_DELAY) < 0) { |
120 | dprintk("%s: dst_gpio_outb ERROR !\n", __FUNCTION__); | 126 | dprintk(verbose, DST_ERROR, 1, "dst_gpio_outb ERROR !"); |
121 | return -1; | 127 | return -1; |
122 | } | 128 | } |
123 | |||
124 | msleep(10); | 129 | msleep(10); |
125 | |||
126 | if (dst_gpio_outb(state, RDC_8820_INT, RDC_8820_INT, RDC_8820_INT, NO_DELAY) < 0) { | 130 | if (dst_gpio_outb(state, RDC_8820_INT, RDC_8820_INT, RDC_8820_INT, NO_DELAY) < 0) { |
127 | dprintk("%s: dst_gpio_outb ERROR !\n", __FUNCTION__); | 131 | dprintk(verbose, DST_ERROR, 1, "dst_gpio_outb ERROR !"); |
128 | msleep(10); | 132 | msleep(10); |
129 | return -1; | 133 | return -1; |
130 | } | 134 | } |
@@ -135,16 +139,14 @@ EXPORT_SYMBOL(rdc_reset_state); | |||
135 | 139 | ||
136 | int rdc_8820_reset(struct dst_state *state) | 140 | int rdc_8820_reset(struct dst_state *state) |
137 | { | 141 | { |
138 | if (verbose > 1) | 142 | dprintk(verbose, DST_DEBUG, 1, "Resetting DST"); |
139 | dprintk("%s: Resetting DST\n", __FUNCTION__); | ||
140 | |||
141 | if (dst_gpio_outb(state, RDC_8820_RESET, RDC_8820_RESET, 0, NO_DELAY) < 0) { | 143 | if (dst_gpio_outb(state, RDC_8820_RESET, RDC_8820_RESET, 0, NO_DELAY) < 0) { |
142 | dprintk("%s: dst_gpio_outb ERROR !\n", __FUNCTION__); | 144 | dprintk(verbose, DST_ERROR, 1, "dst_gpio_outb ERROR !"); |
143 | return -1; | 145 | return -1; |
144 | } | 146 | } |
145 | udelay(1000); | 147 | udelay(1000); |
146 | if (dst_gpio_outb(state, RDC_8820_RESET, RDC_8820_RESET, RDC_8820_RESET, DELAY) < 0) { | 148 | if (dst_gpio_outb(state, RDC_8820_RESET, RDC_8820_RESET, RDC_8820_RESET, DELAY) < 0) { |
147 | dprintk("%s: dst_gpio_outb ERROR !\n", __FUNCTION__); | 149 | dprintk(verbose, DST_ERROR, 1, "dst_gpio_outb ERROR !"); |
148 | return -1; | 150 | return -1; |
149 | } | 151 | } |
150 | 152 | ||
@@ -155,10 +157,11 @@ EXPORT_SYMBOL(rdc_8820_reset); | |||
155 | int dst_pio_enable(struct dst_state *state) | 157 | int dst_pio_enable(struct dst_state *state) |
156 | { | 158 | { |
157 | if (dst_gpio_outb(state, ~0, RDC_8820_PIO_0_ENABLE, 0, NO_DELAY) < 0) { | 159 | if (dst_gpio_outb(state, ~0, RDC_8820_PIO_0_ENABLE, 0, NO_DELAY) < 0) { |
158 | dprintk("%s: dst_gpio_outb ERROR !\n", __FUNCTION__); | 160 | dprintk(verbose, DST_ERROR, 1, "dst_gpio_outb ERROR !"); |
159 | return -1; | 161 | return -1; |
160 | } | 162 | } |
161 | udelay(1000); | 163 | udelay(1000); |
164 | |||
162 | return 0; | 165 | return 0; |
163 | } | 166 | } |
164 | EXPORT_SYMBOL(dst_pio_enable); | 167 | EXPORT_SYMBOL(dst_pio_enable); |
@@ -166,7 +169,7 @@ EXPORT_SYMBOL(dst_pio_enable); | |||
166 | int dst_pio_disable(struct dst_state *state) | 169 | int dst_pio_disable(struct dst_state *state) |
167 | { | 170 | { |
168 | if (dst_gpio_outb(state, ~0, RDC_8820_PIO_0_DISABLE, RDC_8820_PIO_0_DISABLE, NO_DELAY) < 0) { | 171 | if (dst_gpio_outb(state, ~0, RDC_8820_PIO_0_DISABLE, RDC_8820_PIO_0_DISABLE, NO_DELAY) < 0) { |
169 | dprintk("%s: dst_gpio_outb ERROR !\n", __FUNCTION__); | 172 | dprintk(verbose, DST_ERROR, 1, "dst_gpio_outb ERROR !"); |
170 | return -1; | 173 | return -1; |
171 | } | 174 | } |
172 | if (state->type_flags & DST_TYPE_HAS_FW_1) | 175 | if (state->type_flags & DST_TYPE_HAS_FW_1) |
@@ -183,19 +186,16 @@ int dst_wait_dst_ready(struct dst_state *state, u8 delay_mode) | |||
183 | 186 | ||
184 | for (i = 0; i < 200; i++) { | 187 | for (i = 0; i < 200; i++) { |
185 | if (dst_gpio_inb(state, &reply) < 0) { | 188 | if (dst_gpio_inb(state, &reply) < 0) { |
186 | dprintk("%s: dst_gpio_inb ERROR !\n", __FUNCTION__); | 189 | dprintk(verbose, DST_ERROR, 1, "dst_gpio_inb ERROR !"); |
187 | return -1; | 190 | return -1; |
188 | } | 191 | } |
189 | |||
190 | if ((reply & RDC_8820_PIO_0_ENABLE) == 0) { | 192 | if ((reply & RDC_8820_PIO_0_ENABLE) == 0) { |
191 | if (verbose > 4) | 193 | dprintk(verbose, DST_INFO, 1, "dst wait ready after %d", i); |
192 | dprintk("%s: dst wait ready after %d\n", __FUNCTION__, i); | ||
193 | return 1; | 194 | return 1; |
194 | } | 195 | } |
195 | msleep(10); | 196 | msleep(10); |
196 | } | 197 | } |
197 | if (verbose > 1) | 198 | dprintk(verbose, DST_NOTICE, 1, "dst wait NOT ready after %d", i); |
198 | dprintk("%s: dst wait NOT ready after %d\n", __FUNCTION__, i); | ||
199 | 199 | ||
200 | return 0; | 200 | return 0; |
201 | } | 201 | } |
@@ -203,7 +203,7 @@ EXPORT_SYMBOL(dst_wait_dst_ready); | |||
203 | 203 | ||
204 | int dst_error_recovery(struct dst_state *state) | 204 | int dst_error_recovery(struct dst_state *state) |
205 | { | 205 | { |
206 | dprintk("%s: Trying to return from previous errors...\n", __FUNCTION__); | 206 | dprintk(verbose, DST_NOTICE, 1, "Trying to return from previous errors."); |
207 | dst_pio_disable(state); | 207 | dst_pio_disable(state); |
208 | msleep(10); | 208 | msleep(10); |
209 | dst_pio_enable(state); | 209 | dst_pio_enable(state); |
@@ -215,7 +215,7 @@ EXPORT_SYMBOL(dst_error_recovery); | |||
215 | 215 | ||
216 | int dst_error_bailout(struct dst_state *state) | 216 | int dst_error_bailout(struct dst_state *state) |
217 | { | 217 | { |
218 | dprintk("%s: Trying to bailout from previous error...\n", __FUNCTION__); | 218 | dprintk(verbose, DST_INFO, 1, "Trying to bailout from previous error."); |
219 | rdc_8820_reset(state); | 219 | rdc_8820_reset(state); |
220 | dst_pio_disable(state); | 220 | dst_pio_disable(state); |
221 | msleep(10); | 221 | msleep(10); |
@@ -224,17 +224,15 @@ int dst_error_bailout(struct dst_state *state) | |||
224 | } | 224 | } |
225 | EXPORT_SYMBOL(dst_error_bailout); | 225 | EXPORT_SYMBOL(dst_error_bailout); |
226 | 226 | ||
227 | 227 | int dst_comm_init(struct dst_state *state) | |
228 | int dst_comm_init(struct dst_state* state) | ||
229 | { | 228 | { |
230 | if (verbose > 1) | 229 | dprintk(verbose, DST_INFO, 1, "Initializing DST."); |
231 | dprintk ("%s: Initializing DST..\n", __FUNCTION__); | ||
232 | if ((dst_pio_enable(state)) < 0) { | 230 | if ((dst_pio_enable(state)) < 0) { |
233 | dprintk("%s: PIO Enable Failed.\n", __FUNCTION__); | 231 | dprintk(verbose, DST_ERROR, 1, "PIO Enable Failed"); |
234 | return -1; | 232 | return -1; |
235 | } | 233 | } |
236 | if ((rdc_reset_state(state)) < 0) { | 234 | if ((rdc_reset_state(state)) < 0) { |
237 | dprintk("%s: RDC 8820 State RESET Failed.\n", __FUNCTION__); | 235 | dprintk(verbose, DST_ERROR, 1, "RDC 8820 State RESET Failed."); |
238 | return -1; | 236 | return -1; |
239 | } | 237 | } |
240 | if (state->type_flags & DST_TYPE_HAS_FW_1) | 238 | if (state->type_flags & DST_TYPE_HAS_FW_1) |
@@ -246,36 +244,33 @@ int dst_comm_init(struct dst_state* state) | |||
246 | } | 244 | } |
247 | EXPORT_SYMBOL(dst_comm_init); | 245 | EXPORT_SYMBOL(dst_comm_init); |
248 | 246 | ||
249 | |||
250 | int write_dst(struct dst_state *state, u8 *data, u8 len) | 247 | int write_dst(struct dst_state *state, u8 *data, u8 len) |
251 | { | 248 | { |
252 | struct i2c_msg msg = { | 249 | struct i2c_msg msg = { |
253 | .addr = state->config->demod_address,.flags = 0,.buf = data,.len = len | 250 | .addr = state->config->demod_address, |
251 | .flags = 0, | ||
252 | .buf = data, | ||
253 | .len = len | ||
254 | }; | 254 | }; |
255 | 255 | ||
256 | int err; | 256 | int err; |
257 | int cnt; | 257 | u8 cnt, i; |
258 | if (debug && (verbose > 4)) { | 258 | |
259 | u8 i; | 259 | dprintk(verbose, DST_NOTICE, 0, "writing [ "); |
260 | if (verbose > 4) { | 260 | for (i = 0; i < len; i++) |
261 | dprintk("%s writing [ ", __FUNCTION__); | 261 | dprintk(verbose, DST_NOTICE, 0, "%02x ", data[i]); |
262 | for (i = 0; i < len; i++) | 262 | dprintk(verbose, DST_NOTICE, 0, "]\n"); |
263 | dprintk("%02x ", data[i]); | 263 | |
264 | dprintk("]\n"); | ||
265 | } | ||
266 | } | ||
267 | for (cnt = 0; cnt < 2; cnt++) { | 264 | for (cnt = 0; cnt < 2; cnt++) { |
268 | if ((err = i2c_transfer(state->i2c, &msg, 1)) < 0) { | 265 | if ((err = i2c_transfer(state->i2c, &msg, 1)) < 0) { |
269 | dprintk("%s: _write_dst error (err == %i, len == 0x%02x, b0 == 0x%02x)\n", __FUNCTION__, err, len, data[0]); | 266 | dprintk(verbose, DST_INFO, 1, "_write_dst error (err == %i, len == 0x%02x, b0 == 0x%02x)", err, len, data[0]); |
270 | dst_error_recovery(state); | 267 | dst_error_recovery(state); |
271 | continue; | 268 | continue; |
272 | } else | 269 | } else |
273 | break; | 270 | break; |
274 | } | 271 | } |
275 | |||
276 | if (cnt >= 2) { | 272 | if (cnt >= 2) { |
277 | if (verbose > 1) | 273 | dprintk(verbose, DST_INFO, 1, "RDC 8820 RESET"); |
278 | printk("%s: RDC 8820 RESET...\n", __FUNCTION__); | ||
279 | dst_error_bailout(state); | 274 | dst_error_bailout(state); |
280 | 275 | ||
281 | return -1; | 276 | return -1; |
@@ -285,36 +280,37 @@ int write_dst(struct dst_state *state, u8 *data, u8 len) | |||
285 | } | 280 | } |
286 | EXPORT_SYMBOL(write_dst); | 281 | EXPORT_SYMBOL(write_dst); |
287 | 282 | ||
288 | int read_dst(struct dst_state *state, u8 * ret, u8 len) | 283 | int read_dst(struct dst_state *state, u8 *ret, u8 len) |
289 | { | 284 | { |
290 | struct i2c_msg msg = {.addr = state->config->demod_address,.flags = I2C_M_RD,.buf = ret,.len = len }; | 285 | struct i2c_msg msg = { |
286 | .addr = state->config->demod_address, | ||
287 | .flags = I2C_M_RD, | ||
288 | .buf = ret, | ||
289 | .len = len | ||
290 | }; | ||
291 | |||
291 | int err; | 292 | int err; |
292 | int cnt; | 293 | int cnt; |
293 | 294 | ||
294 | for (cnt = 0; cnt < 2; cnt++) { | 295 | for (cnt = 0; cnt < 2; cnt++) { |
295 | if ((err = i2c_transfer(state->i2c, &msg, 1)) < 0) { | 296 | if ((err = i2c_transfer(state->i2c, &msg, 1)) < 0) { |
296 | 297 | dprintk(verbose, DST_INFO, 1, "read_dst error (err == %i, len == 0x%02x, b0 == 0x%02x)", err, len, ret[0]); | |
297 | dprintk("%s: read_dst error (err == %i, len == 0x%02x, b0 == 0x%02x)\n", __FUNCTION__, err, len, ret[0]); | ||
298 | dst_error_recovery(state); | 298 | dst_error_recovery(state); |
299 | |||
300 | continue; | 299 | continue; |
301 | } else | 300 | } else |
302 | break; | 301 | break; |
303 | } | 302 | } |
304 | if (cnt >= 2) { | 303 | if (cnt >= 2) { |
305 | if (verbose > 1) | 304 | dprintk(verbose, DST_INFO, 1, "RDC 8820 RESET"); |
306 | printk("%s: RDC 8820 RESET...\n", __FUNCTION__); | ||
307 | dst_error_bailout(state); | 305 | dst_error_bailout(state); |
308 | 306 | ||
309 | return -1; | 307 | return -1; |
310 | } | 308 | } |
311 | if (debug && (verbose > 4)) { | 309 | dprintk(verbose, DST_DEBUG, 1, "reply is 0x%x", ret[0]); |
312 | dprintk("%s reply is 0x%x\n", __FUNCTION__, ret[0]); | 310 | for (err = 1; err < len; err++) |
313 | for (err = 1; err < len; err++) | 311 | dprintk(verbose, DST_DEBUG, 0, " 0x%x", ret[err]); |
314 | dprintk(" 0x%x", ret[err]); | 312 | if (err > 1) |
315 | if (err > 1) | 313 | dprintk(verbose, DST_DEBUG, 0, "\n"); |
316 | dprintk("\n"); | ||
317 | } | ||
318 | 314 | ||
319 | return 0; | 315 | return 0; |
320 | } | 316 | } |
@@ -323,19 +319,16 @@ EXPORT_SYMBOL(read_dst); | |||
323 | static int dst_set_polarization(struct dst_state *state) | 319 | static int dst_set_polarization(struct dst_state *state) |
324 | { | 320 | { |
325 | switch (state->voltage) { | 321 | switch (state->voltage) { |
326 | case SEC_VOLTAGE_13: // vertical | 322 | case SEC_VOLTAGE_13: /* Vertical */ |
327 | printk("%s: Polarization=[Vertical]\n", __FUNCTION__); | 323 | dprintk(verbose, DST_INFO, 1, "Polarization=[Vertical]"); |
328 | state->tx_tuna[8] &= ~0x40; //1 | 324 | state->tx_tuna[8] &= ~0x40; |
329 | break; | 325 | break; |
330 | 326 | case SEC_VOLTAGE_18: /* Horizontal */ | |
331 | case SEC_VOLTAGE_18: // horizontal | 327 | dprintk(verbose, DST_INFO, 1, "Polarization=[Horizontal]"); |
332 | printk("%s: Polarization=[Horizontal]\n", __FUNCTION__); | 328 | state->tx_tuna[8] |= 0x40; |
333 | state->tx_tuna[8] |= 0x40; // 0 | 329 | break; |
334 | break; | 330 | case SEC_VOLTAGE_OFF: |
335 | 331 | break; | |
336 | case SEC_VOLTAGE_OFF: | ||
337 | |||
338 | break; | ||
339 | } | 332 | } |
340 | 333 | ||
341 | return 0; | 334 | return 0; |
@@ -344,14 +337,12 @@ static int dst_set_polarization(struct dst_state *state) | |||
344 | static int dst_set_freq(struct dst_state *state, u32 freq) | 337 | static int dst_set_freq(struct dst_state *state, u32 freq) |
345 | { | 338 | { |
346 | state->frequency = freq; | 339 | state->frequency = freq; |
347 | if (debug > 4) | 340 | dprintk(verbose, DST_INFO, 1, "set Frequency %u", freq); |
348 | dprintk("%s: set Frequency %u\n", __FUNCTION__, freq); | ||
349 | 341 | ||
350 | if (state->dst_type == DST_TYPE_IS_SAT) { | 342 | if (state->dst_type == DST_TYPE_IS_SAT) { |
351 | freq = freq / 1000; | 343 | freq = freq / 1000; |
352 | if (freq < 950 || freq > 2150) | 344 | if (freq < 950 || freq > 2150) |
353 | return -EINVAL; | 345 | return -EINVAL; |
354 | |||
355 | state->tx_tuna[2] = (freq >> 8); | 346 | state->tx_tuna[2] = (freq >> 8); |
356 | state->tx_tuna[3] = (u8) freq; | 347 | state->tx_tuna[3] = (u8) freq; |
357 | state->tx_tuna[4] = 0x01; | 348 | state->tx_tuna[4] = 0x01; |
@@ -360,27 +351,25 @@ static int dst_set_freq(struct dst_state *state, u32 freq) | |||
360 | if (freq < 1531) | 351 | if (freq < 1531) |
361 | state->tx_tuna[8] |= 0x04; | 352 | state->tx_tuna[8] |= 0x04; |
362 | } | 353 | } |
363 | |||
364 | } else if (state->dst_type == DST_TYPE_IS_TERR) { | 354 | } else if (state->dst_type == DST_TYPE_IS_TERR) { |
365 | freq = freq / 1000; | 355 | freq = freq / 1000; |
366 | if (freq < 137000 || freq > 858000) | 356 | if (freq < 137000 || freq > 858000) |
367 | return -EINVAL; | 357 | return -EINVAL; |
368 | |||
369 | state->tx_tuna[2] = (freq >> 16) & 0xff; | 358 | state->tx_tuna[2] = (freq >> 16) & 0xff; |
370 | state->tx_tuna[3] = (freq >> 8) & 0xff; | 359 | state->tx_tuna[3] = (freq >> 8) & 0xff; |
371 | state->tx_tuna[4] = (u8) freq; | 360 | state->tx_tuna[4] = (u8) freq; |
372 | |||
373 | } else if (state->dst_type == DST_TYPE_IS_CABLE) { | 361 | } else if (state->dst_type == DST_TYPE_IS_CABLE) { |
362 | freq = freq / 1000; | ||
374 | state->tx_tuna[2] = (freq >> 16) & 0xff; | 363 | state->tx_tuna[2] = (freq >> 16) & 0xff; |
375 | state->tx_tuna[3] = (freq >> 8) & 0xff; | 364 | state->tx_tuna[3] = (freq >> 8) & 0xff; |
376 | state->tx_tuna[4] = (u8) freq; | 365 | state->tx_tuna[4] = (u8) freq; |
377 | |||
378 | } else | 366 | } else |
379 | return -EINVAL; | 367 | return -EINVAL; |
368 | |||
380 | return 0; | 369 | return 0; |
381 | } | 370 | } |
382 | 371 | ||
383 | static int dst_set_bandwidth(struct dst_state* state, fe_bandwidth_t bandwidth) | 372 | static int dst_set_bandwidth(struct dst_state *state, fe_bandwidth_t bandwidth) |
384 | { | 373 | { |
385 | state->bandwidth = bandwidth; | 374 | state->bandwidth = bandwidth; |
386 | 375 | ||
@@ -388,103 +377,95 @@ static int dst_set_bandwidth(struct dst_state* state, fe_bandwidth_t bandwidth) | |||
388 | return 0; | 377 | return 0; |
389 | 378 | ||
390 | switch (bandwidth) { | 379 | switch (bandwidth) { |
391 | case BANDWIDTH_6_MHZ: | 380 | case BANDWIDTH_6_MHZ: |
392 | if (state->dst_hw_cap & DST_TYPE_HAS_CA) | 381 | if (state->dst_hw_cap & DST_TYPE_HAS_CA) |
393 | state->tx_tuna[7] = 0x06; | 382 | state->tx_tuna[7] = 0x06; |
394 | else { | 383 | else { |
395 | state->tx_tuna[6] = 0x06; | 384 | state->tx_tuna[6] = 0x06; |
396 | state->tx_tuna[7] = 0x00; | 385 | state->tx_tuna[7] = 0x00; |
397 | } | 386 | } |
398 | break; | 387 | break; |
399 | 388 | case BANDWIDTH_7_MHZ: | |
400 | case BANDWIDTH_7_MHZ: | 389 | if (state->dst_hw_cap & DST_TYPE_HAS_CA) |
401 | if (state->dst_hw_cap & DST_TYPE_HAS_CA) | 390 | state->tx_tuna[7] = 0x07; |
402 | state->tx_tuna[7] = 0x07; | 391 | else { |
403 | else { | 392 | state->tx_tuna[6] = 0x07; |
404 | state->tx_tuna[6] = 0x07; | 393 | state->tx_tuna[7] = 0x00; |
405 | state->tx_tuna[7] = 0x00; | 394 | } |
406 | } | 395 | break; |
407 | break; | 396 | case BANDWIDTH_8_MHZ: |
408 | 397 | if (state->dst_hw_cap & DST_TYPE_HAS_CA) | |
409 | case BANDWIDTH_8_MHZ: | 398 | state->tx_tuna[7] = 0x08; |
410 | if (state->dst_hw_cap & DST_TYPE_HAS_CA) | 399 | else { |
411 | state->tx_tuna[7] = 0x08; | 400 | state->tx_tuna[6] = 0x08; |
412 | else { | 401 | state->tx_tuna[7] = 0x00; |
413 | state->tx_tuna[6] = 0x08; | 402 | } |
414 | state->tx_tuna[7] = 0x00; | 403 | break; |
415 | } | 404 | default: |
416 | break; | 405 | return -EINVAL; |
417 | |||
418 | default: | ||
419 | return -EINVAL; | ||
420 | } | 406 | } |
407 | |||
421 | return 0; | 408 | return 0; |
422 | } | 409 | } |
423 | 410 | ||
424 | static int dst_set_inversion(struct dst_state* state, fe_spectral_inversion_t inversion) | 411 | static int dst_set_inversion(struct dst_state *state, fe_spectral_inversion_t inversion) |
425 | { | 412 | { |
426 | state->inversion = inversion; | 413 | state->inversion = inversion; |
427 | switch (inversion) { | 414 | switch (inversion) { |
428 | case INVERSION_OFF: // Inversion = Normal | 415 | case INVERSION_OFF: /* Inversion = Normal */ |
429 | state->tx_tuna[8] &= ~0x80; | 416 | state->tx_tuna[8] &= ~0x80; |
430 | break; | 417 | break; |
431 | 418 | case INVERSION_ON: | |
432 | case INVERSION_ON: | 419 | state->tx_tuna[8] |= 0x80; |
433 | state->tx_tuna[8] |= 0x80; | 420 | break; |
434 | break; | 421 | default: |
435 | default: | 422 | return -EINVAL; |
436 | return -EINVAL; | ||
437 | } | 423 | } |
424 | |||
438 | return 0; | 425 | return 0; |
439 | } | 426 | } |
440 | 427 | ||
441 | static int dst_set_fec(struct dst_state* state, fe_code_rate_t fec) | 428 | static int dst_set_fec(struct dst_state *state, fe_code_rate_t fec) |
442 | { | 429 | { |
443 | state->fec = fec; | 430 | state->fec = fec; |
444 | return 0; | 431 | return 0; |
445 | } | 432 | } |
446 | 433 | ||
447 | static fe_code_rate_t dst_get_fec(struct dst_state* state) | 434 | static fe_code_rate_t dst_get_fec(struct dst_state *state) |
448 | { | 435 | { |
449 | return state->fec; | 436 | return state->fec; |
450 | } | 437 | } |
451 | 438 | ||
452 | static int dst_set_symbolrate(struct dst_state* state, u32 srate) | 439 | static int dst_set_symbolrate(struct dst_state *state, u32 srate) |
453 | { | 440 | { |
454 | u8 *val; | ||
455 | u32 symcalc; | 441 | u32 symcalc; |
456 | u64 sval; | 442 | u64 sval; |
457 | 443 | ||
458 | state->symbol_rate = srate; | 444 | state->symbol_rate = srate; |
459 | |||
460 | if (state->dst_type == DST_TYPE_IS_TERR) { | 445 | if (state->dst_type == DST_TYPE_IS_TERR) { |
461 | return 0; | 446 | return 0; |
462 | } | 447 | } |
463 | if (debug > 4) | 448 | dprintk(verbose, DST_INFO, 1, "set symrate %u", srate); |
464 | dprintk("%s: set symrate %u\n", __FUNCTION__, srate); | ||
465 | srate /= 1000; | 449 | srate /= 1000; |
466 | val = &state->tx_tuna[0]; | ||
467 | |||
468 | if (state->type_flags & DST_TYPE_HAS_SYMDIV) { | 450 | if (state->type_flags & DST_TYPE_HAS_SYMDIV) { |
469 | sval = srate; | 451 | sval = srate; |
470 | sval <<= 20; | 452 | sval <<= 20; |
471 | do_div(sval, 88000); | 453 | do_div(sval, 88000); |
472 | symcalc = (u32) sval; | 454 | symcalc = (u32) sval; |
473 | 455 | dprintk(verbose, DST_INFO, 1, "set symcalc %u", symcalc); | |
474 | if (debug > 4) | 456 | state->tx_tuna[5] = (u8) (symcalc >> 12); |
475 | dprintk("%s: set symcalc %u\n", __FUNCTION__, symcalc); | 457 | state->tx_tuna[6] = (u8) (symcalc >> 4); |
476 | 458 | state->tx_tuna[7] = (u8) (symcalc << 4); | |
477 | val[5] = (u8) (symcalc >> 12); | ||
478 | val[6] = (u8) (symcalc >> 4); | ||
479 | val[7] = (u8) (symcalc << 4); | ||
480 | } else { | 459 | } else { |
481 | val[5] = (u8) (srate >> 16) & 0x7f; | 460 | state->tx_tuna[5] = (u8) (srate >> 16) & 0x7f; |
482 | val[6] = (u8) (srate >> 8); | 461 | state->tx_tuna[6] = (u8) (srate >> 8); |
483 | val[7] = (u8) srate; | 462 | state->tx_tuna[7] = (u8) srate; |
463 | } | ||
464 | state->tx_tuna[8] &= ~0x20; | ||
465 | if (state->type_flags & DST_TYPE_HAS_OBS_REGS) { | ||
466 | if (srate > 8000) | ||
467 | state->tx_tuna[8] |= 0x20; | ||
484 | } | 468 | } |
485 | val[8] &= ~0x20; | ||
486 | if (srate > 8000) | ||
487 | val[8] |= 0x20; | ||
488 | return 0; | 469 | return 0; |
489 | } | 470 | } |
490 | 471 | ||
@@ -496,32 +477,27 @@ static int dst_set_modulation(struct dst_state *state, fe_modulation_t modulatio | |||
496 | 477 | ||
497 | state->modulation = modulation; | 478 | state->modulation = modulation; |
498 | switch (modulation) { | 479 | switch (modulation) { |
499 | case QAM_16: | 480 | case QAM_16: |
500 | state->tx_tuna[8] = 0x10; | 481 | state->tx_tuna[8] = 0x10; |
501 | break; | 482 | break; |
502 | 483 | case QAM_32: | |
503 | case QAM_32: | 484 | state->tx_tuna[8] = 0x20; |
504 | state->tx_tuna[8] = 0x20; | 485 | break; |
505 | break; | 486 | case QAM_64: |
506 | 487 | state->tx_tuna[8] = 0x40; | |
507 | case QAM_64: | 488 | break; |
508 | state->tx_tuna[8] = 0x40; | 489 | case QAM_128: |
509 | break; | 490 | state->tx_tuna[8] = 0x80; |
510 | 491 | break; | |
511 | case QAM_128: | 492 | case QAM_256: |
512 | state->tx_tuna[8] = 0x80; | 493 | state->tx_tuna[8] = 0x00; |
513 | break; | 494 | break; |
514 | 495 | case QPSK: | |
515 | case QAM_256: | 496 | case QAM_AUTO: |
516 | state->tx_tuna[8] = 0x00; | 497 | case VSB_8: |
517 | break; | 498 | case VSB_16: |
518 | 499 | default: | |
519 | case QPSK: | 500 | return -EINVAL; |
520 | case QAM_AUTO: | ||
521 | case VSB_8: | ||
522 | case VSB_16: | ||
523 | default: | ||
524 | return -EINVAL; | ||
525 | 501 | ||
526 | } | 502 | } |
527 | 503 | ||
@@ -534,7 +510,7 @@ static fe_modulation_t dst_get_modulation(struct dst_state *state) | |||
534 | } | 510 | } |
535 | 511 | ||
536 | 512 | ||
537 | u8 dst_check_sum(u8 * buf, u32 len) | 513 | u8 dst_check_sum(u8 *buf, u32 len) |
538 | { | 514 | { |
539 | u32 i; | 515 | u32 i; |
540 | u8 val = 0; | 516 | u8 val = 0; |
@@ -549,26 +525,24 @@ EXPORT_SYMBOL(dst_check_sum); | |||
549 | 525 | ||
550 | static void dst_type_flags_print(u32 type_flags) | 526 | static void dst_type_flags_print(u32 type_flags) |
551 | { | 527 | { |
552 | printk("DST type flags :"); | 528 | dprintk(verbose, DST_ERROR, 0, "DST type flags :"); |
553 | if (type_flags & DST_TYPE_HAS_NEWTUNE) | 529 | if (type_flags & DST_TYPE_HAS_NEWTUNE) |
554 | printk(" 0x%x newtuner", DST_TYPE_HAS_NEWTUNE); | 530 | dprintk(verbose, DST_ERROR, 0, " 0x%x newtuner", DST_TYPE_HAS_NEWTUNE); |
555 | if (type_flags & DST_TYPE_HAS_TS204) | 531 | if (type_flags & DST_TYPE_HAS_TS204) |
556 | printk(" 0x%x ts204", DST_TYPE_HAS_TS204); | 532 | dprintk(verbose, DST_ERROR, 0, " 0x%x ts204", DST_TYPE_HAS_TS204); |
557 | if (type_flags & DST_TYPE_HAS_SYMDIV) | 533 | if (type_flags & DST_TYPE_HAS_SYMDIV) |
558 | printk(" 0x%x symdiv", DST_TYPE_HAS_SYMDIV); | 534 | dprintk(verbose, DST_ERROR, 0, " 0x%x symdiv", DST_TYPE_HAS_SYMDIV); |
559 | if (type_flags & DST_TYPE_HAS_FW_1) | 535 | if (type_flags & DST_TYPE_HAS_FW_1) |
560 | printk(" 0x%x firmware version = 1", DST_TYPE_HAS_FW_1); | 536 | dprintk(verbose, DST_ERROR, 0, " 0x%x firmware version = 1", DST_TYPE_HAS_FW_1); |
561 | if (type_flags & DST_TYPE_HAS_FW_2) | 537 | if (type_flags & DST_TYPE_HAS_FW_2) |
562 | printk(" 0x%x firmware version = 2", DST_TYPE_HAS_FW_2); | 538 | dprintk(verbose, DST_ERROR, 0, " 0x%x firmware version = 2", DST_TYPE_HAS_FW_2); |
563 | if (type_flags & DST_TYPE_HAS_FW_3) | 539 | if (type_flags & DST_TYPE_HAS_FW_3) |
564 | printk(" 0x%x firmware version = 3", DST_TYPE_HAS_FW_3); | 540 | dprintk(verbose, DST_ERROR, 0, " 0x%x firmware version = 3", DST_TYPE_HAS_FW_3); |
565 | // if ((type_flags & DST_TYPE_HAS_FW_BUILD) && new_fw) | 541 | dprintk(verbose, DST_ERROR, 0, "\n"); |
566 | |||
567 | printk("\n"); | ||
568 | } | 542 | } |
569 | 543 | ||
570 | 544 | ||
571 | static int dst_type_print (u8 type) | 545 | static int dst_type_print(u8 type) |
572 | { | 546 | { |
573 | char *otype; | 547 | char *otype; |
574 | switch (type) { | 548 | switch (type) { |
@@ -585,10 +559,10 @@ static int dst_type_print (u8 type) | |||
585 | break; | 559 | break; |
586 | 560 | ||
587 | default: | 561 | default: |
588 | printk("%s: invalid dst type %d\n", __FUNCTION__, type); | 562 | dprintk(verbose, DST_INFO, 1, "invalid dst type %d", type); |
589 | return -EINVAL; | 563 | return -EINVAL; |
590 | } | 564 | } |
591 | printk("DST type : %s\n", otype); | 565 | dprintk(verbose, DST_INFO, 1, "DST type: %s", otype); |
592 | 566 | ||
593 | return 0; | 567 | return 0; |
594 | } | 568 | } |
@@ -700,7 +674,7 @@ struct dst_types dst_tlist[] = { | |||
700 | .offset = 1, | 674 | .offset = 1, |
701 | .dst_type = DST_TYPE_IS_CABLE, | 675 | .dst_type = DST_TYPE_IS_CABLE, |
702 | .type_flags = DST_TYPE_HAS_TS204 | DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_1 | 676 | .type_flags = DST_TYPE_HAS_TS204 | DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_1 |
703 | | DST_TYPE_HAS_FW_2 | DST_TYPE_HAS_FW_BUILD, | 677 | | DST_TYPE_HAS_FW_2, |
704 | .dst_feature = DST_TYPE_HAS_CA | 678 | .dst_feature = DST_TYPE_HAS_CA |
705 | }, | 679 | }, |
706 | 680 | ||
@@ -708,7 +682,7 @@ struct dst_types dst_tlist[] = { | |||
708 | .device_id = "DCTNEW", | 682 | .device_id = "DCTNEW", |
709 | .offset = 1, | 683 | .offset = 1, |
710 | .dst_type = DST_TYPE_IS_CABLE, | 684 | .dst_type = DST_TYPE_IS_CABLE, |
711 | .type_flags = DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_3, | 685 | .type_flags = DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_3 | DST_TYPE_HAS_FW_BUILD, |
712 | .dst_feature = 0 | 686 | .dst_feature = 0 |
713 | }, | 687 | }, |
714 | 688 | ||
@@ -716,7 +690,7 @@ struct dst_types dst_tlist[] = { | |||
716 | .device_id = "DTT-CI", | 690 | .device_id = "DTT-CI", |
717 | .offset = 1, | 691 | .offset = 1, |
718 | .dst_type = DST_TYPE_IS_TERR, | 692 | .dst_type = DST_TYPE_IS_TERR, |
719 | .type_flags = DST_TYPE_HAS_TS204 | DST_TYPE_HAS_FW_2 | DST_TYPE_HAS_FW_BUILD, | 693 | .type_flags = DST_TYPE_HAS_TS204 | DST_TYPE_HAS_FW_2, |
720 | .dst_feature = 0 | 694 | .dst_feature = 0 |
721 | }, | 695 | }, |
722 | 696 | ||
@@ -756,6 +730,71 @@ struct dst_types dst_tlist[] = { | |||
756 | 730 | ||
757 | }; | 731 | }; |
758 | 732 | ||
733 | static int dst_get_mac(struct dst_state *state) | ||
734 | { | ||
735 | u8 get_mac[] = { 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | ||
736 | get_mac[7] = dst_check_sum(get_mac, 7); | ||
737 | if (dst_command(state, get_mac, 8) < 0) { | ||
738 | dprintk(verbose, DST_INFO, 1, "Unsupported Command"); | ||
739 | return -1; | ||
740 | } | ||
741 | memset(&state->mac_address, '\0', 8); | ||
742 | memcpy(&state->mac_address, &state->rxbuffer, 6); | ||
743 | dprintk(verbose, DST_ERROR, 1, "MAC Address=[%02x:%02x:%02x:%02x:%02x:%02x]", | ||
744 | state->mac_address[0], state->mac_address[1], state->mac_address[2], | ||
745 | state->mac_address[4], state->mac_address[5], state->mac_address[6]); | ||
746 | |||
747 | return 0; | ||
748 | } | ||
749 | |||
750 | static int dst_fw_ver(struct dst_state *state) | ||
751 | { | ||
752 | u8 get_ver[] = { 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | ||
753 | get_ver[7] = dst_check_sum(get_ver, 7); | ||
754 | if (dst_command(state, get_ver, 8) < 0) { | ||
755 | dprintk(verbose, DST_INFO, 1, "Unsupported Command"); | ||
756 | return -1; | ||
757 | } | ||
758 | memset(&state->fw_version, '\0', 8); | ||
759 | memcpy(&state->fw_version, &state->rxbuffer, 8); | ||
760 | dprintk(verbose, DST_ERROR, 1, "Firmware Ver = %x.%x Build = %02x, on %x:%x, %x-%x-20%02x", | ||
761 | state->fw_version[0] >> 4, state->fw_version[0] & 0x0f, | ||
762 | state->fw_version[1], | ||
763 | state->fw_version[5], state->fw_version[6], | ||
764 | state->fw_version[4], state->fw_version[3], state->fw_version[2]); | ||
765 | |||
766 | return 0; | ||
767 | } | ||
768 | |||
769 | static int dst_card_type(struct dst_state *state) | ||
770 | { | ||
771 | u8 get_type[] = { 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | ||
772 | get_type[7] = dst_check_sum(get_type, 7); | ||
773 | if (dst_command(state, get_type, 8) < 0) { | ||
774 | dprintk(verbose, DST_INFO, 1, "Unsupported Command"); | ||
775 | return -1; | ||
776 | } | ||
777 | memset(&state->card_info, '\0', 8); | ||
778 | memcpy(&state->card_info, &state->rxbuffer, 8); | ||
779 | dprintk(verbose, DST_ERROR, 1, "Device Model=[%s]", &state->card_info[0]); | ||
780 | |||
781 | return 0; | ||
782 | } | ||
783 | |||
784 | static int dst_get_vendor(struct dst_state *state) | ||
785 | { | ||
786 | u8 get_vendor[] = { 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | ||
787 | get_vendor[7] = dst_check_sum(get_vendor, 7); | ||
788 | if (dst_command(state, get_vendor, 8) < 0) { | ||
789 | dprintk(verbose, DST_INFO, 1, "Unsupported Command"); | ||
790 | return -1; | ||
791 | } | ||
792 | memset(&state->vendor, '\0', 8); | ||
793 | memcpy(&state->vendor, &state->rxbuffer, 8); | ||
794 | dprintk(verbose, DST_ERROR, 1, "Vendor=[%s]", &state->vendor[0]); | ||
795 | |||
796 | return 0; | ||
797 | } | ||
759 | 798 | ||
760 | static int dst_get_device_id(struct dst_state *state) | 799 | static int dst_get_device_id(struct dst_state *state) |
761 | { | 800 | { |
@@ -772,53 +811,45 @@ static int dst_get_device_id(struct dst_state *state) | |||
772 | 811 | ||
773 | if (write_dst(state, device_type, FIXED_COMM)) | 812 | if (write_dst(state, device_type, FIXED_COMM)) |
774 | return -1; /* Write failed */ | 813 | return -1; /* Write failed */ |
775 | |||
776 | if ((dst_pio_disable(state)) < 0) | 814 | if ((dst_pio_disable(state)) < 0) |
777 | return -1; | 815 | return -1; |
778 | |||
779 | if (read_dst(state, &reply, GET_ACK)) | 816 | if (read_dst(state, &reply, GET_ACK)) |
780 | return -1; /* Read failure */ | 817 | return -1; /* Read failure */ |
781 | |||
782 | if (reply != ACK) { | 818 | if (reply != ACK) { |
783 | dprintk("%s: Write not Acknowledged! [Reply=0x%02x]\n", __FUNCTION__, reply); | 819 | dprintk(verbose, DST_INFO, 1, "Write not Acknowledged! [Reply=0x%02x]", reply); |
784 | return -1; /* Unack'd write */ | 820 | return -1; /* Unack'd write */ |
785 | } | 821 | } |
786 | |||
787 | if (!dst_wait_dst_ready(state, DEVICE_INIT)) | 822 | if (!dst_wait_dst_ready(state, DEVICE_INIT)) |
788 | return -1; /* DST not ready yet */ | 823 | return -1; /* DST not ready yet */ |
789 | |||
790 | if (read_dst(state, state->rxbuffer, FIXED_COMM)) | 824 | if (read_dst(state, state->rxbuffer, FIXED_COMM)) |
791 | return -1; | 825 | return -1; |
792 | 826 | ||
793 | dst_pio_disable(state); | 827 | dst_pio_disable(state); |
794 | |||
795 | if (state->rxbuffer[7] != dst_check_sum(state->rxbuffer, 7)) { | 828 | if (state->rxbuffer[7] != dst_check_sum(state->rxbuffer, 7)) { |
796 | dprintk("%s: Checksum failure! \n", __FUNCTION__); | 829 | dprintk(verbose, DST_INFO, 1, "Checksum failure!"); |
797 | return -1; /* Checksum failure */ | 830 | return -1; /* Checksum failure */ |
798 | } | 831 | } |
799 | |||
800 | state->rxbuffer[7] = '\0'; | 832 | state->rxbuffer[7] = '\0'; |
801 | 833 | ||
802 | for (i = 0, p_dst_type = dst_tlist; i < ARRAY_SIZE (dst_tlist); i++, p_dst_type++) { | 834 | for (i = 0, p_dst_type = dst_tlist; i < ARRAY_SIZE(dst_tlist); i++, p_dst_type++) { |
803 | if (!strncmp (&state->rxbuffer[p_dst_type->offset], p_dst_type->device_id, strlen (p_dst_type->device_id))) { | 835 | if (!strncmp (&state->rxbuffer[p_dst_type->offset], p_dst_type->device_id, strlen (p_dst_type->device_id))) { |
804 | use_type_flags = p_dst_type->type_flags; | 836 | use_type_flags = p_dst_type->type_flags; |
805 | use_dst_type = p_dst_type->dst_type; | 837 | use_dst_type = p_dst_type->dst_type; |
806 | 838 | ||
807 | /* Card capabilities */ | 839 | /* Card capabilities */ |
808 | state->dst_hw_cap = p_dst_type->dst_feature; | 840 | state->dst_hw_cap = p_dst_type->dst_feature; |
809 | printk ("%s: Recognise [%s]\n", __FUNCTION__, p_dst_type->device_id); | 841 | dprintk(verbose, DST_ERROR, 1, "Recognise [%s]\n", p_dst_type->device_id); |
810 | 842 | ||
811 | break; | 843 | break; |
812 | } | 844 | } |
813 | } | 845 | } |
814 | 846 | ||
815 | if (i >= sizeof (dst_tlist) / sizeof (dst_tlist [0])) { | 847 | if (i >= sizeof (dst_tlist) / sizeof (dst_tlist [0])) { |
816 | printk("%s: Unable to recognize %s or %s\n", __FUNCTION__, &state->rxbuffer[0], &state->rxbuffer[1]); | 848 | dprintk(verbose, DST_ERROR, 1, "Unable to recognize %s or %s", &state->rxbuffer[0], &state->rxbuffer[1]); |
817 | printk("%s: please email linux-dvb@linuxtv.org with this type in\n", __FUNCTION__); | 849 | dprintk(verbose, DST_ERROR, 1, "please email linux-dvb@linuxtv.org with this type in"); |
818 | use_dst_type = DST_TYPE_IS_SAT; | 850 | use_dst_type = DST_TYPE_IS_SAT; |
819 | use_type_flags = DST_TYPE_HAS_SYMDIV; | 851 | use_type_flags = DST_TYPE_HAS_SYMDIV; |
820 | } | 852 | } |
821 | |||
822 | dst_type_print(use_dst_type); | 853 | dst_type_print(use_dst_type); |
823 | state->type_flags = use_type_flags; | 854 | state->type_flags = use_type_flags; |
824 | state->dst_type = use_dst_type; | 855 | state->dst_type = use_dst_type; |
@@ -834,7 +865,7 @@ static int dst_get_device_id(struct dst_state *state) | |||
834 | static int dst_probe(struct dst_state *state) | 865 | static int dst_probe(struct dst_state *state) |
835 | { | 866 | { |
836 | if ((rdc_8820_reset(state)) < 0) { | 867 | if ((rdc_8820_reset(state)) < 0) { |
837 | dprintk("%s: RDC 8820 RESET Failed.\n", __FUNCTION__); | 868 | dprintk(verbose, DST_ERROR, 1, "RDC 8820 RESET Failed."); |
838 | return -1; | 869 | return -1; |
839 | } | 870 | } |
840 | if (dst_addons & DST_TYPE_HAS_CA) | 871 | if (dst_addons & DST_TYPE_HAS_CA) |
@@ -843,80 +874,87 @@ static int dst_probe(struct dst_state *state) | |||
843 | msleep(100); | 874 | msleep(100); |
844 | 875 | ||
845 | if ((dst_comm_init(state)) < 0) { | 876 | if ((dst_comm_init(state)) < 0) { |
846 | dprintk("%s: DST Initialization Failed.\n", __FUNCTION__); | 877 | dprintk(verbose, DST_ERROR, 1, "DST Initialization Failed."); |
847 | return -1; | 878 | return -1; |
848 | } | 879 | } |
849 | msleep(100); | 880 | msleep(100); |
850 | if (dst_get_device_id(state) < 0) { | 881 | if (dst_get_device_id(state) < 0) { |
851 | dprintk("%s: unknown device.\n", __FUNCTION__); | 882 | dprintk(verbose, DST_ERROR, 1, "unknown device."); |
852 | return -1; | 883 | return -1; |
853 | } | 884 | } |
885 | if (dst_get_mac(state) < 0) { | ||
886 | dprintk(verbose, DST_INFO, 1, "MAC: Unsupported command"); | ||
887 | return 0; | ||
888 | } | ||
889 | if (state->type_flags & DST_TYPE_HAS_FW_BUILD) { | ||
890 | if (dst_fw_ver(state) < 0) { | ||
891 | dprintk(verbose, DST_INFO, 1, "FW: Unsupported command"); | ||
892 | return 0; | ||
893 | } | ||
894 | if (dst_card_type(state) < 0) { | ||
895 | dprintk(verbose, DST_INFO, 1, "Card: Unsupported command"); | ||
896 | return 0; | ||
897 | } | ||
898 | if (dst_get_vendor(state) < 0) { | ||
899 | dprintk(verbose, DST_INFO, 1, "Vendor: Unsupported command"); | ||
900 | return 0; | ||
901 | } | ||
902 | } | ||
854 | 903 | ||
855 | return 0; | 904 | return 0; |
856 | } | 905 | } |
857 | 906 | ||
858 | int dst_command(struct dst_state* state, u8 * data, u8 len) | 907 | int dst_command(struct dst_state *state, u8 *data, u8 len) |
859 | { | 908 | { |
860 | u8 reply; | 909 | u8 reply; |
861 | if ((dst_comm_init(state)) < 0) { | 910 | if ((dst_comm_init(state)) < 0) { |
862 | dprintk("%s: DST Communication Initialization Failed.\n", __FUNCTION__); | 911 | dprintk(verbose, DST_NOTICE, 1, "DST Communication Initialization Failed."); |
863 | return -1; | 912 | return -1; |
864 | } | 913 | } |
865 | |||
866 | if (write_dst(state, data, len)) { | 914 | if (write_dst(state, data, len)) { |
867 | if (verbose > 1) | 915 | dprintk(verbose, DST_INFO, 1, "Tring to recover.. "); |
868 | dprintk("%s: Tring to recover.. \n", __FUNCTION__); | ||
869 | if ((dst_error_recovery(state)) < 0) { | 916 | if ((dst_error_recovery(state)) < 0) { |
870 | dprintk("%s: Recovery Failed.\n", __FUNCTION__); | 917 | dprintk(verbose, DST_ERROR, 1, "Recovery Failed."); |
871 | return -1; | 918 | return -1; |
872 | } | 919 | } |
873 | return -1; | 920 | return -1; |
874 | } | 921 | } |
875 | if ((dst_pio_disable(state)) < 0) { | 922 | if ((dst_pio_disable(state)) < 0) { |
876 | dprintk("%s: PIO Disable Failed.\n", __FUNCTION__); | 923 | dprintk(verbose, DST_ERROR, 1, "PIO Disable Failed."); |
877 | return -1; | 924 | return -1; |
878 | } | 925 | } |
879 | if (state->type_flags & DST_TYPE_HAS_FW_1) | 926 | if (state->type_flags & DST_TYPE_HAS_FW_1) |
880 | udelay(3000); | 927 | udelay(3000); |
881 | |||
882 | if (read_dst(state, &reply, GET_ACK)) { | 928 | if (read_dst(state, &reply, GET_ACK)) { |
883 | if (verbose > 1) | 929 | dprintk(verbose, DST_DEBUG, 1, "Trying to recover.. "); |
884 | dprintk("%s: Trying to recover.. \n", __FUNCTION__); | ||
885 | if ((dst_error_recovery(state)) < 0) { | 930 | if ((dst_error_recovery(state)) < 0) { |
886 | dprintk("%s: Recovery Failed.\n", __FUNCTION__); | 931 | dprintk(verbose, DST_INFO, 1, "Recovery Failed."); |
887 | return -1; | 932 | return -1; |
888 | } | 933 | } |
889 | return -1; | 934 | return -1; |
890 | } | 935 | } |
891 | |||
892 | if (reply != ACK) { | 936 | if (reply != ACK) { |
893 | dprintk("%s: write not acknowledged 0x%02x \n", __FUNCTION__, reply); | 937 | dprintk(verbose, DST_INFO, 1, "write not acknowledged 0x%02x ", reply); |
894 | return -1; | 938 | return -1; |
895 | } | 939 | } |
896 | if (len >= 2 && data[0] == 0 && (data[1] == 1 || data[1] == 3)) | 940 | if (len >= 2 && data[0] == 0 && (data[1] == 1 || data[1] == 3)) |
897 | return 0; | 941 | return 0; |
898 | |||
899 | // udelay(3000); | ||
900 | if (state->type_flags & DST_TYPE_HAS_FW_1) | 942 | if (state->type_flags & DST_TYPE_HAS_FW_1) |
901 | udelay(3000); | 943 | udelay(3000); |
902 | else | 944 | else |
903 | udelay(2000); | 945 | udelay(2000); |
904 | |||
905 | if (!dst_wait_dst_ready(state, NO_DELAY)) | 946 | if (!dst_wait_dst_ready(state, NO_DELAY)) |
906 | return -1; | 947 | return -1; |
907 | |||
908 | if (read_dst(state, state->rxbuffer, FIXED_COMM)) { | 948 | if (read_dst(state, state->rxbuffer, FIXED_COMM)) { |
909 | if (verbose > 1) | 949 | dprintk(verbose, DST_DEBUG, 1, "Trying to recover.. "); |
910 | dprintk("%s: Trying to recover.. \n", __FUNCTION__); | ||
911 | if ((dst_error_recovery(state)) < 0) { | 950 | if ((dst_error_recovery(state)) < 0) { |
912 | dprintk("%s: Recovery failed.\n", __FUNCTION__); | 951 | dprintk(verbose, DST_INFO, 1, "Recovery failed."); |
913 | return -1; | 952 | return -1; |
914 | } | 953 | } |
915 | return -1; | 954 | return -1; |
916 | } | 955 | } |
917 | |||
918 | if (state->rxbuffer[7] != dst_check_sum(state->rxbuffer, 7)) { | 956 | if (state->rxbuffer[7] != dst_check_sum(state->rxbuffer, 7)) { |
919 | dprintk("%s: checksum failure\n", __FUNCTION__); | 957 | dprintk(verbose, DST_INFO, 1, "checksum failure"); |
920 | return -1; | 958 | return -1; |
921 | } | 959 | } |
922 | 960 | ||
@@ -924,11 +962,11 @@ int dst_command(struct dst_state* state, u8 * data, u8 len) | |||
924 | } | 962 | } |
925 | EXPORT_SYMBOL(dst_command); | 963 | EXPORT_SYMBOL(dst_command); |
926 | 964 | ||
927 | static int dst_get_signal(struct dst_state* state) | 965 | static int dst_get_signal(struct dst_state *state) |
928 | { | 966 | { |
929 | int retval; | 967 | int retval; |
930 | u8 get_signal[] = { 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfb }; | 968 | u8 get_signal[] = { 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfb }; |
931 | dprintk("%s: Getting Signal strength and other parameters\n", __FUNCTION__); | 969 | //dprintk("%s: Getting Signal strength and other parameters\n", __FUNCTION__); |
932 | if ((state->diseq_flags & ATTEMPT_TUNE) == 0) { | 970 | if ((state->diseq_flags & ATTEMPT_TUNE) == 0) { |
933 | state->decode_lock = state->decode_strength = state->decode_snr = 0; | 971 | state->decode_lock = state->decode_strength = state->decode_snr = 0; |
934 | return 0; | 972 | return 0; |
@@ -955,13 +993,12 @@ static int dst_get_signal(struct dst_state* state) | |||
955 | return 0; | 993 | return 0; |
956 | } | 994 | } |
957 | 995 | ||
958 | static int dst_tone_power_cmd(struct dst_state* state) | 996 | static int dst_tone_power_cmd(struct dst_state *state) |
959 | { | 997 | { |
960 | u8 paket[8] = { 0x00, 0x09, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00 }; | 998 | u8 paket[8] = { 0x00, 0x09, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00 }; |
961 | 999 | ||
962 | if (state->dst_type == DST_TYPE_IS_TERR) | 1000 | if (state->dst_type == DST_TYPE_IS_TERR) |
963 | return 0; | 1001 | return 0; |
964 | |||
965 | paket[4] = state->tx_tuna[4]; | 1002 | paket[4] = state->tx_tuna[4]; |
966 | paket[2] = state->tx_tuna[2]; | 1003 | paket[2] = state->tx_tuna[2]; |
967 | paket[3] = state->tx_tuna[3]; | 1004 | paket[3] = state->tx_tuna[3]; |
@@ -971,61 +1008,53 @@ static int dst_tone_power_cmd(struct dst_state* state) | |||
971 | return 0; | 1008 | return 0; |
972 | } | 1009 | } |
973 | 1010 | ||
974 | static int dst_get_tuna(struct dst_state* state) | 1011 | static int dst_get_tuna(struct dst_state *state) |
975 | { | 1012 | { |
976 | int retval; | 1013 | int retval; |
977 | 1014 | ||
978 | if ((state->diseq_flags & ATTEMPT_TUNE) == 0) | 1015 | if ((state->diseq_flags & ATTEMPT_TUNE) == 0) |
979 | return 0; | 1016 | return 0; |
980 | |||
981 | state->diseq_flags &= ~(HAS_LOCK); | 1017 | state->diseq_flags &= ~(HAS_LOCK); |
982 | if (!dst_wait_dst_ready(state, NO_DELAY)) | 1018 | if (!dst_wait_dst_ready(state, NO_DELAY)) |
983 | return 0; | 1019 | return 0; |
984 | 1020 | if (state->type_flags & DST_TYPE_HAS_NEWTUNE) | |
985 | if (state->type_flags & DST_TYPE_HAS_NEWTUNE) { | ||
986 | /* how to get variable length reply ???? */ | 1021 | /* how to get variable length reply ???? */ |
987 | retval = read_dst(state, state->rx_tuna, 10); | 1022 | retval = read_dst(state, state->rx_tuna, 10); |
988 | } else { | 1023 | else |
989 | retval = read_dst(state, &state->rx_tuna[2], FIXED_COMM); | 1024 | retval = read_dst(state, &state->rx_tuna[2], FIXED_COMM); |
990 | } | ||
991 | |||
992 | if (retval < 0) { | 1025 | if (retval < 0) { |
993 | dprintk("%s: read not successful\n", __FUNCTION__); | 1026 | dprintk(verbose, DST_DEBUG, 1, "read not successful"); |
994 | return 0; | 1027 | return 0; |
995 | } | 1028 | } |
996 | |||
997 | if (state->type_flags & DST_TYPE_HAS_NEWTUNE) { | 1029 | if (state->type_flags & DST_TYPE_HAS_NEWTUNE) { |
998 | if (state->rx_tuna[9] != dst_check_sum(&state->rx_tuna[0], 9)) { | 1030 | if (state->rx_tuna[9] != dst_check_sum(&state->rx_tuna[0], 9)) { |
999 | dprintk("%s: checksum failure?\n", __FUNCTION__); | 1031 | dprintk(verbose, DST_INFO, 1, "checksum failure ? "); |
1000 | return 0; | 1032 | return 0; |
1001 | } | 1033 | } |
1002 | } else { | 1034 | } else { |
1003 | if (state->rx_tuna[9] != dst_check_sum(&state->rx_tuna[2], 7)) { | 1035 | if (state->rx_tuna[9] != dst_check_sum(&state->rx_tuna[2], 7)) { |
1004 | dprintk("%s: checksum failure?\n", __FUNCTION__); | 1036 | dprintk(verbose, DST_INFO, 1, "checksum failure? "); |
1005 | return 0; | 1037 | return 0; |
1006 | } | 1038 | } |
1007 | } | 1039 | } |
1008 | if (state->rx_tuna[2] == 0 && state->rx_tuna[3] == 0) | 1040 | if (state->rx_tuna[2] == 0 && state->rx_tuna[3] == 0) |
1009 | return 0; | 1041 | return 0; |
1010 | state->decode_freq = ((state->rx_tuna[2] & 0x7f) << 8) + state->rx_tuna[3]; | 1042 | state->decode_freq = ((state->rx_tuna[2] & 0x7f) << 8) + state->rx_tuna[3]; |
1011 | |||
1012 | state->decode_lock = 1; | 1043 | state->decode_lock = 1; |
1013 | state->diseq_flags |= HAS_LOCK; | 1044 | state->diseq_flags |= HAS_LOCK; |
1014 | 1045 | ||
1015 | return 1; | 1046 | return 1; |
1016 | } | 1047 | } |
1017 | 1048 | ||
1018 | static int dst_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage); | 1049 | static int dst_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage); |
1019 | 1050 | ||
1020 | static int dst_write_tuna(struct dvb_frontend* fe) | 1051 | static int dst_write_tuna(struct dvb_frontend *fe) |
1021 | { | 1052 | { |
1022 | struct dst_state* state = fe->demodulator_priv; | 1053 | struct dst_state *state = fe->demodulator_priv; |
1023 | int retval; | 1054 | int retval; |
1024 | u8 reply; | 1055 | u8 reply; |
1025 | 1056 | ||
1026 | if (debug > 4) | 1057 | dprintk(verbose, DST_INFO, 1, "type_flags 0x%x ", state->type_flags); |
1027 | dprintk("%s: type_flags 0x%x \n", __FUNCTION__, state->type_flags); | ||
1028 | |||
1029 | state->decode_freq = 0; | 1058 | state->decode_freq = 0; |
1030 | state->decode_lock = state->decode_strength = state->decode_snr = 0; | 1059 | state->decode_lock = state->decode_strength = state->decode_snr = 0; |
1031 | if (state->dst_type == DST_TYPE_IS_SAT) { | 1060 | if (state->dst_type == DST_TYPE_IS_SAT) { |
@@ -1035,35 +1064,31 @@ static int dst_write_tuna(struct dvb_frontend* fe) | |||
1035 | state->diseq_flags &= ~(HAS_LOCK | ATTEMPT_TUNE); | 1064 | state->diseq_flags &= ~(HAS_LOCK | ATTEMPT_TUNE); |
1036 | 1065 | ||
1037 | if ((dst_comm_init(state)) < 0) { | 1066 | if ((dst_comm_init(state)) < 0) { |
1038 | dprintk("%s: DST Communication initialization failed.\n", __FUNCTION__); | 1067 | dprintk(verbose, DST_DEBUG, 1, "DST Communication initialization failed."); |
1039 | return -1; | 1068 | return -1; |
1040 | } | 1069 | } |
1041 | |||
1042 | if (state->type_flags & DST_TYPE_HAS_NEWTUNE) { | 1070 | if (state->type_flags & DST_TYPE_HAS_NEWTUNE) { |
1043 | state->tx_tuna[9] = dst_check_sum(&state->tx_tuna[0], 9); | 1071 | state->tx_tuna[9] = dst_check_sum(&state->tx_tuna[0], 9); |
1044 | retval = write_dst(state, &state->tx_tuna[0], 10); | 1072 | retval = write_dst(state, &state->tx_tuna[0], 10); |
1045 | |||
1046 | } else { | 1073 | } else { |
1047 | state->tx_tuna[9] = dst_check_sum(&state->tx_tuna[2], 7); | 1074 | state->tx_tuna[9] = dst_check_sum(&state->tx_tuna[2], 7); |
1048 | retval = write_dst(state, &state->tx_tuna[2], FIXED_COMM); | 1075 | retval = write_dst(state, &state->tx_tuna[2], FIXED_COMM); |
1049 | } | 1076 | } |
1050 | if (retval < 0) { | 1077 | if (retval < 0) { |
1051 | dst_pio_disable(state); | 1078 | dst_pio_disable(state); |
1052 | dprintk("%s: write not successful\n", __FUNCTION__); | 1079 | dprintk(verbose, DST_DEBUG, 1, "write not successful"); |
1053 | return retval; | 1080 | return retval; |
1054 | } | 1081 | } |
1055 | |||
1056 | if ((dst_pio_disable(state)) < 0) { | 1082 | if ((dst_pio_disable(state)) < 0) { |
1057 | dprintk("%s: DST PIO disable failed !\n", __FUNCTION__); | 1083 | dprintk(verbose, DST_DEBUG, 1, "DST PIO disable failed !"); |
1058 | return -1; | 1084 | return -1; |
1059 | } | 1085 | } |
1060 | |||
1061 | if ((read_dst(state, &reply, GET_ACK) < 0)) { | 1086 | if ((read_dst(state, &reply, GET_ACK) < 0)) { |
1062 | dprintk("%s: read verify not successful.\n", __FUNCTION__); | 1087 | dprintk(verbose, DST_DEBUG, 1, "read verify not successful."); |
1063 | return -1; | 1088 | return -1; |
1064 | } | 1089 | } |
1065 | if (reply != ACK) { | 1090 | if (reply != ACK) { |
1066 | dprintk("%s: write not acknowledged 0x%02x \n", __FUNCTION__, reply); | 1091 | dprintk(verbose, DST_DEBUG, 1, "write not acknowledged 0x%02x ", reply); |
1067 | return 0; | 1092 | return 0; |
1068 | } | 1093 | } |
1069 | state->diseq_flags |= ATTEMPT_TUNE; | 1094 | state->diseq_flags |= ATTEMPT_TUNE; |
@@ -1085,14 +1110,13 @@ static int dst_write_tuna(struct dvb_frontend* fe) | |||
1085 | * Diseqc 4 0x00, 0x08, 0x04, 0xe0, 0x10, 0x38, 0xfc, 0xe0 | 1110 | * Diseqc 4 0x00, 0x08, 0x04, 0xe0, 0x10, 0x38, 0xfc, 0xe0 |
1086 | */ | 1111 | */ |
1087 | 1112 | ||
1088 | static int dst_set_diseqc(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd* cmd) | 1113 | static int dst_set_diseqc(struct dvb_frontend *fe, struct dvb_diseqc_master_cmd *cmd) |
1089 | { | 1114 | { |
1090 | struct dst_state* state = fe->demodulator_priv; | 1115 | struct dst_state *state = fe->demodulator_priv; |
1091 | u8 paket[8] = { 0x00, 0x08, 0x04, 0xe0, 0x10, 0x38, 0xf0, 0xec }; | 1116 | u8 paket[8] = { 0x00, 0x08, 0x04, 0xe0, 0x10, 0x38, 0xf0, 0xec }; |
1092 | 1117 | ||
1093 | if (state->dst_type != DST_TYPE_IS_SAT) | 1118 | if (state->dst_type != DST_TYPE_IS_SAT) |
1094 | return 0; | 1119 | return 0; |
1095 | |||
1096 | if (cmd->msg_len == 0 || cmd->msg_len > 4) | 1120 | if (cmd->msg_len == 0 || cmd->msg_len > 4) |
1097 | return -EINVAL; | 1121 | return -EINVAL; |
1098 | memcpy(&paket[3], cmd->msg, cmd->msg_len); | 1122 | memcpy(&paket[3], cmd->msg, cmd->msg_len); |
@@ -1101,65 +1125,61 @@ static int dst_set_diseqc(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd* | |||
1101 | return 0; | 1125 | return 0; |
1102 | } | 1126 | } |
1103 | 1127 | ||
1104 | static int dst_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage) | 1128 | static int dst_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) |
1105 | { | 1129 | { |
1106 | int need_cmd; | 1130 | int need_cmd; |
1107 | struct dst_state* state = fe->demodulator_priv; | 1131 | struct dst_state *state = fe->demodulator_priv; |
1108 | 1132 | ||
1109 | state->voltage = voltage; | 1133 | state->voltage = voltage; |
1110 | |||
1111 | if (state->dst_type != DST_TYPE_IS_SAT) | 1134 | if (state->dst_type != DST_TYPE_IS_SAT) |
1112 | return 0; | 1135 | return 0; |
1113 | 1136 | ||
1114 | need_cmd = 0; | 1137 | need_cmd = 0; |
1115 | switch (voltage) { | ||
1116 | case SEC_VOLTAGE_13: | ||
1117 | case SEC_VOLTAGE_18: | ||
1118 | if ((state->diseq_flags & HAS_POWER) == 0) | ||
1119 | need_cmd = 1; | ||
1120 | state->diseq_flags |= HAS_POWER; | ||
1121 | state->tx_tuna[4] = 0x01; | ||
1122 | break; | ||
1123 | 1138 | ||
1124 | case SEC_VOLTAGE_OFF: | 1139 | switch (voltage) { |
1140 | case SEC_VOLTAGE_13: | ||
1141 | case SEC_VOLTAGE_18: | ||
1142 | if ((state->diseq_flags & HAS_POWER) == 0) | ||
1125 | need_cmd = 1; | 1143 | need_cmd = 1; |
1126 | state->diseq_flags &= ~(HAS_POWER | HAS_LOCK | ATTEMPT_TUNE); | 1144 | state->diseq_flags |= HAS_POWER; |
1127 | state->tx_tuna[4] = 0x00; | 1145 | state->tx_tuna[4] = 0x01; |
1128 | break; | 1146 | break; |
1129 | 1147 | case SEC_VOLTAGE_OFF: | |
1130 | default: | 1148 | need_cmd = 1; |
1131 | return -EINVAL; | 1149 | state->diseq_flags &= ~(HAS_POWER | HAS_LOCK | ATTEMPT_TUNE); |
1150 | state->tx_tuna[4] = 0x00; | ||
1151 | break; | ||
1152 | default: | ||
1153 | return -EINVAL; | ||
1132 | } | 1154 | } |
1155 | |||
1133 | if (need_cmd) | 1156 | if (need_cmd) |
1134 | dst_tone_power_cmd(state); | 1157 | dst_tone_power_cmd(state); |
1135 | 1158 | ||
1136 | return 0; | 1159 | return 0; |
1137 | } | 1160 | } |
1138 | 1161 | ||
1139 | static int dst_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) | 1162 | static int dst_set_tone(struct dvb_frontend *fe, fe_sec_tone_mode_t tone) |
1140 | { | 1163 | { |
1141 | struct dst_state* state = fe->demodulator_priv; | 1164 | struct dst_state *state = fe->demodulator_priv; |
1142 | 1165 | ||
1143 | state->tone = tone; | 1166 | state->tone = tone; |
1144 | |||
1145 | if (state->dst_type != DST_TYPE_IS_SAT) | 1167 | if (state->dst_type != DST_TYPE_IS_SAT) |
1146 | return 0; | 1168 | return 0; |
1147 | 1169 | ||
1148 | switch (tone) { | 1170 | switch (tone) { |
1149 | case SEC_TONE_OFF: | 1171 | case SEC_TONE_OFF: |
1150 | if (state->type_flags & DST_TYPE_HAS_OBS_REGS) | 1172 | if (state->type_flags & DST_TYPE_HAS_OBS_REGS) |
1151 | state->tx_tuna[2] = 0x00; | 1173 | state->tx_tuna[2] = 0x00; |
1152 | else | 1174 | else |
1153 | state->tx_tuna[2] = 0xff; | 1175 | state->tx_tuna[2] = 0xff; |
1154 | 1176 | break; | |
1155 | break; | ||
1156 | |||
1157 | case SEC_TONE_ON: | ||
1158 | state->tx_tuna[2] = 0x02; | ||
1159 | break; | ||
1160 | 1177 | ||
1161 | default: | 1178 | case SEC_TONE_ON: |
1162 | return -EINVAL; | 1179 | state->tx_tuna[2] = 0x02; |
1180 | break; | ||
1181 | default: | ||
1182 | return -EINVAL; | ||
1163 | } | 1183 | } |
1164 | dst_tone_power_cmd(state); | 1184 | dst_tone_power_cmd(state); |
1165 | 1185 | ||
@@ -1172,16 +1192,14 @@ static int dst_send_burst(struct dvb_frontend *fe, fe_sec_mini_cmd_t minicmd) | |||
1172 | 1192 | ||
1173 | if (state->dst_type != DST_TYPE_IS_SAT) | 1193 | if (state->dst_type != DST_TYPE_IS_SAT) |
1174 | return 0; | 1194 | return 0; |
1175 | |||
1176 | state->minicmd = minicmd; | 1195 | state->minicmd = minicmd; |
1177 | |||
1178 | switch (minicmd) { | 1196 | switch (minicmd) { |
1179 | case SEC_MINI_A: | 1197 | case SEC_MINI_A: |
1180 | state->tx_tuna[3] = 0x02; | 1198 | state->tx_tuna[3] = 0x02; |
1181 | break; | 1199 | break; |
1182 | case SEC_MINI_B: | 1200 | case SEC_MINI_B: |
1183 | state->tx_tuna[3] = 0xff; | 1201 | state->tx_tuna[3] = 0xff; |
1184 | break; | 1202 | break; |
1185 | } | 1203 | } |
1186 | dst_tone_power_cmd(state); | 1204 | dst_tone_power_cmd(state); |
1187 | 1205 | ||
@@ -1189,42 +1207,37 @@ static int dst_send_burst(struct dvb_frontend *fe, fe_sec_mini_cmd_t minicmd) | |||
1189 | } | 1207 | } |
1190 | 1208 | ||
1191 | 1209 | ||
1192 | static int dst_init(struct dvb_frontend* fe) | 1210 | static int dst_init(struct dvb_frontend *fe) |
1193 | { | 1211 | { |
1194 | struct dst_state* state = fe->demodulator_priv; | 1212 | struct dst_state *state = fe->demodulator_priv; |
1195 | static u8 ini_satci_tuna[] = { 9, 0, 3, 0xb6, 1, 0, 0x73, 0x21, 0, 0 }; | 1213 | |
1196 | static u8 ini_satfta_tuna[] = { 0, 0, 3, 0xb6, 1, 0x55, 0xbd, 0x50, 0, 0 }; | 1214 | static u8 sat_tuna_188[] = { 0x09, 0x00, 0x03, 0xb6, 0x01, 0x00, 0x73, 0x21, 0x00, 0x00 }; |
1197 | static u8 ini_tvfta_tuna[] = { 0, 0, 3, 0xb6, 1, 7, 0x0, 0x0, 0, 0 }; | 1215 | static u8 sat_tuna_204[] = { 0x00, 0x00, 0x03, 0xb6, 0x01, 0x55, 0xbd, 0x50, 0x00, 0x00 }; |
1198 | static u8 ini_tvci_tuna[] = { 9, 0, 3, 0xb6, 1, 7, 0x0, 0x0, 0, 0 }; | 1216 | static u8 ter_tuna_188[] = { 0x09, 0x00, 0x03, 0xb6, 0x01, 0x07, 0x00, 0x00, 0x00, 0x00 }; |
1199 | static u8 ini_cabfta_tuna[] = { 0, 0, 3, 0xb6, 1, 7, 0x0, 0x0, 0, 0 }; | 1217 | static u8 ter_tuna_204[] = { 0x00, 0x00, 0x03, 0xb6, 0x01, 0x07, 0x00, 0x00, 0x00, 0x00 }; |
1200 | static u8 ini_cabci_tuna[] = { 9, 0, 3, 0xb6, 1, 7, 0x0, 0x0, 0, 0 }; | 1218 | static u8 cab_tuna_204[] = { 0x00, 0x00, 0x03, 0xb6, 0x01, 0x07, 0x00, 0x00, 0x00, 0x00 }; |
1201 | // state->inversion = INVERSION_ON; | 1219 | static u8 cab_tuna_188[] = { 0x09, 0x00, 0x03, 0xb6, 0x01, 0x07, 0x00, 0x00, 0x00, 0x00 }; |
1220 | |||
1202 | state->inversion = INVERSION_OFF; | 1221 | state->inversion = INVERSION_OFF; |
1203 | state->voltage = SEC_VOLTAGE_13; | 1222 | state->voltage = SEC_VOLTAGE_13; |
1204 | state->tone = SEC_TONE_OFF; | 1223 | state->tone = SEC_TONE_OFF; |
1205 | state->symbol_rate = 29473000; | ||
1206 | state->fec = FEC_AUTO; | ||
1207 | state->diseq_flags = 0; | 1224 | state->diseq_flags = 0; |
1208 | state->k22 = 0x02; | 1225 | state->k22 = 0x02; |
1209 | state->bandwidth = BANDWIDTH_7_MHZ; | 1226 | state->bandwidth = BANDWIDTH_7_MHZ; |
1210 | state->cur_jiff = jiffies; | 1227 | state->cur_jiff = jiffies; |
1211 | if (state->dst_type == DST_TYPE_IS_SAT) { | 1228 | if (state->dst_type == DST_TYPE_IS_SAT) |
1212 | state->frequency = 950000; | 1229 | memcpy(state->tx_tuna, ((state->type_flags & DST_TYPE_HAS_NEWTUNE) ? sat_tuna_188 : sat_tuna_204), sizeof (sat_tuna_204)); |
1213 | memcpy(state->tx_tuna, ((state->type_flags & DST_TYPE_HAS_NEWTUNE) ? ini_satci_tuna : ini_satfta_tuna), sizeof(ini_satfta_tuna)); | 1230 | else if (state->dst_type == DST_TYPE_IS_TERR) |
1214 | } else if (state->dst_type == DST_TYPE_IS_TERR) { | 1231 | memcpy(state->tx_tuna, ((state->type_flags & DST_TYPE_HAS_NEWTUNE) ? ter_tuna_188 : ter_tuna_204), sizeof (ter_tuna_204)); |
1215 | state->frequency = 137000000; | 1232 | else if (state->dst_type == DST_TYPE_IS_CABLE) |
1216 | memcpy(state->tx_tuna, ((state->type_flags & DST_TYPE_HAS_NEWTUNE) ? ini_tvci_tuna : ini_tvfta_tuna), sizeof(ini_tvfta_tuna)); | 1233 | memcpy(state->tx_tuna, ((state->type_flags & DST_TYPE_HAS_NEWTUNE) ? cab_tuna_188 : cab_tuna_204), sizeof (cab_tuna_204)); |
1217 | } else if (state->dst_type == DST_TYPE_IS_CABLE) { | ||
1218 | state->frequency = 51000000; | ||
1219 | memcpy(state->tx_tuna, ((state->type_flags & DST_TYPE_HAS_NEWTUNE) ? ini_cabci_tuna : ini_cabfta_tuna), sizeof(ini_cabfta_tuna)); | ||
1220 | } | ||
1221 | 1234 | ||
1222 | return 0; | 1235 | return 0; |
1223 | } | 1236 | } |
1224 | 1237 | ||
1225 | static int dst_read_status(struct dvb_frontend* fe, fe_status_t* status) | 1238 | static int dst_read_status(struct dvb_frontend *fe, fe_status_t *status) |
1226 | { | 1239 | { |
1227 | struct dst_state* state = fe->demodulator_priv; | 1240 | struct dst_state *state = fe->demodulator_priv; |
1228 | 1241 | ||
1229 | *status = 0; | 1242 | *status = 0; |
1230 | if (state->diseq_flags & HAS_LOCK) { | 1243 | if (state->diseq_flags & HAS_LOCK) { |
@@ -1236,9 +1249,9 @@ static int dst_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
1236 | return 0; | 1249 | return 0; |
1237 | } | 1250 | } |
1238 | 1251 | ||
1239 | static int dst_read_signal_strength(struct dvb_frontend* fe, u16* strength) | 1252 | static int dst_read_signal_strength(struct dvb_frontend *fe, u16 *strength) |
1240 | { | 1253 | { |
1241 | struct dst_state* state = fe->demodulator_priv; | 1254 | struct dst_state *state = fe->demodulator_priv; |
1242 | 1255 | ||
1243 | dst_get_signal(state); | 1256 | dst_get_signal(state); |
1244 | *strength = state->decode_strength; | 1257 | *strength = state->decode_strength; |
@@ -1246,9 +1259,9 @@ static int dst_read_signal_strength(struct dvb_frontend* fe, u16* strength) | |||
1246 | return 0; | 1259 | return 0; |
1247 | } | 1260 | } |
1248 | 1261 | ||
1249 | static int dst_read_snr(struct dvb_frontend* fe, u16* snr) | 1262 | static int dst_read_snr(struct dvb_frontend *fe, u16 *snr) |
1250 | { | 1263 | { |
1251 | struct dst_state* state = fe->demodulator_priv; | 1264 | struct dst_state *state = fe->demodulator_priv; |
1252 | 1265 | ||
1253 | dst_get_signal(state); | 1266 | dst_get_signal(state); |
1254 | *snr = state->decode_snr; | 1267 | *snr = state->decode_snr; |
@@ -1256,28 +1269,24 @@ static int dst_read_snr(struct dvb_frontend* fe, u16* snr) | |||
1256 | return 0; | 1269 | return 0; |
1257 | } | 1270 | } |
1258 | 1271 | ||
1259 | static int dst_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) | 1272 | static int dst_set_frontend(struct dvb_frontend *fe, struct dvb_frontend_parameters *p) |
1260 | { | 1273 | { |
1261 | struct dst_state* state = fe->demodulator_priv; | 1274 | struct dst_state *state = fe->demodulator_priv; |
1262 | 1275 | ||
1263 | dst_set_freq(state, p->frequency); | 1276 | dst_set_freq(state, p->frequency); |
1264 | if (verbose > 4) | 1277 | dprintk(verbose, DST_DEBUG, 1, "Set Frequency=[%d]", p->frequency); |
1265 | dprintk("Set Frequency=[%d]\n", p->frequency); | ||
1266 | 1278 | ||
1267 | // dst_set_inversion(state, p->inversion); | ||
1268 | if (state->dst_type == DST_TYPE_IS_SAT) { | 1279 | if (state->dst_type == DST_TYPE_IS_SAT) { |
1269 | if (state->type_flags & DST_TYPE_HAS_OBS_REGS) | 1280 | if (state->type_flags & DST_TYPE_HAS_OBS_REGS) |
1270 | dst_set_inversion(state, p->inversion); | 1281 | dst_set_inversion(state, p->inversion); |
1271 | |||
1272 | dst_set_fec(state, p->u.qpsk.fec_inner); | 1282 | dst_set_fec(state, p->u.qpsk.fec_inner); |
1273 | dst_set_symbolrate(state, p->u.qpsk.symbol_rate); | 1283 | dst_set_symbolrate(state, p->u.qpsk.symbol_rate); |
1274 | dst_set_polarization(state); | 1284 | dst_set_polarization(state); |
1275 | if (verbose > 4) | 1285 | dprintk(verbose, DST_DEBUG, 1, "Set Symbolrate=[%d]", p->u.qpsk.symbol_rate); |
1276 | dprintk("Set Symbolrate=[%d]\n", p->u.qpsk.symbol_rate); | ||
1277 | 1286 | ||
1278 | } else if (state->dst_type == DST_TYPE_IS_TERR) { | 1287 | } else if (state->dst_type == DST_TYPE_IS_TERR) |
1279 | dst_set_bandwidth(state, p->u.ofdm.bandwidth); | 1288 | dst_set_bandwidth(state, p->u.ofdm.bandwidth); |
1280 | } else if (state->dst_type == DST_TYPE_IS_CABLE) { | 1289 | else if (state->dst_type == DST_TYPE_IS_CABLE) { |
1281 | dst_set_fec(state, p->u.qam.fec_inner); | 1290 | dst_set_fec(state, p->u.qam.fec_inner); |
1282 | dst_set_symbolrate(state, p->u.qam.symbol_rate); | 1291 | dst_set_symbolrate(state, p->u.qam.symbol_rate); |
1283 | dst_set_modulation(state, p->u.qam.modulation); | 1292 | dst_set_modulation(state, p->u.qam.modulation); |
@@ -1287,16 +1296,14 @@ static int dst_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_paramet | |||
1287 | return 0; | 1296 | return 0; |
1288 | } | 1297 | } |
1289 | 1298 | ||
1290 | static int dst_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) | 1299 | static int dst_get_frontend(struct dvb_frontend *fe, struct dvb_frontend_parameters *p) |
1291 | { | 1300 | { |
1292 | struct dst_state* state = fe->demodulator_priv; | 1301 | struct dst_state *state = fe->demodulator_priv; |
1293 | 1302 | ||
1294 | p->frequency = state->decode_freq; | 1303 | p->frequency = state->decode_freq; |
1295 | // p->inversion = state->inversion; | ||
1296 | if (state->dst_type == DST_TYPE_IS_SAT) { | 1304 | if (state->dst_type == DST_TYPE_IS_SAT) { |
1297 | if (state->type_flags & DST_TYPE_HAS_OBS_REGS) | 1305 | if (state->type_flags & DST_TYPE_HAS_OBS_REGS) |
1298 | p->inversion = state->inversion; | 1306 | p->inversion = state->inversion; |
1299 | |||
1300 | p->u.qpsk.symbol_rate = state->symbol_rate; | 1307 | p->u.qpsk.symbol_rate = state->symbol_rate; |
1301 | p->u.qpsk.fec_inner = dst_get_fec(state); | 1308 | p->u.qpsk.fec_inner = dst_get_fec(state); |
1302 | } else if (state->dst_type == DST_TYPE_IS_TERR) { | 1309 | } else if (state->dst_type == DST_TYPE_IS_TERR) { |
@@ -1304,16 +1311,15 @@ static int dst_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_paramet | |||
1304 | } else if (state->dst_type == DST_TYPE_IS_CABLE) { | 1311 | } else if (state->dst_type == DST_TYPE_IS_CABLE) { |
1305 | p->u.qam.symbol_rate = state->symbol_rate; | 1312 | p->u.qam.symbol_rate = state->symbol_rate; |
1306 | p->u.qam.fec_inner = dst_get_fec(state); | 1313 | p->u.qam.fec_inner = dst_get_fec(state); |
1307 | // p->u.qam.modulation = QAM_AUTO; | ||
1308 | p->u.qam.modulation = dst_get_modulation(state); | 1314 | p->u.qam.modulation = dst_get_modulation(state); |
1309 | } | 1315 | } |
1310 | 1316 | ||
1311 | return 0; | 1317 | return 0; |
1312 | } | 1318 | } |
1313 | 1319 | ||
1314 | static void dst_release(struct dvb_frontend* fe) | 1320 | static void dst_release(struct dvb_frontend *fe) |
1315 | { | 1321 | { |
1316 | struct dst_state* state = fe->demodulator_priv; | 1322 | struct dst_state *state = fe->demodulator_priv; |
1317 | kfree(state); | 1323 | kfree(state); |
1318 | } | 1324 | } |
1319 | 1325 | ||
@@ -1321,9 +1327,8 @@ static struct dvb_frontend_ops dst_dvbt_ops; | |||
1321 | static struct dvb_frontend_ops dst_dvbs_ops; | 1327 | static struct dvb_frontend_ops dst_dvbs_ops; |
1322 | static struct dvb_frontend_ops dst_dvbc_ops; | 1328 | static struct dvb_frontend_ops dst_dvbc_ops; |
1323 | 1329 | ||
1324 | struct dst_state* dst_attach(struct dst_state *state, struct dvb_adapter *dvb_adapter) | 1330 | struct dst_state *dst_attach(struct dst_state *state, struct dvb_adapter *dvb_adapter) |
1325 | { | 1331 | { |
1326 | |||
1327 | /* check if the ASIC is there */ | 1332 | /* check if the ASIC is there */ |
1328 | if (dst_probe(state) < 0) { | 1333 | if (dst_probe(state) < 0) { |
1329 | if (state) | 1334 | if (state) |
@@ -1336,17 +1341,14 @@ struct dst_state* dst_attach(struct dst_state *state, struct dvb_adapter *dvb_ad | |||
1336 | case DST_TYPE_IS_TERR: | 1341 | case DST_TYPE_IS_TERR: |
1337 | memcpy(&state->ops, &dst_dvbt_ops, sizeof(struct dvb_frontend_ops)); | 1342 | memcpy(&state->ops, &dst_dvbt_ops, sizeof(struct dvb_frontend_ops)); |
1338 | break; | 1343 | break; |
1339 | |||
1340 | case DST_TYPE_IS_CABLE: | 1344 | case DST_TYPE_IS_CABLE: |
1341 | memcpy(&state->ops, &dst_dvbc_ops, sizeof(struct dvb_frontend_ops)); | 1345 | memcpy(&state->ops, &dst_dvbc_ops, sizeof(struct dvb_frontend_ops)); |
1342 | break; | 1346 | break; |
1343 | |||
1344 | case DST_TYPE_IS_SAT: | 1347 | case DST_TYPE_IS_SAT: |
1345 | memcpy(&state->ops, &dst_dvbs_ops, sizeof(struct dvb_frontend_ops)); | 1348 | memcpy(&state->ops, &dst_dvbs_ops, sizeof(struct dvb_frontend_ops)); |
1346 | break; | 1349 | break; |
1347 | |||
1348 | default: | 1350 | default: |
1349 | printk("%s: unknown DST type. please report to the LinuxTV.org DVB mailinglist.\n", __FUNCTION__); | 1351 | dprintk(verbose, DST_ERROR, 1, "unknown DST type. please report to the LinuxTV.org DVB mailinglist."); |
1350 | if (state) | 1352 | if (state) |
1351 | kfree(state); | 1353 | kfree(state); |
1352 | 1354 | ||
@@ -1374,12 +1376,9 @@ static struct dvb_frontend_ops dst_dvbt_ops = { | |||
1374 | }, | 1376 | }, |
1375 | 1377 | ||
1376 | .release = dst_release, | 1378 | .release = dst_release, |
1377 | |||
1378 | .init = dst_init, | 1379 | .init = dst_init, |
1379 | |||
1380 | .set_frontend = dst_set_frontend, | 1380 | .set_frontend = dst_set_frontend, |
1381 | .get_frontend = dst_get_frontend, | 1381 | .get_frontend = dst_get_frontend, |
1382 | |||
1383 | .read_status = dst_read_status, | 1382 | .read_status = dst_read_status, |
1384 | .read_signal_strength = dst_read_signal_strength, | 1383 | .read_signal_strength = dst_read_signal_strength, |
1385 | .read_snr = dst_read_snr, | 1384 | .read_snr = dst_read_snr, |
@@ -1401,16 +1400,12 @@ static struct dvb_frontend_ops dst_dvbs_ops = { | |||
1401 | }, | 1400 | }, |
1402 | 1401 | ||
1403 | .release = dst_release, | 1402 | .release = dst_release, |
1404 | |||
1405 | .init = dst_init, | 1403 | .init = dst_init, |
1406 | |||
1407 | .set_frontend = dst_set_frontend, | 1404 | .set_frontend = dst_set_frontend, |
1408 | .get_frontend = dst_get_frontend, | 1405 | .get_frontend = dst_get_frontend, |
1409 | |||
1410 | .read_status = dst_read_status, | 1406 | .read_status = dst_read_status, |
1411 | .read_signal_strength = dst_read_signal_strength, | 1407 | .read_signal_strength = dst_read_signal_strength, |
1412 | .read_snr = dst_read_snr, | 1408 | .read_snr = dst_read_snr, |
1413 | |||
1414 | .diseqc_send_burst = dst_send_burst, | 1409 | .diseqc_send_burst = dst_send_burst, |
1415 | .diseqc_send_master_cmd = dst_set_diseqc, | 1410 | .diseqc_send_master_cmd = dst_set_diseqc, |
1416 | .set_voltage = dst_set_voltage, | 1411 | .set_voltage = dst_set_voltage, |
@@ -1432,18 +1427,14 @@ static struct dvb_frontend_ops dst_dvbc_ops = { | |||
1432 | }, | 1427 | }, |
1433 | 1428 | ||
1434 | .release = dst_release, | 1429 | .release = dst_release, |
1435 | |||
1436 | .init = dst_init, | 1430 | .init = dst_init, |
1437 | |||
1438 | .set_frontend = dst_set_frontend, | 1431 | .set_frontend = dst_set_frontend, |
1439 | .get_frontend = dst_get_frontend, | 1432 | .get_frontend = dst_get_frontend, |
1440 | |||
1441 | .read_status = dst_read_status, | 1433 | .read_status = dst_read_status, |
1442 | .read_signal_strength = dst_read_signal_strength, | 1434 | .read_signal_strength = dst_read_signal_strength, |
1443 | .read_snr = dst_read_snr, | 1435 | .read_snr = dst_read_snr, |
1444 | }; | 1436 | }; |
1445 | 1437 | ||
1446 | |||
1447 | MODULE_DESCRIPTION("DST DVB-S/T/C Combo Frontend driver"); | 1438 | MODULE_DESCRIPTION("DST DVB-S/T/C Combo Frontend driver"); |
1448 | MODULE_AUTHOR("Jamie Honan, Manu Abraham"); | 1439 | MODULE_AUTHOR("Jamie Honan, Manu Abraham"); |
1449 | MODULE_LICENSE("GPL"); | 1440 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/media/dvb/bt8xx/dst_ca.c b/drivers/media/dvb/bt8xx/dst_ca.c index bfaacd5fc20f..6776a592045f 100644 --- a/drivers/media/dvb/bt8xx/dst_ca.c +++ b/drivers/media/dvb/bt8xx/dst_ca.c | |||
@@ -18,30 +18,42 @@ | |||
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | |||
22 | |||
23 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
24 | #include <linux/module.h> | 22 | #include <linux/module.h> |
25 | #include <linux/init.h> | 23 | #include <linux/init.h> |
26 | #include <linux/string.h> | 24 | #include <linux/string.h> |
27 | |||
28 | #include <linux/dvb/ca.h> | 25 | #include <linux/dvb/ca.h> |
29 | #include "dvbdev.h" | 26 | #include "dvbdev.h" |
30 | #include "dvb_frontend.h" | 27 | #include "dvb_frontend.h" |
31 | |||
32 | #include "dst_ca.h" | 28 | #include "dst_ca.h" |
33 | #include "dst_common.h" | 29 | #include "dst_common.h" |
34 | 30 | ||
31 | #define DST_CA_ERROR 0 | ||
32 | #define DST_CA_NOTICE 1 | ||
33 | #define DST_CA_INFO 2 | ||
34 | #define DST_CA_DEBUG 3 | ||
35 | |||
36 | #define dprintk(x, y, z, format, arg...) do { \ | ||
37 | if (z) { \ | ||
38 | if ((x > DST_CA_ERROR) && (x > y)) \ | ||
39 | printk(KERN_ERR "%s: " format "\n", __FUNCTION__ , ##arg); \ | ||
40 | else if ((x > DST_CA_NOTICE) && (x > y)) \ | ||
41 | printk(KERN_NOTICE "%s: " format "\n", __FUNCTION__ , ##arg); \ | ||
42 | else if ((x > DST_CA_INFO) && (x > y)) \ | ||
43 | printk(KERN_INFO "%s: " format "\n", __FUNCTION__ , ##arg); \ | ||
44 | else if ((x > DST_CA_DEBUG) && (x > y)) \ | ||
45 | printk(KERN_DEBUG "%s: " format "\n", __FUNCTION__ , ##arg); \ | ||
46 | } else { \ | ||
47 | if (x > y) \ | ||
48 | printk(format, ## arg); \ | ||
49 | } \ | ||
50 | } while(0) | ||
51 | |||
52 | |||
35 | static unsigned int verbose = 5; | 53 | static unsigned int verbose = 5; |
36 | module_param(verbose, int, 0644); | 54 | module_param(verbose, int, 0644); |
37 | MODULE_PARM_DESC(verbose, "verbose startup messages, default is 1 (yes)"); | 55 | MODULE_PARM_DESC(verbose, "verbose startup messages, default is 1 (yes)"); |
38 | 56 | ||
39 | static unsigned int debug = 1; | ||
40 | module_param(debug, int, 0644); | ||
41 | MODULE_PARM_DESC(debug, "debug messages, default is 1 (yes)"); | ||
42 | |||
43 | #define dprintk if (debug) printk | ||
44 | |||
45 | /* Need some more work */ | 57 | /* Need some more work */ |
46 | static int ca_set_slot_descr(void) | 58 | static int ca_set_slot_descr(void) |
47 | { | 59 | { |
@@ -61,27 +73,20 @@ static int put_checksum(u8 *check_string, int length) | |||
61 | { | 73 | { |
62 | u8 i = 0, checksum = 0; | 74 | u8 i = 0, checksum = 0; |
63 | 75 | ||
64 | if (verbose > 3) { | 76 | dprintk(verbose, DST_CA_DEBUG, 1, " ========================= Checksum calculation ==========================="); |
65 | dprintk("%s: ========================= Checksum calculation ===========================\n", __FUNCTION__); | 77 | dprintk(verbose, DST_CA_DEBUG, 1, " String Length=[0x%02x]", length); |
66 | dprintk("%s: String Length=[0x%02x]\n", __FUNCTION__, length); | 78 | dprintk(verbose, DST_CA_DEBUG, 1, " String=["); |
67 | 79 | ||
68 | dprintk("%s: String=[", __FUNCTION__); | ||
69 | } | ||
70 | while (i < length) { | 80 | while (i < length) { |
71 | if (verbose > 3) | 81 | dprintk(verbose, DST_CA_DEBUG, 0, " %02x", check_string[i]); |
72 | dprintk(" %02x", check_string[i]); | ||
73 | checksum += check_string[i]; | 82 | checksum += check_string[i]; |
74 | i++; | 83 | i++; |
75 | } | 84 | } |
76 | if (verbose > 3) { | 85 | dprintk(verbose, DST_CA_DEBUG, 0, " ]\n"); |
77 | dprintk(" ]\n"); | 86 | dprintk(verbose, DST_CA_DEBUG, 1, "Sum=[%02x]\n", checksum); |
78 | dprintk("%s: Sum=[%02x]\n", __FUNCTION__, checksum); | ||
79 | } | ||
80 | check_string[length] = ~checksum + 1; | 87 | check_string[length] = ~checksum + 1; |
81 | if (verbose > 3) { | 88 | dprintk(verbose, DST_CA_DEBUG, 1, " Checksum=[%02x]", check_string[length]); |
82 | dprintk("%s: Checksum=[%02x]\n", __FUNCTION__, check_string[length]); | 89 | dprintk(verbose, DST_CA_DEBUG, 1, " =========================================================================="); |
83 | dprintk("%s: ==========================================================================\n", __FUNCTION__); | ||
84 | } | ||
85 | 90 | ||
86 | return 0; | 91 | return 0; |
87 | } | 92 | } |
@@ -94,30 +99,26 @@ static int dst_ci_command(struct dst_state* state, u8 * data, u8 *ca_string, u8 | |||
94 | msleep(65); | 99 | msleep(65); |
95 | 100 | ||
96 | if (write_dst(state, data, len)) { | 101 | if (write_dst(state, data, len)) { |
97 | dprintk("%s: Write not successful, trying to recover\n", __FUNCTION__); | 102 | dprintk(verbose, DST_CA_INFO, 1, " Write not successful, trying to recover"); |
98 | dst_error_recovery(state); | 103 | dst_error_recovery(state); |
99 | return -1; | 104 | return -1; |
100 | } | 105 | } |
101 | |||
102 | if ((dst_pio_disable(state)) < 0) { | 106 | if ((dst_pio_disable(state)) < 0) { |
103 | dprintk("%s: DST PIO disable failed.\n", __FUNCTION__); | 107 | dprintk(verbose, DST_CA_ERROR, 1, " DST PIO disable failed."); |
104 | return -1; | 108 | return -1; |
105 | } | 109 | } |
106 | |||
107 | if (read_dst(state, &reply, GET_ACK) < 0) { | 110 | if (read_dst(state, &reply, GET_ACK) < 0) { |
108 | dprintk("%s: Read not successful, trying to recover\n", __FUNCTION__); | 111 | dprintk(verbose, DST_CA_INFO, 1, " Read not successful, trying to recover"); |
109 | dst_error_recovery(state); | 112 | dst_error_recovery(state); |
110 | return -1; | 113 | return -1; |
111 | } | 114 | } |
112 | |||
113 | if (read) { | 115 | if (read) { |
114 | if (! dst_wait_dst_ready(state, LONG_DELAY)) { | 116 | if (! dst_wait_dst_ready(state, LONG_DELAY)) { |
115 | dprintk("%s: 8820 not ready\n", __FUNCTION__); | 117 | dprintk(verbose, DST_CA_NOTICE, 1, " 8820 not ready"); |
116 | return -1; | 118 | return -1; |
117 | } | 119 | } |
118 | |||
119 | if (read_dst(state, ca_string, 128) < 0) { /* Try to make this dynamic */ | 120 | if (read_dst(state, ca_string, 128) < 0) { /* Try to make this dynamic */ |
120 | dprintk("%s: Read not successful, trying to recover\n", __FUNCTION__); | 121 | dprintk(verbose, DST_CA_INFO, 1, " Read not successful, trying to recover"); |
121 | dst_error_recovery(state); | 122 | dst_error_recovery(state); |
122 | return -1; | 123 | return -1; |
123 | } | 124 | } |
@@ -133,8 +134,7 @@ static int dst_put_ci(struct dst_state *state, u8 *data, int len, u8 *ca_string, | |||
133 | 134 | ||
134 | while (dst_ca_comm_err < RETRIES) { | 135 | while (dst_ca_comm_err < RETRIES) { |
135 | dst_comm_init(state); | 136 | dst_comm_init(state); |
136 | if (verbose > 2) | 137 | dprintk(verbose, DST_CA_NOTICE, 1, " Put Command"); |
137 | dprintk("%s: Put Command\n", __FUNCTION__); | ||
138 | if (dst_ci_command(state, data, ca_string, len, read)) { // If error | 138 | if (dst_ci_command(state, data, ca_string, len, read)) { // If error |
139 | dst_error_recovery(state); | 139 | dst_error_recovery(state); |
140 | dst_ca_comm_err++; // work required here. | 140 | dst_ca_comm_err++; // work required here. |
@@ -153,18 +153,15 @@ static int ca_get_app_info(struct dst_state *state) | |||
153 | 153 | ||
154 | put_checksum(&command[0], command[0]); | 154 | put_checksum(&command[0], command[0]); |
155 | if ((dst_put_ci(state, command, sizeof(command), state->messages, GET_REPLY)) < 0) { | 155 | if ((dst_put_ci(state, command, sizeof(command), state->messages, GET_REPLY)) < 0) { |
156 | dprintk("%s: -->dst_put_ci FAILED !\n", __FUNCTION__); | 156 | dprintk(verbose, DST_CA_ERROR, 1, " -->dst_put_ci FAILED !"); |
157 | return -1; | 157 | return -1; |
158 | } | 158 | } |
159 | if (verbose > 1) { | 159 | dprintk(verbose, DST_CA_INFO, 1, " -->dst_put_ci SUCCESS !"); |
160 | dprintk("%s: -->dst_put_ci SUCCESS !\n", __FUNCTION__); | 160 | dprintk(verbose, DST_CA_INFO, 1, " ================================ CI Module Application Info ======================================"); |
161 | 161 | dprintk(verbose, DST_CA_INFO, 1, " Application Type=[%d], Application Vendor=[%d], Vendor Code=[%d]\n%s: Application info=[%s]", | |
162 | dprintk("%s: ================================ CI Module Application Info ======================================\n", __FUNCTION__); | 162 | state->messages[7], (state->messages[8] << 8) | state->messages[9], |
163 | dprintk("%s: Application Type=[%d], Application Vendor=[%d], Vendor Code=[%d]\n%s: Application info=[%s]\n", | 163 | (state->messages[10] << 8) | state->messages[11], __FUNCTION__, (char *)(&state->messages[12])); |
164 | __FUNCTION__, state->messages[7], (state->messages[8] << 8) | state->messages[9], | 164 | dprintk(verbose, DST_CA_INFO, 1, " =================================================================================================="); |
165 | (state->messages[10] << 8) | state->messages[11], __FUNCTION__, (char *)(&state->messages[12])); | ||
166 | dprintk("%s: ==================================================================================================\n", __FUNCTION__); | ||
167 | } | ||
168 | 165 | ||
169 | return 0; | 166 | return 0; |
170 | } | 167 | } |
@@ -177,31 +174,26 @@ static int ca_get_slot_caps(struct dst_state *state, struct ca_caps *p_ca_caps, | |||
177 | 174 | ||
178 | put_checksum(&slot_command[0], slot_command[0]); | 175 | put_checksum(&slot_command[0], slot_command[0]); |
179 | if ((dst_put_ci(state, slot_command, sizeof (slot_command), slot_cap, GET_REPLY)) < 0) { | 176 | if ((dst_put_ci(state, slot_command, sizeof (slot_command), slot_cap, GET_REPLY)) < 0) { |
180 | dprintk("%s: -->dst_put_ci FAILED !\n", __FUNCTION__); | 177 | dprintk(verbose, DST_CA_ERROR, 1, " -->dst_put_ci FAILED !"); |
181 | return -1; | 178 | return -1; |
182 | } | 179 | } |
183 | if (verbose > 1) | 180 | dprintk(verbose, DST_CA_NOTICE, 1, " -->dst_put_ci SUCCESS !"); |
184 | dprintk("%s: -->dst_put_ci SUCCESS !\n", __FUNCTION__); | ||
185 | 181 | ||
186 | /* Will implement the rest soon */ | 182 | /* Will implement the rest soon */ |
187 | 183 | ||
188 | if (verbose > 1) { | 184 | dprintk(verbose, DST_CA_INFO, 1, " Slot cap = [%d]", slot_cap[7]); |
189 | dprintk("%s: Slot cap = [%d]\n", __FUNCTION__, slot_cap[7]); | 185 | dprintk(verbose, DST_CA_INFO, 0, "===================================\n"); |
190 | dprintk("===================================\n"); | 186 | for (i = 0; i < 8; i++) |
191 | for (i = 0; i < 8; i++) | 187 | dprintk(verbose, DST_CA_INFO, 0, " %d", slot_cap[i]); |
192 | dprintk(" %d", slot_cap[i]); | 188 | dprintk(verbose, DST_CA_INFO, 0, "\n"); |
193 | dprintk("\n"); | ||
194 | } | ||
195 | 189 | ||
196 | p_ca_caps->slot_num = 1; | 190 | p_ca_caps->slot_num = 1; |
197 | p_ca_caps->slot_type = 1; | 191 | p_ca_caps->slot_type = 1; |
198 | p_ca_caps->descr_num = slot_cap[7]; | 192 | p_ca_caps->descr_num = slot_cap[7]; |
199 | p_ca_caps->descr_type = 1; | 193 | p_ca_caps->descr_type = 1; |
200 | 194 | ||
201 | 195 | if (copy_to_user((struct ca_caps *)arg, p_ca_caps, sizeof (struct ca_caps))) | |
202 | if (copy_to_user((struct ca_caps *)arg, p_ca_caps, sizeof (struct ca_caps))) { | ||
203 | return -EFAULT; | 196 | return -EFAULT; |
204 | } | ||
205 | 197 | ||
206 | return 0; | 198 | return 0; |
207 | } | 199 | } |
@@ -222,46 +214,37 @@ static int ca_get_slot_info(struct dst_state *state, struct ca_slot_info *p_ca_s | |||
222 | 214 | ||
223 | put_checksum(&slot_command[0], 7); | 215 | put_checksum(&slot_command[0], 7); |
224 | if ((dst_put_ci(state, slot_command, sizeof (slot_command), slot_info, GET_REPLY)) < 0) { | 216 | if ((dst_put_ci(state, slot_command, sizeof (slot_command), slot_info, GET_REPLY)) < 0) { |
225 | dprintk("%s: -->dst_put_ci FAILED !\n", __FUNCTION__); | 217 | dprintk(verbose, DST_CA_ERROR, 1, " -->dst_put_ci FAILED !"); |
226 | return -1; | 218 | return -1; |
227 | } | 219 | } |
228 | if (verbose > 1) | 220 | dprintk(verbose, DST_CA_INFO, 1, " -->dst_put_ci SUCCESS !"); |
229 | dprintk("%s: -->dst_put_ci SUCCESS !\n", __FUNCTION__); | ||
230 | 221 | ||
231 | /* Will implement the rest soon */ | 222 | /* Will implement the rest soon */ |
232 | 223 | ||
233 | if (verbose > 1) { | 224 | dprintk(verbose, DST_CA_INFO, 1, " Slot info = [%d]", slot_info[3]); |
234 | dprintk("%s: Slot info = [%d]\n", __FUNCTION__, slot_info[3]); | 225 | dprintk(verbose, DST_CA_INFO, 0, "===================================\n"); |
235 | dprintk("===================================\n"); | 226 | for (i = 0; i < 8; i++) |
236 | for (i = 0; i < 8; i++) | 227 | dprintk(verbose, DST_CA_INFO, 0, " %d", slot_info[i]); |
237 | dprintk(" %d", slot_info[i]); | 228 | dprintk(verbose, DST_CA_INFO, 0, "\n"); |
238 | dprintk("\n"); | ||
239 | } | ||
240 | 229 | ||
241 | if (slot_info[4] & 0x80) { | 230 | if (slot_info[4] & 0x80) { |
242 | p_ca_slot_info->flags = CA_CI_MODULE_PRESENT; | 231 | p_ca_slot_info->flags = CA_CI_MODULE_PRESENT; |
243 | p_ca_slot_info->num = 1; | 232 | p_ca_slot_info->num = 1; |
244 | p_ca_slot_info->type = CA_CI; | 233 | p_ca_slot_info->type = CA_CI; |
245 | } | 234 | } else if (slot_info[4] & 0x40) { |
246 | else if (slot_info[4] & 0x40) { | ||
247 | p_ca_slot_info->flags = CA_CI_MODULE_READY; | 235 | p_ca_slot_info->flags = CA_CI_MODULE_READY; |
248 | p_ca_slot_info->num = 1; | 236 | p_ca_slot_info->num = 1; |
249 | p_ca_slot_info->type = CA_CI; | 237 | p_ca_slot_info->type = CA_CI; |
250 | } | 238 | } else |
251 | else { | ||
252 | p_ca_slot_info->flags = 0; | 239 | p_ca_slot_info->flags = 0; |
253 | } | ||
254 | 240 | ||
255 | if (copy_to_user((struct ca_slot_info *)arg, p_ca_slot_info, sizeof (struct ca_slot_info))) { | 241 | if (copy_to_user((struct ca_slot_info *)arg, p_ca_slot_info, sizeof (struct ca_slot_info))) |
256 | return -EFAULT; | 242 | return -EFAULT; |
257 | } | ||
258 | 243 | ||
259 | return 0; | 244 | return 0; |
260 | } | 245 | } |
261 | 246 | ||
262 | 247 | ||
263 | |||
264 | |||
265 | static int ca_get_message(struct dst_state *state, struct ca_msg *p_ca_message, void *arg) | 248 | static int ca_get_message(struct dst_state *state, struct ca_msg *p_ca_message, void *arg) |
266 | { | 249 | { |
267 | u8 i = 0; | 250 | u8 i = 0; |
@@ -270,24 +253,21 @@ static int ca_get_message(struct dst_state *state, struct ca_msg *p_ca_message, | |||
270 | if (copy_from_user(p_ca_message, (void *)arg, sizeof (struct ca_msg))) | 253 | if (copy_from_user(p_ca_message, (void *)arg, sizeof (struct ca_msg))) |
271 | return -EFAULT; | 254 | return -EFAULT; |
272 | 255 | ||
273 | |||
274 | if (p_ca_message->msg) { | 256 | if (p_ca_message->msg) { |
275 | if (verbose > 3) | 257 | dprintk(verbose, DST_CA_NOTICE, 1, " Message = [%02x %02x %02x]", p_ca_message->msg[0], p_ca_message->msg[1], p_ca_message->msg[2]); |
276 | dprintk("Message = [%02x %02x %02x]\n", p_ca_message->msg[0], p_ca_message->msg[1], p_ca_message->msg[2]); | ||
277 | 258 | ||
278 | for (i = 0; i < 3; i++) { | 259 | for (i = 0; i < 3; i++) { |
279 | command = command | p_ca_message->msg[i]; | 260 | command = command | p_ca_message->msg[i]; |
280 | if (i < 2) | 261 | if (i < 2) |
281 | command = command << 8; | 262 | command = command << 8; |
282 | } | 263 | } |
283 | if (verbose > 3) | 264 | dprintk(verbose, DST_CA_NOTICE, 1, " Command=[0x%x]", command); |
284 | dprintk("%s:Command=[0x%x]\n", __FUNCTION__, command); | ||
285 | 265 | ||
286 | switch (command) { | 266 | switch (command) { |
287 | case CA_APP_INFO: | 267 | case CA_APP_INFO: |
288 | memcpy(p_ca_message->msg, state->messages, 128); | 268 | memcpy(p_ca_message->msg, state->messages, 128); |
289 | if (copy_to_user((void *)arg, p_ca_message, sizeof (struct ca_msg)) ) | 269 | if (copy_to_user((void *)arg, p_ca_message, sizeof (struct ca_msg)) ) |
290 | return -EFAULT; | 270 | return -EFAULT; |
291 | break; | 271 | break; |
292 | } | 272 | } |
293 | } | 273 | } |
@@ -298,10 +278,13 @@ static int ca_get_message(struct dst_state *state, struct ca_msg *p_ca_message, | |||
298 | static int handle_dst_tag(struct dst_state *state, struct ca_msg *p_ca_message, struct ca_msg *hw_buffer, u32 length) | 278 | static int handle_dst_tag(struct dst_state *state, struct ca_msg *p_ca_message, struct ca_msg *hw_buffer, u32 length) |
299 | { | 279 | { |
300 | if (state->dst_hw_cap & DST_TYPE_HAS_SESSION) { | 280 | if (state->dst_hw_cap & DST_TYPE_HAS_SESSION) { |
301 | hw_buffer->msg[2] = p_ca_message->msg[1]; /* MSB */ | 281 | hw_buffer->msg[2] = p_ca_message->msg[1]; /* MSB */ |
302 | hw_buffer->msg[3] = p_ca_message->msg[2]; /* LSB */ | 282 | hw_buffer->msg[3] = p_ca_message->msg[2]; /* LSB */ |
303 | } | 283 | } else { |
304 | else { | 284 | if (length > 247) { |
285 | dprintk(verbose, DST_CA_ERROR, 1, " Message too long ! *** Bailing Out *** !"); | ||
286 | return -1; | ||
287 | } | ||
305 | hw_buffer->msg[0] = (length & 0xff) + 7; | 288 | hw_buffer->msg[0] = (length & 0xff) + 7; |
306 | hw_buffer->msg[1] = 0x40; | 289 | hw_buffer->msg[1] = 0x40; |
307 | hw_buffer->msg[2] = 0x03; | 290 | hw_buffer->msg[2] = 0x03; |
@@ -309,6 +292,11 @@ static int handle_dst_tag(struct dst_state *state, struct ca_msg *p_ca_message, | |||
309 | hw_buffer->msg[4] = 0x03; | 292 | hw_buffer->msg[4] = 0x03; |
310 | hw_buffer->msg[5] = length & 0xff; | 293 | hw_buffer->msg[5] = length & 0xff; |
311 | hw_buffer->msg[6] = 0x00; | 294 | hw_buffer->msg[6] = 0x00; |
295 | /* | ||
296 | * Need to compute length for EN50221 section 8.3.2, for the time being | ||
297 | * assuming 8.3.2 is not applicable | ||
298 | */ | ||
299 | memcpy(&hw_buffer->msg[7], &p_ca_message->msg[4], length); | ||
312 | } | 300 | } |
313 | return 0; | 301 | return 0; |
314 | } | 302 | } |
@@ -317,13 +305,12 @@ static int handle_dst_tag(struct dst_state *state, struct ca_msg *p_ca_message, | |||
317 | static int write_to_8820(struct dst_state *state, struct ca_msg *hw_buffer, u8 length, u8 reply) | 305 | static int write_to_8820(struct dst_state *state, struct ca_msg *hw_buffer, u8 length, u8 reply) |
318 | { | 306 | { |
319 | if ((dst_put_ci(state, hw_buffer->msg, length, hw_buffer->msg, reply)) < 0) { | 307 | if ((dst_put_ci(state, hw_buffer->msg, length, hw_buffer->msg, reply)) < 0) { |
320 | dprintk("%s: DST-CI Command failed.\n", __FUNCTION__); | 308 | dprintk(verbose, DST_CA_ERROR, 1, " DST-CI Command failed."); |
321 | dprintk("%s: Resetting DST.\n", __FUNCTION__); | 309 | dprintk(verbose, DST_CA_NOTICE, 1, " Resetting DST."); |
322 | rdc_reset_state(state); | 310 | rdc_reset_state(state); |
323 | return -1; | 311 | return -1; |
324 | } | 312 | } |
325 | if (verbose > 2) | 313 | dprintk(verbose, DST_CA_NOTICE, 1, " DST-CI Command succes."); |
326 | dprintk("%s: DST-CI Command succes.\n", __FUNCTION__); | ||
327 | 314 | ||
328 | return 0; | 315 | return 0; |
329 | } | 316 | } |
@@ -334,130 +321,47 @@ u32 asn_1_decode(u8 *asn_1_array) | |||
334 | u32 length = 0; | 321 | u32 length = 0; |
335 | 322 | ||
336 | length_field = asn_1_array[0]; | 323 | length_field = asn_1_array[0]; |
337 | dprintk("%s: Length field=[%02x]\n", __FUNCTION__, length_field); | 324 | dprintk(verbose, DST_CA_DEBUG, 1, " Length field=[%02x]", length_field); |
338 | if (length_field < 0x80) { | 325 | if (length_field < 0x80) { |
339 | length = length_field & 0x7f; | 326 | length = length_field & 0x7f; |
340 | dprintk("%s: Length=[%02x]\n", __FUNCTION__, length); | 327 | dprintk(verbose, DST_CA_DEBUG, 1, " Length=[%02x]\n", length); |
341 | } else { | 328 | } else { |
342 | word_count = length_field & 0x7f; | 329 | word_count = length_field & 0x7f; |
343 | for (count = 0; count < word_count; count++) { | 330 | for (count = 0; count < word_count; count++) { |
344 | length = (length | asn_1_array[count + 1]) << 8; | 331 | length = (length | asn_1_array[count + 1]) << 8; |
345 | dprintk("%s: Length=[%04x]\n", __FUNCTION__, length); | 332 | dprintk(verbose, DST_CA_DEBUG, 1, " Length=[%04x]", length); |
346 | } | 333 | } |
347 | } | 334 | } |
348 | return length; | 335 | return length; |
349 | } | 336 | } |
350 | 337 | ||
351 | static int init_buffer(u8 *buffer, u32 length) | ||
352 | { | ||
353 | u32 i; | ||
354 | for (i = 0; i < length; i++) | ||
355 | buffer[i] = 0; | ||
356 | |||
357 | return 0; | ||
358 | } | ||
359 | |||
360 | static int debug_string(u8 *msg, u32 length, u32 offset) | 338 | static int debug_string(u8 *msg, u32 length, u32 offset) |
361 | { | 339 | { |
362 | u32 i; | 340 | u32 i; |
363 | 341 | ||
364 | dprintk(" String=[ "); | 342 | dprintk(verbose, DST_CA_DEBUG, 0, " String=[ "); |
365 | for (i = offset; i < length; i++) | 343 | for (i = offset; i < length; i++) |
366 | dprintk("%02x ", msg[i]); | 344 | dprintk(verbose, DST_CA_DEBUG, 0, "%02x ", msg[i]); |
367 | dprintk("]\n"); | 345 | dprintk(verbose, DST_CA_DEBUG, 0, "]\n"); |
368 | |||
369 | return 0; | ||
370 | } | ||
371 | |||
372 | static int copy_string(u8 *destination, u8 *source, u32 dest_offset, u32 source_offset, u32 length) | ||
373 | { | ||
374 | u32 i; | ||
375 | dprintk("%s: Copying [", __FUNCTION__); | ||
376 | for (i = 0; i < length; i++) { | ||
377 | destination[i + dest_offset] = source[i + source_offset]; | ||
378 | dprintk(" %02x", source[i + source_offset]); | ||
379 | } | ||
380 | dprintk("]\n"); | ||
381 | |||
382 | return i; | ||
383 | } | ||
384 | |||
385 | static int modify_4_bits(u8 *message, u32 pos) | ||
386 | { | ||
387 | message[pos] &= 0x0f; | ||
388 | 346 | ||
389 | return 0; | 347 | return 0; |
390 | } | 348 | } |
391 | 349 | ||
392 | |||
393 | |||
394 | static int ca_set_pmt(struct dst_state *state, struct ca_msg *p_ca_message, struct ca_msg *hw_buffer, u8 reply, u8 query) | 350 | static int ca_set_pmt(struct dst_state *state, struct ca_msg *p_ca_message, struct ca_msg *hw_buffer, u8 reply, u8 query) |
395 | { | 351 | { |
396 | u32 length = 0, count = 0; | 352 | u32 length = 0; |
397 | u8 asn_1_words, program_header_length; | 353 | u8 tag_length = 8; |
398 | u16 program_info_length = 0, es_info_length = 0; | ||
399 | u32 hw_offset = 0, buf_offset = 0, i; | ||
400 | u8 dst_tag_length; | ||
401 | 354 | ||
402 | length = asn_1_decode(&p_ca_message->msg[3]); | 355 | length = asn_1_decode(&p_ca_message->msg[3]); |
403 | dprintk("%s: CA Message length=[%d]\n", __FUNCTION__, length); | 356 | dprintk(verbose, DST_CA_DEBUG, 1, " CA Message length=[%d]", length); |
404 | dprintk("%s: ASN.1 ", __FUNCTION__); | 357 | debug_string(&p_ca_message->msg[4], length, 0); /* length is excluding tag & length */ |
405 | debug_string(&p_ca_message->msg[4], length, 0); // length does not include tag and length | ||
406 | 358 | ||
407 | init_buffer(hw_buffer->msg, length); | 359 | memset(hw_buffer->msg, '\0', length); |
408 | handle_dst_tag(state, p_ca_message, hw_buffer, length); | 360 | handle_dst_tag(state, p_ca_message, hw_buffer, length); |
361 | put_checksum(hw_buffer->msg, hw_buffer->msg[0]); | ||
409 | 362 | ||
410 | hw_offset = 7; | 363 | debug_string(hw_buffer->msg, (length + tag_length), 0); /* tags too */ |
411 | asn_1_words = 1; // just a hack to test, should compute this one | 364 | write_to_8820(state, hw_buffer, (length + tag_length), reply); |
412 | buf_offset = 3; | ||
413 | program_header_length = 6; | ||
414 | dst_tag_length = 7; | ||
415 | |||
416 | // debug_twinhan_ca_params(state, p_ca_message, hw_buffer, reply, query, length, hw_offset, buf_offset); | ||
417 | // dprintk("%s: Program Header(BUF)", __FUNCTION__); | ||
418 | // debug_string(&p_ca_message->msg[4], program_header_length, 0); | ||
419 | // dprintk("%s: Copying Program header\n", __FUNCTION__); | ||
420 | copy_string(hw_buffer->msg, p_ca_message->msg, hw_offset, (buf_offset + asn_1_words), program_header_length); | ||
421 | buf_offset += program_header_length, hw_offset += program_header_length; | ||
422 | modify_4_bits(hw_buffer->msg, (hw_offset - 2)); | ||
423 | if (state->type_flags & DST_TYPE_HAS_INC_COUNT) { // workaround | ||
424 | dprintk("%s: Probably an ASIC bug !!!\n", __FUNCTION__); | ||
425 | debug_string(hw_buffer->msg, (hw_offset + program_header_length), 0); | ||
426 | hw_buffer->msg[hw_offset - 1] += 1; | ||
427 | } | ||
428 | |||
429 | // dprintk("%s: Program Header(HW), Count=[%d]", __FUNCTION__, count); | ||
430 | // debug_string(hw_buffer->msg, hw_offset, 0); | ||
431 | |||
432 | program_info_length = ((program_info_length | (p_ca_message->msg[buf_offset - 1] & 0x0f)) << 8) | p_ca_message->msg[buf_offset]; | ||
433 | dprintk("%s: Program info length=[%02x]\n", __FUNCTION__, program_info_length); | ||
434 | if (program_info_length) { | ||
435 | count = copy_string(hw_buffer->msg, p_ca_message->msg, hw_offset, (buf_offset + 1), (program_info_length + 1) ); // copy next elem, not current | ||
436 | buf_offset += count, hw_offset += count; | ||
437 | // dprintk("%s: Program level ", __FUNCTION__); | ||
438 | // debug_string(hw_buffer->msg, hw_offset, 0); | ||
439 | } | ||
440 | |||
441 | buf_offset += 1;// hw_offset += 1; | ||
442 | for (i = buf_offset; i < length; i++) { | ||
443 | // dprintk("%s: Stream Header ", __FUNCTION__); | ||
444 | count = copy_string(hw_buffer->msg, p_ca_message->msg, hw_offset, buf_offset, 5); | ||
445 | modify_4_bits(hw_buffer->msg, (hw_offset + 3)); | ||
446 | |||
447 | hw_offset += 5, buf_offset += 5, i += 4; | ||
448 | // debug_string(hw_buffer->msg, hw_offset, (hw_offset - 5)); | ||
449 | es_info_length = ((es_info_length | (p_ca_message->msg[buf_offset - 1] & 0x0f)) << 8) | p_ca_message->msg[buf_offset]; | ||
450 | dprintk("%s: ES info length=[%02x]\n", __FUNCTION__, es_info_length); | ||
451 | if (es_info_length) { | ||
452 | // copy descriptors @ STREAM level | ||
453 | dprintk("%s: Descriptors @ STREAM level...!!! \n", __FUNCTION__); | ||
454 | } | ||
455 | |||
456 | } | ||
457 | hw_buffer->msg[length + dst_tag_length] = dst_check_sum(hw_buffer->msg, (length + dst_tag_length)); | ||
458 | // dprintk("%s: Total length=[%d], Checksum=[%02x]\n", __FUNCTION__, (length + dst_tag_length), hw_buffer->msg[length + dst_tag_length]); | ||
459 | debug_string(hw_buffer->msg, (length + dst_tag_length + 1), 0); // dst tags also | ||
460 | write_to_8820(state, hw_buffer, (length + dst_tag_length + 1), reply); // checksum | ||
461 | 365 | ||
462 | return 0; | 366 | return 0; |
463 | } | 367 | } |
@@ -471,26 +375,24 @@ static int dst_check_ca_pmt(struct dst_state *state, struct ca_msg *p_ca_message | |||
471 | /* Do test board */ | 375 | /* Do test board */ |
472 | /* Not there yet but soon */ | 376 | /* Not there yet but soon */ |
473 | 377 | ||
474 | |||
475 | /* CA PMT Reply capable */ | 378 | /* CA PMT Reply capable */ |
476 | if (ca_pmt_reply_test) { | 379 | if (ca_pmt_reply_test) { |
477 | if ((ca_set_pmt(state, p_ca_message, hw_buffer, 1, GET_REPLY)) < 0) { | 380 | if ((ca_set_pmt(state, p_ca_message, hw_buffer, 1, GET_REPLY)) < 0) { |
478 | dprintk("%s: ca_set_pmt.. failed !\n", __FUNCTION__); | 381 | dprintk(verbose, DST_CA_ERROR, 1, " ca_set_pmt.. failed !"); |
479 | return -1; | 382 | return -1; |
480 | } | 383 | } |
481 | 384 | ||
482 | /* Process CA PMT Reply */ | 385 | /* Process CA PMT Reply */ |
483 | /* will implement soon */ | 386 | /* will implement soon */ |
484 | dprintk("%s: Not there yet\n", __FUNCTION__); | 387 | dprintk(verbose, DST_CA_ERROR, 1, " Not there yet"); |
485 | } | 388 | } |
486 | /* CA PMT Reply not capable */ | 389 | /* CA PMT Reply not capable */ |
487 | if (!ca_pmt_reply_test) { | 390 | if (!ca_pmt_reply_test) { |
488 | if ((ca_set_pmt(state, p_ca_message, hw_buffer, 0, NO_REPLY)) < 0) { | 391 | if ((ca_set_pmt(state, p_ca_message, hw_buffer, 0, NO_REPLY)) < 0) { |
489 | dprintk("%s: ca_set_pmt.. failed !\n", __FUNCTION__); | 392 | dprintk(verbose, DST_CA_ERROR, 1, " ca_set_pmt.. failed !"); |
490 | return -1; | 393 | return -1; |
491 | } | 394 | } |
492 | if (verbose > 3) | 395 | dprintk(verbose, DST_CA_NOTICE, 1, " ca_set_pmt.. success !"); |
493 | dprintk("%s: ca_set_pmt.. success !\n", __FUNCTION__); | ||
494 | /* put a dummy message */ | 396 | /* put a dummy message */ |
495 | 397 | ||
496 | } | 398 | } |
@@ -506,11 +408,10 @@ static int ca_send_message(struct dst_state *state, struct ca_msg *p_ca_message, | |||
506 | struct ca_msg *hw_buffer; | 408 | struct ca_msg *hw_buffer; |
507 | 409 | ||
508 | if ((hw_buffer = (struct ca_msg *) kmalloc(sizeof (struct ca_msg), GFP_KERNEL)) == NULL) { | 410 | if ((hw_buffer = (struct ca_msg *) kmalloc(sizeof (struct ca_msg), GFP_KERNEL)) == NULL) { |
509 | dprintk("%s: Memory allocation failure\n", __FUNCTION__); | 411 | dprintk(verbose, DST_CA_ERROR, 1, " Memory allocation failure"); |
510 | return -ENOMEM; | 412 | return -ENOMEM; |
511 | } | 413 | } |
512 | if (verbose > 3) | 414 | dprintk(verbose, DST_CA_DEBUG, 1, " "); |
513 | dprintk("%s\n", __FUNCTION__); | ||
514 | 415 | ||
515 | if (copy_from_user(p_ca_message, (void *)arg, sizeof (struct ca_msg))) | 416 | if (copy_from_user(p_ca_message, (void *)arg, sizeof (struct ca_msg))) |
516 | return -EFAULT; | 417 | return -EFAULT; |
@@ -525,51 +426,35 @@ static int ca_send_message(struct dst_state *state, struct ca_msg *p_ca_message, | |||
525 | if (i < 2) | 426 | if (i < 2) |
526 | command = command << 8; | 427 | command = command << 8; |
527 | } | 428 | } |
528 | if (verbose > 3) | 429 | dprintk(verbose, DST_CA_DEBUG, 1, " Command=[0x%x]\n", command); |
529 | dprintk("%s:Command=[0x%x]\n", __FUNCTION__, command); | ||
530 | 430 | ||
531 | switch (command) { | 431 | switch (command) { |
532 | case CA_PMT: | 432 | case CA_PMT: |
533 | if (verbose > 3) | 433 | dprintk(verbose, DST_CA_DEBUG, 1, "Command = SEND_CA_PMT"); |
534 | // dprintk("Command = SEND_CA_PMT\n"); | 434 | if ((ca_set_pmt(state, p_ca_message, hw_buffer, 0, 0)) < 0) { // code simplification started |
535 | dprintk("Command = SEND_CA_PMT\n"); | 435 | dprintk(verbose, DST_CA_ERROR, 1, " -->CA_PMT Failed !"); |
536 | // if ((ca_set_pmt(state, p_ca_message, hw_buffer, 0, 0)) < 0) { | 436 | return -1; |
537 | if ((ca_set_pmt(state, p_ca_message, hw_buffer, 0, 0)) < 0) { // code simplification started | 437 | } |
538 | dprintk("%s: -->CA_PMT Failed !\n", __FUNCTION__); | 438 | dprintk(verbose, DST_CA_INFO, 1, " -->CA_PMT Success !"); |
539 | return -1; | 439 | break; |
540 | } | 440 | case CA_PMT_REPLY: |
541 | if (verbose > 3) | 441 | dprintk(verbose, DST_CA_INFO, 1, "Command = CA_PMT_REPLY"); |
542 | dprintk("%s: -->CA_PMT Success !\n", __FUNCTION__); | 442 | /* Have to handle the 2 basic types of cards here */ |
543 | // retval = dummy_set_pmt(state, p_ca_message, hw_buffer, 0, 0); | 443 | if ((dst_check_ca_pmt(state, p_ca_message, hw_buffer)) < 0) { |
544 | 444 | dprintk(verbose, DST_CA_ERROR, 1, " -->CA_PMT_REPLY Failed !"); | |
545 | break; | 445 | return -1; |
546 | 446 | } | |
547 | case CA_PMT_REPLY: | 447 | dprintk(verbose, DST_CA_INFO, 1, " -->CA_PMT_REPLY Success !"); |
548 | if (verbose > 3) | 448 | break; |
549 | dprintk("Command = CA_PMT_REPLY\n"); | 449 | case CA_APP_INFO_ENQUIRY: // only for debugging |
550 | /* Have to handle the 2 basic types of cards here */ | 450 | dprintk(verbose, DST_CA_INFO, 1, " Getting Cam Application information"); |
551 | if ((dst_check_ca_pmt(state, p_ca_message, hw_buffer)) < 0) { | 451 | |
552 | dprintk("%s: -->CA_PMT_REPLY Failed !\n", __FUNCTION__); | 452 | if ((ca_get_app_info(state)) < 0) { |
553 | return -1; | 453 | dprintk(verbose, DST_CA_ERROR, 1, " -->CA_APP_INFO_ENQUIRY Failed !"); |
554 | } | 454 | return -1; |
555 | if (verbose > 3) | 455 | } |
556 | dprintk("%s: -->CA_PMT_REPLY Success !\n", __FUNCTION__); | 456 | dprintk(verbose, DST_CA_INFO, 1, " -->CA_APP_INFO_ENQUIRY Success !"); |
557 | 457 | break; | |
558 | /* Certain boards do behave different ? */ | ||
559 | // retval = ca_set_pmt(state, p_ca_message, hw_buffer, 1, 1); | ||
560 | |||
561 | case CA_APP_INFO_ENQUIRY: // only for debugging | ||
562 | if (verbose > 3) | ||
563 | dprintk("%s: Getting Cam Application information\n", __FUNCTION__); | ||
564 | |||
565 | if ((ca_get_app_info(state)) < 0) { | ||
566 | dprintk("%s: -->CA_APP_INFO_ENQUIRY Failed !\n", __FUNCTION__); | ||
567 | return -1; | ||
568 | } | ||
569 | if (verbose > 3) | ||
570 | dprintk("%s: -->CA_APP_INFO_ENQUIRY Success !\n", __FUNCTION__); | ||
571 | |||
572 | break; | ||
573 | } | 458 | } |
574 | } | 459 | } |
575 | return 0; | 460 | return 0; |
@@ -584,121 +469,88 @@ static int dst_ca_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
584 | struct ca_msg *p_ca_message; | 469 | struct ca_msg *p_ca_message; |
585 | 470 | ||
586 | if ((p_ca_message = (struct ca_msg *) kmalloc(sizeof (struct ca_msg), GFP_KERNEL)) == NULL) { | 471 | if ((p_ca_message = (struct ca_msg *) kmalloc(sizeof (struct ca_msg), GFP_KERNEL)) == NULL) { |
587 | dprintk("%s: Memory allocation failure\n", __FUNCTION__); | 472 | dprintk(verbose, DST_CA_ERROR, 1, " Memory allocation failure"); |
588 | return -ENOMEM; | 473 | return -ENOMEM; |
589 | } | 474 | } |
590 | |||
591 | if ((p_ca_slot_info = (struct ca_slot_info *) kmalloc(sizeof (struct ca_slot_info), GFP_KERNEL)) == NULL) { | 475 | if ((p_ca_slot_info = (struct ca_slot_info *) kmalloc(sizeof (struct ca_slot_info), GFP_KERNEL)) == NULL) { |
592 | dprintk("%s: Memory allocation failure\n", __FUNCTION__); | 476 | dprintk(verbose, DST_CA_ERROR, 1, " Memory allocation failure"); |
593 | return -ENOMEM; | 477 | return -ENOMEM; |
594 | } | 478 | } |
595 | |||
596 | if ((p_ca_caps = (struct ca_caps *) kmalloc(sizeof (struct ca_caps), GFP_KERNEL)) == NULL) { | 479 | if ((p_ca_caps = (struct ca_caps *) kmalloc(sizeof (struct ca_caps), GFP_KERNEL)) == NULL) { |
597 | dprintk("%s: Memory allocation failure\n", __FUNCTION__); | 480 | dprintk(verbose, DST_CA_ERROR, 1, " Memory allocation failure"); |
598 | return -ENOMEM; | 481 | return -ENOMEM; |
599 | } | 482 | } |
600 | |||
601 | /* We have now only the standard ioctl's, the driver is upposed to handle internals. */ | 483 | /* We have now only the standard ioctl's, the driver is upposed to handle internals. */ |
602 | switch (cmd) { | 484 | switch (cmd) { |
603 | case CA_SEND_MSG: | 485 | case CA_SEND_MSG: |
604 | if (verbose > 1) | 486 | dprintk(verbose, DST_CA_INFO, 1, " Sending message"); |
605 | dprintk("%s: Sending message\n", __FUNCTION__); | 487 | if ((ca_send_message(state, p_ca_message, arg)) < 0) { |
606 | if ((ca_send_message(state, p_ca_message, arg)) < 0) { | 488 | dprintk(verbose, DST_CA_ERROR, 1, " -->CA_SEND_MSG Failed !"); |
607 | dprintk("%s: -->CA_SEND_MSG Failed !\n", __FUNCTION__); | 489 | return -1; |
608 | return -1; | 490 | } |
609 | } | 491 | break; |
610 | 492 | case CA_GET_MSG: | |
611 | break; | 493 | dprintk(verbose, DST_CA_INFO, 1, " Getting message"); |
612 | 494 | if ((ca_get_message(state, p_ca_message, arg)) < 0) { | |
613 | case CA_GET_MSG: | 495 | dprintk(verbose, DST_CA_ERROR, 1, " -->CA_GET_MSG Failed !"); |
614 | if (verbose > 1) | 496 | return -1; |
615 | dprintk("%s: Getting message\n", __FUNCTION__); | 497 | } |
616 | if ((ca_get_message(state, p_ca_message, arg)) < 0) { | 498 | dprintk(verbose, DST_CA_INFO, 1, " -->CA_GET_MSG Success !"); |
617 | dprintk("%s: -->CA_GET_MSG Failed !\n", __FUNCTION__); | 499 | break; |
618 | return -1; | 500 | case CA_RESET: |
619 | } | 501 | dprintk(verbose, DST_CA_ERROR, 1, " Resetting DST"); |
620 | if (verbose > 1) | 502 | dst_error_bailout(state); |
621 | dprintk("%s: -->CA_GET_MSG Success !\n", __FUNCTION__); | 503 | msleep(4000); |
622 | 504 | break; | |
623 | break; | 505 | case CA_GET_SLOT_INFO: |
624 | 506 | dprintk(verbose, DST_CA_INFO, 1, " Getting Slot info"); | |
625 | case CA_RESET: | 507 | if ((ca_get_slot_info(state, p_ca_slot_info, arg)) < 0) { |
626 | if (verbose > 1) | 508 | dprintk(verbose, DST_CA_ERROR, 1, " -->CA_GET_SLOT_INFO Failed !"); |
627 | dprintk("%s: Resetting DST\n", __FUNCTION__); | 509 | return -1; |
628 | dst_error_bailout(state); | 510 | } |
629 | msleep(4000); | 511 | dprintk(verbose, DST_CA_INFO, 1, " -->CA_GET_SLOT_INFO Success !"); |
630 | 512 | break; | |
631 | break; | 513 | case CA_GET_CAP: |
632 | 514 | dprintk(verbose, DST_CA_INFO, 1, " Getting Slot capabilities"); | |
633 | case CA_GET_SLOT_INFO: | 515 | if ((ca_get_slot_caps(state, p_ca_caps, arg)) < 0) { |
634 | if (verbose > 1) | 516 | dprintk(verbose, DST_CA_ERROR, 1, " -->CA_GET_CAP Failed !"); |
635 | dprintk("%s: Getting Slot info\n", __FUNCTION__); | 517 | return -1; |
636 | if ((ca_get_slot_info(state, p_ca_slot_info, arg)) < 0) { | 518 | } |
637 | dprintk("%s: -->CA_GET_SLOT_INFO Failed !\n", __FUNCTION__); | 519 | dprintk(verbose, DST_CA_INFO, 1, " -->CA_GET_CAP Success !"); |
638 | return -1; | 520 | break; |
639 | } | 521 | case CA_GET_DESCR_INFO: |
640 | if (verbose > 1) | 522 | dprintk(verbose, DST_CA_INFO, 1, " Getting descrambler description"); |
641 | dprintk("%s: -->CA_GET_SLOT_INFO Success !\n", __FUNCTION__); | 523 | if ((ca_get_slot_descr(state, p_ca_message, arg)) < 0) { |
642 | 524 | dprintk(verbose, DST_CA_ERROR, 1, " -->CA_GET_DESCR_INFO Failed !"); | |
643 | break; | 525 | return -1; |
644 | 526 | } | |
645 | case CA_GET_CAP: | 527 | dprintk(verbose, DST_CA_INFO, 1, " -->CA_GET_DESCR_INFO Success !"); |
646 | if (verbose > 1) | 528 | break; |
647 | dprintk("%s: Getting Slot capabilities\n", __FUNCTION__); | 529 | case CA_SET_DESCR: |
648 | if ((ca_get_slot_caps(state, p_ca_caps, arg)) < 0) { | 530 | dprintk(verbose, DST_CA_INFO, 1, " Setting descrambler"); |
649 | dprintk("%s: -->CA_GET_CAP Failed !\n", __FUNCTION__); | 531 | if ((ca_set_slot_descr()) < 0) { |
650 | return -1; | 532 | dprintk(verbose, DST_CA_ERROR, 1, " -->CA_SET_DESCR Failed !"); |
651 | } | 533 | return -1; |
652 | if (verbose > 1) | 534 | } |
653 | dprintk("%s: -->CA_GET_CAP Success !\n", __FUNCTION__); | 535 | dprintk(verbose, DST_CA_INFO, 1, " -->CA_SET_DESCR Success !"); |
654 | 536 | break; | |
655 | break; | 537 | case CA_SET_PID: |
656 | 538 | dprintk(verbose, DST_CA_INFO, 1, " Setting PID"); | |
657 | case CA_GET_DESCR_INFO: | 539 | if ((ca_set_pid()) < 0) { |
658 | if (verbose > 1) | 540 | dprintk(verbose, DST_CA_ERROR, 1, " -->CA_SET_PID Failed !"); |
659 | dprintk("%s: Getting descrambler description\n", __FUNCTION__); | 541 | return -1; |
660 | if ((ca_get_slot_descr(state, p_ca_message, arg)) < 0) { | 542 | } |
661 | dprintk("%s: -->CA_GET_DESCR_INFO Failed !\n", __FUNCTION__); | 543 | dprintk(verbose, DST_CA_INFO, 1, " -->CA_SET_PID Success !"); |
662 | return -1; | 544 | default: |
663 | } | 545 | return -EOPNOTSUPP; |
664 | if (verbose > 1) | 546 | }; |
665 | dprintk("%s: -->CA_GET_DESCR_INFO Success !\n", __FUNCTION__); | ||
666 | |||
667 | break; | ||
668 | |||
669 | case CA_SET_DESCR: | ||
670 | if (verbose > 1) | ||
671 | dprintk("%s: Setting descrambler\n", __FUNCTION__); | ||
672 | if ((ca_set_slot_descr()) < 0) { | ||
673 | dprintk("%s: -->CA_SET_DESCR Failed !\n", __FUNCTION__); | ||
674 | return -1; | ||
675 | } | ||
676 | if (verbose > 1) | ||
677 | dprintk("%s: -->CA_SET_DESCR Success !\n", __FUNCTION__); | ||
678 | |||
679 | break; | ||
680 | |||
681 | case CA_SET_PID: | ||
682 | if (verbose > 1) | ||
683 | dprintk("%s: Setting PID\n", __FUNCTION__); | ||
684 | if ((ca_set_pid()) < 0) { | ||
685 | dprintk("%s: -->CA_SET_PID Failed !\n", __FUNCTION__); | ||
686 | return -1; | ||
687 | } | ||
688 | if (verbose > 1) | ||
689 | dprintk("%s: -->CA_SET_PID Success !\n", __FUNCTION__); | ||
690 | |||
691 | default: | ||
692 | return -EOPNOTSUPP; | ||
693 | }; | ||
694 | 547 | ||
695 | return 0; | 548 | return 0; |
696 | } | 549 | } |
697 | 550 | ||
698 | static int dst_ca_open(struct inode *inode, struct file *file) | 551 | static int dst_ca_open(struct inode *inode, struct file *file) |
699 | { | 552 | { |
700 | if (verbose > 4) | 553 | dprintk(verbose, DST_CA_DEBUG, 1, " Device opened [%p] ", file); |
701 | dprintk("%s:Device opened [%p]\n", __FUNCTION__, file); | ||
702 | try_module_get(THIS_MODULE); | 554 | try_module_get(THIS_MODULE); |
703 | 555 | ||
704 | return 0; | 556 | return 0; |
@@ -706,27 +558,24 @@ static int dst_ca_open(struct inode *inode, struct file *file) | |||
706 | 558 | ||
707 | static int dst_ca_release(struct inode *inode, struct file *file) | 559 | static int dst_ca_release(struct inode *inode, struct file *file) |
708 | { | 560 | { |
709 | if (verbose > 4) | 561 | dprintk(verbose, DST_CA_DEBUG, 1, " Device closed."); |
710 | dprintk("%s:Device closed.\n", __FUNCTION__); | ||
711 | module_put(THIS_MODULE); | 562 | module_put(THIS_MODULE); |
712 | 563 | ||
713 | return 0; | 564 | return 0; |
714 | } | 565 | } |
715 | 566 | ||
716 | static int dst_ca_read(struct file *file, char __user * buffer, size_t length, loff_t * offset) | 567 | static int dst_ca_read(struct file *file, char __user *buffer, size_t length, loff_t *offset) |
717 | { | 568 | { |
718 | int bytes_read = 0; | 569 | int bytes_read = 0; |
719 | 570 | ||
720 | if (verbose > 4) | 571 | dprintk(verbose, DST_CA_DEBUG, 1, " Device read."); |
721 | dprintk("%s:Device read.\n", __FUNCTION__); | ||
722 | 572 | ||
723 | return bytes_read; | 573 | return bytes_read; |
724 | } | 574 | } |
725 | 575 | ||
726 | static int dst_ca_write(struct file *file, const char __user * buffer, size_t length, loff_t * offset) | 576 | static int dst_ca_write(struct file *file, const char __user *buffer, size_t length, loff_t *offset) |
727 | { | 577 | { |
728 | if (verbose > 4) | 578 | dprintk(verbose, DST_CA_DEBUG, 1, " Device write."); |
729 | dprintk("%s:Device write.\n", __FUNCTION__); | ||
730 | 579 | ||
731 | return 0; | 580 | return 0; |
732 | } | 581 | } |
@@ -751,8 +600,7 @@ static struct dvb_device dvbdev_ca = { | |||
751 | int dst_ca_attach(struct dst_state *dst, struct dvb_adapter *dvb_adapter) | 600 | int dst_ca_attach(struct dst_state *dst, struct dvb_adapter *dvb_adapter) |
752 | { | 601 | { |
753 | struct dvb_device *dvbdev; | 602 | struct dvb_device *dvbdev; |
754 | if (verbose > 4) | 603 | dprintk(verbose, DST_CA_ERROR, 1, "registering DST-CA device"); |
755 | dprintk("%s:registering DST-CA device\n", __FUNCTION__); | ||
756 | dvb_register_device(dvb_adapter, &dvbdev, &dvbdev_ca, dst, DVB_DEVICE_CA); | 604 | dvb_register_device(dvb_adapter, &dvbdev, &dvbdev_ca, dst, DVB_DEVICE_CA); |
757 | return 0; | 605 | return 0; |
758 | } | 606 | } |
diff --git a/drivers/media/dvb/bt8xx/dst_common.h b/drivers/media/dvb/bt8xx/dst_common.h index ef532a6aceaa..3281a6ca3685 100644 --- a/drivers/media/dvb/bt8xx/dst_common.h +++ b/drivers/media/dvb/bt8xx/dst_common.h | |||
@@ -61,7 +61,6 @@ | |||
61 | #define DST_TYPE_HAS_ANALOG 64 /* Analog inputs */ | 61 | #define DST_TYPE_HAS_ANALOG 64 /* Analog inputs */ |
62 | #define DST_TYPE_HAS_SESSION 128 | 62 | #define DST_TYPE_HAS_SESSION 128 |
63 | 63 | ||
64 | |||
65 | #define RDC_8820_PIO_0_DISABLE 0 | 64 | #define RDC_8820_PIO_0_DISABLE 0 |
66 | #define RDC_8820_PIO_0_ENABLE 1 | 65 | #define RDC_8820_PIO_0_ENABLE 1 |
67 | #define RDC_8820_INT 2 | 66 | #define RDC_8820_INT 2 |
@@ -114,6 +113,10 @@ struct dst_state { | |||
114 | fe_sec_mini_cmd_t minicmd; | 113 | fe_sec_mini_cmd_t minicmd; |
115 | fe_modulation_t modulation; | 114 | fe_modulation_t modulation; |
116 | u8 messages[256]; | 115 | u8 messages[256]; |
116 | u8 mac_address[8]; | ||
117 | u8 fw_version[8]; | ||
118 | u8 card_info[8]; | ||
119 | u8 vendor[8]; | ||
117 | }; | 120 | }; |
118 | 121 | ||
119 | struct dst_types { | 122 | struct dst_types { |
@@ -124,15 +127,12 @@ struct dst_types { | |||
124 | u32 dst_feature; | 127 | u32 dst_feature; |
125 | }; | 128 | }; |
126 | 129 | ||
127 | |||
128 | |||
129 | struct dst_config | 130 | struct dst_config |
130 | { | 131 | { |
131 | /* the ASIC i2c address */ | 132 | /* the ASIC i2c address */ |
132 | u8 demod_address; | 133 | u8 demod_address; |
133 | }; | 134 | }; |
134 | 135 | ||
135 | |||
136 | int rdc_reset_state(struct dst_state *state); | 136 | int rdc_reset_state(struct dst_state *state); |
137 | int rdc_8820_reset(struct dst_state *state); | 137 | int rdc_8820_reset(struct dst_state *state); |
138 | 138 | ||
diff --git a/drivers/media/dvb/bt8xx/dvb-bt8xx.c b/drivers/media/dvb/bt8xx/dvb-bt8xx.c index 6f857c6091f3..c5c7672cd538 100644 --- a/drivers/media/dvb/bt8xx/dvb-bt8xx.c +++ b/drivers/media/dvb/bt8xx/dvb-bt8xx.c | |||
@@ -32,9 +32,7 @@ | |||
32 | #include "dvbdev.h" | 32 | #include "dvbdev.h" |
33 | #include "dvb_demux.h" | 33 | #include "dvb_demux.h" |
34 | #include "dvb_frontend.h" | 34 | #include "dvb_frontend.h" |
35 | |||
36 | #include "dvb-bt8xx.h" | 35 | #include "dvb-bt8xx.h" |
37 | |||
38 | #include "bt878.h" | 36 | #include "bt878.h" |
39 | 37 | ||
40 | static int debug; | 38 | static int debug; |
@@ -43,9 +41,11 @@ module_param(debug, int, 0644); | |||
43 | MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off)."); | 41 | MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off)."); |
44 | 42 | ||
45 | #define dprintk( args... ) \ | 43 | #define dprintk( args... ) \ |
46 | do { \ | 44 | do \ |
47 | if (debug) printk(KERN_DEBUG args); \ | 45 | if (debug) printk(KERN_DEBUG args); \ |
48 | } while (0) | 46 | while (0) |
47 | |||
48 | #define IF_FREQUENCYx6 217 /* 6 * 36.16666666667MHz */ | ||
49 | 49 | ||
50 | static void dvb_bt8xx_task(unsigned long data) | 50 | static void dvb_bt8xx_task(unsigned long data) |
51 | { | 51 | { |
@@ -119,14 +119,12 @@ static struct bt878 __init *dvb_bt8xx_878_match(unsigned int bttv_nr, struct pci | |||
119 | unsigned int card_nr; | 119 | unsigned int card_nr; |
120 | 120 | ||
121 | /* Hmm, n squared. Hope n is small */ | 121 | /* Hmm, n squared. Hope n is small */ |
122 | for (card_nr = 0; card_nr < bt878_num; card_nr++) { | 122 | for (card_nr = 0; card_nr < bt878_num; card_nr++) |
123 | if (is_pci_slot_eq(bt878[card_nr].dev, bttv_pci_dev)) | 123 | if (is_pci_slot_eq(bt878[card_nr].dev, bttv_pci_dev)) |
124 | return &bt878[card_nr]; | 124 | return &bt878[card_nr]; |
125 | } | ||
126 | return NULL; | 125 | return NULL; |
127 | } | 126 | } |
128 | 127 | ||
129 | |||
130 | static int thomson_dtt7579_demod_init(struct dvb_frontend* fe) | 128 | static int thomson_dtt7579_demod_init(struct dvb_frontend* fe) |
131 | { | 129 | { |
132 | static u8 mt352_clock_config [] = { 0x89, 0x38, 0x38 }; | 130 | static u8 mt352_clock_config [] = { 0x89, 0x38, 0x38 }; |
@@ -154,16 +152,21 @@ static int thomson_dtt7579_pll_set(struct dvb_frontend* fe, struct dvb_frontend_ | |||
154 | unsigned char bs = 0; | 152 | unsigned char bs = 0; |
155 | unsigned char cp = 0; | 153 | unsigned char cp = 0; |
156 | 154 | ||
157 | #define IF_FREQUENCYx6 217 /* 6 * 36.16666666667MHz */ | ||
158 | div = (((params->frequency + 83333) * 3) / 500000) + IF_FREQUENCYx6; | 155 | div = (((params->frequency + 83333) * 3) / 500000) + IF_FREQUENCYx6; |
159 | 156 | ||
160 | if (params->frequency < 542000000) cp = 0xb4; | 157 | if (params->frequency < 542000000) |
161 | else if (params->frequency < 771000000) cp = 0xbc; | 158 | cp = 0xb4; |
162 | else cp = 0xf4; | 159 | else if (params->frequency < 771000000) |
160 | cp = 0xbc; | ||
161 | else | ||
162 | cp = 0xf4; | ||
163 | 163 | ||
164 | if (params->frequency == 0) bs = 0x03; | 164 | if (params->frequency == 0) |
165 | else if (params->frequency < 443250000) bs = 0x02; | 165 | bs = 0x03; |
166 | else bs = 0x08; | 166 | else if (params->frequency < 443250000) |
167 | bs = 0x02; | ||
168 | else | ||
169 | bs = 0x08; | ||
167 | 170 | ||
168 | pllbuf[0] = 0xc0; // Note: non-linux standard PLL i2c address | 171 | pllbuf[0] = 0xc0; // Note: non-linux standard PLL i2c address |
169 | pllbuf[1] = div >> 8; | 172 | pllbuf[1] = div >> 8; |
@@ -175,7 +178,6 @@ static int thomson_dtt7579_pll_set(struct dvb_frontend* fe, struct dvb_frontend_ | |||
175 | } | 178 | } |
176 | 179 | ||
177 | static struct mt352_config thomson_dtt7579_config = { | 180 | static struct mt352_config thomson_dtt7579_config = { |
178 | |||
179 | .demod_address = 0x0f, | 181 | .demod_address = 0x0f, |
180 | .demod_init = thomson_dtt7579_demod_init, | 182 | .demod_init = thomson_dtt7579_demod_init, |
181 | .pll_set = thomson_dtt7579_pll_set, | 183 | .pll_set = thomson_dtt7579_pll_set, |
@@ -183,25 +185,26 @@ static struct mt352_config thomson_dtt7579_config = { | |||
183 | 185 | ||
184 | static int cx24108_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 186 | static int cx24108_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) |
185 | { | 187 | { |
186 | u32 freq = params->frequency; | 188 | u32 freq = params->frequency; |
187 | |||
188 | int i, a, n, pump; | ||
189 | u32 band, pll; | ||
190 | 189 | ||
190 | int i, a, n, pump; | ||
191 | u32 band, pll; | ||
191 | 192 | ||
192 | u32 osci[]={950000,1019000,1075000,1178000,1296000,1432000, | 193 | u32 osci[]={950000,1019000,1075000,1178000,1296000,1432000, |
193 | 1576000,1718000,1856000,2036000,2150000}; | 194 | 1576000,1718000,1856000,2036000,2150000}; |
194 | u32 bandsel[]={0,0x00020000,0x00040000,0x00100800,0x00101000, | 195 | u32 bandsel[]={0,0x00020000,0x00040000,0x00100800,0x00101000, |
195 | 0x00102000,0x00104000,0x00108000,0x00110000, | 196 | 0x00102000,0x00104000,0x00108000,0x00110000, |
196 | 0x00120000,0x00140000}; | 197 | 0x00120000,0x00140000}; |
197 | 198 | ||
198 | #define XTAL 1011100 /* Hz, really 1.0111 MHz and a /10 prescaler */ | 199 | #define XTAL 1011100 /* Hz, really 1.0111 MHz and a /10 prescaler */ |
199 | printk("cx24108 debug: entering SetTunerFreq, freq=%d\n",freq); | 200 | printk("cx24108 debug: entering SetTunerFreq, freq=%d\n",freq); |
200 | 201 | ||
201 | /* This is really the bit driving the tuner chip cx24108 */ | 202 | /* This is really the bit driving the tuner chip cx24108 */ |
202 | 203 | ||
203 | if(freq<950000) freq=950000; /* kHz */ | 204 | if (freq<950000) |
204 | if(freq>2150000) freq=2150000; /* satellite IF is 950..2150MHz */ | 205 | freq = 950000; /* kHz */ |
206 | else if (freq>2150000) | ||
207 | freq = 2150000; /* satellite IF is 950..2150MHz */ | ||
205 | 208 | ||
206 | /* decide which VCO to use for the input frequency */ | 209 | /* decide which VCO to use for the input frequency */ |
207 | for(i=1;(i<sizeof(osci)/sizeof(osci[0]))&&(osci[i]<freq);i++); | 210 | for(i=1;(i<sizeof(osci)/sizeof(osci[0]))&&(osci[i]<freq);i++); |
@@ -228,25 +231,22 @@ static int cx24108_pll_set(struct dvb_frontend* fe, struct dvb_frontend_paramete | |||
228 | cx24110_pll_write(fe,0x500c0000); | 231 | cx24110_pll_write(fe,0x500c0000); |
229 | cx24110_pll_write(fe,0x83f1f800); | 232 | cx24110_pll_write(fe,0x83f1f800); |
230 | cx24110_pll_write(fe,pll); | 233 | cx24110_pll_write(fe,pll); |
231 | /* writereg(client,0x56,0x7f);*/ | 234 | //writereg(client,0x56,0x7f); |
232 | 235 | ||
233 | return 0; | 236 | return 0; |
234 | } | 237 | } |
235 | 238 | ||
236 | static int pinnsat_pll_init(struct dvb_frontend* fe) | 239 | static int pinnsat_pll_init(struct dvb_frontend* fe) |
237 | { | 240 | { |
238 | return 0; | 241 | return 0; |
239 | } | 242 | } |
240 | 243 | ||
241 | |||
242 | static struct cx24110_config pctvsat_config = { | 244 | static struct cx24110_config pctvsat_config = { |
243 | |||
244 | .demod_address = 0x55, | 245 | .demod_address = 0x55, |
245 | .pll_init = pinnsat_pll_init, | 246 | .pll_init = pinnsat_pll_init, |
246 | .pll_set = cx24108_pll_set, | 247 | .pll_set = cx24108_pll_set, |
247 | }; | 248 | }; |
248 | 249 | ||
249 | |||
250 | static int microtune_mt7202dtf_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 250 | static int microtune_mt7202dtf_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) |
251 | { | 251 | { |
252 | struct dvb_bt8xx_card *card = (struct dvb_bt8xx_card *) fe->dvb->priv; | 252 | struct dvb_bt8xx_card *card = (struct dvb_bt8xx_card *) fe->dvb->priv; |
@@ -258,15 +258,23 @@ static int microtune_mt7202dtf_pll_set(struct dvb_frontend* fe, struct dvb_front | |||
258 | div = (36000000 + params->frequency + 83333) / 166666; | 258 | div = (36000000 + params->frequency + 83333) / 166666; |
259 | cfg = 0x88; | 259 | cfg = 0x88; |
260 | 260 | ||
261 | if (params->frequency < 175000000) cpump = 2; | 261 | if (params->frequency < 175000000) |
262 | else if (params->frequency < 390000000) cpump = 1; | 262 | cpump = 2; |
263 | else if (params->frequency < 470000000) cpump = 2; | 263 | else if (params->frequency < 390000000) |
264 | else if (params->frequency < 750000000) cpump = 2; | 264 | cpump = 1; |
265 | else cpump = 3; | 265 | else if (params->frequency < 470000000) |
266 | cpump = 2; | ||
267 | else if (params->frequency < 750000000) | ||
268 | cpump = 2; | ||
269 | else | ||
270 | cpump = 3; | ||
266 | 271 | ||
267 | if (params->frequency < 175000000) band_select = 0x0e; | 272 | if (params->frequency < 175000000) |
268 | else if (params->frequency < 470000000) band_select = 0x05; | 273 | band_select = 0x0e; |
269 | else band_select = 0x03; | 274 | else if (params->frequency < 470000000) |
275 | band_select = 0x05; | ||
276 | else | ||
277 | band_select = 0x03; | ||
270 | 278 | ||
271 | data[0] = (div >> 8) & 0x7f; | 279 | data[0] = (div >> 8) & 0x7f; |
272 | data[1] = div & 0xff; | 280 | data[1] = div & 0xff; |
@@ -285,14 +293,11 @@ static int microtune_mt7202dtf_request_firmware(struct dvb_frontend* fe, const s | |||
285 | } | 293 | } |
286 | 294 | ||
287 | static struct sp887x_config microtune_mt7202dtf_config = { | 295 | static struct sp887x_config microtune_mt7202dtf_config = { |
288 | |||
289 | .demod_address = 0x70, | 296 | .demod_address = 0x70, |
290 | .pll_set = microtune_mt7202dtf_pll_set, | 297 | .pll_set = microtune_mt7202dtf_pll_set, |
291 | .request_firmware = microtune_mt7202dtf_request_firmware, | 298 | .request_firmware = microtune_mt7202dtf_request_firmware, |
292 | }; | 299 | }; |
293 | 300 | ||
294 | |||
295 | |||
296 | static int advbt771_samsung_tdtc9251dh0_demod_init(struct dvb_frontend* fe) | 301 | static int advbt771_samsung_tdtc9251dh0_demod_init(struct dvb_frontend* fe) |
297 | { | 302 | { |
298 | static u8 mt352_clock_config [] = { 0x89, 0x38, 0x2d }; | 303 | static u8 mt352_clock_config [] = { 0x89, 0x38, 0x2d }; |
@@ -303,7 +308,6 @@ static int advbt771_samsung_tdtc9251dh0_demod_init(struct dvb_frontend* fe) | |||
303 | static u8 mt352_av771_extra[] = { 0xB5, 0x7A }; | 308 | static u8 mt352_av771_extra[] = { 0xB5, 0x7A }; |
304 | static u8 mt352_capt_range_cfg[] = { 0x75, 0x32 }; | 309 | static u8 mt352_capt_range_cfg[] = { 0x75, 0x32 }; |
305 | 310 | ||
306 | |||
307 | mt352_write(fe, mt352_clock_config, sizeof(mt352_clock_config)); | 311 | mt352_write(fe, mt352_clock_config, sizeof(mt352_clock_config)); |
308 | udelay(2000); | 312 | udelay(2000); |
309 | mt352_write(fe, mt352_reset, sizeof(mt352_reset)); | 313 | mt352_write(fe, mt352_reset, sizeof(mt352_reset)); |
@@ -323,28 +327,45 @@ static int advbt771_samsung_tdtc9251dh0_pll_set(struct dvb_frontend* fe, struct | |||
323 | unsigned char bs = 0; | 327 | unsigned char bs = 0; |
324 | unsigned char cp = 0; | 328 | unsigned char cp = 0; |
325 | 329 | ||
326 | #define IF_FREQUENCYx6 217 /* 6 * 36.16666666667MHz */ | ||
327 | div = (((params->frequency + 83333) * 3) / 500000) + IF_FREQUENCYx6; | 330 | div = (((params->frequency + 83333) * 3) / 500000) + IF_FREQUENCYx6; |
328 | 331 | ||
329 | if (params->frequency < 150000000) cp = 0xB4; | 332 | if (params->frequency < 150000000) |
330 | else if (params->frequency < 173000000) cp = 0xBC; | 333 | cp = 0xB4; |
331 | else if (params->frequency < 250000000) cp = 0xB4; | 334 | else if (params->frequency < 173000000) |
332 | else if (params->frequency < 400000000) cp = 0xBC; | 335 | cp = 0xBC; |
333 | else if (params->frequency < 420000000) cp = 0xF4; | 336 | else if (params->frequency < 250000000) |
334 | else if (params->frequency < 470000000) cp = 0xFC; | 337 | cp = 0xB4; |
335 | else if (params->frequency < 600000000) cp = 0xBC; | 338 | else if (params->frequency < 400000000) |
336 | else if (params->frequency < 730000000) cp = 0xF4; | 339 | cp = 0xBC; |
337 | else cp = 0xFC; | 340 | else if (params->frequency < 420000000) |
338 | 341 | cp = 0xF4; | |
339 | if (params->frequency < 150000000) bs = 0x01; | 342 | else if (params->frequency < 470000000) |
340 | else if (params->frequency < 173000000) bs = 0x01; | 343 | cp = 0xFC; |
341 | else if (params->frequency < 250000000) bs = 0x02; | 344 | else if (params->frequency < 600000000) |
342 | else if (params->frequency < 400000000) bs = 0x02; | 345 | cp = 0xBC; |
343 | else if (params->frequency < 420000000) bs = 0x02; | 346 | else if (params->frequency < 730000000) |
344 | else if (params->frequency < 470000000) bs = 0x02; | 347 | cp = 0xF4; |
345 | else if (params->frequency < 600000000) bs = 0x08; | 348 | else |
346 | else if (params->frequency < 730000000) bs = 0x08; | 349 | cp = 0xFC; |
347 | else bs = 0x08; | 350 | |
351 | if (params->frequency < 150000000) | ||
352 | bs = 0x01; | ||
353 | else if (params->frequency < 173000000) | ||
354 | bs = 0x01; | ||
355 | else if (params->frequency < 250000000) | ||
356 | bs = 0x02; | ||
357 | else if (params->frequency < 400000000) | ||
358 | bs = 0x02; | ||
359 | else if (params->frequency < 420000000) | ||
360 | bs = 0x02; | ||
361 | else if (params->frequency < 470000000) | ||
362 | bs = 0x02; | ||
363 | else if (params->frequency < 600000000) | ||
364 | bs = 0x08; | ||
365 | else if (params->frequency < 730000000) | ||
366 | bs = 0x08; | ||
367 | else | ||
368 | bs = 0x08; | ||
348 | 369 | ||
349 | pllbuf[0] = 0xc2; // Note: non-linux standard PLL i2c address | 370 | pllbuf[0] = 0xc2; // Note: non-linux standard PLL i2c address |
350 | pllbuf[1] = div >> 8; | 371 | pllbuf[1] = div >> 8; |
@@ -356,19 +377,15 @@ static int advbt771_samsung_tdtc9251dh0_pll_set(struct dvb_frontend* fe, struct | |||
356 | } | 377 | } |
357 | 378 | ||
358 | static struct mt352_config advbt771_samsung_tdtc9251dh0_config = { | 379 | static struct mt352_config advbt771_samsung_tdtc9251dh0_config = { |
359 | |||
360 | .demod_address = 0x0f, | 380 | .demod_address = 0x0f, |
361 | .demod_init = advbt771_samsung_tdtc9251dh0_demod_init, | 381 | .demod_init = advbt771_samsung_tdtc9251dh0_demod_init, |
362 | .pll_set = advbt771_samsung_tdtc9251dh0_pll_set, | 382 | .pll_set = advbt771_samsung_tdtc9251dh0_pll_set, |
363 | }; | 383 | }; |
364 | 384 | ||
365 | |||
366 | static struct dst_config dst_config = { | 385 | static struct dst_config dst_config = { |
367 | |||
368 | .demod_address = 0x55, | 386 | .demod_address = 0x55, |
369 | }; | 387 | }; |
370 | 388 | ||
371 | |||
372 | static int or51211_request_firmware(struct dvb_frontend* fe, const struct firmware **fw, char* name) | 389 | static int or51211_request_firmware(struct dvb_frontend* fe, const struct firmware **fw, char* name) |
373 | { | 390 | { |
374 | struct dvb_bt8xx_card* bt = (struct dvb_bt8xx_card*) fe->dvb->priv; | 391 | struct dvb_bt8xx_card* bt = (struct dvb_bt8xx_card*) fe->dvb->priv; |
@@ -398,10 +415,8 @@ static void or51211_reset(struct dvb_frontend * fe) | |||
398 | */ | 415 | */ |
399 | /* reset & PRM1,2&4 are outputs */ | 416 | /* reset & PRM1,2&4 are outputs */ |
400 | int ret = bttv_gpio_enable(bt->bttv_nr, 0x001F, 0x001F); | 417 | int ret = bttv_gpio_enable(bt->bttv_nr, 0x001F, 0x001F); |
401 | if (ret != 0) { | 418 | if (ret != 0) |
402 | printk(KERN_WARNING "or51211: Init Error - Can't Reset DVR " | 419 | printk(KERN_WARNING "or51211: Init Error - Can't Reset DVR (%i)\n", ret); |
403 | "(%i)\n", ret); | ||
404 | } | ||
405 | bttv_write_gpio(bt->bttv_nr, 0x001F, 0x0000); /* Reset */ | 420 | bttv_write_gpio(bt->bttv_nr, 0x001F, 0x0000); /* Reset */ |
406 | msleep(20); | 421 | msleep(20); |
407 | /* Now set for normal operation */ | 422 | /* Now set for normal operation */ |
@@ -417,7 +432,6 @@ static void or51211_sleep(struct dvb_frontend * fe) | |||
417 | } | 432 | } |
418 | 433 | ||
419 | static struct or51211_config or51211_config = { | 434 | static struct or51211_config or51211_config = { |
420 | |||
421 | .demod_address = 0x15, | 435 | .demod_address = 0x15, |
422 | .request_firmware = or51211_request_firmware, | 436 | .request_firmware = or51211_request_firmware, |
423 | .setmode = or51211_setmode, | 437 | .setmode = or51211_setmode, |
@@ -425,7 +439,6 @@ static struct or51211_config or51211_config = { | |||
425 | .sleep = or51211_sleep, | 439 | .sleep = or51211_sleep, |
426 | }; | 440 | }; |
427 | 441 | ||
428 | |||
429 | static int vp3021_alps_tded4_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 442 | static int vp3021_alps_tded4_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) |
430 | { | 443 | { |
431 | struct dvb_bt8xx_card *card = (struct dvb_bt8xx_card *) fe->dvb->priv; | 444 | struct dvb_bt8xx_card *card = (struct dvb_bt8xx_card *) fe->dvb->priv; |
@@ -454,12 +467,84 @@ static int vp3021_alps_tded4_pll_set(struct dvb_frontend* fe, struct dvb_fronten | |||
454 | } | 467 | } |
455 | 468 | ||
456 | static struct nxt6000_config vp3021_alps_tded4_config = { | 469 | static struct nxt6000_config vp3021_alps_tded4_config = { |
457 | |||
458 | .demod_address = 0x0a, | 470 | .demod_address = 0x0a, |
459 | .clock_inversion = 1, | 471 | .clock_inversion = 1, |
460 | .pll_set = vp3021_alps_tded4_pll_set, | 472 | .pll_set = vp3021_alps_tded4_pll_set, |
461 | }; | 473 | }; |
462 | 474 | ||
475 | static int digitv_alps_tded4_demod_init(struct dvb_frontend* fe) | ||
476 | { | ||
477 | static u8 mt352_clock_config [] = { 0x89, 0x38, 0x2d }; | ||
478 | static u8 mt352_reset [] = { 0x50, 0x80 }; | ||
479 | static u8 mt352_adc_ctl_1_cfg [] = { 0x8E, 0x40 }; | ||
480 | static u8 mt352_agc_cfg [] = { 0x67, 0x20, 0xa0 }; | ||
481 | static u8 mt352_capt_range_cfg[] = { 0x75, 0x32 }; | ||
482 | |||
483 | mt352_write(fe, mt352_clock_config, sizeof(mt352_clock_config)); | ||
484 | udelay(2000); | ||
485 | mt352_write(fe, mt352_reset, sizeof(mt352_reset)); | ||
486 | mt352_write(fe, mt352_adc_ctl_1_cfg, sizeof(mt352_adc_ctl_1_cfg)); | ||
487 | mt352_write(fe, mt352_agc_cfg,sizeof(mt352_agc_cfg)); | ||
488 | mt352_write(fe, mt352_capt_range_cfg, sizeof(mt352_capt_range_cfg)); | ||
489 | |||
490 | return 0; | ||
491 | } | ||
492 | |||
493 | static int digitv_alps_tded4_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u8* pllbuf) | ||
494 | { | ||
495 | u32 div; | ||
496 | struct dvb_ofdm_parameters *op = ¶ms->u.ofdm; | ||
497 | |||
498 | div = (((params->frequency + 83333) * 3) / 500000) + IF_FREQUENCYx6; | ||
499 | |||
500 | pllbuf[0] = 0xc2; | ||
501 | pllbuf[1] = (div >> 8) & 0x7F; | ||
502 | pllbuf[2] = div & 0xFF; | ||
503 | pllbuf[3] = 0x85; | ||
504 | |||
505 | dprintk("frequency %u, div %u\n", params->frequency, div); | ||
506 | |||
507 | if (params->frequency < 470000000) | ||
508 | pllbuf[4] = 0x02; | ||
509 | else if (params->frequency > 823000000) | ||
510 | pllbuf[4] = 0x88; | ||
511 | else | ||
512 | pllbuf[4] = 0x08; | ||
513 | |||
514 | if (op->bandwidth == 8) | ||
515 | pllbuf[4] |= 0x04; | ||
516 | |||
517 | return 0; | ||
518 | } | ||
519 | |||
520 | static void digitv_alps_tded4_reset(struct dvb_bt8xx_card *bt) | ||
521 | { | ||
522 | /* | ||
523 | * Reset the frontend, must be called before trying | ||
524 | * to initialise the MT352 or mt352_attach | ||
525 | * will fail. | ||
526 | * | ||
527 | * Presumably not required for the NXT6000 frontend. | ||
528 | * | ||
529 | */ | ||
530 | |||
531 | int ret = bttv_gpio_enable(bt->bttv_nr, 0x08, 0x08); | ||
532 | if (ret != 0) | ||
533 | printk(KERN_WARNING "digitv_alps_tded4: Init Error - Can't Reset DVR (%i)\n", ret); | ||
534 | |||
535 | /* Pulse the reset line */ | ||
536 | bttv_write_gpio(bt->bttv_nr, 0x08, 0x08); /* High */ | ||
537 | bttv_write_gpio(bt->bttv_nr, 0x08, 0x00); /* Low */ | ||
538 | msleep(100); | ||
539 | |||
540 | bttv_write_gpio(bt->bttv_nr, 0x08, 0x08); /* High */ | ||
541 | } | ||
542 | |||
543 | static struct mt352_config digitv_alps_tded4_config = { | ||
544 | .demod_address = 0x0a, | ||
545 | .demod_init = digitv_alps_tded4_demod_init, | ||
546 | .pll_set = digitv_alps_tded4_pll_set, | ||
547 | }; | ||
463 | 548 | ||
464 | static void frontend_init(struct dvb_bt8xx_card *card, u32 type) | 549 | static void frontend_init(struct dvb_bt8xx_card *card, u32 type) |
465 | { | 550 | { |
@@ -473,7 +558,6 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type) | |||
473 | if (card->fe != NULL) { | 558 | if (card->fe != NULL) { |
474 | card->fe->ops->info.frequency_min = 174000000; | 559 | card->fe->ops->info.frequency_min = 174000000; |
475 | card->fe->ops->info.frequency_max = 862000000; | 560 | card->fe->ops->info.frequency_max = 862000000; |
476 | break; | ||
477 | } | 561 | } |
478 | break; | 562 | break; |
479 | #endif | 563 | #endif |
@@ -483,17 +567,28 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type) | |||
483 | #else | 567 | #else |
484 | case BTTV_NEBULA_DIGITV: | 568 | case BTTV_NEBULA_DIGITV: |
485 | #endif | 569 | #endif |
570 | /* | ||
571 | * It is possible to determine the correct frontend using the I2C bus (see the Nebula SDK); | ||
572 | * this would be a cleaner solution than trying each frontend in turn. | ||
573 | */ | ||
574 | |||
575 | /* Old Nebula (marked (c)2003 on high profile pci card) has nxt6000 demod */ | ||
486 | card->fe = nxt6000_attach(&vp3021_alps_tded4_config, card->i2c_adapter); | 576 | card->fe = nxt6000_attach(&vp3021_alps_tded4_config, card->i2c_adapter); |
487 | if (card->fe != NULL) { | 577 | if (card->fe != NULL) { |
578 | dprintk ("dvb_bt8xx: an nxt6000 was detected on your digitv card\n"); | ||
488 | break; | 579 | break; |
489 | } | 580 | } |
581 | |||
582 | /* New Nebula (marked (c)2005 on low profile pci card) has mt352 demod */ | ||
583 | digitv_alps_tded4_reset(card); | ||
584 | card->fe = mt352_attach(&digitv_alps_tded4_config, card->i2c_adapter); | ||
585 | |||
586 | if (card->fe != NULL) | ||
587 | dprintk ("dvb_bt8xx: an mt352 was detected on your digitv card\n"); | ||
490 | break; | 588 | break; |
491 | 589 | ||
492 | case BTTV_AVDVBT_761: | 590 | case BTTV_AVDVBT_761: |
493 | card->fe = sp887x_attach(µtune_mt7202dtf_config, card->i2c_adapter); | 591 | card->fe = sp887x_attach(µtune_mt7202dtf_config, card->i2c_adapter); |
494 | if (card->fe != NULL) { | ||
495 | break; | ||
496 | } | ||
497 | break; | 592 | break; |
498 | 593 | ||
499 | case BTTV_AVDVBT_771: | 594 | case BTTV_AVDVBT_771: |
@@ -501,7 +596,6 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type) | |||
501 | if (card->fe != NULL) { | 596 | if (card->fe != NULL) { |
502 | card->fe->ops->info.frequency_min = 174000000; | 597 | card->fe->ops->info.frequency_min = 174000000; |
503 | card->fe->ops->info.frequency_max = 862000000; | 598 | card->fe->ops->info.frequency_max = 862000000; |
504 | break; | ||
505 | } | 599 | } |
506 | break; | 600 | break; |
507 | 601 | ||
@@ -522,54 +616,41 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type) | |||
522 | 616 | ||
523 | /* Attach other DST peripherals if any */ | 617 | /* Attach other DST peripherals if any */ |
524 | /* Conditional Access device */ | 618 | /* Conditional Access device */ |
525 | if (state->dst_hw_cap & DST_TYPE_HAS_CA) { | 619 | if (state->dst_hw_cap & DST_TYPE_HAS_CA) |
526 | ret = dst_ca_attach(state, &card->dvb_adapter); | 620 | ret = dst_ca_attach(state, &card->dvb_adapter); |
527 | } | ||
528 | if (card->fe != NULL) { | ||
529 | break; | ||
530 | } | ||
531 | break; | 621 | break; |
532 | 622 | ||
533 | case BTTV_PINNACLESAT: | 623 | case BTTV_PINNACLESAT: |
534 | card->fe = cx24110_attach(&pctvsat_config, card->i2c_adapter); | 624 | card->fe = cx24110_attach(&pctvsat_config, card->i2c_adapter); |
535 | if (card->fe != NULL) { | ||
536 | break; | ||
537 | } | ||
538 | break; | 625 | break; |
539 | 626 | ||
540 | case BTTV_PC_HDTV: | 627 | case BTTV_PC_HDTV: |
541 | card->fe = or51211_attach(&or51211_config, card->i2c_adapter); | 628 | card->fe = or51211_attach(&or51211_config, card->i2c_adapter); |
542 | if (card->fe != NULL) { | ||
543 | break; | ||
544 | } | ||
545 | break; | 629 | break; |
546 | } | 630 | } |
547 | 631 | ||
548 | if (card->fe == NULL) { | 632 | if (card->fe == NULL) |
549 | printk("dvb-bt8xx: A frontend driver was not found for device %04x/%04x subsystem %04x/%04x\n", | 633 | printk("dvb-bt8xx: A frontend driver was not found for device %04x/%04x subsystem %04x/%04x\n", |
550 | card->bt->dev->vendor, | 634 | card->bt->dev->vendor, |
551 | card->bt->dev->device, | 635 | card->bt->dev->device, |
552 | card->bt->dev->subsystem_vendor, | 636 | card->bt->dev->subsystem_vendor, |
553 | card->bt->dev->subsystem_device); | 637 | card->bt->dev->subsystem_device); |
554 | } else { | 638 | else |
555 | if (dvb_register_frontend(&card->dvb_adapter, card->fe)) { | 639 | if (dvb_register_frontend(&card->dvb_adapter, card->fe)) { |
556 | printk("dvb-bt8xx: Frontend registration failed!\n"); | 640 | printk("dvb-bt8xx: Frontend registration failed!\n"); |
557 | if (card->fe->ops->release) | 641 | if (card->fe->ops->release) |
558 | card->fe->ops->release(card->fe); | 642 | card->fe->ops->release(card->fe); |
559 | card->fe = NULL; | 643 | card->fe = NULL; |
560 | } | 644 | } |
561 | } | ||
562 | } | 645 | } |
563 | 646 | ||
564 | static int __init dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type) | 647 | static int __init dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type) |
565 | { | 648 | { |
566 | int result; | 649 | int result; |
567 | 650 | ||
568 | if ((result = dvb_register_adapter(&card->dvb_adapter, card->card_name, | 651 | if ((result = dvb_register_adapter(&card->dvb_adapter, card->card_name, THIS_MODULE)) < 0) { |
569 | THIS_MODULE)) < 0) { | ||
570 | printk("dvb_bt8xx: dvb_register_adapter failed (errno = %d)\n", result); | 652 | printk("dvb_bt8xx: dvb_register_adapter failed (errno = %d)\n", result); |
571 | return result; | 653 | return result; |
572 | |||
573 | } | 654 | } |
574 | card->dvb_adapter.priv = card; | 655 | card->dvb_adapter.priv = card; |
575 | 656 | ||
@@ -664,8 +745,7 @@ static int dvb_bt8xx_probe(struct device *dev) | |||
664 | strncpy(card->card_name, sub->core->name, sizeof(sub->core->name)); | 745 | strncpy(card->card_name, sub->core->name, sizeof(sub->core->name)); |
665 | card->i2c_adapter = &sub->core->i2c_adap; | 746 | card->i2c_adapter = &sub->core->i2c_adap; |
666 | 747 | ||
667 | switch(sub->core->type) | 748 | switch(sub->core->type) { |
668 | { | ||
669 | case BTTV_PINNACLESAT: | 749 | case BTTV_PINNACLESAT: |
670 | card->gpio_mode = 0x0400c060; | 750 | card->gpio_mode = 0x0400c060; |
671 | /* should be: BT878_A_GAIN=0,BT878_A_PWRDN,BT878_DA_DPM,BT878_DA_SBR, | 751 | /* should be: BT878_A_GAIN=0,BT878_A_PWRDN,BT878_DA_DPM,BT878_DA_SBR, |
@@ -751,7 +831,6 @@ static int dvb_bt8xx_probe(struct device *dev) | |||
751 | 831 | ||
752 | kfree(card); | 832 | kfree(card); |
753 | return -EFAULT; | 833 | return -EFAULT; |
754 | |||
755 | } | 834 | } |
756 | 835 | ||
757 | init_MUTEX(&card->bt->gpio_lock); | 836 | init_MUTEX(&card->bt->gpio_lock); |
@@ -779,7 +858,8 @@ static int dvb_bt8xx_remove(struct device *dev) | |||
779 | card->demux.dmx.remove_frontend(&card->demux.dmx, &card->fe_hw); | 858 | card->demux.dmx.remove_frontend(&card->demux.dmx, &card->fe_hw); |
780 | dvb_dmxdev_release(&card->dmxdev); | 859 | dvb_dmxdev_release(&card->dmxdev); |
781 | dvb_dmx_release(&card->demux); | 860 | dvb_dmx_release(&card->demux); |
782 | if (card->fe) dvb_unregister_frontend(card->fe); | 861 | if (card->fe) |
862 | dvb_unregister_frontend(card->fe); | ||
783 | dvb_unregister_adapter(&card->dvb_adapter); | 863 | dvb_unregister_adapter(&card->dvb_adapter); |
784 | 864 | ||
785 | kfree(card); | 865 | kfree(card); |
diff --git a/drivers/media/dvb/bt8xx/dvb-bt8xx.h b/drivers/media/dvb/bt8xx/dvb-bt8xx.h index 2923b3b0dd3c..9ec8e5bd6c1f 100644 --- a/drivers/media/dvb/bt8xx/dvb-bt8xx.h +++ b/drivers/media/dvb/bt8xx/dvb-bt8xx.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * Bt8xx based DVB adapter driver | 2 | * Bt8xx based DVB adapter driver |
3 | * | 3 | * |
4 | * Copyright (C) 2002,2003 Florian Schirmer <jolt@tuxbox.org> | 4 | * Copyright (C) 2002,2003 Florian Schirmer <jolt@tuxbox.org> |
5 | * Copyright (C) 2002 Peter Hettkamp <peter.hettkamp@t-online.de> | 5 | * Copyright (C) 2002 Peter Hettkamp <peter.hettkamp@htp-tel.de> |
6 | * Copyright (C) 1999-2001 Ralph Metzler & Marcus Metzler for convergence integrated media GmbH | 6 | * Copyright (C) 1999-2001 Ralph Metzler & Marcus Metzler for convergence integrated media GmbH |
7 | * Copyright (C) 1998,1999 Christian Theiss <mistert@rz.fh-augsburg.de> | 7 | * Copyright (C) 1998,1999 Christian Theiss <mistert@rz.fh-augsburg.de> |
8 | * | 8 | * |
diff --git a/drivers/media/dvb/cinergyT2/Kconfig b/drivers/media/dvb/cinergyT2/Kconfig index 226714085f58..7cf4c4a888ec 100644 --- a/drivers/media/dvb/cinergyT2/Kconfig +++ b/drivers/media/dvb/cinergyT2/Kconfig | |||
@@ -77,7 +77,7 @@ config DVB_CINERGYT2_ENABLE_RC_INPUT_DEVICE | |||
77 | config DVB_CINERGYT2_RC_QUERY_INTERVAL | 77 | config DVB_CINERGYT2_RC_QUERY_INTERVAL |
78 | int "Infrared Remote Controller update interval [milliseconds]" | 78 | int "Infrared Remote Controller update interval [milliseconds]" |
79 | depends on DVB_CINERGYT2_TUNING && DVB_CINERGYT2_ENABLE_RC_INPUT_DEVICE | 79 | depends on DVB_CINERGYT2_TUNING && DVB_CINERGYT2_ENABLE_RC_INPUT_DEVICE |
80 | default "100" | 80 | default "50" |
81 | help | 81 | help |
82 | If you have a very fast-repeating remote control you can try lower | 82 | If you have a very fast-repeating remote control you can try lower |
83 | values, for normal consumer receivers the default value should be | 83 | values, for normal consumer receivers the default value should be |
diff --git a/drivers/media/dvb/cinergyT2/cinergyT2.c b/drivers/media/dvb/cinergyT2/cinergyT2.c index 9ea5747b1211..6db0929ef53d 100644 --- a/drivers/media/dvb/cinergyT2/cinergyT2.c +++ b/drivers/media/dvb/cinergyT2/cinergyT2.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/config.h> | 25 | #include <linux/config.h> |
26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/version.h> | ||
29 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
30 | #include <linux/usb.h> | 29 | #include <linux/usb.h> |
31 | #include <linux/pci.h> | 30 | #include <linux/pci.h> |
@@ -36,7 +35,6 @@ | |||
36 | #include "dvb_demux.h" | 35 | #include "dvb_demux.h" |
37 | #include "dvb_net.h" | 36 | #include "dvb_net.h" |
38 | 37 | ||
39 | |||
40 | #ifdef CONFIG_DVB_CINERGYT2_TUNING | 38 | #ifdef CONFIG_DVB_CINERGYT2_TUNING |
41 | #define STREAM_URB_COUNT (CONFIG_DVB_CINERGYT2_STREAM_URB_COUNT) | 39 | #define STREAM_URB_COUNT (CONFIG_DVB_CINERGYT2_STREAM_URB_COUNT) |
42 | #define STREAM_BUF_SIZE (CONFIG_DVB_CINERGYT2_STREAM_BUF_SIZE) | 40 | #define STREAM_BUF_SIZE (CONFIG_DVB_CINERGYT2_STREAM_BUF_SIZE) |
@@ -49,7 +47,7 @@ | |||
49 | #define STREAM_URB_COUNT (32) | 47 | #define STREAM_URB_COUNT (32) |
50 | #define STREAM_BUF_SIZE (512) /* bytes */ | 48 | #define STREAM_BUF_SIZE (512) /* bytes */ |
51 | #define ENABLE_RC (1) | 49 | #define ENABLE_RC (1) |
52 | #define RC_QUERY_INTERVAL (100) /* milliseconds */ | 50 | #define RC_QUERY_INTERVAL (50) /* milliseconds */ |
53 | #define QUERY_INTERVAL (333) /* milliseconds */ | 51 | #define QUERY_INTERVAL (333) /* milliseconds */ |
54 | #endif | 52 | #endif |
55 | 53 | ||
@@ -142,6 +140,8 @@ struct cinergyt2 { | |||
142 | struct input_dev rc_input_dev; | 140 | struct input_dev rc_input_dev; |
143 | struct work_struct rc_query_work; | 141 | struct work_struct rc_query_work; |
144 | int rc_input_event; | 142 | int rc_input_event; |
143 | u32 rc_last_code; | ||
144 | unsigned long last_event_jiffies; | ||
145 | #endif | 145 | #endif |
146 | }; | 146 | }; |
147 | 147 | ||
@@ -156,7 +156,7 @@ struct cinergyt2_rc_event { | |||
156 | uint32_t value; | 156 | uint32_t value; |
157 | } __attribute__((packed)); | 157 | } __attribute__((packed)); |
158 | 158 | ||
159 | static const uint32_t rc_keys [] = { | 159 | static const uint32_t rc_keys[] = { |
160 | CINERGYT2_RC_EVENT_TYPE_NEC, 0xfe01eb04, KEY_POWER, | 160 | CINERGYT2_RC_EVENT_TYPE_NEC, 0xfe01eb04, KEY_POWER, |
161 | CINERGYT2_RC_EVENT_TYPE_NEC, 0xfd02eb04, KEY_1, | 161 | CINERGYT2_RC_EVENT_TYPE_NEC, 0xfd02eb04, KEY_1, |
162 | CINERGYT2_RC_EVENT_TYPE_NEC, 0xfc03eb04, KEY_2, | 162 | CINERGYT2_RC_EVENT_TYPE_NEC, 0xfc03eb04, KEY_2, |
@@ -685,52 +685,68 @@ static struct dvb_device cinergyt2_fe_template = { | |||
685 | #ifdef ENABLE_RC | 685 | #ifdef ENABLE_RC |
686 | static void cinergyt2_query_rc (void *data) | 686 | static void cinergyt2_query_rc (void *data) |
687 | { | 687 | { |
688 | struct cinergyt2 *cinergyt2 = (struct cinergyt2 *) data; | 688 | struct cinergyt2 *cinergyt2 = data; |
689 | char buf [1] = { CINERGYT2_EP1_GET_RC_EVENTS }; | 689 | char buf[1] = { CINERGYT2_EP1_GET_RC_EVENTS }; |
690 | struct cinergyt2_rc_event rc_events[12]; | 690 | struct cinergyt2_rc_event rc_events[12]; |
691 | int n, len; | 691 | int n, len, i; |
692 | 692 | ||
693 | if (down_interruptible(&cinergyt2->sem)) | 693 | if (down_interruptible(&cinergyt2->sem)) |
694 | return; | 694 | return; |
695 | 695 | ||
696 | len = cinergyt2_command(cinergyt2, buf, sizeof(buf), | 696 | len = cinergyt2_command(cinergyt2, buf, sizeof(buf), |
697 | (char *) rc_events, sizeof(rc_events)); | 697 | (char *) rc_events, sizeof(rc_events)); |
698 | 698 | if (len < 0) | |
699 | for (n=0; len>0 && n<(len/sizeof(rc_events[0])); n++) { | 699 | goto out; |
700 | int i; | 700 | if (len == 0) { |
701 | if (time_after(jiffies, cinergyt2->last_event_jiffies + | ||
702 | msecs_to_jiffies(150))) { | ||
703 | /* stop key repeat */ | ||
704 | if (cinergyt2->rc_input_event != KEY_MAX) { | ||
705 | dprintk(1, "rc_input_event=%d Up\n", cinergyt2->rc_input_event); | ||
706 | input_report_key(&cinergyt2->rc_input_dev, | ||
707 | cinergyt2->rc_input_event, 0); | ||
708 | cinergyt2->rc_input_event = KEY_MAX; | ||
709 | } | ||
710 | cinergyt2->rc_last_code = ~0; | ||
711 | } | ||
712 | goto out; | ||
713 | } | ||
714 | cinergyt2->last_event_jiffies = jiffies; | ||
701 | 715 | ||
702 | /* dprintk(1,"rc_events[%d].value = %x, type=%x\n",n,le32_to_cpu(rc_events[n].value),rc_events[n].type);*/ | 716 | for (n = 0; n < (len / sizeof(rc_events[0])); n++) { |
717 | dprintk(1, "rc_events[%d].value = %x, type=%x\n", | ||
718 | n, le32_to_cpu(rc_events[n].value), rc_events[n].type); | ||
703 | 719 | ||
704 | if (rc_events[n].type == CINERGYT2_RC_EVENT_TYPE_NEC && | 720 | if (rc_events[n].type == CINERGYT2_RC_EVENT_TYPE_NEC && |
705 | rc_events[n].value == ~0) | 721 | rc_events[n].value == ~0) { |
706 | { | 722 | /* keyrepeat bit -> just repeat last rc_input_event */ |
707 | /** | ||
708 | * keyrepeat bit. If we would handle this properly | ||
709 | * we would need to emit down events as long the | ||
710 | * keyrepeat goes, a up event if no further | ||
711 | * repeat bits occur. Would need a timer to implement | ||
712 | * and no other driver does this, so we simply | ||
713 | * emit the last key up/down sequence again. | ||
714 | */ | ||
715 | } else { | 723 | } else { |
716 | cinergyt2->rc_input_event = KEY_MAX; | 724 | cinergyt2->rc_input_event = KEY_MAX; |
717 | for (i=0; i<sizeof(rc_keys)/sizeof(rc_keys[0]); i+=3) { | 725 | for (i = 0; i < sizeof(rc_keys) / sizeof(rc_keys[0]); i += 3) { |
718 | if (rc_keys[i+0] == rc_events[n].type && | 726 | if (rc_keys[i + 0] == rc_events[n].type && |
719 | rc_keys[i+1] == le32_to_cpu(rc_events[n].value)) | 727 | rc_keys[i + 1] == le32_to_cpu(rc_events[n].value)) { |
720 | { | 728 | cinergyt2->rc_input_event = rc_keys[i + 2]; |
721 | cinergyt2->rc_input_event = rc_keys[i+2]; | ||
722 | break; | 729 | break; |
723 | } | 730 | } |
724 | } | 731 | } |
725 | } | 732 | } |
726 | 733 | ||
727 | if (cinergyt2->rc_input_event != KEY_MAX) { | 734 | if (cinergyt2->rc_input_event != KEY_MAX) { |
728 | input_report_key(&cinergyt2->rc_input_dev, cinergyt2->rc_input_event, 1); | 735 | if (rc_events[n].value == cinergyt2->rc_last_code && |
729 | input_report_key(&cinergyt2->rc_input_dev, cinergyt2->rc_input_event, 0); | 736 | cinergyt2->rc_last_code != ~0) { |
730 | input_sync(&cinergyt2->rc_input_dev); | 737 | /* emit a key-up so the double event is recognized */ |
738 | dprintk(1, "rc_input_event=%d UP\n", cinergyt2->rc_input_event); | ||
739 | input_report_key(&cinergyt2->rc_input_dev, | ||
740 | cinergyt2->rc_input_event, 0); | ||
741 | } | ||
742 | dprintk(1, "rc_input_event=%d\n", cinergyt2->rc_input_event); | ||
743 | input_report_key(&cinergyt2->rc_input_dev, | ||
744 | cinergyt2->rc_input_event, 1); | ||
745 | cinergyt2->rc_last_code = rc_events[n].value; | ||
731 | } | 746 | } |
732 | } | 747 | } |
733 | 748 | ||
749 | out: | ||
734 | schedule_delayed_work(&cinergyt2->rc_query_work, | 750 | schedule_delayed_work(&cinergyt2->rc_query_work, |
735 | msecs_to_jiffies(RC_QUERY_INTERVAL)); | 751 | msecs_to_jiffies(RC_QUERY_INTERVAL)); |
736 | 752 | ||
@@ -772,7 +788,10 @@ static int cinergyt2_probe (struct usb_interface *intf, | |||
772 | const struct usb_device_id *id) | 788 | const struct usb_device_id *id) |
773 | { | 789 | { |
774 | struct cinergyt2 *cinergyt2; | 790 | struct cinergyt2 *cinergyt2; |
775 | int i, err; | 791 | int err; |
792 | #ifdef ENABLE_RC | ||
793 | int i; | ||
794 | #endif | ||
776 | 795 | ||
777 | if (!(cinergyt2 = kmalloc (sizeof(struct cinergyt2), GFP_KERNEL))) { | 796 | if (!(cinergyt2 = kmalloc (sizeof(struct cinergyt2), GFP_KERNEL))) { |
778 | dprintk(1, "out of memory?!?\n"); | 797 | dprintk(1, "out of memory?!?\n"); |
@@ -828,19 +847,18 @@ static int cinergyt2_probe (struct usb_interface *intf, | |||
828 | DVB_DEVICE_FRONTEND); | 847 | DVB_DEVICE_FRONTEND); |
829 | 848 | ||
830 | #ifdef ENABLE_RC | 849 | #ifdef ENABLE_RC |
831 | init_input_dev(&cinergyt2->rc_input_dev); | 850 | cinergyt2->rc_input_dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REP); |
832 | 851 | cinergyt2->rc_input_dev.keycodesize = 0; | |
833 | cinergyt2->rc_input_dev.evbit[0] = BIT(EV_KEY); | 852 | cinergyt2->rc_input_dev.keycodemax = 0; |
834 | cinergyt2->rc_input_dev.keycodesize = sizeof(unsigned char); | ||
835 | cinergyt2->rc_input_dev.keycodemax = KEY_MAX; | ||
836 | cinergyt2->rc_input_dev.name = DRIVER_NAME " remote control"; | 853 | cinergyt2->rc_input_dev.name = DRIVER_NAME " remote control"; |
837 | 854 | ||
838 | for (i=0; i<sizeof(rc_keys)/sizeof(rc_keys[0]); i+=3) | 855 | for (i = 0; i < sizeof(rc_keys) / sizeof(rc_keys[0]); i += 3) |
839 | set_bit(rc_keys[i+2], cinergyt2->rc_input_dev.keybit); | 856 | set_bit(rc_keys[i + 2], cinergyt2->rc_input_dev.keybit); |
840 | 857 | ||
841 | input_register_device(&cinergyt2->rc_input_dev); | 858 | input_register_device(&cinergyt2->rc_input_dev); |
842 | 859 | ||
843 | cinergyt2->rc_input_event = KEY_MAX; | 860 | cinergyt2->rc_input_event = KEY_MAX; |
861 | cinergyt2->rc_last_code = ~0; | ||
844 | 862 | ||
845 | INIT_WORK(&cinergyt2->rc_query_work, cinergyt2_query_rc, cinergyt2); | 863 | INIT_WORK(&cinergyt2->rc_query_work, cinergyt2_query_rc, cinergyt2); |
846 | schedule_delayed_work(&cinergyt2->rc_query_work, HZ/2); | 864 | schedule_delayed_work(&cinergyt2->rc_query_work, HZ/2); |
diff --git a/drivers/media/dvb/dvb-core/demux.h b/drivers/media/dvb/dvb-core/demux.h index fb55eaa5c8e7..9719a3b30f78 100644 --- a/drivers/media/dvb/dvb-core/demux.h +++ b/drivers/media/dvb/dvb-core/demux.h | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/errno.h> | 30 | #include <linux/errno.h> |
31 | #include <linux/list.h> | 31 | #include <linux/list.h> |
32 | #include <linux/time.h> | 32 | #include <linux/time.h> |
33 | #include <linux/dvb/dmx.h> | ||
33 | 34 | ||
34 | /*--------------------------------------------------------------------------*/ | 35 | /*--------------------------------------------------------------------------*/ |
35 | /* Common definitions */ | 36 | /* Common definitions */ |
@@ -124,9 +125,7 @@ struct dmx_ts_feed { | |||
124 | u16 pid, | 125 | u16 pid, |
125 | int type, | 126 | int type, |
126 | enum dmx_ts_pes pes_type, | 127 | enum dmx_ts_pes pes_type, |
127 | size_t callback_length, | ||
128 | size_t circular_buffer_size, | 128 | size_t circular_buffer_size, |
129 | int descramble, | ||
130 | struct timespec timeout); | 129 | struct timespec timeout); |
131 | int (*start_filtering) (struct dmx_ts_feed* feed); | 130 | int (*start_filtering) (struct dmx_ts_feed* feed); |
132 | int (*stop_filtering) (struct dmx_ts_feed* feed); | 131 | int (*stop_filtering) (struct dmx_ts_feed* feed); |
@@ -159,7 +158,6 @@ struct dmx_section_feed { | |||
159 | int (*set) (struct dmx_section_feed* feed, | 158 | int (*set) (struct dmx_section_feed* feed, |
160 | u16 pid, | 159 | u16 pid, |
161 | size_t circular_buffer_size, | 160 | size_t circular_buffer_size, |
162 | int descramble, | ||
163 | int check_crc); | 161 | int check_crc); |
164 | int (*allocate_filter) (struct dmx_section_feed* feed, | 162 | int (*allocate_filter) (struct dmx_section_feed* feed, |
165 | struct dmx_section_filter** filter); | 163 | struct dmx_section_filter** filter); |
@@ -207,7 +205,6 @@ struct dmx_frontend { | |||
207 | struct list_head connectivity_list; /* List of front-ends that can | 205 | struct list_head connectivity_list; /* List of front-ends that can |
208 | be connected to a particular | 206 | be connected to a particular |
209 | demux */ | 207 | demux */ |
210 | void* priv; /* Pointer to private data of the API client */ | ||
211 | enum dmx_frontend_source source; | 208 | enum dmx_frontend_source source; |
212 | }; | 209 | }; |
213 | 210 | ||
@@ -225,8 +222,6 @@ struct dmx_frontend { | |||
225 | #define DMX_MEMORY_BASED_FILTERING 8 /* write() available */ | 222 | #define DMX_MEMORY_BASED_FILTERING 8 /* write() available */ |
226 | #define DMX_CRC_CHECKING 16 | 223 | #define DMX_CRC_CHECKING 16 |
227 | #define DMX_TS_DESCRAMBLING 32 | 224 | #define DMX_TS_DESCRAMBLING 32 |
228 | #define DMX_SECTION_PAYLOAD_DESCRAMBLING 64 | ||
229 | #define DMX_MAC_ADDRESS_DESCRAMBLING 128 | ||
230 | 225 | ||
231 | /* | 226 | /* |
232 | * Demux resource type identifier. | 227 | * Demux resource type identifier. |
@@ -244,9 +239,7 @@ struct dmx_frontend { | |||
244 | struct dmx_demux { | 239 | struct dmx_demux { |
245 | u32 capabilities; /* Bitfield of capability flags */ | 240 | u32 capabilities; /* Bitfield of capability flags */ |
246 | struct dmx_frontend* frontend; /* Front-end connected to the demux */ | 241 | struct dmx_frontend* frontend; /* Front-end connected to the demux */ |
247 | struct list_head reg_list; /* List of registered demuxes */ | ||
248 | void* priv; /* Pointer to private data of the API client */ | 242 | void* priv; /* Pointer to private data of the API client */ |
249 | int users; /* Number of users */ | ||
250 | int (*open) (struct dmx_demux* demux); | 243 | int (*open) (struct dmx_demux* demux); |
251 | int (*close) (struct dmx_demux* demux); | 244 | int (*close) (struct dmx_demux* demux); |
252 | int (*write) (struct dmx_demux* demux, const char* buf, size_t count); | 245 | int (*write) (struct dmx_demux* demux, const char* buf, size_t count); |
@@ -260,17 +253,6 @@ struct dmx_demux { | |||
260 | dmx_section_cb callback); | 253 | dmx_section_cb callback); |
261 | int (*release_section_feed) (struct dmx_demux* demux, | 254 | int (*release_section_feed) (struct dmx_demux* demux, |
262 | struct dmx_section_feed* feed); | 255 | struct dmx_section_feed* feed); |
263 | int (*descramble_mac_address) (struct dmx_demux* demux, | ||
264 | u8* buffer1, | ||
265 | size_t buffer1_length, | ||
266 | u8* buffer2, | ||
267 | size_t buffer2_length, | ||
268 | u16 pid); | ||
269 | int (*descramble_section_payload) (struct dmx_demux* demux, | ||
270 | u8* buffer1, | ||
271 | size_t buffer1_length, | ||
272 | u8* buffer2, size_t buffer2_length, | ||
273 | u16 pid); | ||
274 | int (*add_frontend) (struct dmx_demux* demux, | 256 | int (*add_frontend) (struct dmx_demux* demux, |
275 | struct dmx_frontend* frontend); | 257 | struct dmx_frontend* frontend); |
276 | int (*remove_frontend) (struct dmx_demux* demux, | 258 | int (*remove_frontend) (struct dmx_demux* demux, |
@@ -282,20 +264,12 @@ struct dmx_demux { | |||
282 | 264 | ||
283 | int (*get_pes_pids) (struct dmx_demux* demux, u16 *pids); | 265 | int (*get_pes_pids) (struct dmx_demux* demux, u16 *pids); |
284 | 266 | ||
267 | int (*get_caps) (struct dmx_demux* demux, struct dmx_caps *caps); | ||
268 | |||
269 | int (*set_source) (struct dmx_demux* demux, const dmx_source_t *src); | ||
270 | |||
285 | int (*get_stc) (struct dmx_demux* demux, unsigned int num, | 271 | int (*get_stc) (struct dmx_demux* demux, unsigned int num, |
286 | u64 *stc, unsigned int *base); | 272 | u64 *stc, unsigned int *base); |
287 | }; | 273 | }; |
288 | 274 | ||
289 | /*--------------------------------------------------------------------------*/ | ||
290 | /* Demux directory */ | ||
291 | /*--------------------------------------------------------------------------*/ | ||
292 | |||
293 | /* | ||
294 | * DMX_DIR_ENTRY(): Casts elements in the list of registered | ||
295 | * demuxes from the generic type struct list_head* to the type struct dmx_demux | ||
296 | *. | ||
297 | */ | ||
298 | |||
299 | #define DMX_DIR_ENTRY(list) list_entry(list, struct dmx_demux, reg_list) | ||
300 | |||
301 | #endif /* #ifndef __DEMUX_H */ | 275 | #endif /* #ifndef __DEMUX_H */ |
diff --git a/drivers/media/dvb/dvb-core/dmxdev.c b/drivers/media/dvb/dvb-core/dmxdev.c index 68050cd527cb..8028c3a5e287 100644 --- a/drivers/media/dvb/dvb-core/dmxdev.c +++ b/drivers/media/dvb/dvb-core/dmxdev.c | |||
@@ -571,7 +571,7 @@ static int dvb_dmxdev_filter_start(struct dmxdev_filter *filter) | |||
571 | return ret; | 571 | return ret; |
572 | } | 572 | } |
573 | 573 | ||
574 | ret=(*secfeed)->set(*secfeed, para->pid, 32768, 0, | 574 | ret=(*secfeed)->set(*secfeed, para->pid, 32768, |
575 | (para->flags & DMX_CHECK_CRC) ? 1 : 0); | 575 | (para->flags & DMX_CHECK_CRC) ? 1 : 0); |
576 | 576 | ||
577 | if (ret<0) { | 577 | if (ret<0) { |
@@ -654,7 +654,7 @@ static int dvb_dmxdev_filter_start(struct dmxdev_filter *filter) | |||
654 | (*tsfeed)->priv = (void *) filter; | 654 | (*tsfeed)->priv = (void *) filter; |
655 | 655 | ||
656 | ret = (*tsfeed)->set(*tsfeed, para->pid, ts_type, ts_pes, | 656 | ret = (*tsfeed)->set(*tsfeed, para->pid, ts_type, ts_pes, |
657 | 188, 32768, 0, timeout); | 657 | 32768, timeout); |
658 | 658 | ||
659 | if (ret < 0) { | 659 | if (ret < 0) { |
660 | dmxdev->demux->release_ts_feed(dmxdev->demux, *tsfeed); | 660 | dmxdev->demux->release_ts_feed(dmxdev->demux, *tsfeed); |
@@ -929,6 +929,22 @@ static int dvb_demux_do_ioctl(struct inode *inode, struct file *file, | |||
929 | dmxdev->demux->get_pes_pids(dmxdev->demux, (u16 *)parg); | 929 | dmxdev->demux->get_pes_pids(dmxdev->demux, (u16 *)parg); |
930 | break; | 930 | break; |
931 | 931 | ||
932 | case DMX_GET_CAPS: | ||
933 | if (!dmxdev->demux->get_caps) { | ||
934 | ret = -EINVAL; | ||
935 | break; | ||
936 | } | ||
937 | ret = dmxdev->demux->get_caps(dmxdev->demux, parg); | ||
938 | break; | ||
939 | |||
940 | case DMX_SET_SOURCE: | ||
941 | if (!dmxdev->demux->set_source) { | ||
942 | ret = -EINVAL; | ||
943 | break; | ||
944 | } | ||
945 | ret = dmxdev->demux->set_source(dmxdev->demux, parg); | ||
946 | break; | ||
947 | |||
932 | case DMX_GET_STC: | 948 | case DMX_GET_STC: |
933 | if (!dmxdev->demux->get_stc) { | 949 | if (!dmxdev->demux->get_stc) { |
934 | ret=-EINVAL; | 950 | ret=-EINVAL; |
diff --git a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c index 0eb9aa711fb0..88757e2634e5 100644 --- a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c +++ b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c | |||
@@ -47,7 +47,7 @@ MODULE_PARM_DESC(cam_debug, "enable verbose debug messages"); | |||
47 | 47 | ||
48 | #define dprintk if (dvb_ca_en50221_debug) printk | 48 | #define dprintk if (dvb_ca_en50221_debug) printk |
49 | 49 | ||
50 | #define INIT_TIMEOUT_SECS 5 | 50 | #define INIT_TIMEOUT_SECS 10 |
51 | 51 | ||
52 | #define HOST_LINK_BUF_SIZE 0x200 | 52 | #define HOST_LINK_BUF_SIZE 0x200 |
53 | 53 | ||
diff --git a/drivers/media/dvb/dvb-core/dvb_demux.c b/drivers/media/dvb/dvb-core/dvb_demux.c index ac9889d22288..dc476dda2b71 100644 --- a/drivers/media/dvb/dvb-core/dvb_demux.c +++ b/drivers/media/dvb/dvb-core/dvb_demux.c | |||
@@ -38,82 +38,52 @@ | |||
38 | */ | 38 | */ |
39 | // #define DVB_DEMUX_SECTION_LOSS_LOG | 39 | // #define DVB_DEMUX_SECTION_LOSS_LOG |
40 | 40 | ||
41 | |||
42 | static LIST_HEAD(dmx_muxs); | ||
43 | |||
44 | |||
45 | static int dmx_register_demux(struct dmx_demux *demux) | ||
46 | { | ||
47 | demux->users = 0; | ||
48 | list_add(&demux->reg_list, &dmx_muxs); | ||
49 | return 0; | ||
50 | } | ||
51 | |||
52 | static int dmx_unregister_demux(struct dmx_demux* demux) | ||
53 | { | ||
54 | struct list_head *pos, *n, *head=&dmx_muxs; | ||
55 | |||
56 | list_for_each_safe (pos, n, head) { | ||
57 | if (DMX_DIR_ENTRY(pos) == demux) { | ||
58 | if (demux->users>0) | ||
59 | return -EINVAL; | ||
60 | list_del(pos); | ||
61 | return 0; | ||
62 | } | ||
63 | } | ||
64 | |||
65 | return -ENODEV; | ||
66 | } | ||
67 | |||
68 | |||
69 | /****************************************************************************** | 41 | /****************************************************************************** |
70 | * static inlined helper functions | 42 | * static inlined helper functions |
71 | ******************************************************************************/ | 43 | ******************************************************************************/ |
72 | 44 | ||
73 | |||
74 | static inline u16 section_length(const u8 *buf) | 45 | static inline u16 section_length(const u8 *buf) |
75 | { | 46 | { |
76 | return 3+((buf[1]&0x0f)<<8)+buf[2]; | 47 | return 3 + ((buf[1] & 0x0f) << 8) + buf[2]; |
77 | } | 48 | } |
78 | 49 | ||
79 | |||
80 | static inline u16 ts_pid(const u8 *buf) | 50 | static inline u16 ts_pid(const u8 *buf) |
81 | { | 51 | { |
82 | return ((buf[1]&0x1f)<<8)+buf[2]; | 52 | return ((buf[1] & 0x1f) << 8) + buf[2]; |
83 | } | 53 | } |
84 | 54 | ||
85 | |||
86 | static inline u8 payload(const u8 *tsp) | 55 | static inline u8 payload(const u8 *tsp) |
87 | { | 56 | { |
88 | if (!(tsp[3] & 0x10)) // no payload? | 57 | if (!(tsp[3] & 0x10)) // no payload? |
89 | return 0; | 58 | return 0; |
90 | if (tsp[3] & 0x20) { // adaptation field? | 59 | |
91 | if (tsp[4] > 183) // corrupted data? | 60 | if (tsp[3] & 0x20) { // adaptation field? |
61 | if (tsp[4] > 183) // corrupted data? | ||
92 | return 0; | 62 | return 0; |
93 | else | 63 | else |
94 | return 184-1-tsp[4]; | 64 | return 184 - 1 - tsp[4]; |
95 | } | 65 | } |
66 | |||
96 | return 184; | 67 | return 184; |
97 | } | 68 | } |
98 | 69 | ||
99 | 70 | static u32 dvb_dmx_crc32(struct dvb_demux_feed *f, const u8 *src, size_t len) | |
100 | static u32 dvb_dmx_crc32 (struct dvb_demux_feed *f, const u8 *src, size_t len) | ||
101 | { | 71 | { |
102 | return (f->feed.sec.crc_val = crc32_be (f->feed.sec.crc_val, src, len)); | 72 | return (f->feed.sec.crc_val = crc32_be(f->feed.sec.crc_val, src, len)); |
103 | } | 73 | } |
104 | 74 | ||
105 | 75 | static void dvb_dmx_memcopy(struct dvb_demux_feed *f, u8 *d, const u8 *s, | |
106 | static void dvb_dmx_memcopy (struct dvb_demux_feed *f, u8 *d, const u8 *s, size_t len) | 76 | size_t len) |
107 | { | 77 | { |
108 | memcpy (d, s, len); | 78 | memcpy(d, s, len); |
109 | } | 79 | } |
110 | 80 | ||
111 | |||
112 | /****************************************************************************** | 81 | /****************************************************************************** |
113 | * Software filter functions | 82 | * Software filter functions |
114 | ******************************************************************************/ | 83 | ******************************************************************************/ |
115 | 84 | ||
116 | static inline int dvb_dmx_swfilter_payload (struct dvb_demux_feed *feed, const u8 *buf) | 85 | static inline int dvb_dmx_swfilter_payload(struct dvb_demux_feed *feed, |
86 | const u8 *buf) | ||
117 | { | 87 | { |
118 | int count = payload(buf); | 88 | int count = payload(buf); |
119 | int p; | 89 | int p; |
@@ -123,32 +93,31 @@ static inline int dvb_dmx_swfilter_payload (struct dvb_demux_feed *feed, const u | |||
123 | if (count == 0) | 93 | if (count == 0) |
124 | return -1; | 94 | return -1; |
125 | 95 | ||
126 | p = 188-count; | 96 | p = 188 - count; |
127 | 97 | ||
128 | /* | 98 | /* |
129 | cc=buf[3]&0x0f; | 99 | cc = buf[3] & 0x0f; |
130 | ccok=((dvbdmxfeed->cc+1)&0x0f)==cc ? 1 : 0; | 100 | ccok = ((feed->cc + 1) & 0x0f) == cc; |
131 | dvbdmxfeed->cc=cc; | 101 | feed->cc = cc; |
132 | if (!ccok) | 102 | if (!ccok) |
133 | printk("missed packet!\n"); | 103 | printk("missed packet!\n"); |
134 | */ | 104 | */ |
135 | 105 | ||
136 | if (buf[1] & 0x40) // PUSI ? | 106 | if (buf[1] & 0x40) // PUSI ? |
137 | feed->peslen = 0xfffa; | 107 | feed->peslen = 0xfffa; |
138 | 108 | ||
139 | feed->peslen += count; | 109 | feed->peslen += count; |
140 | 110 | ||
141 | return feed->cb.ts (&buf[p], count, NULL, 0, &feed->feed.ts, DMX_OK); | 111 | return feed->cb.ts(&buf[p], count, NULL, 0, &feed->feed.ts, DMX_OK); |
142 | } | 112 | } |
143 | 113 | ||
144 | 114 | static int dvb_dmx_swfilter_sectionfilter(struct dvb_demux_feed *feed, | |
145 | static int dvb_dmx_swfilter_sectionfilter (struct dvb_demux_feed *feed, | 115 | struct dvb_demux_filter *f) |
146 | struct dvb_demux_filter *f) | ||
147 | { | 116 | { |
148 | u8 neq = 0; | 117 | u8 neq = 0; |
149 | int i; | 118 | int i; |
150 | 119 | ||
151 | for (i=0; i<DVB_DEMUX_MASK_MAX; i++) { | 120 | for (i = 0; i < DVB_DEMUX_MASK_MAX; i++) { |
152 | u8 xor = f->filter.filter_value[i] ^ feed->feed.sec.secbuf[i]; | 121 | u8 xor = f->filter.filter_value[i] ^ feed->feed.sec.secbuf[i]; |
153 | 122 | ||
154 | if (f->maskandmode[i] & xor) | 123 | if (f->maskandmode[i] & xor) |
@@ -160,12 +129,11 @@ static int dvb_dmx_swfilter_sectionfilter (struct dvb_demux_feed *feed, | |||
160 | if (f->doneq && !neq) | 129 | if (f->doneq && !neq) |
161 | return 0; | 130 | return 0; |
162 | 131 | ||
163 | return feed->cb.sec (feed->feed.sec.secbuf, feed->feed.sec.seclen, | 132 | return feed->cb.sec(feed->feed.sec.secbuf, feed->feed.sec.seclen, |
164 | NULL, 0, &f->filter, DMX_OK); | 133 | NULL, 0, &f->filter, DMX_OK); |
165 | } | 134 | } |
166 | 135 | ||
167 | 136 | static inline int dvb_dmx_swfilter_section_feed(struct dvb_demux_feed *feed) | |
168 | static inline int dvb_dmx_swfilter_section_feed (struct dvb_demux_feed *feed) | ||
169 | { | 137 | { |
170 | struct dvb_demux *demux = feed->demux; | 138 | struct dvb_demux *demux = feed->demux; |
171 | struct dvb_demux_filter *f = feed->filter; | 139 | struct dvb_demux_filter *f = feed->filter; |
@@ -195,26 +163,24 @@ static inline int dvb_dmx_swfilter_section_feed (struct dvb_demux_feed *feed) | |||
195 | return 0; | 163 | return 0; |
196 | } | 164 | } |
197 | 165 | ||
198 | |||
199 | static void dvb_dmx_swfilter_section_new(struct dvb_demux_feed *feed) | 166 | static void dvb_dmx_swfilter_section_new(struct dvb_demux_feed *feed) |
200 | { | 167 | { |
201 | struct dmx_section_feed *sec = &feed->feed.sec; | 168 | struct dmx_section_feed *sec = &feed->feed.sec; |
202 | 169 | ||
203 | #ifdef DVB_DEMUX_SECTION_LOSS_LOG | 170 | #ifdef DVB_DEMUX_SECTION_LOSS_LOG |
204 | if(sec->secbufp < sec->tsfeedp) | 171 | if (sec->secbufp < sec->tsfeedp) { |
205 | { | ||
206 | int i, n = sec->tsfeedp - sec->secbufp; | 172 | int i, n = sec->tsfeedp - sec->secbufp; |
207 | 173 | ||
208 | /* section padding is done with 0xff bytes entirely. | 174 | /* |
209 | ** due to speed reasons, we won't check all of them | 175 | * Section padding is done with 0xff bytes entirely. |
210 | ** but just first and last | 176 | * Due to speed reasons, we won't check all of them |
211 | */ | 177 | * but just first and last. |
212 | if(sec->secbuf[0] != 0xff || sec->secbuf[n-1] != 0xff) | 178 | */ |
213 | { | 179 | if (sec->secbuf[0] != 0xff || sec->secbuf[n - 1] != 0xff) { |
214 | printk("dvb_demux.c section ts padding loss: %d/%d\n", | 180 | printk("dvb_demux.c section ts padding loss: %d/%d\n", |
215 | n, sec->tsfeedp); | 181 | n, sec->tsfeedp); |
216 | printk("dvb_demux.c pad data:"); | 182 | printk("dvb_demux.c pad data:"); |
217 | for(i = 0; i < n; i++) | 183 | for (i = 0; i < n; i++) |
218 | printk(" %02x", sec->secbuf[i]); | 184 | printk(" %02x", sec->secbuf[i]); |
219 | printk("\n"); | 185 | printk("\n"); |
220 | } | 186 | } |
@@ -226,82 +192,81 @@ static void dvb_dmx_swfilter_section_new(struct dvb_demux_feed *feed) | |||
226 | } | 192 | } |
227 | 193 | ||
228 | /* | 194 | /* |
229 | ** Losless Section Demux 1.4.1 by Emard | 195 | * Losless Section Demux 1.4.1 by Emard |
230 | ** Valsecchi Patrick: | 196 | * Valsecchi Patrick: |
231 | ** - middle of section A (no PUSI) | 197 | * - middle of section A (no PUSI) |
232 | ** - end of section A and start of section B | 198 | * - end of section A and start of section B |
233 | ** (with PUSI pointing to the start of the second section) | 199 | * (with PUSI pointing to the start of the second section) |
234 | ** | 200 | * |
235 | ** In this case, without feed->pusi_seen you'll receive a garbage section | 201 | * In this case, without feed->pusi_seen you'll receive a garbage section |
236 | ** consisting of the end of section A. Basically because tsfeedp | 202 | * consisting of the end of section A. Basically because tsfeedp |
237 | ** is incemented and the use=0 condition is not raised | 203 | * is incemented and the use=0 condition is not raised |
238 | ** when the second packet arrives. | 204 | * when the second packet arrives. |
239 | ** | 205 | * |
240 | ** Fix: | 206 | * Fix: |
241 | ** when demux is started, let feed->pusi_seen = 0 to | 207 | * when demux is started, let feed->pusi_seen = 0 to |
242 | ** prevent initial feeding of garbage from the end of | 208 | * prevent initial feeding of garbage from the end of |
243 | ** previous section. When you for the first time see PUSI=1 | 209 | * previous section. When you for the first time see PUSI=1 |
244 | ** then set feed->pusi_seen = 1 | 210 | * then set feed->pusi_seen = 1 |
245 | */ | 211 | */ |
246 | static int dvb_dmx_swfilter_section_copy_dump(struct dvb_demux_feed *feed, const u8 *buf, u8 len) | 212 | static int dvb_dmx_swfilter_section_copy_dump(struct dvb_demux_feed *feed, |
213 | const u8 *buf, u8 len) | ||
247 | { | 214 | { |
248 | struct dvb_demux *demux = feed->demux; | 215 | struct dvb_demux *demux = feed->demux; |
249 | struct dmx_section_feed *sec = &feed->feed.sec; | 216 | struct dmx_section_feed *sec = &feed->feed.sec; |
250 | u16 limit, seclen, n; | 217 | u16 limit, seclen, n; |
251 | 218 | ||
252 | if(sec->tsfeedp >= DMX_MAX_SECFEED_SIZE) | 219 | if (sec->tsfeedp >= DMX_MAX_SECFEED_SIZE) |
253 | return 0; | 220 | return 0; |
254 | 221 | ||
255 | if(sec->tsfeedp + len > DMX_MAX_SECFEED_SIZE) | 222 | if (sec->tsfeedp + len > DMX_MAX_SECFEED_SIZE) { |
256 | { | ||
257 | #ifdef DVB_DEMUX_SECTION_LOSS_LOG | 223 | #ifdef DVB_DEMUX_SECTION_LOSS_LOG |
258 | printk("dvb_demux.c section buffer full loss: %d/%d\n", | 224 | printk("dvb_demux.c section buffer full loss: %d/%d\n", |
259 | sec->tsfeedp + len - DMX_MAX_SECFEED_SIZE, DMX_MAX_SECFEED_SIZE); | 225 | sec->tsfeedp + len - DMX_MAX_SECFEED_SIZE, |
226 | DMX_MAX_SECFEED_SIZE); | ||
260 | #endif | 227 | #endif |
261 | len = DMX_MAX_SECFEED_SIZE - sec->tsfeedp; | 228 | len = DMX_MAX_SECFEED_SIZE - sec->tsfeedp; |
262 | } | 229 | } |
263 | 230 | ||
264 | if(len <= 0) | 231 | if (len <= 0) |
265 | return 0; | 232 | return 0; |
266 | 233 | ||
267 | demux->memcopy(feed, sec->secbuf_base + sec->tsfeedp, buf, len); | 234 | demux->memcopy(feed, sec->secbuf_base + sec->tsfeedp, buf, len); |
268 | sec->tsfeedp += len; | 235 | sec->tsfeedp += len; |
269 | 236 | ||
270 | /* ----------------------------------------------------- | 237 | /* |
271 | ** Dump all the sections we can find in the data (Emard) | 238 | * Dump all the sections we can find in the data (Emard) |
272 | */ | 239 | */ |
273 | |||
274 | limit = sec->tsfeedp; | 240 | limit = sec->tsfeedp; |
275 | if(limit > DMX_MAX_SECFEED_SIZE) | 241 | if (limit > DMX_MAX_SECFEED_SIZE) |
276 | return -1; /* internal error should never happen */ | 242 | return -1; /* internal error should never happen */ |
277 | 243 | ||
278 | /* to be sure always set secbuf */ | 244 | /* to be sure always set secbuf */ |
279 | sec->secbuf = sec->secbuf_base + sec->secbufp; | 245 | sec->secbuf = sec->secbuf_base + sec->secbufp; |
280 | 246 | ||
281 | for(n = 0; sec->secbufp + 2 < limit; n++) | 247 | for (n = 0; sec->secbufp + 2 < limit; n++) { |
282 | { | ||
283 | seclen = section_length(sec->secbuf); | 248 | seclen = section_length(sec->secbuf); |
284 | if(seclen <= 0 || seclen > DMX_MAX_SECFEED_SIZE | 249 | if (seclen <= 0 || seclen > DMX_MAX_SECFEED_SIZE |
285 | || seclen + sec->secbufp > limit) | 250 | || seclen + sec->secbufp > limit) |
286 | return 0; | 251 | return 0; |
287 | sec->seclen = seclen; | 252 | sec->seclen = seclen; |
288 | sec->crc_val = ~0; | 253 | sec->crc_val = ~0; |
289 | /* dump [secbuf .. secbuf+seclen) */ | 254 | /* dump [secbuf .. secbuf+seclen) */ |
290 | if(feed->pusi_seen) | 255 | if (feed->pusi_seen) |
291 | dvb_dmx_swfilter_section_feed(feed); | 256 | dvb_dmx_swfilter_section_feed(feed); |
292 | #ifdef DVB_DEMUX_SECTION_LOSS_LOG | 257 | #ifdef DVB_DEMUX_SECTION_LOSS_LOG |
293 | else | 258 | else |
294 | printk("dvb_demux.c pusi not seen, discarding section data\n"); | 259 | printk("dvb_demux.c pusi not seen, discarding section data\n"); |
295 | #endif | 260 | #endif |
296 | sec->secbufp += seclen; /* secbufp and secbuf moving together is */ | 261 | sec->secbufp += seclen; /* secbufp and secbuf moving together is */ |
297 | sec->secbuf += seclen; /* redundand but saves pointer arithmetic */ | 262 | sec->secbuf += seclen; /* redundant but saves pointer arithmetic */ |
298 | } | 263 | } |
299 | 264 | ||
300 | return 0; | 265 | return 0; |
301 | } | 266 | } |
302 | 267 | ||
303 | 268 | static int dvb_dmx_swfilter_section_packet(struct dvb_demux_feed *feed, | |
304 | static int dvb_dmx_swfilter_section_packet(struct dvb_demux_feed *feed, const u8 *buf) | 269 | const u8 *buf) |
305 | { | 270 | { |
306 | u8 p, count; | 271 | u8 p, count; |
307 | int ccok, dc_i = 0; | 272 | int ccok, dc_i = 0; |
@@ -309,10 +274,10 @@ static int dvb_dmx_swfilter_section_packet(struct dvb_demux_feed *feed, const u8 | |||
309 | 274 | ||
310 | count = payload(buf); | 275 | count = payload(buf); |
311 | 276 | ||
312 | if (count == 0) /* count == 0 if no payload or out of range */ | 277 | if (count == 0) /* count == 0 if no payload or out of range */ |
313 | return -1; | 278 | return -1; |
314 | 279 | ||
315 | p = 188 - count; /* payload start */ | 280 | p = 188 - count; /* payload start */ |
316 | 281 | ||
317 | cc = buf[3] & 0x0f; | 282 | cc = buf[3] & 0x0f; |
318 | ccok = ((feed->cc + 1) & 0x0f) == cc; | 283 | ccok = ((feed->cc + 1) & 0x0f) == cc; |
@@ -326,52 +291,53 @@ static int dvb_dmx_swfilter_section_packet(struct dvb_demux_feed *feed, const u8 | |||
326 | 291 | ||
327 | if (!ccok || dc_i) { | 292 | if (!ccok || dc_i) { |
328 | #ifdef DVB_DEMUX_SECTION_LOSS_LOG | 293 | #ifdef DVB_DEMUX_SECTION_LOSS_LOG |
329 | printk("dvb_demux.c discontinuity detected %d bytes lost\n", count); | 294 | printk("dvb_demux.c discontinuity detected %d bytes lost\n", |
330 | /* those bytes under sume circumstances will again be reported | 295 | count); |
331 | ** in the following dvb_dmx_swfilter_section_new | 296 | /* |
332 | */ | 297 | * those bytes under sume circumstances will again be reported |
298 | * in the following dvb_dmx_swfilter_section_new | ||
299 | */ | ||
333 | #endif | 300 | #endif |
334 | /* Discontinuity detected. Reset pusi_seen = 0 to | 301 | /* |
335 | ** stop feeding of suspicious data until next PUSI=1 arrives | 302 | * Discontinuity detected. Reset pusi_seen = 0 to |
336 | */ | 303 | * stop feeding of suspicious data until next PUSI=1 arrives |
304 | */ | ||
337 | feed->pusi_seen = 0; | 305 | feed->pusi_seen = 0; |
338 | dvb_dmx_swfilter_section_new(feed); | 306 | dvb_dmx_swfilter_section_new(feed); |
339 | return 0; | ||
340 | } | 307 | } |
341 | 308 | ||
342 | if (buf[1] & 0x40) { | 309 | if (buf[1] & 0x40) { |
343 | // PUSI=1 (is set), section boundary is here | 310 | /* PUSI=1 (is set), section boundary is here */ |
344 | if (count > 1 && buf[p] < count) { | 311 | if (count > 1 && buf[p] < count) { |
345 | const u8 *before = buf+p+1; | 312 | const u8 *before = &buf[p + 1]; |
346 | u8 before_len = buf[p]; | 313 | u8 before_len = buf[p]; |
347 | const u8 *after = before+before_len; | 314 | const u8 *after = &before[before_len]; |
348 | u8 after_len = count-1-before_len; | 315 | u8 after_len = count - 1 - before_len; |
349 | 316 | ||
350 | dvb_dmx_swfilter_section_copy_dump(feed, before, before_len); | 317 | dvb_dmx_swfilter_section_copy_dump(feed, before, |
318 | before_len); | ||
351 | /* before start of new section, set pusi_seen = 1 */ | 319 | /* before start of new section, set pusi_seen = 1 */ |
352 | feed->pusi_seen = 1; | 320 | feed->pusi_seen = 1; |
353 | dvb_dmx_swfilter_section_new(feed); | 321 | dvb_dmx_swfilter_section_new(feed); |
354 | dvb_dmx_swfilter_section_copy_dump(feed, after, after_len); | 322 | dvb_dmx_swfilter_section_copy_dump(feed, after, |
323 | after_len); | ||
355 | } | 324 | } |
356 | #ifdef DVB_DEMUX_SECTION_LOSS_LOG | 325 | #ifdef DVB_DEMUX_SECTION_LOSS_LOG |
357 | else | 326 | else if (count > 0) |
358 | if (count > 0) | 327 | printk("dvb_demux.c PUSI=1 but %d bytes lost\n", count); |
359 | printk("dvb_demux.c PUSI=1 but %d bytes lost\n", count); | ||
360 | #endif | 328 | #endif |
361 | } else { | 329 | } else { |
362 | // PUSI=0 (is not set), no section boundary | 330 | /* PUSI=0 (is not set), no section boundary */ |
363 | const u8 *entire = buf+p; | 331 | dvb_dmx_swfilter_section_copy_dump(feed, &buf[p], count); |
364 | u8 entire_len = count; | ||
365 | |||
366 | dvb_dmx_swfilter_section_copy_dump(feed, entire, entire_len); | ||
367 | } | 332 | } |
333 | |||
368 | return 0; | 334 | return 0; |
369 | } | 335 | } |
370 | 336 | ||
371 | 337 | static inline void dvb_dmx_swfilter_packet_type(struct dvb_demux_feed *feed, | |
372 | static inline void dvb_dmx_swfilter_packet_type(struct dvb_demux_feed *feed, const u8 *buf) | 338 | const u8 *buf) |
373 | { | 339 | { |
374 | switch(feed->type) { | 340 | switch (feed->type) { |
375 | case DMX_TYPE_TS: | 341 | case DMX_TYPE_TS: |
376 | if (!feed->feed.ts.is_filtering) | 342 | if (!feed->feed.ts.is_filtering) |
377 | break; | 343 | break; |
@@ -379,7 +345,8 @@ static inline void dvb_dmx_swfilter_packet_type(struct dvb_demux_feed *feed, con | |||
379 | if (feed->ts_type & TS_PAYLOAD_ONLY) | 345 | if (feed->ts_type & TS_PAYLOAD_ONLY) |
380 | dvb_dmx_swfilter_payload(feed, buf); | 346 | dvb_dmx_swfilter_payload(feed, buf); |
381 | else | 347 | else |
382 | feed->cb.ts(buf, 188, NULL, 0, &feed->feed.ts, DMX_OK); | 348 | feed->cb.ts(buf, 188, NULL, 0, &feed->feed.ts, |
349 | DMX_OK); | ||
383 | } | 350 | } |
384 | if (feed->ts_type & TS_DECODER) | 351 | if (feed->ts_type & TS_DECODER) |
385 | if (feed->demux->write_to_decoder) | 352 | if (feed->demux->write_to_decoder) |
@@ -390,7 +357,7 @@ static inline void dvb_dmx_swfilter_packet_type(struct dvb_demux_feed *feed, con | |||
390 | if (!feed->feed.sec.is_filtering) | 357 | if (!feed->feed.sec.is_filtering) |
391 | break; | 358 | break; |
392 | if (dvb_dmx_swfilter_section_packet(feed, buf) < 0) | 359 | if (dvb_dmx_swfilter_section_packet(feed, buf) < 0) |
393 | feed->feed.sec.seclen = feed->feed.sec.secbufp=0; | 360 | feed->feed.sec.seclen = feed->feed.sec.secbufp = 0; |
394 | break; | 361 | break; |
395 | 362 | ||
396 | default: | 363 | default: |
@@ -406,7 +373,7 @@ static inline void dvb_dmx_swfilter_packet_type(struct dvb_demux_feed *feed, con | |||
406 | static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf) | 373 | static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf) |
407 | { | 374 | { |
408 | struct dvb_demux_feed *feed; | 375 | struct dvb_demux_feed *feed; |
409 | struct list_head *pos, *head=&demux->feed_list; | 376 | struct list_head *pos, *head = &demux->feed_list; |
410 | u16 pid = ts_pid(buf); | 377 | u16 pid = ts_pid(buf); |
411 | int dvr_done = 0; | 378 | int dvr_done = 0; |
412 | 379 | ||
@@ -432,21 +399,21 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf) | |||
432 | } | 399 | } |
433 | } | 400 | } |
434 | 401 | ||
435 | void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf, size_t count) | 402 | void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf, |
403 | size_t count) | ||
436 | { | 404 | { |
437 | spin_lock(&demux->lock); | 405 | spin_lock(&demux->lock); |
438 | 406 | ||
439 | while (count--) { | 407 | while (count--) { |
440 | if(buf[0] == 0x47) { | 408 | if (buf[0] == 0x47) |
441 | dvb_dmx_swfilter_packet(demux, buf); | 409 | dvb_dmx_swfilter_packet(demux, buf); |
442 | } | ||
443 | buf += 188; | 410 | buf += 188; |
444 | } | 411 | } |
445 | 412 | ||
446 | spin_unlock(&demux->lock); | 413 | spin_unlock(&demux->lock); |
447 | } | 414 | } |
448 | EXPORT_SYMBOL(dvb_dmx_swfilter_packets); | ||
449 | 415 | ||
416 | EXPORT_SYMBOL(dvb_dmx_swfilter_packets); | ||
450 | 417 | ||
451 | void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count) | 418 | void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count) |
452 | { | 419 | { |
@@ -454,8 +421,10 @@ void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count) | |||
454 | 421 | ||
455 | spin_lock(&demux->lock); | 422 | spin_lock(&demux->lock); |
456 | 423 | ||
457 | if ((i = demux->tsbufp)) { | 424 | if (demux->tsbufp) { |
458 | if (count < (j=188-i)) { | 425 | i = demux->tsbufp; |
426 | j = 188 - i; | ||
427 | if (count < j) { | ||
459 | memcpy(&demux->tsbuf[i], buf, count); | 428 | memcpy(&demux->tsbuf[i], buf, count); |
460 | demux->tsbufp += count; | 429 | demux->tsbufp += count; |
461 | goto bailout; | 430 | goto bailout; |
@@ -469,13 +438,13 @@ void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count) | |||
469 | 438 | ||
470 | while (p < count) { | 439 | while (p < count) { |
471 | if (buf[p] == 0x47) { | 440 | if (buf[p] == 0x47) { |
472 | if (count-p >= 188) { | 441 | if (count - p >= 188) { |
473 | dvb_dmx_swfilter_packet(demux, buf+p); | 442 | dvb_dmx_swfilter_packet(demux, &buf[p]); |
474 | p += 188; | 443 | p += 188; |
475 | } else { | 444 | } else { |
476 | i = count-p; | 445 | i = count - p; |
477 | memcpy(demux->tsbuf, buf+p, i); | 446 | memcpy(demux->tsbuf, &buf[p], i); |
478 | demux->tsbufp=i; | 447 | demux->tsbufp = i; |
479 | goto bailout; | 448 | goto bailout; |
480 | } | 449 | } |
481 | } else | 450 | } else |
@@ -485,24 +454,29 @@ void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count) | |||
485 | bailout: | 454 | bailout: |
486 | spin_unlock(&demux->lock); | 455 | spin_unlock(&demux->lock); |
487 | } | 456 | } |
457 | |||
488 | EXPORT_SYMBOL(dvb_dmx_swfilter); | 458 | EXPORT_SYMBOL(dvb_dmx_swfilter); |
489 | 459 | ||
490 | void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, size_t count) | 460 | void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, size_t count) |
491 | { | 461 | { |
492 | int p = 0,i, j; | 462 | int p = 0, i, j; |
493 | u8 tmppack[188]; | 463 | u8 tmppack[188]; |
464 | |||
494 | spin_lock(&demux->lock); | 465 | spin_lock(&demux->lock); |
495 | 466 | ||
496 | if ((i = demux->tsbufp)) { | 467 | if (demux->tsbufp) { |
497 | if (count < (j=204-i)) { | 468 | i = demux->tsbufp; |
469 | j = 204 - i; | ||
470 | if (count < j) { | ||
498 | memcpy(&demux->tsbuf[i], buf, count); | 471 | memcpy(&demux->tsbuf[i], buf, count); |
499 | demux->tsbufp += count; | 472 | demux->tsbufp += count; |
500 | goto bailout; | 473 | goto bailout; |
501 | } | 474 | } |
502 | memcpy(&demux->tsbuf[i], buf, j); | 475 | memcpy(&demux->tsbuf[i], buf, j); |
503 | if ((demux->tsbuf[0] == 0x47)|(demux->tsbuf[0]==0xB8)) { | 476 | if ((demux->tsbuf[0] == 0x47) | (demux->tsbuf[0] == 0xB8)) { |
504 | memcpy(tmppack, demux->tsbuf, 188); | 477 | memcpy(tmppack, demux->tsbuf, 188); |
505 | if (tmppack[0] == 0xB8) tmppack[0] = 0x47; | 478 | if (tmppack[0] == 0xB8) |
479 | tmppack[0] = 0x47; | ||
506 | dvb_dmx_swfilter_packet(demux, tmppack); | 480 | dvb_dmx_swfilter_packet(demux, tmppack); |
507 | } | 481 | } |
508 | demux->tsbufp = 0; | 482 | demux->tsbufp = 0; |
@@ -510,16 +484,17 @@ void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, size_t count) | |||
510 | } | 484 | } |
511 | 485 | ||
512 | while (p < count) { | 486 | while (p < count) { |
513 | if ((buf[p] == 0x47)|(buf[p] == 0xB8)) { | 487 | if ((buf[p] == 0x47) | (buf[p] == 0xB8)) { |
514 | if (count-p >= 204) { | 488 | if (count - p >= 204) { |
515 | memcpy(tmppack, buf+p, 188); | 489 | memcpy(tmppack, &buf[p], 188); |
516 | if (tmppack[0] == 0xB8) tmppack[0] = 0x47; | 490 | if (tmppack[0] == 0xB8) |
491 | tmppack[0] = 0x47; | ||
517 | dvb_dmx_swfilter_packet(demux, tmppack); | 492 | dvb_dmx_swfilter_packet(demux, tmppack); |
518 | p += 204; | 493 | p += 204; |
519 | } else { | 494 | } else { |
520 | i = count-p; | 495 | i = count - p; |
521 | memcpy(demux->tsbuf, buf+p, i); | 496 | memcpy(demux->tsbuf, &buf[p], i); |
522 | demux->tsbufp=i; | 497 | demux->tsbufp = i; |
523 | goto bailout; | 498 | goto bailout; |
524 | } | 499 | } |
525 | } else { | 500 | } else { |
@@ -530,14 +505,14 @@ void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, size_t count) | |||
530 | bailout: | 505 | bailout: |
531 | spin_unlock(&demux->lock); | 506 | spin_unlock(&demux->lock); |
532 | } | 507 | } |
533 | EXPORT_SYMBOL(dvb_dmx_swfilter_204); | ||
534 | 508 | ||
509 | EXPORT_SYMBOL(dvb_dmx_swfilter_204); | ||
535 | 510 | ||
536 | static struct dvb_demux_filter * dvb_dmx_filter_alloc(struct dvb_demux *demux) | 511 | static struct dvb_demux_filter *dvb_dmx_filter_alloc(struct dvb_demux *demux) |
537 | { | 512 | { |
538 | int i; | 513 | int i; |
539 | 514 | ||
540 | for (i=0; i<demux->filternum; i++) | 515 | for (i = 0; i < demux->filternum; i++) |
541 | if (demux->filter[i].state == DMX_STATE_FREE) | 516 | if (demux->filter[i].state == DMX_STATE_FREE) |
542 | break; | 517 | break; |
543 | 518 | ||
@@ -549,11 +524,11 @@ static struct dvb_demux_filter * dvb_dmx_filter_alloc(struct dvb_demux *demux) | |||
549 | return &demux->filter[i]; | 524 | return &demux->filter[i]; |
550 | } | 525 | } |
551 | 526 | ||
552 | static struct dvb_demux_feed * dvb_dmx_feed_alloc(struct dvb_demux *demux) | 527 | static struct dvb_demux_feed *dvb_dmx_feed_alloc(struct dvb_demux *demux) |
553 | { | 528 | { |
554 | int i; | 529 | int i; |
555 | 530 | ||
556 | for (i=0; i<demux->feednum; i++) | 531 | for (i = 0; i < demux->feednum; i++) |
557 | if (demux->feed[i].state == DMX_STATE_FREE) | 532 | if (demux->feed[i].state == DMX_STATE_FREE) |
558 | break; | 533 | break; |
559 | 534 | ||
@@ -581,7 +556,7 @@ static void dvb_demux_feed_add(struct dvb_demux_feed *feed) | |||
581 | spin_lock_irq(&feed->demux->lock); | 556 | spin_lock_irq(&feed->demux->lock); |
582 | if (dvb_demux_feed_find(feed)) { | 557 | if (dvb_demux_feed_find(feed)) { |
583 | printk(KERN_ERR "%s: feed already in list (type=%x state=%x pid=%x)\n", | 558 | printk(KERN_ERR "%s: feed already in list (type=%x state=%x pid=%x)\n", |
584 | __FUNCTION__, feed->type, feed->state, feed->pid); | 559 | __FUNCTION__, feed->type, feed->state, feed->pid); |
585 | goto out; | 560 | goto out; |
586 | } | 561 | } |
587 | 562 | ||
@@ -595,7 +570,7 @@ static void dvb_demux_feed_del(struct dvb_demux_feed *feed) | |||
595 | spin_lock_irq(&feed->demux->lock); | 570 | spin_lock_irq(&feed->demux->lock); |
596 | if (!(dvb_demux_feed_find(feed))) { | 571 | if (!(dvb_demux_feed_find(feed))) { |
597 | printk(KERN_ERR "%s: feed not in list (type=%x state=%x pid=%x)\n", | 572 | printk(KERN_ERR "%s: feed not in list (type=%x state=%x pid=%x)\n", |
598 | __FUNCTION__, feed->type, feed->state, feed->pid); | 573 | __FUNCTION__, feed->type, feed->state, feed->pid); |
599 | goto out; | 574 | goto out; |
600 | } | 575 | } |
601 | 576 | ||
@@ -604,18 +579,17 @@ out: | |||
604 | spin_unlock_irq(&feed->demux->lock); | 579 | spin_unlock_irq(&feed->demux->lock); |
605 | } | 580 | } |
606 | 581 | ||
607 | static int dmx_ts_feed_set (struct dmx_ts_feed* ts_feed, u16 pid, int ts_type, | 582 | static int dmx_ts_feed_set(struct dmx_ts_feed *ts_feed, u16 pid, int ts_type, |
608 | enum dmx_ts_pes pes_type, size_t callback_length, | 583 | enum dmx_ts_pes pes_type, |
609 | size_t circular_buffer_size, int descramble, | 584 | size_t circular_buffer_size, struct timespec timeout) |
610 | struct timespec timeout) | ||
611 | { | 585 | { |
612 | struct dvb_demux_feed *feed = (struct dvb_demux_feed *) ts_feed; | 586 | struct dvb_demux_feed *feed = (struct dvb_demux_feed *)ts_feed; |
613 | struct dvb_demux *demux = feed->demux; | 587 | struct dvb_demux *demux = feed->demux; |
614 | 588 | ||
615 | if (pid > DMX_MAX_PID) | 589 | if (pid > DMX_MAX_PID) |
616 | return -EINVAL; | 590 | return -EINVAL; |
617 | 591 | ||
618 | if (down_interruptible (&demux->mutex)) | 592 | if (down_interruptible(&demux->mutex)) |
619 | return -ERESTARTSYS; | 593 | return -ERESTARTSYS; |
620 | 594 | ||
621 | if (ts_type & TS_DECODER) { | 595 | if (ts_type & TS_DECODER) { |
@@ -638,20 +612,13 @@ static int dmx_ts_feed_set (struct dmx_ts_feed* ts_feed, u16 pid, int ts_type, | |||
638 | 612 | ||
639 | feed->pid = pid; | 613 | feed->pid = pid; |
640 | feed->buffer_size = circular_buffer_size; | 614 | feed->buffer_size = circular_buffer_size; |
641 | feed->descramble = descramble; | ||
642 | feed->timeout = timeout; | 615 | feed->timeout = timeout; |
643 | feed->cb_length = callback_length; | ||
644 | feed->ts_type = ts_type; | 616 | feed->ts_type = ts_type; |
645 | feed->pes_type = pes_type; | 617 | feed->pes_type = pes_type; |
646 | 618 | ||
647 | if (feed->descramble) { | ||
648 | up(&demux->mutex); | ||
649 | return -ENOSYS; | ||
650 | } | ||
651 | |||
652 | if (feed->buffer_size) { | 619 | if (feed->buffer_size) { |
653 | #ifdef NOBUFS | 620 | #ifdef NOBUFS |
654 | feed->buffer=NULL; | 621 | feed->buffer = NULL; |
655 | #else | 622 | #else |
656 | feed->buffer = vmalloc(feed->buffer_size); | 623 | feed->buffer = vmalloc(feed->buffer_size); |
657 | if (!feed->buffer) { | 624 | if (!feed->buffer) { |
@@ -667,14 +634,13 @@ static int dmx_ts_feed_set (struct dmx_ts_feed* ts_feed, u16 pid, int ts_type, | |||
667 | return 0; | 634 | return 0; |
668 | } | 635 | } |
669 | 636 | ||
670 | 637 | static int dmx_ts_feed_start_filtering(struct dmx_ts_feed *ts_feed) | |
671 | static int dmx_ts_feed_start_filtering(struct dmx_ts_feed* ts_feed) | ||
672 | { | 638 | { |
673 | struct dvb_demux_feed *feed = (struct dvb_demux_feed *) ts_feed; | 639 | struct dvb_demux_feed *feed = (struct dvb_demux_feed *)ts_feed; |
674 | struct dvb_demux *demux = feed->demux; | 640 | struct dvb_demux *demux = feed->demux; |
675 | int ret; | 641 | int ret; |
676 | 642 | ||
677 | if (down_interruptible (&demux->mutex)) | 643 | if (down_interruptible(&demux->mutex)) |
678 | return -ERESTARTSYS; | 644 | return -ERESTARTSYS; |
679 | 645 | ||
680 | if (feed->state != DMX_STATE_READY || feed->type != DMX_TYPE_TS) { | 646 | if (feed->state != DMX_STATE_READY || feed->type != DMX_TYPE_TS) { |
@@ -701,13 +667,13 @@ static int dmx_ts_feed_start_filtering(struct dmx_ts_feed* ts_feed) | |||
701 | return 0; | 667 | return 0; |
702 | } | 668 | } |
703 | 669 | ||
704 | static int dmx_ts_feed_stop_filtering(struct dmx_ts_feed* ts_feed) | 670 | static int dmx_ts_feed_stop_filtering(struct dmx_ts_feed *ts_feed) |
705 | { | 671 | { |
706 | struct dvb_demux_feed *feed = (struct dvb_demux_feed *) ts_feed; | 672 | struct dvb_demux_feed *feed = (struct dvb_demux_feed *)ts_feed; |
707 | struct dvb_demux *demux = feed->demux; | 673 | struct dvb_demux *demux = feed->demux; |
708 | int ret; | 674 | int ret; |
709 | 675 | ||
710 | if (down_interruptible (&demux->mutex)) | 676 | if (down_interruptible(&demux->mutex)) |
711 | return -ERESTARTSYS; | 677 | return -ERESTARTSYS; |
712 | 678 | ||
713 | if (feed->state < DMX_STATE_GO) { | 679 | if (feed->state < DMX_STATE_GO) { |
@@ -731,13 +697,14 @@ static int dmx_ts_feed_stop_filtering(struct dmx_ts_feed* ts_feed) | |||
731 | return ret; | 697 | return ret; |
732 | } | 698 | } |
733 | 699 | ||
734 | static int dvbdmx_allocate_ts_feed (struct dmx_demux *dmx, struct dmx_ts_feed **ts_feed, | 700 | static int dvbdmx_allocate_ts_feed(struct dmx_demux *dmx, |
735 | dmx_ts_cb callback) | 701 | struct dmx_ts_feed **ts_feed, |
702 | dmx_ts_cb callback) | ||
736 | { | 703 | { |
737 | struct dvb_demux *demux = (struct dvb_demux *) dmx; | 704 | struct dvb_demux *demux = (struct dvb_demux *)dmx; |
738 | struct dvb_demux_feed *feed; | 705 | struct dvb_demux_feed *feed; |
739 | 706 | ||
740 | if (down_interruptible (&demux->mutex)) | 707 | if (down_interruptible(&demux->mutex)) |
741 | return -ERESTARTSYS; | 708 | return -ERESTARTSYS; |
742 | 709 | ||
743 | if (!(feed = dvb_dmx_feed_alloc(demux))) { | 710 | if (!(feed = dvb_dmx_feed_alloc(demux))) { |
@@ -760,7 +727,6 @@ static int dvbdmx_allocate_ts_feed (struct dmx_demux *dmx, struct dmx_ts_feed ** | |||
760 | (*ts_feed)->stop_filtering = dmx_ts_feed_stop_filtering; | 727 | (*ts_feed)->stop_filtering = dmx_ts_feed_stop_filtering; |
761 | (*ts_feed)->set = dmx_ts_feed_set; | 728 | (*ts_feed)->set = dmx_ts_feed_set; |
762 | 729 | ||
763 | |||
764 | if (!(feed->filter = dvb_dmx_filter_alloc(demux))) { | 730 | if (!(feed->filter = dvb_dmx_filter_alloc(demux))) { |
765 | feed->state = DMX_STATE_FREE; | 731 | feed->state = DMX_STATE_FREE; |
766 | up(&demux->mutex); | 732 | up(&demux->mutex); |
@@ -776,22 +742,22 @@ static int dvbdmx_allocate_ts_feed (struct dmx_demux *dmx, struct dmx_ts_feed ** | |||
776 | return 0; | 742 | return 0; |
777 | } | 743 | } |
778 | 744 | ||
779 | static int dvbdmx_release_ts_feed(struct dmx_demux *dmx, struct dmx_ts_feed *ts_feed) | 745 | static int dvbdmx_release_ts_feed(struct dmx_demux *dmx, |
746 | struct dmx_ts_feed *ts_feed) | ||
780 | { | 747 | { |
781 | struct dvb_demux *demux = (struct dvb_demux *) dmx; | 748 | struct dvb_demux *demux = (struct dvb_demux *)dmx; |
782 | struct dvb_demux_feed *feed = (struct dvb_demux_feed *) ts_feed; | 749 | struct dvb_demux_feed *feed = (struct dvb_demux_feed *)ts_feed; |
783 | 750 | ||
784 | if (down_interruptible (&demux->mutex)) | 751 | if (down_interruptible(&demux->mutex)) |
785 | return -ERESTARTSYS; | 752 | return -ERESTARTSYS; |
786 | 753 | ||
787 | if (feed->state == DMX_STATE_FREE) { | 754 | if (feed->state == DMX_STATE_FREE) { |
788 | up(&demux->mutex); | 755 | up(&demux->mutex); |
789 | return -EINVAL; | 756 | return -EINVAL; |
790 | } | 757 | } |
791 | |||
792 | #ifndef NOBUFS | 758 | #ifndef NOBUFS |
793 | vfree(feed->buffer); | 759 | vfree(feed->buffer); |
794 | feed->buffer=0; | 760 | feed->buffer = NULL; |
795 | #endif | 761 | #endif |
796 | 762 | ||
797 | feed->state = DMX_STATE_FREE; | 763 | feed->state = DMX_STATE_FREE; |
@@ -808,19 +774,18 @@ static int dvbdmx_release_ts_feed(struct dmx_demux *dmx, struct dmx_ts_feed *ts_ | |||
808 | return 0; | 774 | return 0; |
809 | } | 775 | } |
810 | 776 | ||
811 | |||
812 | /****************************************************************************** | 777 | /****************************************************************************** |
813 | * dmx_section_feed API calls | 778 | * dmx_section_feed API calls |
814 | ******************************************************************************/ | 779 | ******************************************************************************/ |
815 | 780 | ||
816 | static int dmx_section_feed_allocate_filter(struct dmx_section_feed* feed, | 781 | static int dmx_section_feed_allocate_filter(struct dmx_section_feed *feed, |
817 | struct dmx_section_filter** filter) | 782 | struct dmx_section_filter **filter) |
818 | { | 783 | { |
819 | struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *) feed; | 784 | struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed; |
820 | struct dvb_demux *dvbdemux = dvbdmxfeed->demux; | 785 | struct dvb_demux *dvbdemux = dvbdmxfeed->demux; |
821 | struct dvb_demux_filter *dvbdmxfilter; | 786 | struct dvb_demux_filter *dvbdmxfilter; |
822 | 787 | ||
823 | if (down_interruptible (&dvbdemux->mutex)) | 788 | if (down_interruptible(&dvbdemux->mutex)) |
824 | return -ERESTARTSYS; | 789 | return -ERESTARTSYS; |
825 | 790 | ||
826 | dvbdmxfilter = dvb_dmx_filter_alloc(dvbdemux); | 791 | dvbdmxfilter = dvb_dmx_filter_alloc(dvbdemux); |
@@ -844,36 +809,29 @@ static int dmx_section_feed_allocate_filter(struct dmx_section_feed* feed, | |||
844 | return 0; | 809 | return 0; |
845 | } | 810 | } |
846 | 811 | ||
847 | 812 | static int dmx_section_feed_set(struct dmx_section_feed *feed, | |
848 | static int dmx_section_feed_set(struct dmx_section_feed* feed, | 813 | u16 pid, size_t circular_buffer_size, |
849 | u16 pid, size_t circular_buffer_size, | 814 | int check_crc) |
850 | int descramble, int check_crc) | ||
851 | { | 815 | { |
852 | struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *) feed; | 816 | struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed; |
853 | struct dvb_demux *dvbdmx = dvbdmxfeed->demux; | 817 | struct dvb_demux *dvbdmx = dvbdmxfeed->demux; |
854 | 818 | ||
855 | if (pid > 0x1fff) | 819 | if (pid > 0x1fff) |
856 | return -EINVAL; | 820 | return -EINVAL; |
857 | 821 | ||
858 | if (down_interruptible (&dvbdmx->mutex)) | 822 | if (down_interruptible(&dvbdmx->mutex)) |
859 | return -ERESTARTSYS; | 823 | return -ERESTARTSYS; |
860 | 824 | ||
861 | dvb_demux_feed_add(dvbdmxfeed); | 825 | dvb_demux_feed_add(dvbdmxfeed); |
862 | 826 | ||
863 | dvbdmxfeed->pid = pid; | 827 | dvbdmxfeed->pid = pid; |
864 | dvbdmxfeed->buffer_size = circular_buffer_size; | 828 | dvbdmxfeed->buffer_size = circular_buffer_size; |
865 | dvbdmxfeed->descramble = descramble; | ||
866 | if (dvbdmxfeed->descramble) { | ||
867 | up(&dvbdmx->mutex); | ||
868 | return -ENOSYS; | ||
869 | } | ||
870 | |||
871 | dvbdmxfeed->feed.sec.check_crc = check_crc; | 829 | dvbdmxfeed->feed.sec.check_crc = check_crc; |
872 | 830 | ||
873 | #ifdef NOBUFS | 831 | #ifdef NOBUFS |
874 | dvbdmxfeed->buffer = NULL; | 832 | dvbdmxfeed->buffer = NULL; |
875 | #else | 833 | #else |
876 | dvbdmxfeed->buffer=vmalloc(dvbdmxfeed->buffer_size); | 834 | dvbdmxfeed->buffer = vmalloc(dvbdmxfeed->buffer_size); |
877 | if (!dvbdmxfeed->buffer) { | 835 | if (!dvbdmxfeed->buffer) { |
878 | up(&dvbdmx->mutex); | 836 | up(&dvbdmx->mutex); |
879 | return -ENOMEM; | 837 | return -ENOMEM; |
@@ -885,7 +843,6 @@ static int dmx_section_feed_set(struct dmx_section_feed* feed, | |||
885 | return 0; | 843 | return 0; |
886 | } | 844 | } |
887 | 845 | ||
888 | |||
889 | static void prepare_secfilters(struct dvb_demux_feed *dvbdmxfeed) | 846 | static void prepare_secfilters(struct dvb_demux_feed *dvbdmxfeed) |
890 | { | 847 | { |
891 | int i; | 848 | int i; |
@@ -893,12 +850,12 @@ static void prepare_secfilters(struct dvb_demux_feed *dvbdmxfeed) | |||
893 | struct dmx_section_filter *sf; | 850 | struct dmx_section_filter *sf; |
894 | u8 mask, mode, doneq; | 851 | u8 mask, mode, doneq; |
895 | 852 | ||
896 | if (!(f=dvbdmxfeed->filter)) | 853 | if (!(f = dvbdmxfeed->filter)) |
897 | return; | 854 | return; |
898 | do { | 855 | do { |
899 | sf = &f->filter; | 856 | sf = &f->filter; |
900 | doneq = 0; | 857 | doneq = 0; |
901 | for (i=0; i<DVB_DEMUX_MASK_MAX; i++) { | 858 | for (i = 0; i < DVB_DEMUX_MASK_MAX; i++) { |
902 | mode = sf->filter_mode[i]; | 859 | mode = sf->filter_mode[i]; |
903 | mask = sf->filter_mask[i]; | 860 | mask = sf->filter_mask[i]; |
904 | f->maskandmode[i] = mask & mode; | 861 | f->maskandmode[i] = mask & mode; |
@@ -908,14 +865,13 @@ static void prepare_secfilters(struct dvb_demux_feed *dvbdmxfeed) | |||
908 | } while ((f = f->next)); | 865 | } while ((f = f->next)); |
909 | } | 866 | } |
910 | 867 | ||
911 | |||
912 | static int dmx_section_feed_start_filtering(struct dmx_section_feed *feed) | 868 | static int dmx_section_feed_start_filtering(struct dmx_section_feed *feed) |
913 | { | 869 | { |
914 | struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *) feed; | 870 | struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed; |
915 | struct dvb_demux *dvbdmx = dvbdmxfeed->demux; | 871 | struct dvb_demux *dvbdmx = dvbdmxfeed->demux; |
916 | int ret; | 872 | int ret; |
917 | 873 | ||
918 | if (down_interruptible (&dvbdmx->mutex)) | 874 | if (down_interruptible(&dvbdmx->mutex)) |
919 | return -ERESTARTSYS; | 875 | return -ERESTARTSYS; |
920 | 876 | ||
921 | if (feed->is_filtering) { | 877 | if (feed->is_filtering) { |
@@ -954,14 +910,13 @@ static int dmx_section_feed_start_filtering(struct dmx_section_feed *feed) | |||
954 | return 0; | 910 | return 0; |
955 | } | 911 | } |
956 | 912 | ||
957 | 913 | static int dmx_section_feed_stop_filtering(struct dmx_section_feed *feed) | |
958 | static int dmx_section_feed_stop_filtering(struct dmx_section_feed* feed) | ||
959 | { | 914 | { |
960 | struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *) feed; | 915 | struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed; |
961 | struct dvb_demux *dvbdmx = dvbdmxfeed->demux; | 916 | struct dvb_demux *dvbdmx = dvbdmxfeed->demux; |
962 | int ret; | 917 | int ret; |
963 | 918 | ||
964 | if (down_interruptible (&dvbdmx->mutex)) | 919 | if (down_interruptible(&dvbdmx->mutex)) |
965 | return -ERESTARTSYS; | 920 | return -ERESTARTSYS; |
966 | 921 | ||
967 | if (!dvbdmx->stop_feed) { | 922 | if (!dvbdmx->stop_feed) { |
@@ -980,15 +935,14 @@ static int dmx_section_feed_stop_filtering(struct dmx_section_feed* feed) | |||
980 | return ret; | 935 | return ret; |
981 | } | 936 | } |
982 | 937 | ||
983 | |||
984 | static int dmx_section_feed_release_filter(struct dmx_section_feed *feed, | 938 | static int dmx_section_feed_release_filter(struct dmx_section_feed *feed, |
985 | struct dmx_section_filter* filter) | 939 | struct dmx_section_filter *filter) |
986 | { | 940 | { |
987 | struct dvb_demux_filter *dvbdmxfilter = (struct dvb_demux_filter *) filter, *f; | 941 | struct dvb_demux_filter *dvbdmxfilter = (struct dvb_demux_filter *)filter, *f; |
988 | struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *) feed; | 942 | struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed; |
989 | struct dvb_demux *dvbdmx = dvbdmxfeed->demux; | 943 | struct dvb_demux *dvbdmx = dvbdmxfeed->demux; |
990 | 944 | ||
991 | if (down_interruptible (&dvbdmx->mutex)) | 945 | if (down_interruptible(&dvbdmx->mutex)) |
992 | return -ERESTARTSYS; | 946 | return -ERESTARTSYS; |
993 | 947 | ||
994 | if (dvbdmxfilter->feed != dvbdmxfeed) { | 948 | if (dvbdmxfilter->feed != dvbdmxfeed) { |
@@ -1005,7 +959,7 @@ static int dmx_section_feed_release_filter(struct dmx_section_feed *feed, | |||
1005 | if (f == dvbdmxfilter) { | 959 | if (f == dvbdmxfilter) { |
1006 | dvbdmxfeed->filter = dvbdmxfilter->next; | 960 | dvbdmxfeed->filter = dvbdmxfilter->next; |
1007 | } else { | 961 | } else { |
1008 | while(f->next != dvbdmxfilter) | 962 | while (f->next != dvbdmxfilter) |
1009 | f = f->next; | 963 | f = f->next; |
1010 | f->next = f->next->next; | 964 | f->next = f->next->next; |
1011 | } | 965 | } |
@@ -1020,10 +974,10 @@ static int dvbdmx_allocate_section_feed(struct dmx_demux *demux, | |||
1020 | struct dmx_section_feed **feed, | 974 | struct dmx_section_feed **feed, |
1021 | dmx_section_cb callback) | 975 | dmx_section_cb callback) |
1022 | { | 976 | { |
1023 | struct dvb_demux *dvbdmx = (struct dvb_demux *) demux; | 977 | struct dvb_demux *dvbdmx = (struct dvb_demux *)demux; |
1024 | struct dvb_demux_feed *dvbdmxfeed; | 978 | struct dvb_demux_feed *dvbdmxfeed; |
1025 | 979 | ||
1026 | if (down_interruptible (&dvbdmx->mutex)) | 980 | if (down_interruptible(&dvbdmx->mutex)) |
1027 | return -ERESTARTSYS; | 981 | return -ERESTARTSYS; |
1028 | 982 | ||
1029 | if (!(dvbdmxfeed = dvb_dmx_feed_alloc(dvbdmx))) { | 983 | if (!(dvbdmxfeed = dvb_dmx_feed_alloc(dvbdmx))) { |
@@ -1041,7 +995,7 @@ static int dvbdmx_allocate_section_feed(struct dmx_demux *demux, | |||
1041 | dvbdmxfeed->filter = NULL; | 995 | dvbdmxfeed->filter = NULL; |
1042 | dvbdmxfeed->buffer = NULL; | 996 | dvbdmxfeed->buffer = NULL; |
1043 | 997 | ||
1044 | (*feed)=&dvbdmxfeed->feed.sec; | 998 | (*feed) = &dvbdmxfeed->feed.sec; |
1045 | (*feed)->is_filtering = 0; | 999 | (*feed)->is_filtering = 0; |
1046 | (*feed)->parent = demux; | 1000 | (*feed)->parent = demux; |
1047 | (*feed)->priv = NULL; | 1001 | (*feed)->priv = NULL; |
@@ -1059,21 +1013,21 @@ static int dvbdmx_allocate_section_feed(struct dmx_demux *demux, | |||
1059 | static int dvbdmx_release_section_feed(struct dmx_demux *demux, | 1013 | static int dvbdmx_release_section_feed(struct dmx_demux *demux, |
1060 | struct dmx_section_feed *feed) | 1014 | struct dmx_section_feed *feed) |
1061 | { | 1015 | { |
1062 | struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *) feed; | 1016 | struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed; |
1063 | struct dvb_demux *dvbdmx = (struct dvb_demux *) demux; | 1017 | struct dvb_demux *dvbdmx = (struct dvb_demux *)demux; |
1064 | 1018 | ||
1065 | if (down_interruptible (&dvbdmx->mutex)) | 1019 | if (down_interruptible(&dvbdmx->mutex)) |
1066 | return -ERESTARTSYS; | 1020 | return -ERESTARTSYS; |
1067 | 1021 | ||
1068 | if (dvbdmxfeed->state==DMX_STATE_FREE) { | 1022 | if (dvbdmxfeed->state == DMX_STATE_FREE) { |
1069 | up(&dvbdmx->mutex); | 1023 | up(&dvbdmx->mutex); |
1070 | return -EINVAL; | 1024 | return -EINVAL; |
1071 | } | 1025 | } |
1072 | #ifndef NOBUFS | 1026 | #ifndef NOBUFS |
1073 | vfree(dvbdmxfeed->buffer); | 1027 | vfree(dvbdmxfeed->buffer); |
1074 | dvbdmxfeed->buffer=0; | 1028 | dvbdmxfeed->buffer = NULL; |
1075 | #endif | 1029 | #endif |
1076 | dvbdmxfeed->state=DMX_STATE_FREE; | 1030 | dvbdmxfeed->state = DMX_STATE_FREE; |
1077 | 1031 | ||
1078 | dvb_demux_feed_del(dvbdmxfeed); | 1032 | dvb_demux_feed_del(dvbdmxfeed); |
1079 | 1033 | ||
@@ -1083,14 +1037,13 @@ static int dvbdmx_release_section_feed(struct dmx_demux *demux, | |||
1083 | return 0; | 1037 | return 0; |
1084 | } | 1038 | } |
1085 | 1039 | ||
1086 | |||
1087 | /****************************************************************************** | 1040 | /****************************************************************************** |
1088 | * dvb_demux kernel data API calls | 1041 | * dvb_demux kernel data API calls |
1089 | ******************************************************************************/ | 1042 | ******************************************************************************/ |
1090 | 1043 | ||
1091 | static int dvbdmx_open(struct dmx_demux *demux) | 1044 | static int dvbdmx_open(struct dmx_demux *demux) |
1092 | { | 1045 | { |
1093 | struct dvb_demux *dvbdemux = (struct dvb_demux *) demux; | 1046 | struct dvb_demux *dvbdemux = (struct dvb_demux *)demux; |
1094 | 1047 | ||
1095 | if (dvbdemux->users >= MAX_DVB_DEMUX_USERS) | 1048 | if (dvbdemux->users >= MAX_DVB_DEMUX_USERS) |
1096 | return -EUSERS; | 1049 | return -EUSERS; |
@@ -1099,10 +1052,9 @@ static int dvbdmx_open(struct dmx_demux *demux) | |||
1099 | return 0; | 1052 | return 0; |
1100 | } | 1053 | } |
1101 | 1054 | ||
1102 | |||
1103 | static int dvbdmx_close(struct dmx_demux *demux) | 1055 | static int dvbdmx_close(struct dmx_demux *demux) |
1104 | { | 1056 | { |
1105 | struct dvb_demux *dvbdemux = (struct dvb_demux *) demux; | 1057 | struct dvb_demux *dvbdemux = (struct dvb_demux *)demux; |
1106 | 1058 | ||
1107 | if (dvbdemux->users == 0) | 1059 | if (dvbdemux->users == 0) |
1108 | return -ENODEV; | 1060 | return -ENODEV; |
@@ -1112,15 +1064,14 @@ static int dvbdmx_close(struct dmx_demux *demux) | |||
1112 | return 0; | 1064 | return 0; |
1113 | } | 1065 | } |
1114 | 1066 | ||
1115 | |||
1116 | static int dvbdmx_write(struct dmx_demux *demux, const char *buf, size_t count) | 1067 | static int dvbdmx_write(struct dmx_demux *demux, const char *buf, size_t count) |
1117 | { | 1068 | { |
1118 | struct dvb_demux *dvbdemux=(struct dvb_demux *) demux; | 1069 | struct dvb_demux *dvbdemux = (struct dvb_demux *)demux; |
1119 | 1070 | ||
1120 | if ((!demux->frontend) || (demux->frontend->source != DMX_MEMORY_FE)) | 1071 | if ((!demux->frontend) || (demux->frontend->source != DMX_MEMORY_FE)) |
1121 | return -EINVAL; | 1072 | return -EINVAL; |
1122 | 1073 | ||
1123 | if (down_interruptible (&dvbdemux->mutex)) | 1074 | if (down_interruptible(&dvbdemux->mutex)) |
1124 | return -ERESTARTSYS; | 1075 | return -ERESTARTSYS; |
1125 | dvb_dmx_swfilter(dvbdemux, buf, count); | 1076 | dvb_dmx_swfilter(dvbdemux, buf, count); |
1126 | up(&dvbdemux->mutex); | 1077 | up(&dvbdemux->mutex); |
@@ -1130,10 +1081,10 @@ static int dvbdmx_write(struct dmx_demux *demux, const char *buf, size_t count) | |||
1130 | return count; | 1081 | return count; |
1131 | } | 1082 | } |
1132 | 1083 | ||
1133 | 1084 | static int dvbdmx_add_frontend(struct dmx_demux *demux, | |
1134 | static int dvbdmx_add_frontend(struct dmx_demux *demux, struct dmx_frontend *frontend) | 1085 | struct dmx_frontend *frontend) |
1135 | { | 1086 | { |
1136 | struct dvb_demux *dvbdemux = (struct dvb_demux *) demux; | 1087 | struct dvb_demux *dvbdemux = (struct dvb_demux *)demux; |
1137 | struct list_head *head = &dvbdemux->frontend_list; | 1088 | struct list_head *head = &dvbdemux->frontend_list; |
1138 | 1089 | ||
1139 | list_add(&(frontend->connectivity_list), head); | 1090 | list_add(&(frontend->connectivity_list), head); |
@@ -1141,13 +1092,13 @@ static int dvbdmx_add_frontend(struct dmx_demux *demux, struct dmx_frontend *fro | |||
1141 | return 0; | 1092 | return 0; |
1142 | } | 1093 | } |
1143 | 1094 | ||
1144 | 1095 | static int dvbdmx_remove_frontend(struct dmx_demux *demux, | |
1145 | static int dvbdmx_remove_frontend(struct dmx_demux *demux, struct dmx_frontend *frontend) | 1096 | struct dmx_frontend *frontend) |
1146 | { | 1097 | { |
1147 | struct dvb_demux *dvbdemux = (struct dvb_demux *) demux; | 1098 | struct dvb_demux *dvbdemux = (struct dvb_demux *)demux; |
1148 | struct list_head *pos, *n, *head = &dvbdemux->frontend_list; | 1099 | struct list_head *pos, *n, *head = &dvbdemux->frontend_list; |
1149 | 1100 | ||
1150 | list_for_each_safe (pos, n, head) { | 1101 | list_for_each_safe(pos, n, head) { |
1151 | if (DMX_FE_ENTRY(pos) == frontend) { | 1102 | if (DMX_FE_ENTRY(pos) == frontend) { |
1152 | list_del(pos); | 1103 | list_del(pos); |
1153 | return 0; | 1104 | return 0; |
@@ -1157,25 +1108,25 @@ static int dvbdmx_remove_frontend(struct dmx_demux *demux, struct dmx_frontend * | |||
1157 | return -ENODEV; | 1108 | return -ENODEV; |
1158 | } | 1109 | } |
1159 | 1110 | ||
1160 | 1111 | static struct list_head *dvbdmx_get_frontends(struct dmx_demux *demux) | |
1161 | static struct list_head * dvbdmx_get_frontends(struct dmx_demux *demux) | ||
1162 | { | 1112 | { |
1163 | struct dvb_demux *dvbdemux = (struct dvb_demux *) demux; | 1113 | struct dvb_demux *dvbdemux = (struct dvb_demux *)demux; |
1164 | 1114 | ||
1165 | if (list_empty(&dvbdemux->frontend_list)) | 1115 | if (list_empty(&dvbdemux->frontend_list)) |
1166 | return NULL; | 1116 | return NULL; |
1117 | |||
1167 | return &dvbdemux->frontend_list; | 1118 | return &dvbdemux->frontend_list; |
1168 | } | 1119 | } |
1169 | 1120 | ||
1170 | 1121 | static int dvbdmx_connect_frontend(struct dmx_demux *demux, | |
1171 | static int dvbdmx_connect_frontend(struct dmx_demux *demux, struct dmx_frontend *frontend) | 1122 | struct dmx_frontend *frontend) |
1172 | { | 1123 | { |
1173 | struct dvb_demux *dvbdemux = (struct dvb_demux *) demux; | 1124 | struct dvb_demux *dvbdemux = (struct dvb_demux *)demux; |
1174 | 1125 | ||
1175 | if (demux->frontend) | 1126 | if (demux->frontend) |
1176 | return -EINVAL; | 1127 | return -EINVAL; |
1177 | 1128 | ||
1178 | if (down_interruptible (&dvbdemux->mutex)) | 1129 | if (down_interruptible(&dvbdemux->mutex)) |
1179 | return -ERESTARTSYS; | 1130 | return -ERESTARTSYS; |
1180 | 1131 | ||
1181 | demux->frontend = frontend; | 1132 | demux->frontend = frontend; |
@@ -1183,12 +1134,11 @@ static int dvbdmx_connect_frontend(struct dmx_demux *demux, struct dmx_frontend | |||
1183 | return 0; | 1134 | return 0; |
1184 | } | 1135 | } |
1185 | 1136 | ||
1186 | |||
1187 | static int dvbdmx_disconnect_frontend(struct dmx_demux *demux) | 1137 | static int dvbdmx_disconnect_frontend(struct dmx_demux *demux) |
1188 | { | 1138 | { |
1189 | struct dvb_demux *dvbdemux = (struct dvb_demux *) demux; | 1139 | struct dvb_demux *dvbdemux = (struct dvb_demux *)demux; |
1190 | 1140 | ||
1191 | if (down_interruptible (&dvbdemux->mutex)) | 1141 | if (down_interruptible(&dvbdemux->mutex)) |
1192 | return -ERESTARTSYS; | 1142 | return -ERESTARTSYS; |
1193 | 1143 | ||
1194 | demux->frontend = NULL; | 1144 | demux->frontend = NULL; |
@@ -1196,44 +1146,42 @@ static int dvbdmx_disconnect_frontend(struct dmx_demux *demux) | |||
1196 | return 0; | 1146 | return 0; |
1197 | } | 1147 | } |
1198 | 1148 | ||
1199 | 1149 | static int dvbdmx_get_pes_pids(struct dmx_demux *demux, u16 * pids) | |
1200 | static int dvbdmx_get_pes_pids(struct dmx_demux *demux, u16 *pids) | ||
1201 | { | 1150 | { |
1202 | struct dvb_demux *dvbdemux = (struct dvb_demux *) demux; | 1151 | struct dvb_demux *dvbdemux = (struct dvb_demux *)demux; |
1203 | 1152 | ||
1204 | memcpy(pids, dvbdemux->pids, 5*sizeof(u16)); | 1153 | memcpy(pids, dvbdemux->pids, 5 * sizeof(u16)); |
1205 | return 0; | 1154 | return 0; |
1206 | } | 1155 | } |
1207 | 1156 | ||
1208 | |||
1209 | int dvb_dmx_init(struct dvb_demux *dvbdemux) | 1157 | int dvb_dmx_init(struct dvb_demux *dvbdemux) |
1210 | { | 1158 | { |
1211 | int i, err; | 1159 | int i; |
1212 | struct dmx_demux *dmx = &dvbdemux->dmx; | 1160 | struct dmx_demux *dmx = &dvbdemux->dmx; |
1213 | 1161 | ||
1214 | dvbdemux->users = 0; | 1162 | dvbdemux->users = 0; |
1215 | dvbdemux->filter = vmalloc(dvbdemux->filternum*sizeof(struct dvb_demux_filter)); | 1163 | dvbdemux->filter = vmalloc(dvbdemux->filternum * sizeof(struct dvb_demux_filter)); |
1216 | 1164 | ||
1217 | if (!dvbdemux->filter) | 1165 | if (!dvbdemux->filter) |
1218 | return -ENOMEM; | 1166 | return -ENOMEM; |
1219 | 1167 | ||
1220 | dvbdemux->feed = vmalloc(dvbdemux->feednum*sizeof(struct dvb_demux_feed)); | 1168 | dvbdemux->feed = vmalloc(dvbdemux->feednum * sizeof(struct dvb_demux_feed)); |
1221 | if (!dvbdemux->feed) { | 1169 | if (!dvbdemux->feed) { |
1222 | vfree(dvbdemux->filter); | 1170 | vfree(dvbdemux->filter); |
1223 | return -ENOMEM; | 1171 | return -ENOMEM; |
1224 | } | 1172 | } |
1225 | for (i=0; i<dvbdemux->filternum; i++) { | 1173 | for (i = 0; i < dvbdemux->filternum; i++) { |
1226 | dvbdemux->filter[i].state = DMX_STATE_FREE; | 1174 | dvbdemux->filter[i].state = DMX_STATE_FREE; |
1227 | dvbdemux->filter[i].index = i; | 1175 | dvbdemux->filter[i].index = i; |
1228 | } | 1176 | } |
1229 | for (i=0; i<dvbdemux->feednum; i++) { | 1177 | for (i = 0; i < dvbdemux->feednum; i++) { |
1230 | dvbdemux->feed[i].state = DMX_STATE_FREE; | 1178 | dvbdemux->feed[i].state = DMX_STATE_FREE; |
1231 | dvbdemux->feed[i].index = i; | 1179 | dvbdemux->feed[i].index = i; |
1232 | } | 1180 | } |
1233 | dvbdemux->frontend_list.next= | 1181 | |
1234 | dvbdemux->frontend_list.prev= | 1182 | INIT_LIST_HEAD(&dvbdemux->frontend_list); |
1235 | &dvbdemux->frontend_list; | 1183 | |
1236 | for (i=0; i<DMX_TS_PES_OTHER; i++) { | 1184 | for (i = 0; i < DMX_TS_PES_OTHER; i++) { |
1237 | dvbdemux->pesfilter[i] = NULL; | 1185 | dvbdemux->pesfilter[i] = NULL; |
1238 | dvbdemux->pids[i] = 0xffff; | 1186 | dvbdemux->pids[i] = 0xffff; |
1239 | } | 1187 | } |
@@ -1247,12 +1195,11 @@ int dvb_dmx_init(struct dvb_demux *dvbdemux) | |||
1247 | if (!dvbdemux->check_crc32) | 1195 | if (!dvbdemux->check_crc32) |
1248 | dvbdemux->check_crc32 = dvb_dmx_crc32; | 1196 | dvbdemux->check_crc32 = dvb_dmx_crc32; |
1249 | 1197 | ||
1250 | if (!dvbdemux->memcopy) | 1198 | if (!dvbdemux->memcopy) |
1251 | dvbdemux->memcopy = dvb_dmx_memcopy; | 1199 | dvbdemux->memcopy = dvb_dmx_memcopy; |
1252 | 1200 | ||
1253 | dmx->frontend = NULL; | 1201 | dmx->frontend = NULL; |
1254 | dmx->reg_list.prev = dmx->reg_list.next = &dmx->reg_list; | 1202 | dmx->priv = dvbdemux; |
1255 | dmx->priv = (void *) dvbdemux; | ||
1256 | dmx->open = dvbdmx_open; | 1203 | dmx->open = dvbdmx_open; |
1257 | dmx->close = dvbdmx_close; | 1204 | dmx->close = dvbdmx_close; |
1258 | dmx->write = dvbdmx_write; | 1205 | dmx->write = dvbdmx_write; |
@@ -1261,9 +1208,6 @@ int dvb_dmx_init(struct dvb_demux *dvbdemux) | |||
1261 | dmx->allocate_section_feed = dvbdmx_allocate_section_feed; | 1208 | dmx->allocate_section_feed = dvbdmx_allocate_section_feed; |
1262 | dmx->release_section_feed = dvbdmx_release_section_feed; | 1209 | dmx->release_section_feed = dvbdmx_release_section_feed; |
1263 | 1210 | ||
1264 | dmx->descramble_mac_address = NULL; | ||
1265 | dmx->descramble_section_payload = NULL; | ||
1266 | |||
1267 | dmx->add_frontend = dvbdmx_add_frontend; | 1211 | dmx->add_frontend = dvbdmx_add_frontend; |
1268 | dmx->remove_frontend = dvbdmx_remove_frontend; | 1212 | dmx->remove_frontend = dvbdmx_remove_frontend; |
1269 | dmx->get_frontends = dvbdmx_get_frontends; | 1213 | dmx->get_frontends = dvbdmx_get_frontends; |
@@ -1274,21 +1218,15 @@ int dvb_dmx_init(struct dvb_demux *dvbdemux) | |||
1274 | sema_init(&dvbdemux->mutex, 1); | 1218 | sema_init(&dvbdemux->mutex, 1); |
1275 | spin_lock_init(&dvbdemux->lock); | 1219 | spin_lock_init(&dvbdemux->lock); |
1276 | 1220 | ||
1277 | if ((err = dmx_register_demux(dmx)) < 0) | ||
1278 | return err; | ||
1279 | |||
1280 | return 0; | 1221 | return 0; |
1281 | } | 1222 | } |
1282 | EXPORT_SYMBOL(dvb_dmx_init); | ||
1283 | 1223 | ||
1224 | EXPORT_SYMBOL(dvb_dmx_init); | ||
1284 | 1225 | ||
1285 | int dvb_dmx_release(struct dvb_demux *dvbdemux) | 1226 | void dvb_dmx_release(struct dvb_demux *dvbdemux) |
1286 | { | 1227 | { |
1287 | struct dmx_demux *dmx = &dvbdemux->dmx; | ||
1288 | |||
1289 | dmx_unregister_demux(dmx); | ||
1290 | vfree(dvbdemux->filter); | 1228 | vfree(dvbdemux->filter); |
1291 | vfree(dvbdemux->feed); | 1229 | vfree(dvbdemux->feed); |
1292 | return 0; | ||
1293 | } | 1230 | } |
1231 | |||
1294 | EXPORT_SYMBOL(dvb_dmx_release); | 1232 | EXPORT_SYMBOL(dvb_dmx_release); |
diff --git a/drivers/media/dvb/dvb-core/dvb_demux.h b/drivers/media/dvb/dvb-core/dvb_demux.h index c09beb391622..0cc888339d52 100644 --- a/drivers/media/dvb/dvb-core/dvb_demux.h +++ b/drivers/media/dvb/dvb-core/dvb_demux.h | |||
@@ -20,7 +20,6 @@ | |||
20 | * | 20 | * |
21 | */ | 21 | */ |
22 | 22 | ||
23 | |||
24 | #ifndef _DVB_DEMUX_H_ | 23 | #ifndef _DVB_DEMUX_H_ |
25 | #define _DVB_DEMUX_H_ | 24 | #define _DVB_DEMUX_H_ |
26 | 25 | ||
@@ -44,103 +43,98 @@ | |||
44 | #define DVB_DEMUX_MASK_MAX 18 | 43 | #define DVB_DEMUX_MASK_MAX 18 |
45 | 44 | ||
46 | struct dvb_demux_filter { | 45 | struct dvb_demux_filter { |
47 | struct dmx_section_filter filter; | 46 | struct dmx_section_filter filter; |
48 | u8 maskandmode [DMX_MAX_FILTER_SIZE]; | 47 | u8 maskandmode[DMX_MAX_FILTER_SIZE]; |
49 | u8 maskandnotmode [DMX_MAX_FILTER_SIZE]; | 48 | u8 maskandnotmode[DMX_MAX_FILTER_SIZE]; |
50 | int doneq; | 49 | int doneq; |
51 | 50 | ||
52 | struct dvb_demux_filter *next; | 51 | struct dvb_demux_filter *next; |
53 | struct dvb_demux_feed *feed; | 52 | struct dvb_demux_feed *feed; |
54 | int index; | 53 | int index; |
55 | int state; | 54 | int state; |
56 | int type; | 55 | int type; |
57 | int pesto; | ||
58 | |||
59 | u16 handle; | ||
60 | u16 hw_handle; | ||
61 | struct timer_list timer; | ||
62 | int ts_state; | ||
63 | }; | ||
64 | 56 | ||
57 | u16 hw_handle; | ||
58 | struct timer_list timer; | ||
59 | }; | ||
65 | 60 | ||
66 | #define DMX_FEED_ENTRY(pos) list_entry(pos, struct dvb_demux_feed, list_head) | 61 | #define DMX_FEED_ENTRY(pos) list_entry(pos, struct dvb_demux_feed, list_head) |
67 | 62 | ||
68 | struct dvb_demux_feed { | 63 | struct dvb_demux_feed { |
69 | union { | 64 | union { |
70 | struct dmx_ts_feed ts; | 65 | struct dmx_ts_feed ts; |
71 | struct dmx_section_feed sec; | 66 | struct dmx_section_feed sec; |
72 | } feed; | 67 | } feed; |
73 | 68 | ||
74 | union { | 69 | union { |
75 | dmx_ts_cb ts; | 70 | dmx_ts_cb ts; |
76 | dmx_section_cb sec; | 71 | dmx_section_cb sec; |
77 | } cb; | 72 | } cb; |
78 | 73 | ||
79 | struct dvb_demux *demux; | 74 | struct dvb_demux *demux; |
80 | void *priv; | 75 | void *priv; |
81 | int type; | 76 | int type; |
82 | int state; | 77 | int state; |
83 | u16 pid; | 78 | u16 pid; |
84 | u8 *buffer; | 79 | u8 *buffer; |
85 | int buffer_size; | 80 | int buffer_size; |
86 | int descramble; | ||
87 | 81 | ||
88 | struct timespec timeout; | 82 | struct timespec timeout; |
89 | struct dvb_demux_filter *filter; | 83 | struct dvb_demux_filter *filter; |
90 | int cb_length; | ||
91 | 84 | ||
92 | int ts_type; | 85 | int ts_type; |
93 | enum dmx_ts_pes pes_type; | 86 | enum dmx_ts_pes pes_type; |
94 | 87 | ||
95 | int cc; | 88 | int cc; |
96 | int pusi_seen; /* prevents feeding of garbage from previous section */ | 89 | int pusi_seen; /* prevents feeding of garbage from previous section */ |
97 | 90 | ||
98 | u16 peslen; | 91 | u16 peslen; |
99 | 92 | ||
100 | struct list_head list_head; | 93 | struct list_head list_head; |
101 | int index; /* a unique index for each feed (can be used as hardware pid filter index) */ | 94 | unsigned int index; /* a unique index for each feed (can be used as hardware pid filter index) */ |
102 | }; | 95 | }; |
103 | 96 | ||
104 | struct dvb_demux { | 97 | struct dvb_demux { |
105 | struct dmx_demux dmx; | 98 | struct dmx_demux dmx; |
106 | void *priv; | 99 | void *priv; |
107 | int filternum; | 100 | int filternum; |
108 | int feednum; | 101 | int feednum; |
109 | int (*start_feed) (struct dvb_demux_feed *feed); | 102 | int (*start_feed)(struct dvb_demux_feed *feed); |
110 | int (*stop_feed) (struct dvb_demux_feed *feed); | 103 | int (*stop_feed)(struct dvb_demux_feed *feed); |
111 | int (*write_to_decoder) (struct dvb_demux_feed *feed, | 104 | int (*write_to_decoder)(struct dvb_demux_feed *feed, |
112 | const u8 *buf, size_t len); | 105 | const u8 *buf, size_t len); |
113 | u32 (*check_crc32) (struct dvb_demux_feed *feed, | 106 | u32 (*check_crc32)(struct dvb_demux_feed *feed, |
114 | const u8 *buf, size_t len); | 107 | const u8 *buf, size_t len); |
115 | void (*memcopy) (struct dvb_demux_feed *feed, u8 *dst, | 108 | void (*memcopy)(struct dvb_demux_feed *feed, u8 *dst, |
116 | const u8 *src, size_t len); | 109 | const u8 *src, size_t len); |
117 | 110 | ||
118 | int users; | 111 | int users; |
119 | #define MAX_DVB_DEMUX_USERS 10 | 112 | #define MAX_DVB_DEMUX_USERS 10 |
120 | struct dvb_demux_filter *filter; | 113 | struct dvb_demux_filter *filter; |
121 | struct dvb_demux_feed *feed; | 114 | struct dvb_demux_feed *feed; |
122 | 115 | ||
123 | struct list_head frontend_list; | 116 | struct list_head frontend_list; |
124 | 117 | ||
125 | struct dvb_demux_feed *pesfilter[DMX_TS_PES_OTHER]; | 118 | struct dvb_demux_feed *pesfilter[DMX_TS_PES_OTHER]; |
126 | u16 pids[DMX_TS_PES_OTHER]; | 119 | u16 pids[DMX_TS_PES_OTHER]; |
127 | int playing; | 120 | int playing; |
128 | int recording; | 121 | int recording; |
129 | 122 | ||
130 | #define DMX_MAX_PID 0x2000 | 123 | #define DMX_MAX_PID 0x2000 |
131 | struct list_head feed_list; | 124 | struct list_head feed_list; |
132 | u8 tsbuf[204]; | 125 | u8 tsbuf[204]; |
133 | int tsbufp; | 126 | int tsbufp; |
134 | 127 | ||
135 | struct semaphore mutex; | 128 | struct semaphore mutex; |
136 | spinlock_t lock; | 129 | spinlock_t lock; |
137 | }; | 130 | }; |
138 | 131 | ||
139 | |||
140 | int dvb_dmx_init(struct dvb_demux *dvbdemux); | 132 | int dvb_dmx_init(struct dvb_demux *dvbdemux); |
141 | int dvb_dmx_release(struct dvb_demux *dvbdemux); | 133 | void dvb_dmx_release(struct dvb_demux *dvbdemux); |
142 | void dvb_dmx_swfilter_packets(struct dvb_demux *dvbdmx, const u8 *buf, size_t count); | 134 | void dvb_dmx_swfilter_packets(struct dvb_demux *dvbdmx, const u8 *buf, |
135 | size_t count); | ||
143 | void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count); | 136 | void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count); |
144 | void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, size_t count); | 137 | void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, |
138 | size_t count); | ||
145 | 139 | ||
146 | #endif /* _DVB_DEMUX_H_ */ | 140 | #endif /* _DVB_DEMUX_H_ */ |
diff --git a/drivers/media/dvb/dvb-core/dvb_net.c b/drivers/media/dvb/dvb-core/dvb_net.c index 6a968c346a36..87935490bfb2 100644 --- a/drivers/media/dvb/dvb-core/dvb_net.c +++ b/drivers/media/dvb/dvb-core/dvb_net.c | |||
@@ -62,7 +62,6 @@ | |||
62 | #include <linux/uio.h> | 62 | #include <linux/uio.h> |
63 | #include <asm/uaccess.h> | 63 | #include <asm/uaccess.h> |
64 | #include <linux/crc32.h> | 64 | #include <linux/crc32.h> |
65 | #include <linux/version.h> | ||
66 | 65 | ||
67 | #include "dvb_demux.h" | 66 | #include "dvb_demux.h" |
68 | #include "dvb_net.h" | 67 | #include "dvb_net.h" |
@@ -171,11 +170,7 @@ static unsigned short dvb_net_eth_type_trans(struct sk_buff *skb, | |||
171 | 170 | ||
172 | skb->mac.raw=skb->data; | 171 | skb->mac.raw=skb->data; |
173 | skb_pull(skb,dev->hard_header_len); | 172 | skb_pull(skb,dev->hard_header_len); |
174 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,8) | ||
175 | eth = skb->mac.ethernet; | ||
176 | #else | ||
177 | eth = eth_hdr(skb); | 173 | eth = eth_hdr(skb); |
178 | #endif | ||
179 | 174 | ||
180 | if (*eth->h_dest & 1) { | 175 | if (*eth->h_dest & 1) { |
181 | if(memcmp(eth->h_dest,dev->broadcast, ETH_ALEN)==0) | 176 | if(memcmp(eth->h_dest,dev->broadcast, ETH_ALEN)==0) |
@@ -908,7 +903,7 @@ static int dvb_net_feed_start(struct net_device *dev) | |||
908 | return ret; | 903 | return ret; |
909 | } | 904 | } |
910 | 905 | ||
911 | ret = priv->secfeed->set(priv->secfeed, priv->pid, 32768, 0, 1); | 906 | ret = priv->secfeed->set(priv->secfeed, priv->pid, 32768, 1); |
912 | 907 | ||
913 | if (ret<0) { | 908 | if (ret<0) { |
914 | printk("%s: could not set section feed\n", dev->name); | 909 | printk("%s: could not set section feed\n", dev->name); |
@@ -960,9 +955,7 @@ static int dvb_net_feed_start(struct net_device *dev) | |||
960 | priv->tsfeed->priv = (void *)dev; | 955 | priv->tsfeed->priv = (void *)dev; |
961 | ret = priv->tsfeed->set(priv->tsfeed, priv->pid, | 956 | ret = priv->tsfeed->set(priv->tsfeed, priv->pid, |
962 | TS_PACKET, DMX_TS_PES_OTHER, | 957 | TS_PACKET, DMX_TS_PES_OTHER, |
963 | 188 * 100, /* nr. of bytes delivered per callback */ | ||
964 | 32768, /* circular buffer size */ | 958 | 32768, /* circular buffer size */ |
965 | 0, /* descramble */ | ||
966 | timeout); | 959 | timeout); |
967 | 960 | ||
968 | if (ret < 0) { | 961 | if (ret < 0) { |
diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig index 612e5b087b1c..54e2b29076b1 100644 --- a/drivers/media/dvb/dvb-usb/Kconfig +++ b/drivers/media/dvb/dvb-usb/Kconfig | |||
@@ -93,13 +93,30 @@ config DVB_USB_DIGITV | |||
93 | Say Y here to support the Nebula Electronics uDigitV USB2.0 DVB-T receiver. | 93 | Say Y here to support the Nebula Electronics uDigitV USB2.0 DVB-T receiver. |
94 | 94 | ||
95 | config DVB_USB_VP7045 | 95 | config DVB_USB_VP7045 |
96 | tristate "TwinhanDTV Alpha/MagicBoxII and DNTV tinyUSB2 DVB-T USB2.0 support" | 96 | tristate "TwinhanDTV Alpha/MagicBoxII, DNTV tinyUSB2, Beetle USB2.0 support" |
97 | depends on DVB_USB | 97 | depends on DVB_USB |
98 | help | 98 | help |
99 | Say Y here to support the | 99 | Say Y here to support the |
100 | |||
100 | TwinhanDTV Alpha (stick) (VP-7045), | 101 | TwinhanDTV Alpha (stick) (VP-7045), |
101 | TwinhanDTV MagicBox II (VP-7046) and | 102 | TwinhanDTV MagicBox II (VP-7046), |
102 | DigitalNow TinyUSB 2 DVB-t DVB-T USB2.0 receivers. | 103 | DigitalNow TinyUSB 2 DVB-t, |
104 | DigitalRise USB 2.0 Ter (Beetle) and | ||
105 | TYPHOON DVB-T USB DRIVE | ||
106 | |||
107 | DVB-T USB2.0 receivers. | ||
108 | |||
109 | config DVB_USB_VP702X | ||
110 | tristate "TwinhanDTV StarBox and clones DVB-S USB2.0 support" | ||
111 | depends on DVB_USB | ||
112 | help | ||
113 | Say Y here to support the | ||
114 | |||
115 | TwinhanDTV StarBox, | ||
116 | DigitalRise USB Starbox and | ||
117 | TYPHOON DVB-S USB 2.0 BOX | ||
118 | |||
119 | DVB-S USB2.0 receivers. | ||
103 | 120 | ||
104 | config DVB_USB_NOVA_T_USB2 | 121 | config DVB_USB_NOVA_T_USB2 |
105 | tristate "Hauppauge WinTV-NOVA-T usb2 DVB-T USB2.0 support" | 122 | tristate "Hauppauge WinTV-NOVA-T usb2 DVB-T USB2.0 support" |
diff --git a/drivers/media/dvb/dvb-usb/Makefile b/drivers/media/dvb/dvb-usb/Makefile index 746d87ed6f32..2dc9aad9681e 100644 --- a/drivers/media/dvb/dvb-usb/Makefile +++ b/drivers/media/dvb/dvb-usb/Makefile | |||
@@ -4,6 +4,9 @@ obj-$(CONFIG_DVB_USB) += dvb-usb.o | |||
4 | dvb-usb-vp7045-objs = vp7045.o vp7045-fe.o | 4 | dvb-usb-vp7045-objs = vp7045.o vp7045-fe.o |
5 | obj-$(CONFIG_DVB_USB_VP7045) += dvb-usb-vp7045.o | 5 | obj-$(CONFIG_DVB_USB_VP7045) += dvb-usb-vp7045.o |
6 | 6 | ||
7 | dvb-usb-vp702x-objs = vp702x.o vp702x-fe.o | ||
8 | obj-$(CONFIG_DVB_USB_VP702X) += dvb-usb-vp702x.o | ||
9 | |||
7 | dvb-usb-dtt200u-objs = dtt200u.o dtt200u-fe.o | 10 | dvb-usb-dtt200u-objs = dtt200u.o dtt200u-fe.o |
8 | obj-$(CONFIG_DVB_USB_DTT200U) += dvb-usb-dtt200u.o | 11 | obj-$(CONFIG_DVB_USB_DTT200U) += dvb-usb-dtt200u.o |
9 | 12 | ||
diff --git a/drivers/media/dvb/dvb-usb/a800.c b/drivers/media/dvb/dvb-usb/a800.c index f2fcc2f1f846..e55322ef76b3 100644 --- a/drivers/media/dvb/dvb-usb/a800.c +++ b/drivers/media/dvb/dvb-usb/a800.c | |||
@@ -90,7 +90,7 @@ static struct dvb_usb_properties a800_properties; | |||
90 | static int a800_probe(struct usb_interface *intf, | 90 | static int a800_probe(struct usb_interface *intf, |
91 | const struct usb_device_id *id) | 91 | const struct usb_device_id *id) |
92 | { | 92 | { |
93 | return dvb_usb_device_init(intf,&a800_properties,THIS_MODULE); | 93 | return dvb_usb_device_init(intf,&a800_properties,THIS_MODULE,NULL); |
94 | } | 94 | } |
95 | 95 | ||
96 | /* do not change the order of the ID table */ | 96 | /* do not change the order of the ID table */ |
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c index 9e96a188f1e9..3fe383f4bb4c 100644 --- a/drivers/media/dvb/dvb-usb/cxusb.c +++ b/drivers/media/dvb/dvb-usb/cxusb.c | |||
@@ -48,35 +48,26 @@ static int cxusb_ctrl_msg(struct dvb_usb_device *d, | |||
48 | return 0; | 48 | return 0; |
49 | } | 49 | } |
50 | 50 | ||
51 | /* I2C */ | 51 | /* GPIO */ |
52 | static void cxusb_set_i2c_path(struct dvb_usb_device *d, enum cxusb_i2c_pathes path) | 52 | static void cxusb_gpio_tuner(struct dvb_usb_device *d, int onoff) |
53 | { | 53 | { |
54 | struct cxusb_state *st = d->priv; | 54 | struct cxusb_state *st = d->priv; |
55 | u8 o[2],i; | 55 | u8 o[2],i; |
56 | 56 | ||
57 | if (path == st->cur_i2c_path) | 57 | if (st->gpio_write_state[GPIO_TUNER] == onoff) |
58 | return; | 58 | return; |
59 | 59 | ||
60 | o[0] = IOCTL_SET_I2C_PATH; | 60 | o[0] = GPIO_TUNER; |
61 | switch (path) { | 61 | o[1] = onoff; |
62 | case PATH_CX22702: | 62 | cxusb_ctrl_msg(d,CMD_GPIO_WRITE,o,2,&i,1); |
63 | o[1] = 0; | ||
64 | break; | ||
65 | case PATH_TUNER_OTHER: | ||
66 | o[1] = 1; | ||
67 | break; | ||
68 | default: | ||
69 | err("unkown i2c path"); | ||
70 | return; | ||
71 | } | ||
72 | cxusb_ctrl_msg(d,CMD_IOCTL,o,2,&i,1); | ||
73 | 63 | ||
74 | if (i != 0x01) | 64 | if (i != 0x01) |
75 | deb_info("i2c_path setting failed.\n"); | 65 | deb_info("gpio_write failed.\n"); |
76 | 66 | ||
77 | st->cur_i2c_path = path; | 67 | st->gpio_write_state[GPIO_TUNER] = onoff; |
78 | } | 68 | } |
79 | 69 | ||
70 | /* I2C */ | ||
80 | static int cxusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num) | 71 | static int cxusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num) |
81 | { | 72 | { |
82 | struct dvb_usb_device *d = i2c_get_adapdata(adap); | 73 | struct dvb_usb_device *d = i2c_get_adapdata(adap); |
@@ -92,10 +83,10 @@ static int cxusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num) | |||
92 | 83 | ||
93 | switch (msg[i].addr) { | 84 | switch (msg[i].addr) { |
94 | case 0x63: | 85 | case 0x63: |
95 | cxusb_set_i2c_path(d,PATH_CX22702); | 86 | cxusb_gpio_tuner(d,0); |
96 | break; | 87 | break; |
97 | default: | 88 | default: |
98 | cxusb_set_i2c_path(d,PATH_TUNER_OTHER); | 89 | cxusb_gpio_tuner(d,1); |
99 | break; | 90 | break; |
100 | } | 91 | } |
101 | 92 | ||
@@ -147,16 +138,20 @@ static struct i2c_algorithm cxusb_i2c_algo = { | |||
147 | 138 | ||
148 | static int cxusb_power_ctrl(struct dvb_usb_device *d, int onoff) | 139 | static int cxusb_power_ctrl(struct dvb_usb_device *d, int onoff) |
149 | { | 140 | { |
150 | return 0; | 141 | u8 b = 0; |
142 | if (onoff) | ||
143 | return cxusb_ctrl_msg(d, CMD_POWER_ON, &b, 1, NULL, 0); | ||
144 | else | ||
145 | return cxusb_ctrl_msg(d, CMD_POWER_OFF, &b, 1, NULL, 0); | ||
151 | } | 146 | } |
152 | 147 | ||
153 | static int cxusb_streaming_ctrl(struct dvb_usb_device *d, int onoff) | 148 | static int cxusb_streaming_ctrl(struct dvb_usb_device *d, int onoff) |
154 | { | 149 | { |
155 | u8 buf[2] = { 0x03, 0x00 }; | 150 | u8 buf[2] = { 0x03, 0x00 }; |
156 | if (onoff) | 151 | if (onoff) |
157 | cxusb_ctrl_msg(d,0x36, buf, 2, NULL, 0); | 152 | cxusb_ctrl_msg(d,CMD_STREAMING_ON, buf, 2, NULL, 0); |
158 | else | 153 | else |
159 | cxusb_ctrl_msg(d,0x37, NULL, 0, NULL, 0); | 154 | cxusb_ctrl_msg(d,CMD_STREAMING_OFF, NULL, 0, NULL, 0); |
160 | 155 | ||
161 | return 0; | 156 | return 0; |
162 | } | 157 | } |
@@ -182,22 +177,11 @@ static int cxusb_tuner_attach(struct dvb_usb_device *d) | |||
182 | 177 | ||
183 | static int cxusb_frontend_attach(struct dvb_usb_device *d) | 178 | static int cxusb_frontend_attach(struct dvb_usb_device *d) |
184 | { | 179 | { |
185 | u8 buf[2] = { 0x03, 0x00 }; | 180 | u8 b; |
186 | u8 b = 0; | ||
187 | |||
188 | if (usb_set_interface(d->udev,0,0) < 0) | ||
189 | err("set interface to alts=0 failed"); | ||
190 | |||
191 | cxusb_ctrl_msg(d,0xde,&b,0,NULL,0); | ||
192 | cxusb_set_i2c_path(d,PATH_TUNER_OTHER); | ||
193 | cxusb_ctrl_msg(d,CMD_POWER_OFF, NULL, 0, &b, 1); | ||
194 | |||
195 | if (usb_set_interface(d->udev,0,6) < 0) | 181 | if (usb_set_interface(d->udev,0,6) < 0) |
196 | err("set interface failed"); | 182 | err("set interface failed"); |
197 | 183 | ||
198 | cxusb_ctrl_msg(d,0x36, buf, 2, NULL, 0); | 184 | cxusb_ctrl_msg(d,CMD_DIGITAL, NULL, 0, &b, 1); |
199 | cxusb_set_i2c_path(d,PATH_CX22702); | ||
200 | cxusb_ctrl_msg(d,CMD_POWER_ON, NULL, 0, &b, 1); | ||
201 | 185 | ||
202 | if ((d->fe = cx22702_attach(&cxusb_cx22702_config, &d->i2c_adap)) != NULL) | 186 | if ((d->fe = cx22702_attach(&cxusb_cx22702_config, &d->i2c_adap)) != NULL) |
203 | return 0; | 187 | return 0; |
@@ -211,7 +195,7 @@ static struct dvb_usb_properties cxusb_properties; | |||
211 | static int cxusb_probe(struct usb_interface *intf, | 195 | static int cxusb_probe(struct usb_interface *intf, |
212 | const struct usb_device_id *id) | 196 | const struct usb_device_id *id) |
213 | { | 197 | { |
214 | return dvb_usb_device_init(intf,&cxusb_properties,THIS_MODULE); | 198 | return dvb_usb_device_init(intf,&cxusb_properties,THIS_MODULE,NULL); |
215 | } | 199 | } |
216 | 200 | ||
217 | static struct usb_device_id cxusb_table [] = { | 201 | static struct usb_device_id cxusb_table [] = { |
@@ -237,14 +221,12 @@ static struct dvb_usb_properties cxusb_properties = { | |||
237 | .generic_bulk_ctrl_endpoint = 0x01, | 221 | .generic_bulk_ctrl_endpoint = 0x01, |
238 | /* parameter for the MPEG2-data transfer */ | 222 | /* parameter for the MPEG2-data transfer */ |
239 | .urb = { | 223 | .urb = { |
240 | .type = DVB_USB_ISOC, | 224 | .type = DVB_USB_BULK, |
241 | .count = 5, | 225 | .count = 5, |
242 | .endpoint = 0x02, | 226 | .endpoint = 0x02, |
243 | .u = { | 227 | .u = { |
244 | .isoc = { | 228 | .bulk = { |
245 | .framesperurb = 32, | 229 | .buffersize = 8192, |
246 | .framesize = 940, | ||
247 | .interval = 5, | ||
248 | } | 230 | } |
249 | } | 231 | } |
250 | }, | 232 | }, |
diff --git a/drivers/media/dvb/dvb-usb/cxusb.h b/drivers/media/dvb/dvb-usb/cxusb.h index 1d79016e3195..135c2a81f581 100644 --- a/drivers/media/dvb/dvb-usb/cxusb.h +++ b/drivers/media/dvb/dvb-usb/cxusb.h | |||
@@ -1,30 +1,31 @@ | |||
1 | #ifndef _DVB_USB_CXUSB_H_ | 1 | #ifndef _DVB_USB_CXUSB_H_ |
2 | #define _DVB_USB_CXUSB_H_ | 2 | #define _DVB_USB_CXUSB_H_ |
3 | 3 | ||
4 | #define DVB_USB_LOG_PREFIX "digitv" | 4 | #define DVB_USB_LOG_PREFIX "cxusb" |
5 | #include "dvb-usb.h" | 5 | #include "dvb-usb.h" |
6 | 6 | ||
7 | extern int dvb_usb_cxusb_debug; | 7 | extern int dvb_usb_cxusb_debug; |
8 | #define deb_info(args...) dprintk(dvb_usb_cxusb_debug,0x01,args) | 8 | #define deb_info(args...) dprintk(dvb_usb_cxusb_debug,0x01,args) |
9 | 9 | ||
10 | /* usb commands - some of it are guesses, don't have a reference yet */ | 10 | /* usb commands - some of it are guesses, don't have a reference yet */ |
11 | #define CMD_I2C_WRITE 0x08 | 11 | #define CMD_I2C_WRITE 0x08 |
12 | #define CMD_I2C_READ 0x09 | 12 | #define CMD_I2C_READ 0x09 |
13 | 13 | ||
14 | #define CMD_IOCTL 0x0e | 14 | #define CMD_GPIO_READ 0x0d |
15 | #define IOCTL_SET_I2C_PATH 0x02 | 15 | #define CMD_GPIO_WRITE 0x0e |
16 | #define GPIO_TUNER 0x02 | ||
16 | 17 | ||
17 | #define CMD_POWER_OFF 0x50 | 18 | #define CMD_POWER_OFF 0xdc |
18 | #define CMD_POWER_ON 0x51 | 19 | #define CMD_POWER_ON 0xde |
19 | 20 | ||
20 | enum cxusb_i2c_pathes { | 21 | #define CMD_STREAMING_ON 0x36 |
21 | PATH_UNDEF = 0x00, | 22 | #define CMD_STREAMING_OFF 0x37 |
22 | PATH_CX22702 = 0x01, | 23 | |
23 | PATH_TUNER_OTHER = 0x02, | 24 | #define CMD_ANALOG 0x50 |
24 | }; | 25 | #define CMD_DIGITAL 0x51 |
25 | 26 | ||
26 | struct cxusb_state { | 27 | struct cxusb_state { |
27 | enum cxusb_i2c_pathes cur_i2c_path; | 28 | u8 gpio_write_state[3]; |
28 | }; | 29 | }; |
29 | 30 | ||
30 | #endif | 31 | #endif |
diff --git a/drivers/media/dvb/dvb-usb/dibusb-mb.c b/drivers/media/dvb/dvb-usb/dibusb-mb.c index 828b5182e16c..0058505634a0 100644 --- a/drivers/media/dvb/dvb-usb/dibusb-mb.c +++ b/drivers/media/dvb/dvb-usb/dibusb-mb.c | |||
@@ -86,9 +86,9 @@ static struct dvb_usb_properties dibusb2_0b_properties; | |||
86 | static int dibusb_probe(struct usb_interface *intf, | 86 | static int dibusb_probe(struct usb_interface *intf, |
87 | const struct usb_device_id *id) | 87 | const struct usb_device_id *id) |
88 | { | 88 | { |
89 | if (dvb_usb_device_init(intf,&dibusb1_1_properties,THIS_MODULE) == 0 || | 89 | if (dvb_usb_device_init(intf,&dibusb1_1_properties,THIS_MODULE,NULL) == 0 || |
90 | dvb_usb_device_init(intf,&dibusb1_1_an2235_properties,THIS_MODULE) == 0 || | 90 | dvb_usb_device_init(intf,&dibusb1_1_an2235_properties,THIS_MODULE,NULL) == 0 || |
91 | dvb_usb_device_init(intf,&dibusb2_0b_properties,THIS_MODULE) == 0) | 91 | dvb_usb_device_init(intf,&dibusb2_0b_properties,THIS_MODULE,NULL) == 0) |
92 | return 0; | 92 | return 0; |
93 | 93 | ||
94 | return -EINVAL; | 94 | return -EINVAL; |
@@ -126,10 +126,12 @@ static struct usb_device_id dibusb_dib3000mb_table [] = { | |||
126 | /* 25 */ { USB_DEVICE(USB_VID_KYE, USB_PID_KYE_DVB_T_COLD) }, | 126 | /* 25 */ { USB_DEVICE(USB_VID_KYE, USB_PID_KYE_DVB_T_COLD) }, |
127 | /* 26 */ { USB_DEVICE(USB_VID_KYE, USB_PID_KYE_DVB_T_WARM) }, | 127 | /* 26 */ { USB_DEVICE(USB_VID_KYE, USB_PID_KYE_DVB_T_WARM) }, |
128 | 128 | ||
129 | /* 27 */ { USB_DEVICE(USB_VID_KWORLD, USB_PID_KWORLD_VSTREAM_COLD) }, | ||
130 | |||
129 | // #define DVB_USB_DIBUSB_MB_FAULTY_USB_IDs | 131 | // #define DVB_USB_DIBUSB_MB_FAULTY_USB_IDs |
130 | 132 | ||
131 | #ifdef DVB_USB_DIBUSB_MB_FAULTY_USB_IDs | 133 | #ifdef DVB_USB_DIBUSB_MB_FAULTY_USB_IDs |
132 | /* 27 */ { USB_DEVICE(USB_VID_ANCHOR, USB_PID_ULTIMA_TVBOX_ANCHOR_COLD) }, | 134 | /* 28 */ { USB_DEVICE(USB_VID_ANCHOR, USB_PID_ULTIMA_TVBOX_ANCHOR_COLD) }, |
133 | #endif | 135 | #endif |
134 | { } /* Terminating entry */ | 136 | { } /* Terminating entry */ |
135 | }; | 137 | }; |
@@ -262,7 +264,7 @@ static struct dvb_usb_properties dibusb1_1_an2235_properties = { | |||
262 | }, | 264 | }, |
263 | #ifdef DVB_USB_DIBUSB_MB_FAULTY_USB_IDs | 265 | #ifdef DVB_USB_DIBUSB_MB_FAULTY_USB_IDs |
264 | { "Artec T1 USB1.1 TVBOX with AN2235 (faulty USB IDs)", | 266 | { "Artec T1 USB1.1 TVBOX with AN2235 (faulty USB IDs)", |
265 | { &dibusb_dib3000mb_table[27], NULL }, | 267 | { &dibusb_dib3000mb_table[28], NULL }, |
266 | { NULL }, | 268 | { NULL }, |
267 | }, | 269 | }, |
268 | #endif | 270 | #endif |
@@ -306,12 +308,16 @@ static struct dvb_usb_properties dibusb2_0b_properties = { | |||
306 | } | 308 | } |
307 | }, | 309 | }, |
308 | 310 | ||
309 | .num_device_descs = 1, | 311 | .num_device_descs = 2, |
310 | .devices = { | 312 | .devices = { |
311 | { "KWorld/ADSTech Instant DVB-T USB 2.0", | 313 | { "KWorld/ADSTech Instant DVB-T USB2.0", |
312 | { &dibusb_dib3000mb_table[23], NULL }, | 314 | { &dibusb_dib3000mb_table[23], NULL }, |
313 | { &dibusb_dib3000mb_table[24], NULL }, | 315 | { &dibusb_dib3000mb_table[24], NULL }, |
314 | }, | 316 | }, |
317 | { "KWorld Xpert DVB-T USB2.0", | ||
318 | { &dibusb_dib3000mb_table[27], NULL }, | ||
319 | { NULL } | ||
320 | }, | ||
315 | } | 321 | } |
316 | }; | 322 | }; |
317 | 323 | ||
diff --git a/drivers/media/dvb/dvb-usb/dibusb-mc.c b/drivers/media/dvb/dvb-usb/dibusb-mc.c index e9dac430f37d..6a0912eab396 100644 --- a/drivers/media/dvb/dvb-usb/dibusb-mc.c +++ b/drivers/media/dvb/dvb-usb/dibusb-mc.c | |||
@@ -20,7 +20,7 @@ static struct dvb_usb_properties dibusb_mc_properties; | |||
20 | static int dibusb_mc_probe(struct usb_interface *intf, | 20 | static int dibusb_mc_probe(struct usb_interface *intf, |
21 | const struct usb_device_id *id) | 21 | const struct usb_device_id *id) |
22 | { | 22 | { |
23 | return dvb_usb_device_init(intf,&dibusb_mc_properties,THIS_MODULE); | 23 | return dvb_usb_device_init(intf,&dibusb_mc_properties,THIS_MODULE,NULL); |
24 | } | 24 | } |
25 | 25 | ||
26 | /* do not change the order of the ID table */ | 26 | /* do not change the order of the ID table */ |
diff --git a/drivers/media/dvb/dvb-usb/digitv.c b/drivers/media/dvb/dvb-usb/digitv.c index f70e0be0920a..74545f82eff1 100644 --- a/drivers/media/dvb/dvb-usb/digitv.c +++ b/drivers/media/dvb/dvb-usb/digitv.c | |||
@@ -111,31 +111,28 @@ static int digitv_mt352_demod_init(struct dvb_frontend *fe) | |||
111 | } | 111 | } |
112 | 112 | ||
113 | static struct mt352_config digitv_mt352_config = { | 113 | static struct mt352_config digitv_mt352_config = { |
114 | .demod_address = 0x0, /* ignored by the digitv anyway */ | ||
115 | .demod_init = digitv_mt352_demod_init, | 114 | .demod_init = digitv_mt352_demod_init, |
116 | .pll_set = dvb_usb_pll_set, | 115 | .pll_set = dvb_usb_pll_set, |
117 | }; | 116 | }; |
118 | 117 | ||
119 | static struct nxt6000_config digitv_nxt6000_config = { | 118 | static int digitv_nxt6000_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep) |
120 | .demod_address = 0x0, /* ignored by the digitv anyway */ | 119 | { |
121 | .clock_inversion = 0x0, | 120 | struct dvb_usb_device *d = fe->dvb->priv; |
121 | u8 b[5]; | ||
122 | dvb_usb_pll_set(fe,fep,b); | ||
123 | return digitv_ctrl_msg(d,USB_WRITE_TUNER,0,&b[1],4,NULL,0); | ||
124 | } | ||
122 | 125 | ||
123 | .pll_init = NULL, | 126 | static struct nxt6000_config digitv_nxt6000_config = { |
124 | .pll_set = NULL, | 127 | .clock_inversion = 1, |
128 | .pll_set = digitv_nxt6000_pll_set, | ||
125 | }; | 129 | }; |
126 | 130 | ||
127 | static int digitv_frontend_attach(struct dvb_usb_device *d) | 131 | static int digitv_frontend_attach(struct dvb_usb_device *d) |
128 | { | 132 | { |
129 | if ((d->fe = mt352_attach(&digitv_mt352_config, &d->i2c_adap)) != NULL) | 133 | if ((d->fe = mt352_attach(&digitv_mt352_config, &d->i2c_adap)) != NULL || |
134 | (d->fe = nxt6000_attach(&digitv_nxt6000_config, &d->i2c_adap)) != NULL) | ||
130 | return 0; | 135 | return 0; |
131 | if ((d->fe = nxt6000_attach(&digitv_nxt6000_config, &d->i2c_adap)) != NULL) { | ||
132 | |||
133 | warn("nxt6000 support is not done yet, in fact you are one of the first " | ||
134 | "person who wants to use this device in Linux. Please report to " | ||
135 | "linux-dvb@linuxtv.org"); | ||
136 | |||
137 | return 0; | ||
138 | } | ||
139 | return -EIO; | 136 | return -EIO; |
140 | } | 137 | } |
141 | 138 | ||
@@ -173,7 +170,18 @@ static struct dvb_usb_properties digitv_properties; | |||
173 | static int digitv_probe(struct usb_interface *intf, | 170 | static int digitv_probe(struct usb_interface *intf, |
174 | const struct usb_device_id *id) | 171 | const struct usb_device_id *id) |
175 | { | 172 | { |
176 | return dvb_usb_device_init(intf,&digitv_properties,THIS_MODULE); | 173 | struct dvb_usb_device *d; |
174 | int ret; | ||
175 | if ((ret = dvb_usb_device_init(intf,&digitv_properties,THIS_MODULE,&d)) == 0) { | ||
176 | u8 b[4] = { 0 }; | ||
177 | |||
178 | b[0] = 1; | ||
179 | digitv_ctrl_msg(d,USB_WRITE_REMOTE_TYPE,0,b,4,NULL,0); | ||
180 | |||
181 | b[0] = 0; | ||
182 | digitv_ctrl_msg(d,USB_WRITE_REMOTE,0,b,4,NULL,0); | ||
183 | } | ||
184 | return ret; | ||
177 | } | 185 | } |
178 | 186 | ||
179 | static struct usb_device_id digitv_table [] = { | 187 | static struct usb_device_id digitv_table [] = { |
diff --git a/drivers/media/dvb/dvb-usb/dtt200u-fe.c b/drivers/media/dvb/dvb-usb/dtt200u-fe.c index b032523b07bc..0a94ec22aeb8 100644 --- a/drivers/media/dvb/dvb-usb/dtt200u-fe.c +++ b/drivers/media/dvb/dvb-usb/dtt200u-fe.c | |||
@@ -18,6 +18,7 @@ struct dtt200u_fe_state { | |||
18 | 18 | ||
19 | struct dvb_frontend_parameters fep; | 19 | struct dvb_frontend_parameters fep; |
20 | struct dvb_frontend frontend; | 20 | struct dvb_frontend frontend; |
21 | struct dvb_frontend_ops ops; | ||
21 | }; | 22 | }; |
22 | 23 | ||
23 | static int dtt200u_fe_read_status(struct dvb_frontend* fe, fe_status_t *stat) | 24 | static int dtt200u_fe_read_status(struct dvb_frontend* fe, fe_status_t *stat) |
@@ -163,8 +164,9 @@ struct dvb_frontend* dtt200u_fe_attach(struct dvb_usb_device *d) | |||
163 | deb_info("attaching frontend dtt200u\n"); | 164 | deb_info("attaching frontend dtt200u\n"); |
164 | 165 | ||
165 | state->d = d; | 166 | state->d = d; |
167 | memcpy(&state->ops,&dtt200u_fe_ops,sizeof(struct dvb_frontend_ops)); | ||
166 | 168 | ||
167 | state->frontend.ops = &dtt200u_fe_ops; | 169 | state->frontend.ops = &state->ops; |
168 | state->frontend.demodulator_priv = state; | 170 | state->frontend.demodulator_priv = state; |
169 | 171 | ||
170 | goto success; | 172 | goto success; |
diff --git a/drivers/media/dvb/dvb-usb/dtt200u.c b/drivers/media/dvb/dvb-usb/dtt200u.c index 47dba6e45968..5aa12ebab34f 100644 --- a/drivers/media/dvb/dvb-usb/dtt200u.c +++ b/drivers/media/dvb/dvb-usb/dtt200u.c | |||
@@ -98,20 +98,19 @@ static struct dvb_usb_properties wt220u_properties; | |||
98 | static int dtt200u_usb_probe(struct usb_interface *intf, | 98 | static int dtt200u_usb_probe(struct usb_interface *intf, |
99 | const struct usb_device_id *id) | 99 | const struct usb_device_id *id) |
100 | { | 100 | { |
101 | if (dvb_usb_device_init(intf,&dtt200u_properties,THIS_MODULE) == 0 || | 101 | if (dvb_usb_device_init(intf,&dtt200u_properties,THIS_MODULE,NULL) == 0 || |
102 | dvb_usb_device_init(intf,&wt220u_properties,THIS_MODULE) == 0) | 102 | dvb_usb_device_init(intf,&wt220u_properties,THIS_MODULE,NULL) == 0) |
103 | return 0; | 103 | return 0; |
104 | 104 | ||
105 | return -ENODEV; | 105 | return -ENODEV; |
106 | } | 106 | } |
107 | 107 | ||
108 | static struct usb_device_id dtt200u_usb_table [] = { | 108 | static struct usb_device_id dtt200u_usb_table [] = { |
109 | // { USB_DEVICE(0x04b4,0x8613) }, | 109 | { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_DTT200U_COLD) }, |
110 | { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_DTT200U_COLD) }, | 110 | { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_DTT200U_WARM) }, |
111 | { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_DTT200U_WARM) }, | 111 | { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_WT220U_COLD) }, |
112 | { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_WT220U_COLD) }, | 112 | { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_WT220U_WARM) }, |
113 | { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_WT220U_WARM) }, | 113 | { 0 }, |
114 | { 0 }, | ||
115 | }; | 114 | }; |
116 | MODULE_DEVICE_TABLE(usb, dtt200u_usb_table); | 115 | MODULE_DEVICE_TABLE(usb, dtt200u_usb_table); |
117 | 116 | ||
@@ -189,7 +188,7 @@ static struct dvb_usb_properties wt220u_properties = { | |||
189 | 188 | ||
190 | .num_device_descs = 1, | 189 | .num_device_descs = 1, |
191 | .devices = { | 190 | .devices = { |
192 | { .name = "WideView WT-220U PenType Receiver (and clones)", | 191 | { .name = "WideView WT-220U PenType Receiver (Typhoon/Freecom)", |
193 | .cold_ids = { &dtt200u_usb_table[2], NULL }, | 192 | .cold_ids = { &dtt200u_usb_table[2], NULL }, |
194 | .warm_ids = { &dtt200u_usb_table[3], NULL }, | 193 | .warm_ids = { &dtt200u_usb_table[3], NULL }, |
195 | }, | 194 | }, |
@@ -201,9 +200,9 @@ static struct dvb_usb_properties wt220u_properties = { | |||
201 | static struct usb_driver dtt200u_usb_driver = { | 200 | static struct usb_driver dtt200u_usb_driver = { |
202 | .owner = THIS_MODULE, | 201 | .owner = THIS_MODULE, |
203 | .name = "dvb_usb_dtt200u", | 202 | .name = "dvb_usb_dtt200u", |
204 | .probe = dtt200u_usb_probe, | 203 | .probe = dtt200u_usb_probe, |
205 | .disconnect = dvb_usb_device_exit, | 204 | .disconnect = dvb_usb_device_exit, |
206 | .id_table = dtt200u_usb_table, | 205 | .id_table = dtt200u_usb_table, |
207 | }; | 206 | }; |
208 | 207 | ||
209 | /* module stuff */ | 208 | /* module stuff */ |
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h index 794d513a8480..0818996bf150 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h | |||
@@ -24,8 +24,10 @@ | |||
24 | #define USB_VID_HANFTEK 0x15f4 | 24 | #define USB_VID_HANFTEK 0x15f4 |
25 | #define USB_VID_HAUPPAUGE 0x2040 | 25 | #define USB_VID_HAUPPAUGE 0x2040 |
26 | #define USB_VID_HYPER_PALTEK 0x1025 | 26 | #define USB_VID_HYPER_PALTEK 0x1025 |
27 | #define USB_VID_KWORLD 0xeb2a | ||
27 | #define USB_VID_KYE 0x0458 | 28 | #define USB_VID_KYE 0x0458 |
28 | #define USB_VID_MEDION 0x1660 | 29 | #define USB_VID_MEDION 0x1660 |
30 | #define USB_VID_PINNACLE 0x2304 | ||
29 | #define USB_VID_VISIONPLUS 0x13d3 | 31 | #define USB_VID_VISIONPLUS 0x13d3 |
30 | #define USB_VID_TWINHAN 0x1822 | 32 | #define USB_VID_TWINHAN 0x1822 |
31 | #define USB_VID_ULTIMA_ELECTRONIC 0x05d8 | 33 | #define USB_VID_ULTIMA_ELECTRONIC 0x05d8 |
@@ -52,12 +54,14 @@ | |||
52 | #define USB_PID_KWORLD_VSTREAM_WARM 0x17df | 54 | #define USB_PID_KWORLD_VSTREAM_WARM 0x17df |
53 | #define USB_PID_TWINHAN_VP7041_COLD 0x3201 | 55 | #define USB_PID_TWINHAN_VP7041_COLD 0x3201 |
54 | #define USB_PID_TWINHAN_VP7041_WARM 0x3202 | 56 | #define USB_PID_TWINHAN_VP7041_WARM 0x3202 |
57 | #define USB_PID_TWINHAN_VP7020_COLD 0x3203 | ||
58 | #define USB_PID_TWINHAN_VP7020_WARM 0x3204 | ||
55 | #define USB_PID_TWINHAN_VP7045_COLD 0x3205 | 59 | #define USB_PID_TWINHAN_VP7045_COLD 0x3205 |
56 | #define USB_PID_TWINHAN_VP7045_WARM 0x3206 | 60 | #define USB_PID_TWINHAN_VP7045_WARM 0x3206 |
57 | #define USB_PID_DNTV_TINYUSB2_COLD 0x3223 | ||
58 | #define USB_PID_DNTV_TINYUSB2_WARM 0x3224 | ||
59 | #define USB_PID_TWINHAN_VP7021_COLD 0x3207 | 61 | #define USB_PID_TWINHAN_VP7021_COLD 0x3207 |
60 | #define USB_PID_TWINHAN_VP7021_WARM 0x3208 | 62 | #define USB_PID_TWINHAN_VP7021_WARM 0x3208 |
63 | #define USB_PID_DNTV_TINYUSB2_COLD 0x3223 | ||
64 | #define USB_PID_DNTV_TINYUSB2_WARM 0x3224 | ||
61 | #define USB_PID_ULTIMA_TVBOX_COLD 0x8105 | 65 | #define USB_PID_ULTIMA_TVBOX_COLD 0x8105 |
62 | #define USB_PID_ULTIMA_TVBOX_WARM 0x8106 | 66 | #define USB_PID_ULTIMA_TVBOX_WARM 0x8106 |
63 | #define USB_PID_ULTIMA_TVBOX_AN2235_COLD 0x8107 | 67 | #define USB_PID_ULTIMA_TVBOX_AN2235_COLD 0x8107 |
@@ -85,5 +89,7 @@ | |||
85 | #define USB_PID_MEDION_MD95700 0x0932 | 89 | #define USB_PID_MEDION_MD95700 0x0932 |
86 | #define USB_PID_KYE_DVB_T_COLD 0x701e | 90 | #define USB_PID_KYE_DVB_T_COLD 0x701e |
87 | #define USB_PID_KYE_DVB_T_WARM 0x701f | 91 | #define USB_PID_KYE_DVB_T_WARM 0x701f |
92 | #define USB_PID_PCTV_200E 0x020e | ||
93 | #define USB_PID_PCTV_400E 0x020f | ||
88 | 94 | ||
89 | #endif | 95 | #endif |
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-init.c b/drivers/media/dvb/dvb-usb/dvb-usb-init.c index 65f0c095abc9..a902059812a2 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-init.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-init.c | |||
@@ -128,7 +128,9 @@ static struct dvb_usb_device_description * dvb_usb_find_device(struct usb_device | |||
128 | /* | 128 | /* |
129 | * USB | 129 | * USB |
130 | */ | 130 | */ |
131 | int dvb_usb_device_init(struct usb_interface *intf, struct dvb_usb_properties *props, struct module *owner) | 131 | |
132 | int dvb_usb_device_init(struct usb_interface *intf, struct dvb_usb_properties | ||
133 | *props, struct module *owner,struct dvb_usb_device **du) | ||
132 | { | 134 | { |
133 | struct usb_device *udev = interface_to_usbdev(intf); | 135 | struct usb_device *udev = interface_to_usbdev(intf); |
134 | struct dvb_usb_device *d = NULL; | 136 | struct dvb_usb_device *d = NULL; |
@@ -170,6 +172,9 @@ int dvb_usb_device_init(struct usb_interface *intf, struct dvb_usb_properties *p | |||
170 | 172 | ||
171 | usb_set_intfdata(intf, d); | 173 | usb_set_intfdata(intf, d); |
172 | 174 | ||
175 | if (du != NULL) | ||
176 | *du = d; | ||
177 | |||
173 | ret = dvb_usb_init(d); | 178 | ret = dvb_usb_init(d); |
174 | } | 179 | } |
175 | 180 | ||
@@ -196,19 +201,6 @@ void dvb_usb_device_exit(struct usb_interface *intf) | |||
196 | } | 201 | } |
197 | EXPORT_SYMBOL(dvb_usb_device_exit); | 202 | EXPORT_SYMBOL(dvb_usb_device_exit); |
198 | 203 | ||
199 | /* module stuff */ | ||
200 | static int __init dvb_usb_module_init(void) | ||
201 | { | ||
202 | return 0; | ||
203 | } | ||
204 | |||
205 | static void __exit dvb_usb_module_exit(void) | ||
206 | { | ||
207 | } | ||
208 | |||
209 | module_init (dvb_usb_module_init); | ||
210 | module_exit (dvb_usb_module_exit); | ||
211 | |||
212 | MODULE_VERSION("0.3"); | 204 | MODULE_VERSION("0.3"); |
213 | MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); | 205 | MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); |
214 | MODULE_DESCRIPTION("A library module containing commonly used USB and DVB function USB DVB devices"); | 206 | MODULE_DESCRIPTION("A library module containing commonly used USB and DVB function USB DVB devices"); |
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb.h b/drivers/media/dvb/dvb-usb/dvb-usb.h index a80567caf508..0e4f1035b0dd 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb.h | |||
@@ -127,7 +127,7 @@ struct dvb_usb_device; | |||
127 | * helper functions. | 127 | * helper functions. |
128 | * | 128 | * |
129 | * @urb: describes the kind of USB transfer used for MPEG2-TS-streaming. | 129 | * @urb: describes the kind of USB transfer used for MPEG2-TS-streaming. |
130 | * Currently only BULK is implemented | 130 | * (BULK or ISOC) |
131 | * | 131 | * |
132 | * @num_device_descs: number of struct dvb_usb_device_description in @devices | 132 | * @num_device_descs: number of struct dvb_usb_device_description in @devices |
133 | * @devices: array of struct dvb_usb_device_description compatibles with these | 133 | * @devices: array of struct dvb_usb_device_description compatibles with these |
@@ -310,7 +310,7 @@ struct dvb_usb_device { | |||
310 | void *priv; | 310 | void *priv; |
311 | }; | 311 | }; |
312 | 312 | ||
313 | extern int dvb_usb_device_init(struct usb_interface *, struct dvb_usb_properties *, struct module *); | 313 | extern int dvb_usb_device_init(struct usb_interface *, struct dvb_usb_properties *, struct module *, struct dvb_usb_device **); |
314 | extern void dvb_usb_device_exit(struct usb_interface *); | 314 | extern void dvb_usb_device_exit(struct usb_interface *); |
315 | 315 | ||
316 | /* the generic read/write method for device control */ | 316 | /* the generic read/write method for device control */ |
diff --git a/drivers/media/dvb/dvb-usb/nova-t-usb2.c b/drivers/media/dvb/dvb-usb/nova-t-usb2.c index 258a92bfbcc7..1841a66427bf 100644 --- a/drivers/media/dvb/dvb-usb/nova-t-usb2.c +++ b/drivers/media/dvb/dvb-usb/nova-t-usb2.c | |||
@@ -144,7 +144,7 @@ static struct dvb_usb_properties nova_t_properties; | |||
144 | static int nova_t_probe(struct usb_interface *intf, | 144 | static int nova_t_probe(struct usb_interface *intf, |
145 | const struct usb_device_id *id) | 145 | const struct usb_device_id *id) |
146 | { | 146 | { |
147 | return dvb_usb_device_init(intf,&nova_t_properties,THIS_MODULE); | 147 | return dvb_usb_device_init(intf,&nova_t_properties,THIS_MODULE,NULL); |
148 | } | 148 | } |
149 | 149 | ||
150 | /* do not change the order of the ID table */ | 150 | /* do not change the order of the ID table */ |
diff --git a/drivers/media/dvb/dvb-usb/umt-010.c b/drivers/media/dvb/dvb-usb/umt-010.c index 2112ac3cf5e2..6fd67657c269 100644 --- a/drivers/media/dvb/dvb-usb/umt-010.c +++ b/drivers/media/dvb/dvb-usb/umt-010.c | |||
@@ -77,7 +77,7 @@ static struct dvb_usb_properties umt_properties; | |||
77 | static int umt_probe(struct usb_interface *intf, | 77 | static int umt_probe(struct usb_interface *intf, |
78 | const struct usb_device_id *id) | 78 | const struct usb_device_id *id) |
79 | { | 79 | { |
80 | if (dvb_usb_device_init(intf,&umt_properties,THIS_MODULE) == 0) | 80 | if (dvb_usb_device_init(intf,&umt_properties,THIS_MODULE,NULL) == 0) |
81 | return 0; | 81 | return 0; |
82 | return -EINVAL; | 82 | return -EINVAL; |
83 | } | 83 | } |
diff --git a/drivers/media/dvb/dvb-usb/vp702x-fe.c b/drivers/media/dvb/dvb-usb/vp702x-fe.c new file mode 100644 index 000000000000..f20d8dbd0be8 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/vp702x-fe.c | |||
@@ -0,0 +1,339 @@ | |||
1 | /* DVB frontend part of the Linux driver for the TwinhanDTV StarBox USB2.0 | ||
2 | * DVB-S receiver. | ||
3 | * | ||
4 | * Copyright (C) 2005 Ralph Metzler <rjkm@metzlerbros.de> | ||
5 | * Metzler Brothers Systementwicklung GbR | ||
6 | * | ||
7 | * Copyright (C) 2005 Patrick Boettcher <patrick.boettcher@desy.de> | ||
8 | * | ||
9 | * Thanks to Twinhan who kindly provided hardware and information. | ||
10 | * | ||
11 | * This file can be removed soon, after the DST-driver is rewritten to provice | ||
12 | * the frontend-controlling separately. | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or modify it | ||
15 | * under the terms of the GNU General Public License as published by the Free | ||
16 | * Software Foundation, version 2. | ||
17 | * | ||
18 | * see Documentation/dvb/README.dvb-usb for more information | ||
19 | * | ||
20 | */ | ||
21 | #include "vp702x.h" | ||
22 | |||
23 | struct vp702x_fe_state { | ||
24 | struct dvb_frontend fe; | ||
25 | struct dvb_usb_device *d; | ||
26 | |||
27 | fe_sec_voltage_t voltage; | ||
28 | fe_sec_tone_mode_t tone_mode; | ||
29 | |||
30 | u8 lnb_buf[8]; | ||
31 | |||
32 | u8 lock; | ||
33 | u8 sig; | ||
34 | u8 snr; | ||
35 | |||
36 | unsigned long next_status_check; | ||
37 | unsigned long status_check_interval; | ||
38 | }; | ||
39 | |||
40 | static int vp702x_fe_refresh_state(struct vp702x_fe_state *st) | ||
41 | { | ||
42 | u8 buf[10]; | ||
43 | if (time_after(jiffies,st->next_status_check)) { | ||
44 | vp702x_usb_in_op(st->d,READ_STATUS,0,0,buf,10); | ||
45 | |||
46 | st->lock = buf[4]; | ||
47 | vp702x_usb_in_op(st->d,READ_TUNER_REG_REQ,0x11,0,&st->snr,1); | ||
48 | vp702x_usb_in_op(st->d,READ_TUNER_REG_REQ,0x15,0,&st->sig,1); | ||
49 | |||
50 | st->next_status_check = jiffies + (st->status_check_interval*HZ)/1000; | ||
51 | } | ||
52 | return 0; | ||
53 | } | ||
54 | |||
55 | static u8 vp702x_chksum(u8 *buf,int f, int count) | ||
56 | { | ||
57 | u8 s = 0; | ||
58 | int i; | ||
59 | for (i = f; i < f+count; i++) | ||
60 | s += buf[i]; | ||
61 | return ~s+1; | ||
62 | } | ||
63 | |||
64 | static int vp702x_fe_read_status(struct dvb_frontend* fe, fe_status_t *status) | ||
65 | { | ||
66 | struct vp702x_fe_state *st = fe->demodulator_priv; | ||
67 | vp702x_fe_refresh_state(st); | ||
68 | deb_fe("%s\n",__FUNCTION__); | ||
69 | |||
70 | if (st->lock == 0) | ||
71 | *status = FE_HAS_LOCK | FE_HAS_SYNC | FE_HAS_VITERBI | FE_HAS_SIGNAL | FE_HAS_CARRIER; | ||
72 | else | ||
73 | *status = 0; | ||
74 | |||
75 | deb_fe("real state: %x\n",*status); | ||
76 | *status = 0x1f; | ||
77 | |||
78 | if (*status & FE_HAS_LOCK) | ||
79 | st->status_check_interval = 1000; | ||
80 | else | ||
81 | st->status_check_interval = 250; | ||
82 | return 0; | ||
83 | } | ||
84 | |||
85 | /* not supported by this Frontend */ | ||
86 | static int vp702x_fe_read_ber(struct dvb_frontend* fe, u32 *ber) | ||
87 | { | ||
88 | struct vp702x_fe_state *st = fe->demodulator_priv; | ||
89 | vp702x_fe_refresh_state(st); | ||
90 | *ber = 0; | ||
91 | return 0; | ||
92 | } | ||
93 | |||
94 | /* not supported by this Frontend */ | ||
95 | static int vp702x_fe_read_unc_blocks(struct dvb_frontend* fe, u32 *unc) | ||
96 | { | ||
97 | struct vp702x_fe_state *st = fe->demodulator_priv; | ||
98 | vp702x_fe_refresh_state(st); | ||
99 | *unc = 0; | ||
100 | return 0; | ||
101 | } | ||
102 | |||
103 | static int vp702x_fe_read_signal_strength(struct dvb_frontend* fe, u16 *strength) | ||
104 | { | ||
105 | struct vp702x_fe_state *st = fe->demodulator_priv; | ||
106 | vp702x_fe_refresh_state(st); | ||
107 | |||
108 | *strength = (st->sig << 8) | st->sig; | ||
109 | return 0; | ||
110 | } | ||
111 | |||
112 | static int vp702x_fe_read_snr(struct dvb_frontend* fe, u16 *snr) | ||
113 | { | ||
114 | u8 _snr; | ||
115 | struct vp702x_fe_state *st = fe->demodulator_priv; | ||
116 | vp702x_fe_refresh_state(st); | ||
117 | |||
118 | _snr = (st->snr & 0x1f) * 0xff / 0x1f; | ||
119 | *snr = (_snr << 8) | _snr; | ||
120 | return 0; | ||
121 | } | ||
122 | |||
123 | static int vp702x_fe_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings *tune) | ||
124 | { | ||
125 | deb_fe("%s\n",__FUNCTION__); | ||
126 | tune->min_delay_ms = 2000; | ||
127 | return 0; | ||
128 | } | ||
129 | |||
130 | static int vp702x_fe_set_frontend(struct dvb_frontend* fe, | ||
131 | struct dvb_frontend_parameters *fep) | ||
132 | { | ||
133 | struct vp702x_fe_state *st = fe->demodulator_priv; | ||
134 | u32 freq = fep->frequency/1000; | ||
135 | /*CalFrequency*/ | ||
136 | /* u16 frequencyRef[16] = { 2, 4, 8, 16, 32, 64, 128, 256, 24, 5, 10, 20, 40, 80, 160, 320 }; */ | ||
137 | u64 sr; | ||
138 | u8 cmd[8] = { 0 },ibuf[10]; | ||
139 | |||
140 | cmd[0] = (freq >> 8) & 0x7f; | ||
141 | cmd[1] = freq & 0xff; | ||
142 | cmd[2] = 1; /* divrate == 4 -> frequencyRef[1] -> 1 here */ | ||
143 | |||
144 | sr = (u64) (fep->u.qpsk.symbol_rate/1000) << 20; | ||
145 | do_div(sr,88000); | ||
146 | cmd[3] = (sr >> 12) & 0xff; | ||
147 | cmd[4] = (sr >> 4) & 0xff; | ||
148 | cmd[5] = (sr << 4) & 0xf0; | ||
149 | |||
150 | deb_fe("setting frontend to: %u -> %u (%x) LNB-based GHz, symbolrate: %d -> %Lu (%Lx)\n", | ||
151 | fep->frequency,freq,freq, fep->u.qpsk.symbol_rate, sr, sr); | ||
152 | |||
153 | /* if (fep->inversion == INVERSION_ON) | ||
154 | cmd[6] |= 0x80; */ | ||
155 | |||
156 | if (st->voltage == SEC_VOLTAGE_18) | ||
157 | cmd[6] |= 0x40; | ||
158 | |||
159 | /* if (fep->u.qpsk.symbol_rate > 8000000) | ||
160 | cmd[6] |= 0x20; | ||
161 | |||
162 | if (fep->frequency < 1531000) | ||
163 | cmd[6] |= 0x04; | ||
164 | |||
165 | if (st->tone_mode == SEC_TONE_ON) | ||
166 | cmd[6] |= 0x01;*/ | ||
167 | |||
168 | cmd[7] = vp702x_chksum(cmd,0,7); | ||
169 | |||
170 | st->status_check_interval = 250; | ||
171 | st->next_status_check = jiffies; | ||
172 | |||
173 | vp702x_usb_in_op(st->d, RESET_TUNER, 0, 0, NULL, 0); | ||
174 | msleep(30); | ||
175 | vp702x_usb_inout_op(st->d,cmd,8,ibuf,10,100); | ||
176 | |||
177 | if (ibuf[2] == 0 && ibuf[3] == 0) | ||
178 | deb_fe("tuning failed.\n"); | ||
179 | else | ||
180 | deb_fe("tuning succeeded.\n"); | ||
181 | |||
182 | return 0; | ||
183 | } | ||
184 | |||
185 | static int vp702x_fe_get_frontend(struct dvb_frontend* fe, | ||
186 | struct dvb_frontend_parameters *fep) | ||
187 | { | ||
188 | deb_fe("%s\n",__FUNCTION__); | ||
189 | return 0; | ||
190 | } | ||
191 | |||
192 | static int vp702x_fe_send_diseqc_msg (struct dvb_frontend* fe, | ||
193 | struct dvb_diseqc_master_cmd *m) | ||
194 | { | ||
195 | struct vp702x_fe_state *st = fe->demodulator_priv; | ||
196 | u8 cmd[8],ibuf[10]; | ||
197 | memset(cmd,0,8); | ||
198 | |||
199 | deb_fe("%s\n",__FUNCTION__); | ||
200 | |||
201 | if (m->msg_len > 4) | ||
202 | return -EINVAL; | ||
203 | |||
204 | cmd[1] = SET_DISEQC_CMD; | ||
205 | cmd[2] = m->msg_len; | ||
206 | memcpy(&cmd[3], m->msg, m->msg_len); | ||
207 | cmd[7] = vp702x_chksum(cmd,0,7); | ||
208 | |||
209 | vp702x_usb_inout_op(st->d,cmd,8,ibuf,10,100); | ||
210 | |||
211 | if (ibuf[2] == 0 && ibuf[3] == 0) | ||
212 | deb_fe("diseqc cmd failed.\n"); | ||
213 | else | ||
214 | deb_fe("diseqc cmd succeeded.\n"); | ||
215 | |||
216 | return 0; | ||
217 | } | ||
218 | |||
219 | static int vp702x_fe_send_diseqc_burst (struct dvb_frontend* fe, fe_sec_mini_cmd_t burst) | ||
220 | { | ||
221 | deb_fe("%s\n",__FUNCTION__); | ||
222 | return 0; | ||
223 | } | ||
224 | |||
225 | static int vp702x_fe_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) | ||
226 | { | ||
227 | struct vp702x_fe_state *st = fe->demodulator_priv; | ||
228 | u8 ibuf[10]; | ||
229 | deb_fe("%s\n",__FUNCTION__); | ||
230 | |||
231 | st->tone_mode = tone; | ||
232 | |||
233 | if (tone == SEC_TONE_ON) | ||
234 | st->lnb_buf[2] = 0x02; | ||
235 | else | ||
236 | st->lnb_buf[2] = 0x00; | ||
237 | |||
238 | st->lnb_buf[7] = vp702x_chksum(st->lnb_buf,0,7); | ||
239 | |||
240 | vp702x_usb_inout_op(st->d,st->lnb_buf,8,ibuf,10,100); | ||
241 | if (ibuf[2] == 0 && ibuf[3] == 0) | ||
242 | deb_fe("set_tone cmd failed.\n"); | ||
243 | else | ||
244 | deb_fe("set_tone cmd succeeded.\n"); | ||
245 | |||
246 | return 0; | ||
247 | } | ||
248 | |||
249 | static int vp702x_fe_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t | ||
250 | voltage) | ||
251 | { | ||
252 | struct vp702x_fe_state *st = fe->demodulator_priv; | ||
253 | u8 ibuf[10]; | ||
254 | deb_fe("%s\n",__FUNCTION__); | ||
255 | |||
256 | st->voltage = voltage; | ||
257 | |||
258 | if (voltage != SEC_VOLTAGE_OFF) | ||
259 | st->lnb_buf[4] = 0x01; | ||
260 | else | ||
261 | st->lnb_buf[4] = 0x00; | ||
262 | |||
263 | st->lnb_buf[7] = vp702x_chksum(st->lnb_buf,0,7); | ||
264 | |||
265 | vp702x_usb_inout_op(st->d,st->lnb_buf,8,ibuf,10,100); | ||
266 | if (ibuf[2] == 0 && ibuf[3] == 0) | ||
267 | deb_fe("set_voltage cmd failed.\n"); | ||
268 | else | ||
269 | deb_fe("set_voltage cmd succeeded.\n"); | ||
270 | |||
271 | return 0; | ||
272 | } | ||
273 | |||
274 | static void vp702x_fe_release(struct dvb_frontend* fe) | ||
275 | { | ||
276 | struct vp702x_fe_state *st = fe->demodulator_priv; | ||
277 | kfree(st); | ||
278 | } | ||
279 | |||
280 | static struct dvb_frontend_ops vp702x_fe_ops; | ||
281 | |||
282 | struct dvb_frontend * vp702x_fe_attach(struct dvb_usb_device *d) | ||
283 | { | ||
284 | struct vp702x_fe_state *s = kmalloc(sizeof(struct vp702x_fe_state), GFP_KERNEL); | ||
285 | if (s == NULL) | ||
286 | goto error; | ||
287 | memset(s,0,sizeof(struct vp702x_fe_state)); | ||
288 | |||
289 | s->d = d; | ||
290 | s->fe.ops = &vp702x_fe_ops; | ||
291 | s->fe.demodulator_priv = s; | ||
292 | |||
293 | s->lnb_buf[1] = SET_LNB_POWER; | ||
294 | s->lnb_buf[3] = 0xff; /* 0=tone burst, 2=data burst, ff=off */ | ||
295 | |||
296 | goto success; | ||
297 | error: | ||
298 | return NULL; | ||
299 | success: | ||
300 | return &s->fe; | ||
301 | } | ||
302 | |||
303 | |||
304 | static struct dvb_frontend_ops vp702x_fe_ops = { | ||
305 | .info = { | ||
306 | .name = "Twinhan DST-like frontend (VP7021/VP7020) DVB-S", | ||
307 | .type = FE_QPSK, | ||
308 | .frequency_min = 950000, | ||
309 | .frequency_max = 2150000, | ||
310 | .frequency_stepsize = 1000, /* kHz for QPSK frontends */ | ||
311 | .frequency_tolerance = 0, | ||
312 | .symbol_rate_min = 1000000, | ||
313 | .symbol_rate_max = 45000000, | ||
314 | .symbol_rate_tolerance = 500, /* ppm */ | ||
315 | .caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | | ||
316 | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | | ||
317 | FE_CAN_QPSK | | ||
318 | FE_CAN_FEC_AUTO | ||
319 | }, | ||
320 | .release = vp702x_fe_release, | ||
321 | |||
322 | .init = NULL, | ||
323 | .sleep = NULL, | ||
324 | |||
325 | .set_frontend = vp702x_fe_set_frontend, | ||
326 | .get_frontend = vp702x_fe_get_frontend, | ||
327 | .get_tune_settings = vp702x_fe_get_tune_settings, | ||
328 | |||
329 | .read_status = vp702x_fe_read_status, | ||
330 | .read_ber = vp702x_fe_read_ber, | ||
331 | .read_signal_strength = vp702x_fe_read_signal_strength, | ||
332 | .read_snr = vp702x_fe_read_snr, | ||
333 | .read_ucblocks = vp702x_fe_read_unc_blocks, | ||
334 | |||
335 | .diseqc_send_master_cmd = vp702x_fe_send_diseqc_msg, | ||
336 | .diseqc_send_burst = vp702x_fe_send_diseqc_burst, | ||
337 | .set_tone = vp702x_fe_set_tone, | ||
338 | .set_voltage = vp702x_fe_set_voltage, | ||
339 | }; | ||
diff --git a/drivers/media/dvb/dvb-usb/vp702x.c b/drivers/media/dvb/dvb-usb/vp702x.c new file mode 100644 index 000000000000..de13c04e8e64 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/vp702x.c | |||
@@ -0,0 +1,290 @@ | |||
1 | /* DVB USB compliant Linux driver for the TwinhanDTV StarBox USB2.0 DVB-S | ||
2 | * receiver. | ||
3 | * | ||
4 | * Copyright (C) 2005 Ralph Metzler <rjkm@metzlerbros.de> | ||
5 | * Metzler Brothers Systementwicklung GbR | ||
6 | * | ||
7 | * Copyright (C) 2005 Patrick Boettcher <patrick.boettcher@desy.de> | ||
8 | * | ||
9 | * Thanks to Twinhan who kindly provided hardware and information. | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify it | ||
12 | * under the terms of the GNU General Public License as published by the Free | ||
13 | * Software Foundation, version 2. | ||
14 | * | ||
15 | * see Documentation/dvb/README.dvb-usb for more information | ||
16 | */ | ||
17 | #include "vp702x.h" | ||
18 | |||
19 | /* debug */ | ||
20 | int dvb_usb_vp702x_debug; | ||
21 | module_param_named(debug,dvb_usb_vp702x_debug, int, 0644); | ||
22 | MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,rc=4 (or-able))." DVB_USB_DEBUG_STATUS); | ||
23 | |||
24 | struct vp702x_state { | ||
25 | u8 pid_table[17]; /* [16] controls the pid_table state */ | ||
26 | }; | ||
27 | |||
28 | /* check for mutex FIXME */ | ||
29 | int vp702x_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen) | ||
30 | { | ||
31 | int ret = 0,try = 0; | ||
32 | |||
33 | while (ret >= 0 && ret != blen && try < 3) { | ||
34 | ret = usb_control_msg(d->udev, | ||
35 | usb_rcvctrlpipe(d->udev,0), | ||
36 | req, | ||
37 | USB_TYPE_VENDOR | USB_DIR_IN, | ||
38 | value,index,b,blen, | ||
39 | 2000); | ||
40 | deb_info("reading number %d (ret: %d)\n",try,ret); | ||
41 | try++; | ||
42 | } | ||
43 | |||
44 | if (ret < 0 || ret != blen) { | ||
45 | warn("usb in operation failed."); | ||
46 | ret = -EIO; | ||
47 | } else | ||
48 | ret = 0; | ||
49 | |||
50 | deb_xfer("in: req. %x, val: %x, ind: %x, buffer: ",req,value,index); | ||
51 | debug_dump(b,blen,deb_xfer); | ||
52 | |||
53 | return ret; | ||
54 | } | ||
55 | |||
56 | int vp702x_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen) | ||
57 | { | ||
58 | deb_xfer("out: req. %x, val: %x, ind: %x, buffer: ",req,value,index); | ||
59 | debug_dump(b,blen,deb_xfer); | ||
60 | |||
61 | if (usb_control_msg(d->udev, | ||
62 | usb_sndctrlpipe(d->udev,0), | ||
63 | req, | ||
64 | USB_TYPE_VENDOR | USB_DIR_OUT, | ||
65 | value,index,b,blen, | ||
66 | 2000) != blen) { | ||
67 | warn("usb out operation failed."); | ||
68 | return -EIO; | ||
69 | } else | ||
70 | return 0; | ||
71 | } | ||
72 | |||
73 | int vp702x_usb_inout_op(struct dvb_usb_device *d, u8 *o, int olen, u8 *i, int ilen, int msec) | ||
74 | { | ||
75 | int ret; | ||
76 | |||
77 | if ((ret = down_interruptible(&d->usb_sem))) | ||
78 | return ret; | ||
79 | |||
80 | if ((ret = vp702x_usb_out_op(d,REQUEST_OUT,0,0,o,olen)) < 0) | ||
81 | goto unlock; | ||
82 | msleep(msec); | ||
83 | ret = vp702x_usb_in_op(d,REQUEST_IN,0,0,i,ilen); | ||
84 | |||
85 | unlock: | ||
86 | up(&d->usb_sem); | ||
87 | |||
88 | return ret; | ||
89 | } | ||
90 | |||
91 | int vp702x_usb_inout_cmd(struct dvb_usb_device *d, u8 cmd, u8 *o, int olen, u8 *i, int ilen, int msec) | ||
92 | { | ||
93 | u8 bout[olen+2]; | ||
94 | u8 bin[ilen+1]; | ||
95 | int ret = 0; | ||
96 | |||
97 | bout[0] = 0x00; | ||
98 | bout[1] = cmd; | ||
99 | memcpy(&bout[2],o,olen); | ||
100 | |||
101 | ret = vp702x_usb_inout_op(d, bout, olen+2, bin, ilen+1,msec); | ||
102 | |||
103 | if (ret == 0) | ||
104 | memcpy(i,&bin[1],ilen); | ||
105 | |||
106 | return ret; | ||
107 | } | ||
108 | |||
109 | static int vp702x_pid_filter(struct dvb_usb_device *d, int index, u16 pid, int onoff) | ||
110 | { | ||
111 | struct vp702x_state *st = d->priv; | ||
112 | u8 buf[9]; | ||
113 | |||
114 | if (onoff) { | ||
115 | st->pid_table[16] |= 1 << index; | ||
116 | st->pid_table[index*2] = (pid >> 8) & 0xff; | ||
117 | st->pid_table[index*2+1] = pid & 0xff; | ||
118 | } else { | ||
119 | st->pid_table[16] &= ~(1 << index); | ||
120 | st->pid_table[index*2] = st->pid_table[index*2+1] = 0; | ||
121 | } | ||
122 | |||
123 | return vp702x_usb_inout_cmd(d,SET_PID_FILTER,st->pid_table,17,buf,9,10); | ||
124 | } | ||
125 | |||
126 | static int vp702x_power_ctrl(struct dvb_usb_device *d, int onoff) | ||
127 | { | ||
128 | vp702x_usb_in_op(d,RESET_TUNER,0,0,NULL,0); | ||
129 | |||
130 | vp702x_usb_in_op(d,SET_TUNER_POWER_REQ,0,onoff,NULL,0); | ||
131 | return vp702x_usb_in_op(d,SET_TUNER_POWER_REQ,0,onoff,NULL,0); | ||
132 | } | ||
133 | |||
134 | /* keys for the enclosed remote control */ | ||
135 | static struct dvb_usb_rc_key vp702x_rc_keys[] = { | ||
136 | { 0x00, 0x01, KEY_1 }, | ||
137 | { 0x00, 0x02, KEY_2 }, | ||
138 | }; | ||
139 | |||
140 | /* remote control stuff (does not work with my box) */ | ||
141 | static int vp702x_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | ||
142 | { | ||
143 | u8 key[10]; | ||
144 | int i; | ||
145 | |||
146 | /* remove the following return to enabled remote querying */ | ||
147 | return 0; | ||
148 | |||
149 | vp702x_usb_in_op(d,READ_REMOTE_REQ,0,0,key,10); | ||
150 | |||
151 | deb_rc("remote query key: %x %d\n",key[1],key[1]); | ||
152 | |||
153 | if (key[1] == 0x44) { | ||
154 | *state = REMOTE_NO_KEY_PRESSED; | ||
155 | return 0; | ||
156 | } | ||
157 | |||
158 | for (i = 0; i < ARRAY_SIZE(vp702x_rc_keys); i++) | ||
159 | if (vp702x_rc_keys[i].custom == key[1]) { | ||
160 | *state = REMOTE_KEY_PRESSED; | ||
161 | *event = vp702x_rc_keys[i].event; | ||
162 | break; | ||
163 | } | ||
164 | return 0; | ||
165 | } | ||
166 | |||
167 | static int vp702x_read_mac_addr(struct dvb_usb_device *d,u8 mac[6]) | ||
168 | { | ||
169 | u8 macb[9]; | ||
170 | if (vp702x_usb_inout_cmd(d, GET_MAC_ADDRESS, NULL, 0, macb, 9, 10)) | ||
171 | return -EIO; | ||
172 | memcpy(mac,&macb[3],6); | ||
173 | return 0; | ||
174 | } | ||
175 | |||
176 | static int vp702x_frontend_attach(struct dvb_usb_device *d) | ||
177 | { | ||
178 | u8 buf[9] = { 0 }; | ||
179 | |||
180 | if (vp702x_usb_inout_cmd(d, GET_SYSTEM_STRING, NULL, 0, buf, 9, 10)) | ||
181 | return -EIO; | ||
182 | |||
183 | buf[8] = '\0'; | ||
184 | info("system string: %s",&buf[1]); | ||
185 | |||
186 | d->fe = vp702x_fe_attach(d); | ||
187 | return 0; | ||
188 | } | ||
189 | |||
190 | static struct dvb_usb_properties vp702x_properties; | ||
191 | |||
192 | static int vp702x_usb_probe(struct usb_interface *intf, | ||
193 | const struct usb_device_id *id) | ||
194 | { | ||
195 | struct usb_device *udev = interface_to_usbdev(intf); | ||
196 | |||
197 | usb_clear_halt(udev,usb_sndctrlpipe(udev,0)); | ||
198 | usb_clear_halt(udev,usb_rcvctrlpipe(udev,0)); | ||
199 | |||
200 | return dvb_usb_device_init(intf,&vp702x_properties,THIS_MODULE,NULL); | ||
201 | } | ||
202 | |||
203 | static struct usb_device_id vp702x_usb_table [] = { | ||
204 | { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_TWINHAN_VP7021_COLD) }, | ||
205 | { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_TWINHAN_VP7021_WARM) }, | ||
206 | { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_TWINHAN_VP7020_COLD) }, | ||
207 | { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_TWINHAN_VP7020_WARM) }, | ||
208 | { 0 }, | ||
209 | }; | ||
210 | MODULE_DEVICE_TABLE(usb, vp702x_usb_table); | ||
211 | |||
212 | static struct dvb_usb_properties vp702x_properties = { | ||
213 | .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_NEED_PID_FILTERING, | ||
214 | .pid_filter_count = 8, /* !!! */ | ||
215 | |||
216 | .usb_ctrl = CYPRESS_FX2, | ||
217 | .firmware = "dvb-usb-vp702x-01.fw", | ||
218 | |||
219 | .pid_filter = vp702x_pid_filter, | ||
220 | .power_ctrl = vp702x_power_ctrl, | ||
221 | .frontend_attach = vp702x_frontend_attach, | ||
222 | .read_mac_address = vp702x_read_mac_addr, | ||
223 | |||
224 | .rc_key_map = vp702x_rc_keys, | ||
225 | .rc_key_map_size = ARRAY_SIZE(vp702x_rc_keys), | ||
226 | .rc_interval = 400, | ||
227 | .rc_query = vp702x_rc_query, | ||
228 | |||
229 | .size_of_priv = sizeof(struct vp702x_state), | ||
230 | |||
231 | /* parameter for the MPEG2-data transfer */ | ||
232 | .urb = { | ||
233 | .type = DVB_USB_BULK, | ||
234 | .count = 7, | ||
235 | .endpoint = 0x02, | ||
236 | .u = { | ||
237 | .bulk = { | ||
238 | .buffersize = 4096, | ||
239 | } | ||
240 | } | ||
241 | }, | ||
242 | |||
243 | .num_device_descs = 2, | ||
244 | .devices = { | ||
245 | { .name = "TwinhanDTV StarBox DVB-S USB2.0 (VP7021)", | ||
246 | .cold_ids = { &vp702x_usb_table[0], NULL }, | ||
247 | .warm_ids = { &vp702x_usb_table[1], NULL }, | ||
248 | }, | ||
249 | { .name = "TwinhanDTV StarBox DVB-S USB2.0 (VP7020)", | ||
250 | .cold_ids = { &vp702x_usb_table[2], NULL }, | ||
251 | .warm_ids = { &vp702x_usb_table[3], NULL }, | ||
252 | }, | ||
253 | { 0 }, | ||
254 | } | ||
255 | }; | ||
256 | |||
257 | /* usb specific object needed to register this driver with the usb subsystem */ | ||
258 | static struct usb_driver vp702x_usb_driver = { | ||
259 | .owner = THIS_MODULE, | ||
260 | .name = "dvb-usb-vp702x", | ||
261 | .probe = vp702x_usb_probe, | ||
262 | .disconnect = dvb_usb_device_exit, | ||
263 | .id_table = vp702x_usb_table, | ||
264 | }; | ||
265 | |||
266 | /* module stuff */ | ||
267 | static int __init vp702x_usb_module_init(void) | ||
268 | { | ||
269 | int result; | ||
270 | if ((result = usb_register(&vp702x_usb_driver))) { | ||
271 | err("usb_register failed. (%d)",result); | ||
272 | return result; | ||
273 | } | ||
274 | |||
275 | return 0; | ||
276 | } | ||
277 | |||
278 | static void __exit vp702x_usb_module_exit(void) | ||
279 | { | ||
280 | /* deregister this driver from the USB subsystem */ | ||
281 | usb_deregister(&vp702x_usb_driver); | ||
282 | } | ||
283 | |||
284 | module_init(vp702x_usb_module_init); | ||
285 | module_exit(vp702x_usb_module_exit); | ||
286 | |||
287 | MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); | ||
288 | MODULE_DESCRIPTION("Driver for Twinhan StarBox DVB-S USB2.0 and clones"); | ||
289 | MODULE_VERSION("1.0-alpha"); | ||
290 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/dvb/dvb-usb/vp702x.h b/drivers/media/dvb/dvb-usb/vp702x.h new file mode 100644 index 000000000000..4a3e8c7eca2b --- /dev/null +++ b/drivers/media/dvb/dvb-usb/vp702x.h | |||
@@ -0,0 +1,109 @@ | |||
1 | #ifndef _DVB_USB_VP7021_H_ | ||
2 | #define _DVB_USB_VP7021_H_ | ||
3 | |||
4 | #define DVB_USB_LOG_PREFIX "vp702x" | ||
5 | #include "dvb-usb.h" | ||
6 | |||
7 | extern int dvb_usb_vp702x_debug; | ||
8 | #define deb_info(args...) dprintk(dvb_usb_vp702x_debug,0x01,args) | ||
9 | #define deb_xfer(args...) dprintk(dvb_usb_vp702x_debug,0x02,args) | ||
10 | #define deb_rc(args...) dprintk(dvb_usb_vp702x_debug,0x04,args) | ||
11 | #define deb_fe(args...) dprintk(dvb_usb_vp702x_debug,0x08,args) | ||
12 | |||
13 | /* commands are read and written with USB control messages */ | ||
14 | |||
15 | /* consecutive read/write operation */ | ||
16 | #define REQUEST_OUT 0xB2 | ||
17 | #define REQUEST_IN 0xB3 | ||
18 | |||
19 | /* the out-buffer of these consecutive operations contain sub-commands when b[0] = 0 | ||
20 | * request: 0xB2; i: 0; v: 0; b[0] = 0, b[1] = subcmd, additional buffer | ||
21 | * the returning buffer looks as follows | ||
22 | * request: 0xB3; i: 0; v: 0; b[0] = 0xB3, additional buffer */ | ||
23 | |||
24 | #define GET_TUNER_STATUS 0x05 | ||
25 | /* additional in buffer: | ||
26 | * 0 1 2 3 4 5 6 7 8 | ||
27 | * N/A N/A 0x05 signal-quality N/A N/A signal-strength lock==0 N/A */ | ||
28 | |||
29 | #define GET_SYSTEM_STRING 0x06 | ||
30 | /* additional in buffer: | ||
31 | * 0 1 2 3 4 5 6 7 8 | ||
32 | * N/A 'U' 'S' 'B' '7' '0' '2' 'X' N/A */ | ||
33 | |||
34 | #define SET_DISEQC_CMD 0x08 | ||
35 | /* additional out buffer: | ||
36 | * 0 1 2 3 4 | ||
37 | * len X1 X2 X3 X4 | ||
38 | * additional in buffer: | ||
39 | * 0 1 2 | ||
40 | * N/A 0 0 b[1] == b[2] == 0 -> success otherwise not */ | ||
41 | |||
42 | #define SET_LNB_POWER 0x09 | ||
43 | /* additional out buffer: | ||
44 | * 0 1 2 | ||
45 | * 0x00 0xff 1 = on, 0 = off | ||
46 | * additional in buffer: | ||
47 | * 0 1 2 | ||
48 | * N/A 0 0 b[1] == b[2] == 0 -> success otherwise not */ | ||
49 | |||
50 | #define GET_MAC_ADDRESS 0x0A | ||
51 | /* #define GET_MAC_ADDRESS 0x0B */ | ||
52 | /* additional in buffer: | ||
53 | * 0 1 2 3 4 5 6 7 8 | ||
54 | * N/A N/A 0x0A or 0x0B MAC0 MAC1 MAC2 MAC3 MAC4 MAC5 */ | ||
55 | |||
56 | #define SET_PID_FILTER 0x11 | ||
57 | /* additional in buffer: | ||
58 | * 0 1 ... 14 15 16 | ||
59 | * PID0_MSB PID0_LSB ... PID7_MSB PID7_LSB PID_active (bits) */ | ||
60 | |||
61 | /* request: 0xB2; i: 0; v: 0; | ||
62 | * b[0] != 0 -> tune and lock a channel | ||
63 | * 0 1 2 3 4 5 6 7 | ||
64 | * freq0 freq1 divstep srate0 srate1 srate2 flag chksum | ||
65 | */ | ||
66 | |||
67 | |||
68 | /* one direction requests */ | ||
69 | #define READ_REMOTE_REQ 0xB4 | ||
70 | /* IN i: 0; v: 0; b[0] == request, b[1] == key */ | ||
71 | |||
72 | #define READ_PID_NUMBER_REQ 0xB5 | ||
73 | /* IN i: 0; v: 0; b[0] == request, b[1] == 0, b[2] = pid number */ | ||
74 | |||
75 | #define WRITE_EEPROM_REQ 0xB6 | ||
76 | /* OUT i: offset; v: value to write; no extra buffer */ | ||
77 | |||
78 | #define READ_EEPROM_REQ 0xB7 | ||
79 | /* IN i: bufferlen; v: offset; buffer with bufferlen bytes */ | ||
80 | |||
81 | #define READ_STATUS 0xB8 | ||
82 | /* IN i: 0; v: 0; bufferlen 10 */ | ||
83 | |||
84 | #define READ_TUNER_REG_REQ 0xB9 | ||
85 | /* IN i: 0; v: register; b[0] = value */ | ||
86 | |||
87 | #define READ_FX2_REG_REQ 0xBA | ||
88 | /* IN i: offset; v: 0; b[0] = value */ | ||
89 | |||
90 | #define WRITE_FX2_REG_REQ 0xBB | ||
91 | /* OUT i: offset; v: value to write; 1 byte extra buffer */ | ||
92 | |||
93 | #define SET_TUNER_POWER_REQ 0xBC | ||
94 | /* IN i: 0 = power off, 1 = power on */ | ||
95 | |||
96 | #define WRITE_TUNER_REG_REQ 0xBD | ||
97 | /* IN i: register, v: value to write, no extra buffer */ | ||
98 | |||
99 | #define RESET_TUNER 0xBE | ||
100 | /* IN i: 0, v: 0, no extra buffer */ | ||
101 | |||
102 | extern struct dvb_frontend * vp702x_fe_attach(struct dvb_usb_device *d); | ||
103 | |||
104 | extern int vp702x_usb_inout_op(struct dvb_usb_device *d, u8 *o, int olen, u8 *i, int ilen, int msec); | ||
105 | extern int vp702x_usb_inout_cmd(struct dvb_usb_device *d, u8 cmd, u8 *o, int olen, u8 *i, int ilen, int msec); | ||
106 | extern int vp702x_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen); | ||
107 | extern int vp702x_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen); | ||
108 | |||
109 | #endif | ||
diff --git a/drivers/media/dvb/dvb-usb/vp7045.c b/drivers/media/dvb/dvb-usb/vp7045.c index 9ac95f54f9fc..0f57abeb6d6b 100644 --- a/drivers/media/dvb/dvb-usb/vp7045.c +++ b/drivers/media/dvb/dvb-usb/vp7045.c | |||
@@ -164,7 +164,6 @@ static int vp7045_read_eeprom(struct dvb_usb_device *d,u8 *buf, int len, int off | |||
164 | return 0; | 164 | return 0; |
165 | } | 165 | } |
166 | 166 | ||
167 | |||
168 | static int vp7045_read_mac_addr(struct dvb_usb_device *d,u8 mac[6]) | 167 | static int vp7045_read_mac_addr(struct dvb_usb_device *d,u8 mac[6]) |
169 | { | 168 | { |
170 | return vp7045_read_eeprom(d,mac, 6, MAC_0_ADDR); | 169 | return vp7045_read_eeprom(d,mac, 6, MAC_0_ADDR); |
@@ -199,7 +198,7 @@ static struct dvb_usb_properties vp7045_properties; | |||
199 | static int vp7045_usb_probe(struct usb_interface *intf, | 198 | static int vp7045_usb_probe(struct usb_interface *intf, |
200 | const struct usb_device_id *id) | 199 | const struct usb_device_id *id) |
201 | { | 200 | { |
202 | return dvb_usb_device_init(intf,&vp7045_properties,THIS_MODULE); | 201 | return dvb_usb_device_init(intf,&vp7045_properties,THIS_MODULE,NULL); |
203 | } | 202 | } |
204 | 203 | ||
205 | static struct usb_device_id vp7045_usb_table [] = { | 204 | static struct usb_device_id vp7045_usb_table [] = { |
@@ -256,9 +255,9 @@ static struct dvb_usb_properties vp7045_properties = { | |||
256 | static struct usb_driver vp7045_usb_driver = { | 255 | static struct usb_driver vp7045_usb_driver = { |
257 | .owner = THIS_MODULE, | 256 | .owner = THIS_MODULE, |
258 | .name = "dvb_usb_vp7045", | 257 | .name = "dvb_usb_vp7045", |
259 | .probe = vp7045_usb_probe, | 258 | .probe = vp7045_usb_probe, |
260 | .disconnect = dvb_usb_device_exit, | 259 | .disconnect = dvb_usb_device_exit, |
261 | .id_table = vp7045_usb_table, | 260 | .id_table = vp7045_usb_table, |
262 | }; | 261 | }; |
263 | 262 | ||
264 | /* module stuff */ | 263 | /* module stuff */ |
diff --git a/drivers/media/dvb/frontends/cx24110.c b/drivers/media/dvb/frontends/cx24110.c index 8222b88cb486..d4b97989e3ed 100644 --- a/drivers/media/dvb/frontends/cx24110.c +++ b/drivers/media/dvb/frontends/cx24110.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | cx24110 - Single Chip Satellite Channel Receiver driver module | 2 | cx24110 - Single Chip Satellite Channel Receiver driver module |
3 | 3 | ||
4 | Copyright (C) 2002 Peter Hettkamp <peter.hettkamp@t-online.de> based on | 4 | Copyright (C) 2002 Peter Hettkamp <peter.hettkamp@htp-tel.de> based on |
5 | work | 5 | work |
6 | Copyright (C) 1999 Convergence Integrated Media GmbH <ralph@convergence.de> | 6 | Copyright (C) 1999 Convergence Integrated Media GmbH <ralph@convergence.de> |
7 | 7 | ||
@@ -387,8 +387,9 @@ static int cx24110_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t voltag | |||
387 | 387 | ||
388 | static int cx24110_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t burst) | 388 | static int cx24110_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t burst) |
389 | { | 389 | { |
390 | int rv, bit, i; | 390 | int rv, bit; |
391 | struct cx24110_state *state = fe->demodulator_priv; | 391 | struct cx24110_state *state = fe->demodulator_priv; |
392 | unsigned long timeout; | ||
392 | 393 | ||
393 | if (burst == SEC_MINI_A) | 394 | if (burst == SEC_MINI_A) |
394 | bit = 0x00; | 395 | bit = 0x00; |
@@ -398,12 +399,14 @@ static int cx24110_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t | |||
398 | return -EINVAL; | 399 | return -EINVAL; |
399 | 400 | ||
400 | rv = cx24110_readreg(state, 0x77); | 401 | rv = cx24110_readreg(state, 0x77); |
401 | cx24110_writereg(state, 0x77, rv|0x04); | 402 | if (!(rv & 0x04)) |
403 | cx24110_writereg(state, 0x77, rv | 0x04); | ||
402 | 404 | ||
403 | rv = cx24110_readreg(state, 0x76); | 405 | rv = cx24110_readreg(state, 0x76); |
404 | cx24110_writereg(state, 0x76, ((rv & 0x90) | 0x40 | bit)); | 406 | cx24110_writereg(state, 0x76, ((rv & 0x90) | 0x40 | bit)); |
405 | for (i = 500; i-- > 0 && !(cx24110_readreg(state,0x76)&0x40) ; ) | 407 | timeout = jiffies + msecs_to_jiffies(100); |
406 | ; /* wait for LNB ready */ | 408 | while (!time_after(jiffies, timeout) && !(cx24110_readreg(state, 0x76) & 0x40)) |
409 | ; /* wait for LNB ready */ | ||
407 | 410 | ||
408 | return 0; | 411 | return 0; |
409 | } | 412 | } |
@@ -413,17 +416,22 @@ static int cx24110_send_diseqc_msg(struct dvb_frontend* fe, | |||
413 | { | 416 | { |
414 | int i, rv; | 417 | int i, rv; |
415 | struct cx24110_state *state = fe->demodulator_priv; | 418 | struct cx24110_state *state = fe->demodulator_priv; |
419 | unsigned long timeout; | ||
416 | 420 | ||
417 | for (i = 0; i < cmd->msg_len; i++) | 421 | for (i = 0; i < cmd->msg_len; i++) |
418 | cx24110_writereg(state, 0x79 + i, cmd->msg[i]); | 422 | cx24110_writereg(state, 0x79 + i, cmd->msg[i]); |
419 | 423 | ||
420 | rv = cx24110_readreg(state, 0x77); | 424 | rv = cx24110_readreg(state, 0x77); |
421 | cx24110_writereg(state, 0x77, rv|0x04); | 425 | if (rv & 0x04) { |
426 | cx24110_writereg(state, 0x77, rv & ~0x04); | ||
427 | msleep(30); /* reportedly fixes switching problems */ | ||
428 | } | ||
422 | 429 | ||
423 | rv = cx24110_readreg(state, 0x76); | 430 | rv = cx24110_readreg(state, 0x76); |
424 | 431 | ||
425 | cx24110_writereg(state, 0x76, ((rv & 0x90) | 0x40) | ((cmd->msg_len-3) & 3)); | 432 | cx24110_writereg(state, 0x76, ((rv & 0x90) | 0x40) | ((cmd->msg_len-3) & 3)); |
426 | for (i=500; i-- > 0 && !(cx24110_readreg(state,0x76)&0x40);) | 433 | timeout = jiffies + msecs_to_jiffies(100); |
434 | while (!time_after(jiffies, timeout) && !(cx24110_readreg(state, 0x76) & 0x40)) | ||
427 | ; /* wait for LNB ready */ | 435 | ; /* wait for LNB ready */ |
428 | 436 | ||
429 | return 0; | 437 | return 0; |
diff --git a/drivers/media/dvb/frontends/cx24110.h b/drivers/media/dvb/frontends/cx24110.h index 6b663f4744e0..b63ecf26421a 100644 --- a/drivers/media/dvb/frontends/cx24110.h +++ b/drivers/media/dvb/frontends/cx24110.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | cx24110 - Single Chip Satellite Channel Receiver driver module | 2 | cx24110 - Single Chip Satellite Channel Receiver driver module |
3 | 3 | ||
4 | Copyright (C) 2002 Peter Hettkamp <peter.hettkamp@t-online.de> based on | 4 | Copyright (C) 2002 Peter Hettkamp <peter.hettkamp@htp-tel.de> based on |
5 | work | 5 | work |
6 | Copyright (C) 1999 Convergence Integrated Media GmbH <ralph@convergence.de> | 6 | Copyright (C) 1999 Convergence Integrated Media GmbH <ralph@convergence.de> |
7 | 7 | ||
diff --git a/drivers/media/dvb/frontends/dib3000mb.c b/drivers/media/dvb/frontends/dib3000mb.c index cd434b7cf9db..21433e1831e7 100644 --- a/drivers/media/dvb/frontends/dib3000mb.c +++ b/drivers/media/dvb/frontends/dib3000mb.c | |||
@@ -23,7 +23,6 @@ | |||
23 | 23 | ||
24 | #include <linux/config.h> | 24 | #include <linux/config.h> |
25 | #include <linux/kernel.h> | 25 | #include <linux/kernel.h> |
26 | #include <linux/version.h> | ||
27 | #include <linux/module.h> | 26 | #include <linux/module.h> |
28 | #include <linux/moduleparam.h> | 27 | #include <linux/moduleparam.h> |
29 | #include <linux/init.h> | 28 | #include <linux/init.h> |
diff --git a/drivers/media/dvb/frontends/dib3000mc.c b/drivers/media/dvb/frontends/dib3000mc.c index cd33705a4320..441de665fec3 100644 --- a/drivers/media/dvb/frontends/dib3000mc.c +++ b/drivers/media/dvb/frontends/dib3000mc.c | |||
@@ -22,7 +22,6 @@ | |||
22 | */ | 22 | */ |
23 | #include <linux/config.h> | 23 | #include <linux/config.h> |
24 | #include <linux/kernel.h> | 24 | #include <linux/kernel.h> |
25 | #include <linux/version.h> | ||
26 | #include <linux/module.h> | 25 | #include <linux/module.h> |
27 | #include <linux/moduleparam.h> | 26 | #include <linux/moduleparam.h> |
28 | #include <linux/init.h> | 27 | #include <linux/init.h> |
diff --git a/drivers/media/dvb/frontends/mt352.c b/drivers/media/dvb/frontends/mt352.c index d32dc4de9e7f..cc1bc0edd65e 100644 --- a/drivers/media/dvb/frontends/mt352.c +++ b/drivers/media/dvb/frontends/mt352.c | |||
@@ -462,9 +462,11 @@ static int mt352_read_signal_strength(struct dvb_frontend* fe, u16* strength) | |||
462 | { | 462 | { |
463 | struct mt352_state* state = fe->demodulator_priv; | 463 | struct mt352_state* state = fe->demodulator_priv; |
464 | 464 | ||
465 | u16 signal = ((mt352_read_register(state, AGC_GAIN_1) << 8) & 0x0f) | | 465 | /* align the 12 bit AGC gain with the most significant bits */ |
466 | (mt352_read_register(state, AGC_GAIN_0)); | 466 | u16 signal = ((mt352_read_register(state, AGC_GAIN_1) & 0x0f) << 12) | |
467 | (mt352_read_register(state, AGC_GAIN_0) << 4); | ||
467 | 468 | ||
469 | /* inverse of gain is signal strength */ | ||
468 | *strength = ~signal; | 470 | *strength = ~signal; |
469 | return 0; | 471 | return 0; |
470 | } | 472 | } |
diff --git a/drivers/media/dvb/frontends/nxt6000.c b/drivers/media/dvb/frontends/nxt6000.c index 966de9853d18..88a57b791112 100644 --- a/drivers/media/dvb/frontends/nxt6000.c +++ b/drivers/media/dvb/frontends/nxt6000.c | |||
@@ -482,6 +482,7 @@ static int nxt6000_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
482 | if ((result = nxt6000_set_inversion(state, param->inversion)) < 0) | 482 | if ((result = nxt6000_set_inversion(state, param->inversion)) < 0) |
483 | return result; | 483 | return result; |
484 | 484 | ||
485 | msleep(500); | ||
485 | return 0; | 486 | return 0; |
486 | } | 487 | } |
487 | 488 | ||
@@ -525,6 +526,12 @@ static int nxt6000_read_signal_strength(struct dvb_frontend* fe, u16* signal_str | |||
525 | return 0; | 526 | return 0; |
526 | } | 527 | } |
527 | 528 | ||
529 | static int nxt6000_fe_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings *tune) | ||
530 | { | ||
531 | tune->min_delay_ms = 500; | ||
532 | return 0; | ||
533 | } | ||
534 | |||
528 | static struct dvb_frontend_ops nxt6000_ops; | 535 | static struct dvb_frontend_ops nxt6000_ops; |
529 | 536 | ||
530 | struct dvb_frontend* nxt6000_attach(const struct nxt6000_config* config, | 537 | struct dvb_frontend* nxt6000_attach(const struct nxt6000_config* config, |
@@ -578,6 +585,8 @@ static struct dvb_frontend_ops nxt6000_ops = { | |||
578 | 585 | ||
579 | .init = nxt6000_init, | 586 | .init = nxt6000_init, |
580 | 587 | ||
588 | .get_tune_settings = nxt6000_fe_get_tune_settings, | ||
589 | |||
581 | .set_frontend = nxt6000_set_frontend, | 590 | .set_frontend = nxt6000_set_frontend, |
582 | 591 | ||
583 | .read_status = nxt6000_read_status, | 592 | .read_status = nxt6000_read_status, |
diff --git a/drivers/media/dvb/frontends/or51132.c b/drivers/media/dvb/frontends/or51132.c index cc0a77c790f1..b6d0eecc59eb 100644 --- a/drivers/media/dvb/frontends/or51132.c +++ b/drivers/media/dvb/frontends/or51132.c | |||
@@ -370,22 +370,19 @@ static int or51132_set_parameters(struct dvb_frontend* fe, | |||
370 | or51132_setmode(fe); | 370 | or51132_setmode(fe); |
371 | } | 371 | } |
372 | 372 | ||
373 | /* Change only if we are actually changing the channel */ | 373 | dvb_pll_configure(state->config->pll_desc, buf, |
374 | if (state->current_frequency != param->frequency) { | 374 | param->frequency, 0); |
375 | dvb_pll_configure(state->config->pll_desc, buf, | 375 | dprintk("set_parameters tuner bytes: 0x%02x 0x%02x " |
376 | param->frequency, 0); | 376 | "0x%02x 0x%02x\n",buf[0],buf[1],buf[2],buf[3]); |
377 | dprintk("set_parameters tuner bytes: 0x%02x 0x%02x " | 377 | if (i2c_writebytes(state, state->config->pll_address ,buf, 4)) |
378 | "0x%02x 0x%02x\n",buf[0],buf[1],buf[2],buf[3]); | 378 | printk(KERN_WARNING "or51132: set_parameters error " |
379 | if (i2c_writebytes(state, state->config->pll_address ,buf, 4)) | 379 | "writing to tuner\n"); |
380 | printk(KERN_WARNING "or51132: set_parameters error " | 380 | |
381 | "writing to tuner\n"); | 381 | /* Set to current mode */ |
382 | 382 | or51132_setmode(fe); | |
383 | /* Set to current mode */ | 383 | |
384 | or51132_setmode(fe); | 384 | /* Update current frequency */ |
385 | 385 | state->current_frequency = param->frequency; | |
386 | /* Update current frequency */ | ||
387 | state->current_frequency = param->frequency; | ||
388 | } | ||
389 | return 0; | 386 | return 0; |
390 | } | 387 | } |
391 | 388 | ||
diff --git a/drivers/media/dvb/frontends/s5h1420.c b/drivers/media/dvb/frontends/s5h1420.c index 4f396ac8de77..c7fe27fd530c 100644 --- a/drivers/media/dvb/frontends/s5h1420.c +++ b/drivers/media/dvb/frontends/s5h1420.c | |||
@@ -48,7 +48,8 @@ struct s5h1420_state { | |||
48 | }; | 48 | }; |
49 | 49 | ||
50 | static u32 s5h1420_getsymbolrate(struct s5h1420_state* state); | 50 | static u32 s5h1420_getsymbolrate(struct s5h1420_state* state); |
51 | static int s5h1420_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fesettings); | 51 | static int s5h1420_get_tune_settings(struct dvb_frontend* fe, |
52 | struct dvb_frontend_tune_settings* fesettings); | ||
52 | 53 | ||
53 | 54 | ||
54 | static int debug = 0; | 55 | static int debug = 0; |
@@ -91,7 +92,8 @@ static int s5h1420_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t voltag | |||
91 | 92 | ||
92 | switch(voltage) { | 93 | switch(voltage) { |
93 | case SEC_VOLTAGE_13: | 94 | case SEC_VOLTAGE_13: |
94 | s5h1420_writereg(state, 0x3c, (s5h1420_readreg(state, 0x3c) & 0xfe) | 0x02); | 95 | s5h1420_writereg(state, 0x3c, |
96 | (s5h1420_readreg(state, 0x3c) & 0xfe) | 0x02); | ||
95 | break; | 97 | break; |
96 | 98 | ||
97 | case SEC_VOLTAGE_18: | 99 | case SEC_VOLTAGE_18: |
@@ -112,18 +114,21 @@ static int s5h1420_set_tone (struct dvb_frontend* fe, fe_sec_tone_mode_t tone) | |||
112 | 114 | ||
113 | switch(tone) { | 115 | switch(tone) { |
114 | case SEC_TONE_ON: | 116 | case SEC_TONE_ON: |
115 | s5h1420_writereg(state, 0x3b, (s5h1420_readreg(state, 0x3b) & 0x74) | 0x08); | 117 | s5h1420_writereg(state, 0x3b, |
118 | (s5h1420_readreg(state, 0x3b) & 0x74) | 0x08); | ||
116 | break; | 119 | break; |
117 | 120 | ||
118 | case SEC_TONE_OFF: | 121 | case SEC_TONE_OFF: |
119 | s5h1420_writereg(state, 0x3b, (s5h1420_readreg(state, 0x3b) & 0x74) | 0x01); | 122 | s5h1420_writereg(state, 0x3b, |
123 | (s5h1420_readreg(state, 0x3b) & 0x74) | 0x01); | ||
120 | break; | 124 | break; |
121 | } | 125 | } |
122 | 126 | ||
123 | return 0; | 127 | return 0; |
124 | } | 128 | } |
125 | 129 | ||
126 | static int s5h1420_send_master_cmd (struct dvb_frontend* fe, struct dvb_diseqc_master_cmd* cmd) | 130 | static int s5h1420_send_master_cmd (struct dvb_frontend* fe, |
131 | struct dvb_diseqc_master_cmd* cmd) | ||
127 | { | 132 | { |
128 | struct s5h1420_state* state = fe->demodulator_priv; | 133 | struct s5h1420_state* state = fe->demodulator_priv; |
129 | u8 val; | 134 | u8 val; |
@@ -131,6 +136,9 @@ static int s5h1420_send_master_cmd (struct dvb_frontend* fe, struct dvb_diseqc_m | |||
131 | unsigned long timeout; | 136 | unsigned long timeout; |
132 | int result = 0; | 137 | int result = 0; |
133 | 138 | ||
139 | if (cmd->msg_len > 8) | ||
140 | return -EINVAL; | ||
141 | |||
134 | /* setup for DISEQC */ | 142 | /* setup for DISEQC */ |
135 | val = s5h1420_readreg(state, 0x3b); | 143 | val = s5h1420_readreg(state, 0x3b); |
136 | s5h1420_writereg(state, 0x3b, 0x02); | 144 | s5h1420_writereg(state, 0x3b, 0x02); |
@@ -138,16 +146,17 @@ static int s5h1420_send_master_cmd (struct dvb_frontend* fe, struct dvb_diseqc_m | |||
138 | 146 | ||
139 | /* write the DISEQC command bytes */ | 147 | /* write the DISEQC command bytes */ |
140 | for(i=0; i< cmd->msg_len; i++) { | 148 | for(i=0; i< cmd->msg_len; i++) { |
141 | s5h1420_writereg(state, 0x3c + i, cmd->msg[i]); | 149 | s5h1420_writereg(state, 0x3d + i, cmd->msg[i]); |
142 | } | 150 | } |
143 | 151 | ||
144 | /* kick off transmission */ | 152 | /* kick off transmission */ |
145 | s5h1420_writereg(state, 0x3b, s5h1420_readreg(state, 0x3b) | ((cmd->msg_len-1) << 4) | 0x08); | 153 | s5h1420_writereg(state, 0x3b, s5h1420_readreg(state, 0x3b) | |
154 | ((cmd->msg_len-1) << 4) | 0x08); | ||
146 | 155 | ||
147 | /* wait for transmission to complete */ | 156 | /* wait for transmission to complete */ |
148 | timeout = jiffies + ((100*HZ) / 1000); | 157 | timeout = jiffies + ((100*HZ) / 1000); |
149 | while(time_before(jiffies, timeout)) { | 158 | while(time_before(jiffies, timeout)) { |
150 | if (s5h1420_readreg(state, 0x3b) & 0x08) | 159 | if (!(s5h1420_readreg(state, 0x3b) & 0x08)) |
151 | break; | 160 | break; |
152 | 161 | ||
153 | msleep(5); | 162 | msleep(5); |
@@ -161,7 +170,8 @@ static int s5h1420_send_master_cmd (struct dvb_frontend* fe, struct dvb_diseqc_m | |||
161 | return result; | 170 | return result; |
162 | } | 171 | } |
163 | 172 | ||
164 | static int s5h1420_recv_slave_reply (struct dvb_frontend* fe, struct dvb_diseqc_slave_reply* reply) | 173 | static int s5h1420_recv_slave_reply (struct dvb_frontend* fe, |
174 | struct dvb_diseqc_slave_reply* reply) | ||
165 | { | 175 | { |
166 | struct s5h1420_state* state = fe->demodulator_priv; | 176 | struct s5h1420_state* state = fe->demodulator_priv; |
167 | u8 val; | 177 | u8 val; |
@@ -205,7 +215,7 @@ static int s5h1420_recv_slave_reply (struct dvb_frontend* fe, struct dvb_diseqc_ | |||
205 | 215 | ||
206 | /* extract data */ | 216 | /* extract data */ |
207 | for(i=0; i< length; i++) { | 217 | for(i=0; i< length; i++) { |
208 | reply->msg[i] = s5h1420_readreg(state, 0x3c + i); | 218 | reply->msg[i] = s5h1420_readreg(state, 0x3d + i); |
209 | } | 219 | } |
210 | 220 | ||
211 | exit: | 221 | exit: |
@@ -236,7 +246,7 @@ static int s5h1420_send_burst (struct dvb_frontend* fe, fe_sec_mini_cmd_t minicm | |||
236 | s5h1420_writereg(state, 0x3b, s5h1420_readreg(state, 0x3b) | 0x08); | 246 | s5h1420_writereg(state, 0x3b, s5h1420_readreg(state, 0x3b) | 0x08); |
237 | 247 | ||
238 | /* wait for transmission to complete */ | 248 | /* wait for transmission to complete */ |
239 | timeout = jiffies + ((20*HZ) / 1000); | 249 | timeout = jiffies + ((100*HZ) / 1000); |
240 | while(time_before(jiffies, timeout)) { | 250 | while(time_before(jiffies, timeout)) { |
241 | if (!(s5h1420_readreg(state, 0x3b) & 0x08)) | 251 | if (!(s5h1420_readreg(state, 0x3b) & 0x08)) |
242 | break; | 252 | break; |
@@ -259,9 +269,9 @@ static fe_status_t s5h1420_get_status_bits(struct s5h1420_state* state) | |||
259 | 269 | ||
260 | val = s5h1420_readreg(state, 0x14); | 270 | val = s5h1420_readreg(state, 0x14); |
261 | if (val & 0x02) | 271 | if (val & 0x02) |
262 | status |= FE_HAS_SIGNAL; // FIXME: not sure if this is right | 272 | status |= FE_HAS_SIGNAL; |
263 | if (val & 0x01) | 273 | if (val & 0x01) |
264 | status |= FE_HAS_CARRIER; // FIXME: not sure if this is right | 274 | status |= FE_HAS_CARRIER; |
265 | val = s5h1420_readreg(state, 0x36); | 275 | val = s5h1420_readreg(state, 0x36); |
266 | if (val & 0x01) | 276 | if (val & 0x01) |
267 | status |= FE_HAS_VITERBI; | 277 | status |= FE_HAS_VITERBI; |
@@ -284,8 +294,8 @@ static int s5h1420_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
284 | /* determine lock state */ | 294 | /* determine lock state */ |
285 | *status = s5h1420_get_status_bits(state); | 295 | *status = s5h1420_get_status_bits(state); |
286 | 296 | ||
287 | /* fix for FEC 5/6 inversion issue - if it doesn't quite lock, invert the inversion, | 297 | /* fix for FEC 5/6 inversion issue - if it doesn't quite lock, invert |
288 | wait a bit and check again */ | 298 | the inversion, wait a bit and check again */ |
289 | if (*status == (FE_HAS_SIGNAL|FE_HAS_CARRIER|FE_HAS_VITERBI)) { | 299 | if (*status == (FE_HAS_SIGNAL|FE_HAS_CARRIER|FE_HAS_VITERBI)) { |
290 | val = s5h1420_readreg(state, 0x32); | 300 | val = s5h1420_readreg(state, 0x32); |
291 | if ((val & 0x07) == 0x03) { | 301 | if ((val & 0x07) == 0x03) { |
@@ -330,6 +340,10 @@ static int s5h1420_read_status(struct dvb_frontend* fe, fe_status_t* status) | |||
330 | tmp = (tmp * 2 * 7) / 8; | 340 | tmp = (tmp * 2 * 7) / 8; |
331 | break; | 341 | break; |
332 | } | 342 | } |
343 | if (tmp == 0) { | ||
344 | printk("s5h1420: avoided division by 0\n"); | ||
345 | tmp = 1; | ||
346 | } | ||
333 | tmp = state->fclk / tmp; | 347 | tmp = state->fclk / tmp; |
334 | 348 | ||
335 | /* set the MPEG_CLK_INTL for the calculated data rate */ | 349 | /* set the MPEG_CLK_INTL for the calculated data rate */ |
@@ -368,16 +382,21 @@ static int s5h1420_read_ber(struct dvb_frontend* fe, u32* ber) | |||
368 | 382 | ||
369 | s5h1420_writereg(state, 0x46, 0x1d); | 383 | s5h1420_writereg(state, 0x46, 0x1d); |
370 | mdelay(25); | 384 | mdelay(25); |
371 | return (s5h1420_readreg(state, 0x48) << 8) | s5h1420_readreg(state, 0x47); | 385 | |
386 | *ber = (s5h1420_readreg(state, 0x48) << 8) | s5h1420_readreg(state, 0x47); | ||
387 | |||
388 | return 0; | ||
372 | } | 389 | } |
373 | 390 | ||
374 | static int s5h1420_read_signal_strength(struct dvb_frontend* fe, u16* strength) | 391 | static int s5h1420_read_signal_strength(struct dvb_frontend* fe, u16* strength) |
375 | { | 392 | { |
376 | struct s5h1420_state* state = fe->demodulator_priv; | 393 | struct s5h1420_state* state = fe->demodulator_priv; |
377 | 394 | ||
378 | u8 val = 0xff - s5h1420_readreg(state, 0x15); | 395 | u8 val = s5h1420_readreg(state, 0x15); |
379 | 396 | ||
380 | return (int) ((val << 8) | val); | 397 | *strength = (u16) ((val << 8) | val); |
398 | |||
399 | return 0; | ||
381 | } | 400 | } |
382 | 401 | ||
383 | static int s5h1420_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | 402 | static int s5h1420_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) |
@@ -386,7 +405,10 @@ static int s5h1420_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | |||
386 | 405 | ||
387 | s5h1420_writereg(state, 0x46, 0x1f); | 406 | s5h1420_writereg(state, 0x46, 0x1f); |
388 | mdelay(25); | 407 | mdelay(25); |
389 | return (s5h1420_readreg(state, 0x48) << 8) | s5h1420_readreg(state, 0x47); | 408 | |
409 | *ucblocks = (s5h1420_readreg(state, 0x48) << 8) | s5h1420_readreg(state, 0x47); | ||
410 | |||
411 | return 0; | ||
390 | } | 412 | } |
391 | 413 | ||
392 | static void s5h1420_reset(struct s5h1420_state* state) | 414 | static void s5h1420_reset(struct s5h1420_state* state) |
@@ -396,11 +418,12 @@ static void s5h1420_reset(struct s5h1420_state* state) | |||
396 | udelay(10); | 418 | udelay(10); |
397 | } | 419 | } |
398 | 420 | ||
399 | static void s5h1420_setsymbolrate(struct s5h1420_state* state, struct dvb_frontend_parameters *p) | 421 | static void s5h1420_setsymbolrate(struct s5h1420_state* state, |
422 | struct dvb_frontend_parameters *p) | ||
400 | { | 423 | { |
401 | u64 val; | 424 | u64 val; |
402 | 425 | ||
403 | val = (p->u.qpsk.symbol_rate / 1000) * (1<<24); | 426 | val = ((u64) p->u.qpsk.symbol_rate / 1000ULL) * (1ULL<<24); |
404 | if (p->u.qpsk.symbol_rate <= 21000000) { | 427 | if (p->u.qpsk.symbol_rate <= 21000000) { |
405 | val *= 2; | 428 | val *= 2; |
406 | } | 429 | } |
@@ -415,7 +438,7 @@ static void s5h1420_setsymbolrate(struct s5h1420_state* state, struct dvb_fronte | |||
415 | 438 | ||
416 | static u32 s5h1420_getsymbolrate(struct s5h1420_state* state) | 439 | static u32 s5h1420_getsymbolrate(struct s5h1420_state* state) |
417 | { | 440 | { |
418 | u64 val; | 441 | u64 val = 0; |
419 | int sampling = 2; | 442 | int sampling = 2; |
420 | 443 | ||
421 | if (s5h1420_readreg(state, 0x05) & 0x2) | 444 | if (s5h1420_readreg(state, 0x05) & 0x2) |
@@ -427,10 +450,10 @@ static u32 s5h1420_getsymbolrate(struct s5h1420_state* state) | |||
427 | val |= s5h1420_readreg(state, 0x13); | 450 | val |= s5h1420_readreg(state, 0x13); |
428 | s5h1420_writereg(state, 0x06, s5h1420_readreg(state, 0x06) & 0xf7); | 451 | s5h1420_writereg(state, 0x06, s5h1420_readreg(state, 0x06) & 0xf7); |
429 | 452 | ||
430 | val *= (state->fclk / 1000); | 453 | val *= (state->fclk / 1000ULL); |
431 | do_div(val, ((1<<24) * sampling)); | 454 | do_div(val, ((1<<24) * sampling)); |
432 | 455 | ||
433 | return (u32) (val * 1000); | 456 | return (u32) (val * 1000ULL); |
434 | } | 457 | } |
435 | 458 | ||
436 | static void s5h1420_setfreqoffset(struct s5h1420_state* state, int freqoffset) | 459 | static void s5h1420_setfreqoffset(struct s5h1420_state* state, int freqoffset) |
@@ -463,46 +486,55 @@ static int s5h1420_getfreqoffset(struct s5h1420_state* state) | |||
463 | 486 | ||
464 | /* remember freqoffset is in kHz, but the chip wants the offset in Hz, so | 487 | /* remember freqoffset is in kHz, but the chip wants the offset in Hz, so |
465 | * divide fclk by 1000000 to get the correct value. */ | 488 | * divide fclk by 1000000 to get the correct value. */ |
466 | val = - ((val * (state->fclk/1000000)) / (1<<24)); | 489 | val = (((-val) * (state->fclk/1000000)) / (1<<24)); |
467 | 490 | ||
468 | return val; | 491 | return val; |
469 | } | 492 | } |
470 | 493 | ||
471 | static void s5h1420_setfec(struct s5h1420_state* state, struct dvb_frontend_parameters *p) | 494 | static void s5h1420_setfec_inversion(struct s5h1420_state* state, |
495 | struct dvb_frontend_parameters *p) | ||
472 | { | 496 | { |
497 | u8 inversion = 0; | ||
498 | |||
499 | if (p->inversion == INVERSION_OFF) { | ||
500 | inversion = state->config->invert ? 0x08 : 0; | ||
501 | } else if (p->inversion == INVERSION_ON) { | ||
502 | inversion = state->config->invert ? 0 : 0x08; | ||
503 | } | ||
504 | |||
473 | if ((p->u.qpsk.fec_inner == FEC_AUTO) || (p->inversion == INVERSION_AUTO)) { | 505 | if ((p->u.qpsk.fec_inner == FEC_AUTO) || (p->inversion == INVERSION_AUTO)) { |
474 | s5h1420_writereg(state, 0x31, 0x00); | ||
475 | s5h1420_writereg(state, 0x30, 0x3f); | 506 | s5h1420_writereg(state, 0x30, 0x3f); |
507 | s5h1420_writereg(state, 0x31, 0x00 | inversion); | ||
476 | } else { | 508 | } else { |
477 | switch(p->u.qpsk.fec_inner) { | 509 | switch(p->u.qpsk.fec_inner) { |
478 | case FEC_1_2: | 510 | case FEC_1_2: |
479 | s5h1420_writereg(state, 0x31, 0x10); | ||
480 | s5h1420_writereg(state, 0x30, 0x01); | 511 | s5h1420_writereg(state, 0x30, 0x01); |
512 | s5h1420_writereg(state, 0x31, 0x10 | inversion); | ||
481 | break; | 513 | break; |
482 | 514 | ||
483 | case FEC_2_3: | 515 | case FEC_2_3: |
484 | s5h1420_writereg(state, 0x31, 0x11); | ||
485 | s5h1420_writereg(state, 0x30, 0x02); | 516 | s5h1420_writereg(state, 0x30, 0x02); |
517 | s5h1420_writereg(state, 0x31, 0x11 | inversion); | ||
486 | break; | 518 | break; |
487 | 519 | ||
488 | case FEC_3_4: | 520 | case FEC_3_4: |
489 | s5h1420_writereg(state, 0x31, 0x12); | ||
490 | s5h1420_writereg(state, 0x30, 0x04); | 521 | s5h1420_writereg(state, 0x30, 0x04); |
491 | break; | 522 | s5h1420_writereg(state, 0x31, 0x12 | inversion); |
523 | break; | ||
492 | 524 | ||
493 | case FEC_5_6: | 525 | case FEC_5_6: |
494 | s5h1420_writereg(state, 0x31, 0x13); | ||
495 | s5h1420_writereg(state, 0x30, 0x08); | 526 | s5h1420_writereg(state, 0x30, 0x08); |
527 | s5h1420_writereg(state, 0x31, 0x13 | inversion); | ||
496 | break; | 528 | break; |
497 | 529 | ||
498 | case FEC_6_7: | 530 | case FEC_6_7: |
499 | s5h1420_writereg(state, 0x31, 0x14); | ||
500 | s5h1420_writereg(state, 0x30, 0x10); | 531 | s5h1420_writereg(state, 0x30, 0x10); |
532 | s5h1420_writereg(state, 0x31, 0x14 | inversion); | ||
501 | break; | 533 | break; |
502 | 534 | ||
503 | case FEC_7_8: | 535 | case FEC_7_8: |
504 | s5h1420_writereg(state, 0x31, 0x15); | ||
505 | s5h1420_writereg(state, 0x30, 0x20); | 536 | s5h1420_writereg(state, 0x30, 0x20); |
537 | s5h1420_writereg(state, 0x31, 0x15 | inversion); | ||
506 | break; | 538 | break; |
507 | 539 | ||
508 | default: | 540 | default: |
@@ -536,22 +568,6 @@ static fe_code_rate_t s5h1420_getfec(struct s5h1420_state* state) | |||
536 | return FEC_NONE; | 568 | return FEC_NONE; |
537 | } | 569 | } |
538 | 570 | ||
539 | static void s5h1420_setinversion(struct s5h1420_state* state, struct dvb_frontend_parameters *p) | ||
540 | { | ||
541 | if ((p->u.qpsk.fec_inner == FEC_AUTO) || (p->inversion == INVERSION_AUTO)) { | ||
542 | s5h1420_writereg(state, 0x31, 0x00); | ||
543 | s5h1420_writereg(state, 0x30, 0x3f); | ||
544 | } else { | ||
545 | u8 tmp = s5h1420_readreg(state, 0x31) & 0xf7; | ||
546 | tmp |= 0x10; | ||
547 | |||
548 | if (p->inversion == INVERSION_ON) | ||
549 | tmp |= 0x80; | ||
550 | |||
551 | s5h1420_writereg(state, 0x31, tmp); | ||
552 | } | ||
553 | } | ||
554 | |||
555 | static fe_spectral_inversion_t s5h1420_getinversion(struct s5h1420_state* state) | 571 | static fe_spectral_inversion_t s5h1420_getinversion(struct s5h1420_state* state) |
556 | { | 572 | { |
557 | if (s5h1420_readreg(state, 0x32) & 0x08) | 573 | if (s5h1420_readreg(state, 0x32) & 0x08) |
@@ -560,35 +576,35 @@ static fe_spectral_inversion_t s5h1420_getinversion(struct s5h1420_state* state) | |||
560 | return INVERSION_OFF; | 576 | return INVERSION_OFF; |
561 | } | 577 | } |
562 | 578 | ||
563 | static int s5h1420_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) | 579 | static int s5h1420_set_frontend(struct dvb_frontend* fe, |
580 | struct dvb_frontend_parameters *p) | ||
564 | { | 581 | { |
565 | struct s5h1420_state* state = fe->demodulator_priv; | 582 | struct s5h1420_state* state = fe->demodulator_priv; |
566 | u32 frequency_delta; | 583 | int frequency_delta; |
567 | struct dvb_frontend_tune_settings fesettings; | 584 | struct dvb_frontend_tune_settings fesettings; |
585 | u32 tmp; | ||
568 | 586 | ||
569 | /* check if we should do a fast-tune */ | 587 | /* check if we should do a fast-tune */ |
570 | memcpy(&fesettings.parameters, p, sizeof(struct dvb_frontend_parameters)); | 588 | memcpy(&fesettings.parameters, p, sizeof(struct dvb_frontend_parameters)); |
571 | s5h1420_get_tune_settings(fe, &fesettings); | 589 | s5h1420_get_tune_settings(fe, &fesettings); |
572 | frequency_delta = p->frequency - state->tunedfreq; | 590 | frequency_delta = p->frequency - state->tunedfreq; |
573 | if ((frequency_delta > -fesettings.max_drift) && (frequency_delta < fesettings.max_drift) && | 591 | if ((frequency_delta > -fesettings.max_drift) && |
592 | (frequency_delta < fesettings.max_drift) && | ||
574 | (frequency_delta != 0) && | 593 | (frequency_delta != 0) && |
575 | (state->fec_inner == p->u.qpsk.fec_inner) && | 594 | (state->fec_inner == p->u.qpsk.fec_inner) && |
576 | (state->symbol_rate == p->u.qpsk.symbol_rate)) { | 595 | (state->symbol_rate == p->u.qpsk.symbol_rate)) { |
577 | 596 | ||
578 | s5h1420_setfreqoffset(state, frequency_delta); | 597 | if (state->config->pll_set) { |
598 | s5h1420_writereg (state, 0x02, s5h1420_readreg(state,0x02) | 1); | ||
599 | state->config->pll_set(fe, p, &tmp); | ||
600 | s5h1420_setfreqoffset(state, p->frequency - tmp); | ||
601 | } | ||
579 | return 0; | 602 | return 0; |
580 | } | 603 | } |
581 | 604 | ||
582 | /* first of all, software reset */ | 605 | /* first of all, software reset */ |
583 | s5h1420_reset(state); | 606 | s5h1420_reset(state); |
584 | 607 | ||
585 | /* set tuner PLL */ | ||
586 | if (state->config->pll_set) { | ||
587 | s5h1420_writereg (state, 0x02, s5h1420_readreg(state,0x02) | 1); | ||
588 | state->config->pll_set(fe, p, &state->tunedfreq); | ||
589 | s5h1420_writereg (state, 0x02, s5h1420_readreg(state,0x02) & 0xfe); | ||
590 | } | ||
591 | |||
592 | /* set s5h1420 fclk PLL according to desired symbol rate */ | 608 | /* set s5h1420 fclk PLL according to desired symbol rate */ |
593 | if (p->u.qpsk.symbol_rate > 28000000) { | 609 | if (p->u.qpsk.symbol_rate > 28000000) { |
594 | state->fclk = 88000000; | 610 | state->fclk = 88000000; |
@@ -609,8 +625,9 @@ static int s5h1420_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
609 | 625 | ||
610 | /* set misc registers */ | 626 | /* set misc registers */ |
611 | s5h1420_writereg(state, 0x02, 0x00); | 627 | s5h1420_writereg(state, 0x02, 0x00); |
628 | s5h1420_writereg(state, 0x06, 0x00); | ||
612 | s5h1420_writereg(state, 0x07, 0xb0); | 629 | s5h1420_writereg(state, 0x07, 0xb0); |
613 | s5h1420_writereg(state, 0x0a, 0x67); | 630 | s5h1420_writereg(state, 0x0a, 0xe7); |
614 | s5h1420_writereg(state, 0x0b, 0x78); | 631 | s5h1420_writereg(state, 0x0b, 0x78); |
615 | s5h1420_writereg(state, 0x0c, 0x48); | 632 | s5h1420_writereg(state, 0x0c, 0x48); |
616 | s5h1420_writereg(state, 0x0d, 0x6b); | 633 | s5h1420_writereg(state, 0x0d, 0x6b); |
@@ -626,21 +643,26 @@ static int s5h1420_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
626 | /* start QPSK */ | 643 | /* start QPSK */ |
627 | s5h1420_writereg(state, 0x05, s5h1420_readreg(state, 0x05) | 1); | 644 | s5h1420_writereg(state, 0x05, s5h1420_readreg(state, 0x05) | 1); |
628 | 645 | ||
629 | /* set the frequency offset to adjust for PLL inaccuracy */ | 646 | /* set tuner PLL */ |
630 | s5h1420_setfreqoffset(state, p->frequency - state->tunedfreq); | 647 | if (state->config->pll_set) { |
648 | s5h1420_writereg (state, 0x02, s5h1420_readreg(state,0x02) | 1); | ||
649 | state->config->pll_set(fe, p, &tmp); | ||
650 | s5h1420_setfreqoffset(state, 0); | ||
651 | } | ||
631 | 652 | ||
632 | /* set the reset of the parameters */ | 653 | /* set the reset of the parameters */ |
633 | s5h1420_setsymbolrate(state, p); | 654 | s5h1420_setsymbolrate(state, p); |
634 | s5h1420_setinversion(state, p); | 655 | s5h1420_setfec_inversion(state, p); |
635 | s5h1420_setfec(state, p); | ||
636 | 656 | ||
637 | state->fec_inner = p->u.qpsk.fec_inner; | 657 | state->fec_inner = p->u.qpsk.fec_inner; |
638 | state->symbol_rate = p->u.qpsk.symbol_rate; | 658 | state->symbol_rate = p->u.qpsk.symbol_rate; |
639 | state->postlocked = 0; | 659 | state->postlocked = 0; |
660 | state->tunedfreq = p->frequency; | ||
640 | return 0; | 661 | return 0; |
641 | } | 662 | } |
642 | 663 | ||
643 | static int s5h1420_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) | 664 | static int s5h1420_get_frontend(struct dvb_frontend* fe, |
665 | struct dvb_frontend_parameters *p) | ||
644 | { | 666 | { |
645 | struct s5h1420_state* state = fe->demodulator_priv; | 667 | struct s5h1420_state* state = fe->demodulator_priv; |
646 | 668 | ||
@@ -652,7 +674,8 @@ static int s5h1420_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
652 | return 0; | 674 | return 0; |
653 | } | 675 | } |
654 | 676 | ||
655 | static int s5h1420_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fesettings) | 677 | static int s5h1420_get_tune_settings(struct dvb_frontend* fe, |
678 | struct dvb_frontend_tune_settings* fesettings) | ||
656 | { | 679 | { |
657 | if (fesettings->parameters.u.qpsk.symbol_rate > 20000000) { | 680 | if (fesettings->parameters.u.qpsk.symbol_rate > 20000000) { |
658 | fesettings->min_delay_ms = 50; | 681 | fesettings->min_delay_ms = 50; |
@@ -717,7 +740,8 @@ static void s5h1420_release(struct dvb_frontend* fe) | |||
717 | 740 | ||
718 | static struct dvb_frontend_ops s5h1420_ops; | 741 | static struct dvb_frontend_ops s5h1420_ops; |
719 | 742 | ||
720 | struct dvb_frontend* s5h1420_attach(const struct s5h1420_config* config, struct i2c_adapter* i2c) | 743 | struct dvb_frontend* s5h1420_attach(const struct s5h1420_config* config, |
744 | struct i2c_adapter* i2c) | ||
721 | { | 745 | { |
722 | struct s5h1420_state* state = NULL; | 746 | struct s5h1420_state* state = NULL; |
723 | u8 identity; | 747 | u8 identity; |
diff --git a/drivers/media/dvb/frontends/s5h1420.h b/drivers/media/dvb/frontends/s5h1420.h index b687fc77ceb3..872028ddf2a2 100644 --- a/drivers/media/dvb/frontends/s5h1420.h +++ b/drivers/media/dvb/frontends/s5h1420.h | |||
@@ -30,6 +30,9 @@ struct s5h1420_config | |||
30 | /* the demodulator's i2c address */ | 30 | /* the demodulator's i2c address */ |
31 | u8 demod_address; | 31 | u8 demod_address; |
32 | 32 | ||
33 | /* does the inversion require inversion? */ | ||
34 | u8 invert:1; | ||
35 | |||
33 | /* PLL maintenance */ | 36 | /* PLL maintenance */ |
34 | int (*pll_init)(struct dvb_frontend* fe); | 37 | int (*pll_init)(struct dvb_frontend* fe); |
35 | int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u32* freqout); | 38 | int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u32* freqout); |
diff --git a/drivers/media/dvb/frontends/stv0297.c b/drivers/media/dvb/frontends/stv0297.c index 928aca052afe..8d09afd7545d 100644 --- a/drivers/media/dvb/frontends/stv0297.c +++ b/drivers/media/dvb/frontends/stv0297.c | |||
@@ -35,7 +35,6 @@ struct stv0297_state { | |||
35 | struct dvb_frontend frontend; | 35 | struct dvb_frontend frontend; |
36 | 36 | ||
37 | unsigned long base_freq; | 37 | unsigned long base_freq; |
38 | u8 pwm; | ||
39 | }; | 38 | }; |
40 | 39 | ||
41 | #if 1 | 40 | #if 1 |
@@ -46,94 +45,6 @@ struct stv0297_state { | |||
46 | 45 | ||
47 | #define STV0297_CLOCK_KHZ 28900 | 46 | #define STV0297_CLOCK_KHZ 28900 |
48 | 47 | ||
49 | static u8 init_tab[] = { | ||
50 | 0x00, 0x09, | ||
51 | 0x01, 0x69, | ||
52 | 0x03, 0x00, | ||
53 | 0x04, 0x00, | ||
54 | 0x07, 0x00, | ||
55 | 0x08, 0x00, | ||
56 | 0x20, 0x00, | ||
57 | 0x21, 0x40, | ||
58 | 0x22, 0x00, | ||
59 | 0x23, 0x00, | ||
60 | 0x24, 0x40, | ||
61 | 0x25, 0x88, | ||
62 | 0x30, 0xff, | ||
63 | 0x31, 0x00, | ||
64 | 0x32, 0xff, | ||
65 | 0x33, 0x00, | ||
66 | 0x34, 0x50, | ||
67 | 0x35, 0x7f, | ||
68 | 0x36, 0x00, | ||
69 | 0x37, 0x20, | ||
70 | 0x38, 0x00, | ||
71 | 0x40, 0x1c, | ||
72 | 0x41, 0xff, | ||
73 | 0x42, 0x29, | ||
74 | 0x43, 0x00, | ||
75 | 0x44, 0xff, | ||
76 | 0x45, 0x00, | ||
77 | 0x46, 0x00, | ||
78 | 0x49, 0x04, | ||
79 | 0x4a, 0xff, | ||
80 | 0x4b, 0x7f, | ||
81 | 0x52, 0x30, | ||
82 | 0x55, 0xae, | ||
83 | 0x56, 0x47, | ||
84 | 0x57, 0xe1, | ||
85 | 0x58, 0x3a, | ||
86 | 0x5a, 0x1e, | ||
87 | 0x5b, 0x34, | ||
88 | 0x60, 0x00, | ||
89 | 0x63, 0x00, | ||
90 | 0x64, 0x00, | ||
91 | 0x65, 0x00, | ||
92 | 0x66, 0x00, | ||
93 | 0x67, 0x00, | ||
94 | 0x68, 0x00, | ||
95 | 0x69, 0x00, | ||
96 | 0x6a, 0x02, | ||
97 | 0x6b, 0x00, | ||
98 | 0x70, 0xff, | ||
99 | 0x71, 0x00, | ||
100 | 0x72, 0x00, | ||
101 | 0x73, 0x00, | ||
102 | 0x74, 0x0c, | ||
103 | 0x80, 0x00, | ||
104 | 0x81, 0x00, | ||
105 | 0x82, 0x00, | ||
106 | 0x83, 0x00, | ||
107 | 0x84, 0x04, | ||
108 | 0x85, 0x80, | ||
109 | 0x86, 0x24, | ||
110 | 0x87, 0x78, | ||
111 | 0x88, 0x00, | ||
112 | 0x89, 0x00, | ||
113 | 0x90, 0x01, | ||
114 | 0x91, 0x01, | ||
115 | 0xa0, 0x00, | ||
116 | 0xa1, 0x00, | ||
117 | 0xa2, 0x00, | ||
118 | 0xb0, 0x91, | ||
119 | 0xb1, 0x0b, | ||
120 | 0xc0, 0x53, | ||
121 | 0xc1, 0x70, | ||
122 | 0xc2, 0x12, | ||
123 | 0xd0, 0x00, | ||
124 | 0xd1, 0x00, | ||
125 | 0xd2, 0x00, | ||
126 | 0xd3, 0x00, | ||
127 | 0xd4, 0x00, | ||
128 | 0xd5, 0x00, | ||
129 | 0xde, 0x00, | ||
130 | 0xdf, 0x00, | ||
131 | 0x61, 0x49, | ||
132 | 0x62, 0x0b, | ||
133 | 0x53, 0x08, | ||
134 | 0x59, 0x08, | ||
135 | }; | ||
136 | |||
137 | 48 | ||
138 | static int stv0297_writereg(struct stv0297_state *state, u8 reg, u8 data) | 49 | static int stv0297_writereg(struct stv0297_state *state, u8 reg, u8 data) |
139 | { | 50 | { |
@@ -378,34 +289,9 @@ static int stv0297_init(struct dvb_frontend *fe) | |||
378 | struct stv0297_state *state = fe->demodulator_priv; | 289 | struct stv0297_state *state = fe->demodulator_priv; |
379 | int i; | 290 | int i; |
380 | 291 | ||
381 | /* soft reset */ | ||
382 | stv0297_writereg_mask(state, 0x80, 1, 1); | ||
383 | stv0297_writereg_mask(state, 0x80, 1, 0); | ||
384 | |||
385 | /* reset deinterleaver */ | ||
386 | stv0297_writereg_mask(state, 0x81, 1, 1); | ||
387 | stv0297_writereg_mask(state, 0x81, 1, 0); | ||
388 | |||
389 | /* load init table */ | 292 | /* load init table */ |
390 | for (i = 0; i < sizeof(init_tab); i += 2) { | 293 | for (i=0; !(state->config->inittab[i] == 0xff && state->config->inittab[i+1] == 0xff); i+=2) |
391 | stv0297_writereg(state, init_tab[i], init_tab[i + 1]); | 294 | stv0297_writereg(state, state->config->inittab[i], state->config->inittab[i+1]); |
392 | } | ||
393 | |||
394 | /* set a dummy symbol rate */ | ||
395 | stv0297_set_symbolrate(state, 6900); | ||
396 | |||
397 | /* invert AGC1 polarity */ | ||
398 | stv0297_writereg_mask(state, 0x88, 0x10, 0x10); | ||
399 | |||
400 | /* setup bit error counting */ | ||
401 | stv0297_writereg_mask(state, 0xA0, 0x80, 0x00); | ||
402 | stv0297_writereg_mask(state, 0xA0, 0x10, 0x00); | ||
403 | stv0297_writereg_mask(state, 0xA0, 0x08, 0x00); | ||
404 | stv0297_writereg_mask(state, 0xA0, 0x07, 0x04); | ||
405 | |||
406 | /* min + max PWM */ | ||
407 | stv0297_writereg(state, 0x4a, 0x00); | ||
408 | stv0297_writereg(state, 0x4b, state->pwm); | ||
409 | msleep(200); | 295 | msleep(200); |
410 | 296 | ||
411 | if (state->config->pll_init) | 297 | if (state->config->pll_init) |
@@ -606,7 +492,13 @@ static int stv0297_set_frontend(struct dvb_frontend *fe, struct dvb_frontend_par | |||
606 | stv0297_set_inversion(state, inversion); | 492 | stv0297_set_inversion(state, inversion); |
607 | 493 | ||
608 | /* kick off lock */ | 494 | /* kick off lock */ |
609 | stv0297_writereg_mask(state, 0x88, 0x08, 0x08); | 495 | /* Disable corner detection for higher QAMs */ |
496 | if (p->u.qam.modulation == QAM_128 || | ||
497 | p->u.qam.modulation == QAM_256) | ||
498 | stv0297_writereg_mask(state, 0x88, 0x08, 0x00); | ||
499 | else | ||
500 | stv0297_writereg_mask(state, 0x88, 0x08, 0x08); | ||
501 | |||
610 | stv0297_writereg_mask(state, 0x5a, 0x20, 0x00); | 502 | stv0297_writereg_mask(state, 0x5a, 0x20, 0x00); |
611 | stv0297_writereg_mask(state, 0x6a, 0x01, 0x01); | 503 | stv0297_writereg_mask(state, 0x6a, 0x01, 0x01); |
612 | stv0297_writereg_mask(state, 0x43, 0x40, 0x40); | 504 | stv0297_writereg_mask(state, 0x43, 0x40, 0x40); |
@@ -732,7 +624,7 @@ static void stv0297_release(struct dvb_frontend *fe) | |||
732 | static struct dvb_frontend_ops stv0297_ops; | 624 | static struct dvb_frontend_ops stv0297_ops; |
733 | 625 | ||
734 | struct dvb_frontend *stv0297_attach(const struct stv0297_config *config, | 626 | struct dvb_frontend *stv0297_attach(const struct stv0297_config *config, |
735 | struct i2c_adapter *i2c, int pwm) | 627 | struct i2c_adapter *i2c) |
736 | { | 628 | { |
737 | struct stv0297_state *state = NULL; | 629 | struct stv0297_state *state = NULL; |
738 | 630 | ||
@@ -746,7 +638,6 @@ struct dvb_frontend *stv0297_attach(const struct stv0297_config *config, | |||
746 | state->i2c = i2c; | 638 | state->i2c = i2c; |
747 | memcpy(&state->ops, &stv0297_ops, sizeof(struct dvb_frontend_ops)); | 639 | memcpy(&state->ops, &stv0297_ops, sizeof(struct dvb_frontend_ops)); |
748 | state->base_freq = 0; | 640 | state->base_freq = 0; |
749 | state->pwm = pwm; | ||
750 | 641 | ||
751 | /* check if the demod is there */ | 642 | /* check if the demod is there */ |
752 | if ((stv0297_readreg(state, 0x80) & 0x70) != 0x20) | 643 | if ((stv0297_readreg(state, 0x80) & 0x70) != 0x20) |
diff --git a/drivers/media/dvb/frontends/stv0297.h b/drivers/media/dvb/frontends/stv0297.h index 3be535989302..9e53f019db71 100644 --- a/drivers/media/dvb/frontends/stv0297.h +++ b/drivers/media/dvb/frontends/stv0297.h | |||
@@ -29,6 +29,12 @@ struct stv0297_config | |||
29 | /* the demodulator's i2c address */ | 29 | /* the demodulator's i2c address */ |
30 | u8 demod_address; | 30 | u8 demod_address; |
31 | 31 | ||
32 | /* inittab - array of pairs of values. | ||
33 | * First of each pair is the register, second is the value. | ||
34 | * List should be terminated with an 0xff, 0xff pair. | ||
35 | */ | ||
36 | u8* inittab; | ||
37 | |||
32 | /* does the "inversion" need inverted? */ | 38 | /* does the "inversion" need inverted? */ |
33 | u8 invert:1; | 39 | u8 invert:1; |
34 | 40 | ||
@@ -38,7 +44,7 @@ struct stv0297_config | |||
38 | }; | 44 | }; |
39 | 45 | ||
40 | extern struct dvb_frontend* stv0297_attach(const struct stv0297_config* config, | 46 | extern struct dvb_frontend* stv0297_attach(const struct stv0297_config* config, |
41 | struct i2c_adapter* i2c, int pwm); | 47 | struct i2c_adapter* i2c); |
42 | extern int stv0297_enable_plli2c(struct dvb_frontend* fe); | 48 | extern int stv0297_enable_plli2c(struct dvb_frontend* fe); |
43 | 49 | ||
44 | #endif // STV0297_H | 50 | #endif // STV0297_H |
diff --git a/drivers/media/dvb/frontends/stv0299.c b/drivers/media/dvb/frontends/stv0299.c index cfa3928bb487..2d62931f20b5 100644 --- a/drivers/media/dvb/frontends/stv0299.c +++ b/drivers/media/dvb/frontends/stv0299.c | |||
@@ -63,12 +63,8 @@ struct stv0299_state { | |||
63 | u32 tuner_frequency; | 63 | u32 tuner_frequency; |
64 | u32 symbol_rate; | 64 | u32 symbol_rate; |
65 | fe_code_rate_t fec_inner; | 65 | fe_code_rate_t fec_inner; |
66 | int errmode; | ||
67 | }; | 66 | }; |
68 | 67 | ||
69 | #define STATUS_BER 0 | ||
70 | #define STATUS_UCBLOCKS 1 | ||
71 | |||
72 | static int debug; | 68 | static int debug; |
73 | static int debug_legacy_dish_switch; | 69 | static int debug_legacy_dish_switch; |
74 | #define dprintk(args...) \ | 70 | #define dprintk(args...) \ |
@@ -481,7 +477,7 @@ static int stv0299_init (struct dvb_frontend* fe) | |||
481 | 477 | ||
482 | if (state->config->pll_init) { | 478 | if (state->config->pll_init) { |
483 | stv0299_writeregI(state, 0x05, 0xb5); /* enable i2c repeater on stv0299 */ | 479 | stv0299_writeregI(state, 0x05, 0xb5); /* enable i2c repeater on stv0299 */ |
484 | state->config->pll_init(fe); | 480 | state->config->pll_init(fe, state->i2c); |
485 | stv0299_writeregI(state, 0x05, 0x35); /* disable i2c repeater on stv0299 */ | 481 | stv0299_writeregI(state, 0x05, 0x35); /* disable i2c repeater on stv0299 */ |
486 | } | 482 | } |
487 | 483 | ||
@@ -520,7 +516,8 @@ static int stv0299_read_ber(struct dvb_frontend* fe, u32* ber) | |||
520 | { | 516 | { |
521 | struct stv0299_state* state = fe->demodulator_priv; | 517 | struct stv0299_state* state = fe->demodulator_priv; |
522 | 518 | ||
523 | if (state->errmode != STATUS_BER) return 0; | 519 | stv0299_writeregI(state, 0x34, (stv0299_readreg(state, 0x34) & 0xcf) | 0x10); |
520 | msleep(100); | ||
524 | *ber = (stv0299_readreg (state, 0x1d) << 8) | stv0299_readreg (state, 0x1e); | 521 | *ber = (stv0299_readreg (state, 0x1d) << 8) | stv0299_readreg (state, 0x1e); |
525 | 522 | ||
526 | return 0; | 523 | return 0; |
@@ -559,8 +556,9 @@ static int stv0299_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | |||
559 | { | 556 | { |
560 | struct stv0299_state* state = fe->demodulator_priv; | 557 | struct stv0299_state* state = fe->demodulator_priv; |
561 | 558 | ||
562 | if (state->errmode != STATUS_UCBLOCKS) *ucblocks = 0; | 559 | stv0299_writeregI(state, 0x34, (stv0299_readreg(state, 0x34) & 0xcf) | 0x30); |
563 | else *ucblocks = (stv0299_readreg (state, 0x1d) << 8) | stv0299_readreg (state, 0x1e); | 560 | msleep(100); |
561 | *ucblocks = (stv0299_readreg (state, 0x1d) << 8) | stv0299_readreg (state, 0x1e); | ||
564 | 562 | ||
565 | return 0; | 563 | return 0; |
566 | } | 564 | } |
@@ -603,7 +601,7 @@ static int stv0299_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
603 | } else { | 601 | } else { |
604 | /* A "normal" tune is requested */ | 602 | /* A "normal" tune is requested */ |
605 | stv0299_writeregI(state, 0x05, 0xb5); /* enable i2c repeater on stv0299 */ | 603 | stv0299_writeregI(state, 0x05, 0xb5); /* enable i2c repeater on stv0299 */ |
606 | state->config->pll_set(fe, p); | 604 | state->config->pll_set(fe, state->i2c, p); |
607 | stv0299_writeregI(state, 0x05, 0x35); /* disable i2c repeater on stv0299 */ | 605 | stv0299_writeregI(state, 0x05, 0x35); /* disable i2c repeater on stv0299 */ |
608 | 606 | ||
609 | stv0299_writeregI(state, 0x32, 0x80); | 607 | stv0299_writeregI(state, 0x32, 0x80); |
@@ -615,7 +613,7 @@ static int stv0299_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
615 | } | 613 | } |
616 | } else { | 614 | } else { |
617 | stv0299_writeregI(state, 0x05, 0xb5); /* enable i2c repeater on stv0299 */ | 615 | stv0299_writeregI(state, 0x05, 0xb5); /* enable i2c repeater on stv0299 */ |
618 | state->config->pll_set(fe, p); | 616 | state->config->pll_set(fe, state->i2c, p); |
619 | stv0299_writeregI(state, 0x05, 0x35); /* disable i2c repeater on stv0299 */ | 617 | stv0299_writeregI(state, 0x05, 0x35); /* disable i2c repeater on stv0299 */ |
620 | 618 | ||
621 | stv0299_set_FEC (state, p->u.qpsk.fec_inner); | 619 | stv0299_set_FEC (state, p->u.qpsk.fec_inner); |
@@ -709,7 +707,6 @@ struct dvb_frontend* stv0299_attach(const struct stv0299_config* config, | |||
709 | state->tuner_frequency = 0; | 707 | state->tuner_frequency = 0; |
710 | state->symbol_rate = 0; | 708 | state->symbol_rate = 0; |
711 | state->fec_inner = 0; | 709 | state->fec_inner = 0; |
712 | state->errmode = STATUS_BER; | ||
713 | 710 | ||
714 | /* check if the demod is there */ | 711 | /* check if the demod is there */ |
715 | stv0299_writeregI(state, 0x02, 0x34); /* standby off */ | 712 | stv0299_writeregI(state, 0x02, 0x34); /* standby off */ |
diff --git a/drivers/media/dvb/frontends/stv0299.h b/drivers/media/dvb/frontends/stv0299.h index 79457a80a11f..d0c4484861e1 100644 --- a/drivers/media/dvb/frontends/stv0299.h +++ b/drivers/media/dvb/frontends/stv0299.h | |||
@@ -92,8 +92,8 @@ struct stv0299_config | |||
92 | int (*set_symbol_rate)(struct dvb_frontend* fe, u32 srate, u32 ratio); | 92 | int (*set_symbol_rate)(struct dvb_frontend* fe, u32 srate, u32 ratio); |
93 | 93 | ||
94 | /* PLL maintenance */ | 94 | /* PLL maintenance */ |
95 | int (*pll_init)(struct dvb_frontend* fe); | 95 | int (*pll_init)(struct dvb_frontend *fe, struct i2c_adapter *i2c); |
96 | int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); | 96 | int (*pll_set)(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters *params); |
97 | }; | 97 | }; |
98 | 98 | ||
99 | extern int stv0299_writereg (struct dvb_frontend* fe, u8 reg, u8 data); | 99 | extern int stv0299_writereg (struct dvb_frontend* fe, u8 reg, u8 data); |
diff --git a/drivers/media/dvb/frontends/tda1004x.c b/drivers/media/dvb/frontends/tda1004x.c index ab0c032472cc..74cea9f8d721 100644 --- a/drivers/media/dvb/frontends/tda1004x.c +++ b/drivers/media/dvb/frontends/tda1004x.c | |||
@@ -1046,8 +1046,7 @@ static int tda1004x_read_snr(struct dvb_frontend* fe, u16 * snr) | |||
1046 | tmp = tda1004x_read_byte(state, TDA1004X_SNR); | 1046 | tmp = tda1004x_read_byte(state, TDA1004X_SNR); |
1047 | if (tmp < 0) | 1047 | if (tmp < 0) |
1048 | return -EIO; | 1048 | return -EIO; |
1049 | if (tmp) | 1049 | tmp = 255 - tmp; |
1050 | tmp = 255 - tmp; | ||
1051 | 1050 | ||
1052 | *snr = ((tmp << 8) | tmp); | 1051 | *snr = ((tmp << 8) | tmp); |
1053 | dprintk("%s: snr=0x%x\n", __FUNCTION__, *snr); | 1052 | dprintk("%s: snr=0x%x\n", __FUNCTION__, *snr); |
diff --git a/drivers/media/dvb/frontends/ves1820.c b/drivers/media/dvb/frontends/ves1820.c index 70fb44b391a7..c6d276618e86 100644 --- a/drivers/media/dvb/frontends/ves1820.c +++ b/drivers/media/dvb/frontends/ves1820.c | |||
@@ -194,19 +194,18 @@ static int ves1820_init(struct dvb_frontend* fe) | |||
194 | { | 194 | { |
195 | struct ves1820_state* state = fe->demodulator_priv; | 195 | struct ves1820_state* state = fe->demodulator_priv; |
196 | int i; | 196 | int i; |
197 | int val; | ||
198 | 197 | ||
199 | ves1820_writereg(state, 0, 0); | 198 | ves1820_writereg(state, 0, 0); |
200 | 199 | ||
201 | for (i = 0; i < 53; i++) { | 200 | for (i = 0; i < sizeof(ves1820_inittab); i++) |
202 | val = ves1820_inittab[i]; | 201 | ves1820_writereg(state, i, ves1820_inittab[i]); |
203 | if ((i == 2) && (state->config->selagc)) val |= 0x08; | 202 | if (state->config->selagc) |
204 | ves1820_writereg(state, i, val); | 203 | ves1820_writereg(state, 2, ves1820_inittab[2] | 0x08); |
205 | } | ||
206 | 204 | ||
207 | ves1820_writereg(state, 0x34, state->pwm); | 205 | ves1820_writereg(state, 0x34, state->pwm); |
208 | 206 | ||
209 | if (state->config->pll_init) state->config->pll_init(fe); | 207 | if (state->config->pll_init) |
208 | state->config->pll_init(fe); | ||
210 | 209 | ||
211 | return 0; | 210 | return 0; |
212 | } | 211 | } |
@@ -234,7 +233,7 @@ static int ves1820_set_parameters(struct dvb_frontend* fe, struct dvb_frontend_p | |||
234 | ves1820_writereg(state, 0x09, reg0x09[real_qam]); | 233 | ves1820_writereg(state, 0x09, reg0x09[real_qam]); |
235 | 234 | ||
236 | ves1820_setup_reg0(state, reg0x00[real_qam], p->inversion); | 235 | ves1820_setup_reg0(state, reg0x00[real_qam], p->inversion); |
237 | 236 | ves1820_writereg(state, 2, ves1820_inittab[2] | (state->config->selagc ? 0x08 : 0)); | |
238 | return 0; | 237 | return 0; |
239 | } | 238 | } |
240 | 239 | ||
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c index e4c6e87f6c5d..22b203f8ff27 100644 --- a/drivers/media/dvb/ttpci/av7110.c +++ b/drivers/media/dvb/ttpci/av7110.c | |||
@@ -168,7 +168,9 @@ static void init_av7110_av(struct av7110 *av7110) | |||
168 | if (ret < 0) | 168 | if (ret < 0) |
169 | printk("dvb-ttpci:cannot switch on SCART(AD):%d\n",ret); | 169 | printk("dvb-ttpci:cannot switch on SCART(AD):%d\n",ret); |
170 | if (rgb_on && | 170 | if (rgb_on && |
171 | (av7110->dev->pci->subsystem_vendor == 0x110a) && (av7110->dev->pci->subsystem_device == 0x0000)) { | 171 | ((av7110->dev->pci->subsystem_vendor == 0x110a) || |
172 | (av7110->dev->pci->subsystem_vendor == 0x13c2)) && | ||
173 | (av7110->dev->pci->subsystem_device == 0x0000)) { | ||
172 | saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTHI); // RGB on, SCART pin 16 | 174 | saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTHI); // RGB on, SCART pin 16 |
173 | //saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO); // SCARTpin 8 | 175 | //saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO); // SCARTpin 8 |
174 | } | 176 | } |
@@ -177,9 +179,6 @@ static void init_av7110_av(struct av7110 *av7110) | |||
177 | ret = av7110_set_volume(av7110, av7110->mixer.volume_left, av7110->mixer.volume_right); | 179 | ret = av7110_set_volume(av7110, av7110->mixer.volume_left, av7110->mixer.volume_right); |
178 | if (ret < 0) | 180 | if (ret < 0) |
179 | printk("dvb-ttpci:cannot set volume :%d\n",ret); | 181 | printk("dvb-ttpci:cannot set volume :%d\n",ret); |
180 | ret = av7110_setup_irc_config(av7110, 0); | ||
181 | if (ret < 0) | ||
182 | printk("dvb-ttpci:cannot setup irc config :%d\n",ret); | ||
183 | } | 182 | } |
184 | 183 | ||
185 | static void recover_arm(struct av7110 *av7110) | 184 | static void recover_arm(struct av7110 *av7110) |
@@ -265,60 +264,6 @@ static int arm_thread(void *data) | |||
265 | } | 264 | } |
266 | 265 | ||
267 | 266 | ||
268 | /** | ||
269 | * Hack! we save the last av7110 ptr. This should be ok, since | ||
270 | * you rarely will use more then one IR control. | ||
271 | * | ||
272 | * If we want to support multiple controls we would have to do much more... | ||
273 | */ | ||
274 | int av7110_setup_irc_config(struct av7110 *av7110, u32 ir_config) | ||
275 | { | ||
276 | int ret = 0; | ||
277 | static struct av7110 *last; | ||
278 | |||
279 | dprintk(4, "%p\n", av7110); | ||
280 | |||
281 | if (!av7110) | ||
282 | av7110 = last; | ||
283 | else | ||
284 | last = av7110; | ||
285 | |||
286 | if (av7110) { | ||
287 | ret = av7110_fw_cmd(av7110, COMTYPE_PIDFILTER, SetIR, 1, ir_config); | ||
288 | av7110->ir_config = ir_config; | ||
289 | } | ||
290 | return ret; | ||
291 | } | ||
292 | |||
293 | static void (*irc_handler)(u32); | ||
294 | |||
295 | void av7110_register_irc_handler(void (*func)(u32)) | ||
296 | { | ||
297 | dprintk(4, "registering %p\n", func); | ||
298 | irc_handler = func; | ||
299 | } | ||
300 | |||
301 | void av7110_unregister_irc_handler(void (*func)(u32)) | ||
302 | { | ||
303 | dprintk(4, "unregistering %p\n", func); | ||
304 | irc_handler = NULL; | ||
305 | } | ||
306 | |||
307 | static void run_handlers(unsigned long ircom) | ||
308 | { | ||
309 | if (irc_handler != NULL) | ||
310 | (*irc_handler)((u32) ircom); | ||
311 | } | ||
312 | |||
313 | static DECLARE_TASKLET(irtask, run_handlers, 0); | ||
314 | |||
315 | static void IR_handle(struct av7110 *av7110, u32 ircom) | ||
316 | { | ||
317 | dprintk(4, "ircommand = %08x\n", ircom); | ||
318 | irtask.data = (unsigned long) ircom; | ||
319 | tasklet_schedule(&irtask); | ||
320 | } | ||
321 | |||
322 | /**************************************************************************** | 267 | /**************************************************************************** |
323 | * IRQ handling | 268 | * IRQ handling |
324 | ****************************************************************************/ | 269 | ****************************************************************************/ |
@@ -711,8 +656,9 @@ static void gpioirq(unsigned long data) | |||
711 | return; | 656 | return; |
712 | 657 | ||
713 | case DATA_IRCOMMAND: | 658 | case DATA_IRCOMMAND: |
714 | IR_handle(av7110, | 659 | if (av7110->ir_handler) |
715 | swahw32(irdebi(av7110, DEBINOSWAP, Reserved, 0, 4))); | 660 | av7110->ir_handler(av7110, |
661 | swahw32(irdebi(av7110, DEBINOSWAP, Reserved, 0, 4))); | ||
716 | iwdebi(av7110, DEBINOSWAP, RX_BUFF, 0, 2); | 662 | iwdebi(av7110, DEBINOSWAP, RX_BUFF, 0, 2); |
717 | break; | 663 | break; |
718 | 664 | ||
@@ -1668,9 +1614,8 @@ static int alps_bsru6_set_symbol_rate(struct dvb_frontend* fe, u32 srate, u32 ra | |||
1668 | return 0; | 1614 | return 0; |
1669 | } | 1615 | } |
1670 | 1616 | ||
1671 | static int alps_bsru6_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 1617 | static int alps_bsru6_pll_set(struct dvb_frontend* fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters* params) |
1672 | { | 1618 | { |
1673 | struct av7110* av7110 = (struct av7110*) fe->dvb->priv; | ||
1674 | int ret; | 1619 | int ret; |
1675 | u8 data[4]; | 1620 | u8 data[4]; |
1676 | u32 div; | 1621 | u32 div; |
@@ -1687,7 +1632,7 @@ static int alps_bsru6_pll_set(struct dvb_frontend* fe, struct dvb_frontend_param | |||
1687 | 1632 | ||
1688 | if (params->frequency > 1530000) data[3] = 0xc0; | 1633 | if (params->frequency > 1530000) data[3] = 0xc0; |
1689 | 1634 | ||
1690 | ret = i2c_transfer(&av7110->i2c_adap, &msg, 1); | 1635 | ret = i2c_transfer(i2c, &msg, 1); |
1691 | if (ret != 1) | 1636 | if (ret != 1) |
1692 | return -EIO; | 1637 | return -EIO; |
1693 | return 0; | 1638 | return 0; |
@@ -1751,9 +1696,8 @@ static u8 alps_bsbe1_inittab[] = { | |||
1751 | 0xff, 0xff | 1696 | 0xff, 0xff |
1752 | }; | 1697 | }; |
1753 | 1698 | ||
1754 | static int alps_bsbe1_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 1699 | static int alps_bsbe1_pll_set(struct dvb_frontend* fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters* params) |
1755 | { | 1700 | { |
1756 | struct av7110* av7110 = (struct av7110*) fe->dvb->priv; | ||
1757 | int ret; | 1701 | int ret; |
1758 | u8 data[4]; | 1702 | u8 data[4]; |
1759 | u32 div; | 1703 | u32 div; |
@@ -1768,7 +1712,7 @@ static int alps_bsbe1_pll_set(struct dvb_frontend* fe, struct dvb_frontend_param | |||
1768 | data[2] = 0x80 | ((div & 0x18000) >> 10) | 4; | 1712 | data[2] = 0x80 | ((div & 0x18000) >> 10) | 4; |
1769 | data[3] = (params->frequency > 1530000) ? 0xE0 : 0xE4; | 1713 | data[3] = (params->frequency > 1530000) ? 0xE0 : 0xE4; |
1770 | 1714 | ||
1771 | ret = i2c_transfer(&av7110->i2c_adap, &msg, 1); | 1715 | ret = i2c_transfer(i2c, &msg, 1); |
1772 | return (ret != 1) ? -EIO : 0; | 1716 | return (ret != 1) ? -EIO : 0; |
1773 | } | 1717 | } |
1774 | 1718 | ||
@@ -1936,6 +1880,98 @@ static struct sp8870_config alps_tdlb7_config = { | |||
1936 | }; | 1880 | }; |
1937 | 1881 | ||
1938 | 1882 | ||
1883 | static u8 nexusca_stv0297_inittab[] = { | ||
1884 | 0x80, 0x01, | ||
1885 | 0x80, 0x00, | ||
1886 | 0x81, 0x01, | ||
1887 | 0x81, 0x00, | ||
1888 | 0x00, 0x09, | ||
1889 | 0x01, 0x69, | ||
1890 | 0x03, 0x00, | ||
1891 | 0x04, 0x00, | ||
1892 | 0x07, 0x00, | ||
1893 | 0x08, 0x00, | ||
1894 | 0x20, 0x00, | ||
1895 | 0x21, 0x40, | ||
1896 | 0x22, 0x00, | ||
1897 | 0x23, 0x00, | ||
1898 | 0x24, 0x40, | ||
1899 | 0x25, 0x88, | ||
1900 | 0x30, 0xff, | ||
1901 | 0x31, 0x00, | ||
1902 | 0x32, 0xff, | ||
1903 | 0x33, 0x00, | ||
1904 | 0x34, 0x50, | ||
1905 | 0x35, 0x7f, | ||
1906 | 0x36, 0x00, | ||
1907 | 0x37, 0x20, | ||
1908 | 0x38, 0x00, | ||
1909 | 0x40, 0x1c, | ||
1910 | 0x41, 0xff, | ||
1911 | 0x42, 0x29, | ||
1912 | 0x43, 0x00, | ||
1913 | 0x44, 0xff, | ||
1914 | 0x45, 0x00, | ||
1915 | 0x46, 0x00, | ||
1916 | 0x49, 0x04, | ||
1917 | 0x4a, 0x00, | ||
1918 | 0x4b, 0x7b, | ||
1919 | 0x52, 0x30, | ||
1920 | 0x55, 0xae, | ||
1921 | 0x56, 0x47, | ||
1922 | 0x57, 0xe1, | ||
1923 | 0x58, 0x3a, | ||
1924 | 0x5a, 0x1e, | ||
1925 | 0x5b, 0x34, | ||
1926 | 0x60, 0x00, | ||
1927 | 0x63, 0x00, | ||
1928 | 0x64, 0x00, | ||
1929 | 0x65, 0x00, | ||
1930 | 0x66, 0x00, | ||
1931 | 0x67, 0x00, | ||
1932 | 0x68, 0x00, | ||
1933 | 0x69, 0x00, | ||
1934 | 0x6a, 0x02, | ||
1935 | 0x6b, 0x00, | ||
1936 | 0x70, 0xff, | ||
1937 | 0x71, 0x00, | ||
1938 | 0x72, 0x00, | ||
1939 | 0x73, 0x00, | ||
1940 | 0x74, 0x0c, | ||
1941 | 0x80, 0x00, | ||
1942 | 0x81, 0x00, | ||
1943 | 0x82, 0x00, | ||
1944 | 0x83, 0x00, | ||
1945 | 0x84, 0x04, | ||
1946 | 0x85, 0x80, | ||
1947 | 0x86, 0x24, | ||
1948 | 0x87, 0x78, | ||
1949 | 0x88, 0x10, | ||
1950 | 0x89, 0x00, | ||
1951 | 0x90, 0x01, | ||
1952 | 0x91, 0x01, | ||
1953 | 0xa0, 0x04, | ||
1954 | 0xa1, 0x00, | ||
1955 | 0xa2, 0x00, | ||
1956 | 0xb0, 0x91, | ||
1957 | 0xb1, 0x0b, | ||
1958 | 0xc0, 0x53, | ||
1959 | 0xc1, 0x70, | ||
1960 | 0xc2, 0x12, | ||
1961 | 0xd0, 0x00, | ||
1962 | 0xd1, 0x00, | ||
1963 | 0xd2, 0x00, | ||
1964 | 0xd3, 0x00, | ||
1965 | 0xd4, 0x00, | ||
1966 | 0xd5, 0x00, | ||
1967 | 0xde, 0x00, | ||
1968 | 0xdf, 0x00, | ||
1969 | 0x61, 0x49, | ||
1970 | 0x62, 0x0b, | ||
1971 | 0x53, 0x08, | ||
1972 | 0x59, 0x08, | ||
1973 | 0xff, 0xff, | ||
1974 | }; | ||
1939 | 1975 | ||
1940 | static int nexusca_stv0297_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 1976 | static int nexusca_stv0297_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) |
1941 | { | 1977 | { |
@@ -1984,6 +2020,7 @@ static int nexusca_stv0297_pll_set(struct dvb_frontend* fe, struct dvb_frontend_ | |||
1984 | static struct stv0297_config nexusca_stv0297_config = { | 2020 | static struct stv0297_config nexusca_stv0297_config = { |
1985 | 2021 | ||
1986 | .demod_address = 0x1C, | 2022 | .demod_address = 0x1C, |
2023 | .inittab = nexusca_stv0297_inittab, | ||
1987 | .invert = 1, | 2024 | .invert = 1, |
1988 | .pll_set = nexusca_stv0297_pll_set, | 2025 | .pll_set = nexusca_stv0297_pll_set, |
1989 | }; | 2026 | }; |
@@ -2261,7 +2298,7 @@ static int frontend_init(struct av7110 *av7110) | |||
2261 | 2298 | ||
2262 | case 0x000A: // Hauppauge/TT Nexus-CA rev1.X | 2299 | case 0x000A: // Hauppauge/TT Nexus-CA rev1.X |
2263 | 2300 | ||
2264 | av7110->fe = stv0297_attach(&nexusca_stv0297_config, &av7110->i2c_adap, 0x7b); | 2301 | av7110->fe = stv0297_attach(&nexusca_stv0297_config, &av7110->i2c_adap); |
2265 | if (av7110->fe) { | 2302 | if (av7110->fe) { |
2266 | /* set TDA9819 into DVB mode */ | 2303 | /* set TDA9819 into DVB mode */ |
2267 | saa7146_setgpio(av7110->dev, 1, SAA7146_GPIO_OUTLO); // TDA9198 pin9(STD) | 2304 | saa7146_setgpio(av7110->dev, 1, SAA7146_GPIO_OUTLO); // TDA9198 pin9(STD) |
@@ -2692,7 +2729,7 @@ static int av7110_attach(struct saa7146_dev* dev, struct saa7146_pci_extension_d | |||
2692 | goto err_av7110_exit_v4l_12; | 2729 | goto err_av7110_exit_v4l_12; |
2693 | 2730 | ||
2694 | #if defined(CONFIG_INPUT_EVDEV) || defined(CONFIG_INPUT_EVDEV_MODULE) | 2731 | #if defined(CONFIG_INPUT_EVDEV) || defined(CONFIG_INPUT_EVDEV_MODULE) |
2695 | av7110_ir_init(); | 2732 | av7110_ir_init(av7110); |
2696 | #endif | 2733 | #endif |
2697 | printk(KERN_INFO "dvb-ttpci: found av7110-%d.\n", av7110_num); | 2734 | printk(KERN_INFO "dvb-ttpci: found av7110-%d.\n", av7110_num); |
2698 | av7110_num++; | 2735 | av7110_num++; |
@@ -2734,6 +2771,9 @@ static int av7110_detach(struct saa7146_dev* saa) | |||
2734 | struct av7110 *av7110 = saa->ext_priv; | 2771 | struct av7110 *av7110 = saa->ext_priv; |
2735 | dprintk(4, "%p\n", av7110); | 2772 | dprintk(4, "%p\n", av7110); |
2736 | 2773 | ||
2774 | #if defined(CONFIG_INPUT_EVDEV) || defined(CONFIG_INPUT_EVDEV_MODULE) | ||
2775 | av7110_ir_exit(av7110); | ||
2776 | #endif | ||
2737 | if (budgetpatch) { | 2777 | if (budgetpatch) { |
2738 | /* Disable RPS1 */ | 2778 | /* Disable RPS1 */ |
2739 | saa7146_write(saa, MC1, MASK_29); | 2779 | saa7146_write(saa, MC1, MASK_29); |
@@ -2830,7 +2870,7 @@ static struct saa7146_pci_extension_data x_var = { \ | |||
2830 | .ext_priv = x_name, \ | 2870 | .ext_priv = x_name, \ |
2831 | .ext = &av7110_extension } | 2871 | .ext = &av7110_extension } |
2832 | 2872 | ||
2833 | MAKE_AV7110_INFO(tts_1_X, "Technotrend/Hauppauge WinTV DVB-S rev1.X"); | 2873 | MAKE_AV7110_INFO(tts_1_X_fsc,"Technotrend/Hauppauge WinTV DVB-S rev1.X or Fujitsu Siemens DVB-C"); |
2834 | MAKE_AV7110_INFO(ttt_1_X, "Technotrend/Hauppauge WinTV DVB-T rev1.X"); | 2874 | MAKE_AV7110_INFO(ttt_1_X, "Technotrend/Hauppauge WinTV DVB-T rev1.X"); |
2835 | MAKE_AV7110_INFO(ttc_1_X, "Technotrend/Hauppauge WinTV Nexus-CA rev1.X"); | 2875 | MAKE_AV7110_INFO(ttc_1_X, "Technotrend/Hauppauge WinTV Nexus-CA rev1.X"); |
2836 | MAKE_AV7110_INFO(ttc_2_X, "Technotrend/Hauppauge WinTV DVB-C rev2.X"); | 2876 | MAKE_AV7110_INFO(ttc_2_X, "Technotrend/Hauppauge WinTV DVB-C rev2.X"); |
@@ -2842,16 +2882,16 @@ MAKE_AV7110_INFO(fsc, "Fujitsu Siemens DVB-C"); | |||
2842 | MAKE_AV7110_INFO(fss, "Fujitsu Siemens DVB-S rev1.6"); | 2882 | MAKE_AV7110_INFO(fss, "Fujitsu Siemens DVB-S rev1.6"); |
2843 | 2883 | ||
2844 | static struct pci_device_id pci_tbl[] = { | 2884 | static struct pci_device_id pci_tbl[] = { |
2845 | MAKE_EXTENSION_PCI(fsc, 0x110a, 0x0000), | 2885 | MAKE_EXTENSION_PCI(fsc, 0x110a, 0x0000), |
2846 | MAKE_EXTENSION_PCI(tts_1_X, 0x13c2, 0x0000), | 2886 | MAKE_EXTENSION_PCI(tts_1_X_fsc, 0x13c2, 0x0000), |
2847 | MAKE_EXTENSION_PCI(ttt_1_X, 0x13c2, 0x0001), | 2887 | MAKE_EXTENSION_PCI(ttt_1_X, 0x13c2, 0x0001), |
2848 | MAKE_EXTENSION_PCI(ttc_2_X, 0x13c2, 0x0002), | 2888 | MAKE_EXTENSION_PCI(ttc_2_X, 0x13c2, 0x0002), |
2849 | MAKE_EXTENSION_PCI(tts_2_X, 0x13c2, 0x0003), | 2889 | MAKE_EXTENSION_PCI(tts_2_X, 0x13c2, 0x0003), |
2850 | MAKE_EXTENSION_PCI(fss, 0x13c2, 0x0006), | 2890 | MAKE_EXTENSION_PCI(fss, 0x13c2, 0x0006), |
2851 | MAKE_EXTENSION_PCI(ttt, 0x13c2, 0x0008), | 2891 | MAKE_EXTENSION_PCI(ttt, 0x13c2, 0x0008), |
2852 | MAKE_EXTENSION_PCI(ttc_1_X, 0x13c2, 0x000a), | 2892 | MAKE_EXTENSION_PCI(ttc_1_X, 0x13c2, 0x000a), |
2853 | MAKE_EXTENSION_PCI(tts_2_3, 0x13c2, 0x000e), | 2893 | MAKE_EXTENSION_PCI(tts_2_3, 0x13c2, 0x000e), |
2854 | MAKE_EXTENSION_PCI(tts_1_3se, 0x13c2, 0x1002), | 2894 | MAKE_EXTENSION_PCI(tts_1_3se, 0x13c2, 0x1002), |
2855 | 2895 | ||
2856 | /* MAKE_EXTENSION_PCI(???, 0x13c2, 0x0004), UNDEFINED CARD */ // Galaxis DVB PC-Sat-Carte | 2896 | /* MAKE_EXTENSION_PCI(???, 0x13c2, 0x0004), UNDEFINED CARD */ // Galaxis DVB PC-Sat-Carte |
2857 | /* MAKE_EXTENSION_PCI(???, 0x13c2, 0x0005), UNDEFINED CARD */ // Technisat SkyStar1 | 2897 | /* MAKE_EXTENSION_PCI(???, 0x13c2, 0x0005), UNDEFINED CARD */ // Technisat SkyStar1 |
@@ -2889,9 +2929,6 @@ static int __init av7110_init(void) | |||
2889 | 2929 | ||
2890 | static void __exit av7110_exit(void) | 2930 | static void __exit av7110_exit(void) |
2891 | { | 2931 | { |
2892 | #if defined(CONFIG_INPUT_EVDEV) || defined(CONFIG_INPUT_EVDEV_MODULE) | ||
2893 | av7110_ir_exit(); | ||
2894 | #endif | ||
2895 | saa7146_unregister_extension(&av7110_extension); | 2932 | saa7146_unregister_extension(&av7110_extension); |
2896 | } | 2933 | } |
2897 | 2934 | ||
diff --git a/drivers/media/dvb/ttpci/av7110.h b/drivers/media/dvb/ttpci/av7110.h index 508b7739c609..cce00ef293e9 100644 --- a/drivers/media/dvb/ttpci/av7110.h +++ b/drivers/media/dvb/ttpci/av7110.h | |||
@@ -228,7 +228,10 @@ struct av7110 { | |||
228 | struct dvb_video_events video_events; | 228 | struct dvb_video_events video_events; |
229 | video_size_t video_size; | 229 | video_size_t video_size; |
230 | 230 | ||
231 | u32 ir_config; | 231 | u32 ir_config; |
232 | u32 ir_command; | ||
233 | void (*ir_handler)(struct av7110 *av7110, u32 ircom); | ||
234 | struct tasklet_struct ir_tasklet; | ||
232 | 235 | ||
233 | /* firmware stuff */ | 236 | /* firmware stuff */ |
234 | unsigned char *bin_fw; | 237 | unsigned char *bin_fw; |
@@ -257,12 +260,10 @@ struct av7110 { | |||
257 | extern int ChangePIDs(struct av7110 *av7110, u16 vpid, u16 apid, u16 ttpid, | 260 | extern int ChangePIDs(struct av7110 *av7110, u16 vpid, u16 apid, u16 ttpid, |
258 | u16 subpid, u16 pcrpid); | 261 | u16 subpid, u16 pcrpid); |
259 | 262 | ||
260 | extern void av7110_register_irc_handler(void (*func)(u32)); | ||
261 | extern void av7110_unregister_irc_handler(void (*func)(u32)); | ||
262 | extern int av7110_setup_irc_config (struct av7110 *av7110, u32 ir_config); | 263 | extern int av7110_setup_irc_config (struct av7110 *av7110, u32 ir_config); |
263 | 264 | ||
264 | extern int av7110_ir_init (void); | 265 | extern int av7110_ir_init(struct av7110 *av7110); |
265 | extern void av7110_ir_exit (void); | 266 | extern void av7110_ir_exit(struct av7110 *av7110); |
266 | 267 | ||
267 | /* msp3400 i2c subaddresses */ | 268 | /* msp3400 i2c subaddresses */ |
268 | #define MSP_WR_DEM 0x10 | 269 | #define MSP_WR_DEM 0x10 |
diff --git a/drivers/media/dvb/ttpci/av7110_hw.c b/drivers/media/dvb/ttpci/av7110_hw.c index 1220826696c5..7442f56a72ec 100644 --- a/drivers/media/dvb/ttpci/av7110_hw.c +++ b/drivers/media/dvb/ttpci/av7110_hw.c | |||
@@ -41,6 +41,8 @@ | |||
41 | #include "av7110.h" | 41 | #include "av7110.h" |
42 | #include "av7110_hw.h" | 42 | #include "av7110_hw.h" |
43 | 43 | ||
44 | #define _NOHANDSHAKE | ||
45 | |||
44 | /**************************************************************************** | 46 | /**************************************************************************** |
45 | * DEBI functions | 47 | * DEBI functions |
46 | ****************************************************************************/ | 48 | ****************************************************************************/ |
@@ -364,7 +366,8 @@ static int __av7110_send_fw_cmd(struct av7110 *av7110, u16* buf, int length) | |||
364 | msleep(1); | 366 | msleep(1); |
365 | } | 367 | } |
366 | 368 | ||
367 | wdebi(av7110, DEBINOSWAP, COM_IF_LOCK, 0xffff, 2); | 369 | if (FW_VERSION(av7110->arm_app) <= 0x261f) |
370 | wdebi(av7110, DEBINOSWAP, COM_IF_LOCK, 0xffff, 2); | ||
368 | 371 | ||
369 | #ifndef _NOHANDSHAKE | 372 | #ifndef _NOHANDSHAKE |
370 | start = jiffies; | 373 | start = jiffies; |
@@ -437,7 +440,8 @@ static int __av7110_send_fw_cmd(struct av7110 *av7110, u16* buf, int length) | |||
437 | 440 | ||
438 | wdebi(av7110, DEBINOSWAP, COMMAND, (u32) buf[0], 2); | 441 | wdebi(av7110, DEBINOSWAP, COMMAND, (u32) buf[0], 2); |
439 | 442 | ||
440 | wdebi(av7110, DEBINOSWAP, COM_IF_LOCK, 0x0000, 2); | 443 | if (FW_VERSION(av7110->arm_app) <= 0x261f) |
444 | wdebi(av7110, DEBINOSWAP, COM_IF_LOCK, 0x0000, 2); | ||
441 | 445 | ||
442 | #ifdef COM_DEBUG | 446 | #ifdef COM_DEBUG |
443 | start = jiffies; | 447 | start = jiffies; |
diff --git a/drivers/media/dvb/ttpci/av7110_ir.c b/drivers/media/dvb/ttpci/av7110_ir.c index 665cdb8a3f71..357a3728ec68 100644 --- a/drivers/media/dvb/ttpci/av7110_ir.c +++ b/drivers/media/dvb/ttpci/av7110_ir.c | |||
@@ -7,16 +7,16 @@ | |||
7 | #include <asm/bitops.h> | 7 | #include <asm/bitops.h> |
8 | 8 | ||
9 | #include "av7110.h" | 9 | #include "av7110.h" |
10 | #include "av7110_hw.h" | ||
10 | 11 | ||
11 | #define UP_TIMEOUT (HZ/4) | 12 | #define UP_TIMEOUT (HZ*7/25) |
12 | 13 | ||
13 | /* enable ir debugging by or'ing debug with 16 */ | 14 | /* enable ir debugging by or'ing debug with 16 */ |
14 | 15 | ||
15 | static int ir_initialized; | 16 | static int av_cnt; |
17 | static struct av7110 *av_list[4]; | ||
16 | static struct input_dev input_dev; | 18 | static struct input_dev input_dev; |
17 | 19 | ||
18 | static u32 ir_config; | ||
19 | |||
20 | static u16 key_map [256] = { | 20 | static u16 key_map [256] = { |
21 | KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, | 21 | KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, |
22 | KEY_8, KEY_9, KEY_BACK, 0, KEY_POWER, KEY_MUTE, 0, KEY_INFO, | 22 | KEY_8, KEY_9, KEY_BACK, 0, KEY_POWER, KEY_MUTE, 0, KEY_INFO, |
@@ -53,8 +53,11 @@ static void av7110_emit_keyup(unsigned long data) | |||
53 | static struct timer_list keyup_timer = { .function = av7110_emit_keyup }; | 53 | static struct timer_list keyup_timer = { .function = av7110_emit_keyup }; |
54 | 54 | ||
55 | 55 | ||
56 | static void av7110_emit_key(u32 ircom) | 56 | static void av7110_emit_key(unsigned long parm) |
57 | { | 57 | { |
58 | struct av7110 *av7110 = (struct av7110 *) parm; | ||
59 | u32 ir_config = av7110->ir_config; | ||
60 | u32 ircom = av7110->ir_command; | ||
58 | u8 data; | 61 | u8 data; |
59 | u8 addr; | 62 | u8 addr; |
60 | static u16 old_toggle = 0; | 63 | static u16 old_toggle = 0; |
@@ -62,19 +65,33 @@ static void av7110_emit_key(u32 ircom) | |||
62 | u16 keycode; | 65 | u16 keycode; |
63 | 66 | ||
64 | /* extract device address and data */ | 67 | /* extract device address and data */ |
65 | if (ir_config & 0x0001) { | 68 | switch (ir_config & 0x0003) { |
66 | /* TODO RCMM: ? bits device address, 8 bits data */ | 69 | case 0: /* RC5: 5 bits device address, 6 bits data */ |
70 | data = ircom & 0x3f; | ||
71 | addr = (ircom >> 6) & 0x1f; | ||
72 | break; | ||
73 | |||
74 | case 1: /* RCMM: 8(?) bits device address, 8(?) bits data */ | ||
67 | data = ircom & 0xff; | 75 | data = ircom & 0xff; |
68 | addr = (ircom >> 8) & 0xff; | 76 | addr = (ircom >> 8) & 0xff; |
69 | } else { | 77 | break; |
70 | /* RC5: 5 bits device address, 6 bits data */ | 78 | |
79 | case 2: /* extended RC5: 5 bits device address, 7 bits data */ | ||
71 | data = ircom & 0x3f; | 80 | data = ircom & 0x3f; |
72 | addr = (ircom >> 6) & 0x1f; | 81 | addr = (ircom >> 6) & 0x1f; |
82 | /* invert 7th data bit for backward compatibility with RC5 keymaps */ | ||
83 | if (!(ircom & 0x1000)) | ||
84 | data |= 0x40; | ||
85 | break; | ||
86 | |||
87 | default: | ||
88 | printk("invalid ir_config %x\n", ir_config); | ||
89 | return; | ||
73 | } | 90 | } |
74 | 91 | ||
75 | keycode = key_map[data]; | 92 | keycode = key_map[data]; |
76 | 93 | ||
77 | dprintk(16, "#########%08x######### addr %i data 0x%02x (keycode %i)\n", | 94 | dprintk(16, "code %08x -> addr %i data 0x%02x -> keycode %i\n", |
78 | ircom, addr, data, keycode); | 95 | ircom, addr, data, keycode); |
79 | 96 | ||
80 | /* check device address (if selected) */ | 97 | /* check device address (if selected) */ |
@@ -87,10 +104,10 @@ static void av7110_emit_key(u32 ircom) | |||
87 | return; | 104 | return; |
88 | } | 105 | } |
89 | 106 | ||
90 | if (ir_config & 0x0001) | 107 | if ((ir_config & 0x0003) == 1) |
91 | new_toggle = 0; /* RCMM */ | 108 | new_toggle = 0; /* RCMM */ |
92 | else | 109 | else |
93 | new_toggle = (ircom & 0x800); /* RC5 */ | 110 | new_toggle = (ircom & 0x800); /* RC5, extended RC5 */ |
94 | 111 | ||
95 | if (timer_pending(&keyup_timer)) { | 112 | if (timer_pending(&keyup_timer)) { |
96 | del_timer(&keyup_timer); | 113 | del_timer(&keyup_timer); |
@@ -137,6 +154,8 @@ static int av7110_ir_write_proc(struct file *file, const char __user *buffer, | |||
137 | { | 154 | { |
138 | char *page; | 155 | char *page; |
139 | int size = 4 + 256 * sizeof(u16); | 156 | int size = 4 + 256 * sizeof(u16); |
157 | u32 ir_config; | ||
158 | int i; | ||
140 | 159 | ||
141 | if (count < size) | 160 | if (count < size) |
142 | return -EINVAL; | 161 | return -EINVAL; |
@@ -153,60 +172,95 @@ static int av7110_ir_write_proc(struct file *file, const char __user *buffer, | |||
153 | memcpy(&ir_config, page, 4); | 172 | memcpy(&ir_config, page, 4); |
154 | memcpy(&key_map, page + 4, 256 * sizeof(u16)); | 173 | memcpy(&key_map, page + 4, 256 * sizeof(u16)); |
155 | vfree(page); | 174 | vfree(page); |
156 | av7110_setup_irc_config(NULL, ir_config); | 175 | if (FW_VERSION(av_list[0]->arm_app) >= 0x2620 && !(ir_config & 0x0001)) |
176 | ir_config |= 0x0002; /* enable extended RC5 */ | ||
177 | for (i = 0; i < av_cnt; i++) | ||
178 | av7110_setup_irc_config(av_list[i], ir_config); | ||
157 | input_register_keys(); | 179 | input_register_keys(); |
158 | return count; | 180 | return count; |
159 | } | 181 | } |
160 | 182 | ||
161 | 183 | ||
162 | int __init av7110_ir_init(void) | 184 | int av7110_setup_irc_config(struct av7110 *av7110, u32 ir_config) |
163 | { | 185 | { |
164 | static struct proc_dir_entry *e; | 186 | int ret = 0; |
165 | 187 | ||
166 | if (ir_initialized) | 188 | dprintk(4, "%p\n", av7110); |
167 | return 0; | 189 | if (av7110) { |
190 | ret = av7110_fw_cmd(av7110, COMTYPE_PIDFILTER, SetIR, 1, ir_config); | ||
191 | av7110->ir_config = ir_config; | ||
192 | } | ||
193 | return ret; | ||
194 | } | ||
168 | 195 | ||
169 | init_timer(&keyup_timer); | ||
170 | keyup_timer.data = 0; | ||
171 | 196 | ||
172 | input_dev.name = "DVB on-card IR receiver"; | 197 | static void ir_handler(struct av7110 *av7110, u32 ircom) |
198 | { | ||
199 | dprintk(4, "ircommand = %08x\n", ircom); | ||
200 | av7110->ir_command = ircom; | ||
201 | tasklet_schedule(&av7110->ir_tasklet); | ||
202 | } | ||
173 | 203 | ||
174 | /** | ||
175 | * enable keys | ||
176 | */ | ||
177 | set_bit(EV_KEY, input_dev.evbit); | ||
178 | set_bit(EV_REP, input_dev.evbit); | ||
179 | 204 | ||
180 | input_register_keys(); | 205 | int __init av7110_ir_init(struct av7110 *av7110) |
206 | { | ||
207 | static struct proc_dir_entry *e; | ||
181 | 208 | ||
182 | input_register_device(&input_dev); | 209 | if (av_cnt >= sizeof av_list/sizeof av_list[0]) |
183 | input_dev.timer.function = input_repeat_key; | 210 | return -ENOSPC; |
184 | 211 | ||
185 | av7110_setup_irc_config(NULL, 0x0001); | 212 | av7110_setup_irc_config(av7110, 0x0001); |
186 | av7110_register_irc_handler(av7110_emit_key); | 213 | av_list[av_cnt++] = av7110; |
187 | 214 | ||
188 | e = create_proc_entry("av7110_ir", S_IFREG | S_IRUGO | S_IWUSR, NULL); | 215 | if (av_cnt == 1) { |
189 | if (e) { | 216 | init_timer(&keyup_timer); |
190 | e->write_proc = av7110_ir_write_proc; | 217 | keyup_timer.data = 0; |
191 | e->size = 4 + 256 * sizeof(u16); | 218 | |
219 | input_dev.name = "DVB on-card IR receiver"; | ||
220 | set_bit(EV_KEY, input_dev.evbit); | ||
221 | set_bit(EV_REP, input_dev.evbit); | ||
222 | input_register_keys(); | ||
223 | input_register_device(&input_dev); | ||
224 | input_dev.timer.function = input_repeat_key; | ||
225 | |||
226 | e = create_proc_entry("av7110_ir", S_IFREG | S_IRUGO | S_IWUSR, NULL); | ||
227 | if (e) { | ||
228 | e->write_proc = av7110_ir_write_proc; | ||
229 | e->size = 4 + 256 * sizeof(u16); | ||
230 | } | ||
192 | } | 231 | } |
193 | 232 | ||
194 | ir_initialized = 1; | 233 | tasklet_init(&av7110->ir_tasklet, av7110_emit_key, (unsigned long) av7110); |
234 | av7110->ir_handler = ir_handler; | ||
235 | |||
195 | return 0; | 236 | return 0; |
196 | } | 237 | } |
197 | 238 | ||
198 | 239 | ||
199 | void __exit av7110_ir_exit(void) | 240 | void __exit av7110_ir_exit(struct av7110 *av7110) |
200 | { | 241 | { |
201 | if (ir_initialized == 0) | 242 | int i; |
243 | |||
244 | if (av_cnt == 0) | ||
202 | return; | 245 | return; |
203 | del_timer_sync(&keyup_timer); | 246 | |
204 | remove_proc_entry("av7110_ir", NULL); | 247 | av7110->ir_handler = NULL; |
205 | av7110_unregister_irc_handler(av7110_emit_key); | 248 | tasklet_kill(&av7110->ir_tasklet); |
206 | input_unregister_device(&input_dev); | 249 | for (i = 0; i < av_cnt; i++) |
207 | ir_initialized = 0; | 250 | if (av_list[i] == av7110) { |
251 | av_list[i] = av_list[av_cnt-1]; | ||
252 | av_list[av_cnt-1] = NULL; | ||
253 | break; | ||
254 | } | ||
255 | |||
256 | if (av_cnt == 1) { | ||
257 | del_timer_sync(&keyup_timer); | ||
258 | remove_proc_entry("av7110_ir", NULL); | ||
259 | input_unregister_device(&input_dev); | ||
260 | } | ||
261 | |||
262 | av_cnt--; | ||
208 | } | 263 | } |
209 | 264 | ||
210 | //MODULE_AUTHOR("Holger Waechtler <holger@convergence.de>"); | 265 | //MODULE_AUTHOR("Holger Waechtler <holger@convergence.de>"); |
211 | //MODULE_LICENSE("GPL"); | 266 | //MODULE_LICENSE("GPL"); |
212 | |||
diff --git a/drivers/media/dvb/ttpci/av7110_v4l.c b/drivers/media/dvb/ttpci/av7110_v4l.c index e65fc36e2ce8..6af74f78b3e5 100644 --- a/drivers/media/dvb/ttpci/av7110_v4l.c +++ b/drivers/media/dvb/ttpci/av7110_v4l.c | |||
@@ -70,7 +70,7 @@ static int msp_readreg(struct av7110 *av7110, u8 dev, u16 reg, u16 *val) | |||
70 | return 0; | 70 | return 0; |
71 | } | 71 | } |
72 | 72 | ||
73 | static struct v4l2_input inputs[2] = { | 73 | static struct v4l2_input inputs[4] = { |
74 | { | 74 | { |
75 | .index = 0, | 75 | .index = 0, |
76 | .name = "DVB", | 76 | .name = "DVB", |
@@ -87,6 +87,22 @@ static struct v4l2_input inputs[2] = { | |||
87 | .tuner = 0, | 87 | .tuner = 0, |
88 | .std = V4L2_STD_PAL_BG|V4L2_STD_NTSC_M, | 88 | .std = V4L2_STD_PAL_BG|V4L2_STD_NTSC_M, |
89 | .status = 0, | 89 | .status = 0, |
90 | }, { | ||
91 | .index = 2, | ||
92 | .name = "Video", | ||
93 | .type = V4L2_INPUT_TYPE_CAMERA, | ||
94 | .audioset = 0, | ||
95 | .tuner = 0, | ||
96 | .std = V4L2_STD_PAL_BG|V4L2_STD_NTSC_M, | ||
97 | .status = 0, | ||
98 | }, { | ||
99 | .index = 3, | ||
100 | .name = "Y/C", | ||
101 | .type = V4L2_INPUT_TYPE_CAMERA, | ||
102 | .audioset = 0, | ||
103 | .tuner = 0, | ||
104 | .std = V4L2_STD_PAL_BG|V4L2_STD_NTSC_M, | ||
105 | .status = 0, | ||
90 | } | 106 | } |
91 | }; | 107 | }; |
92 | 108 | ||
@@ -212,24 +228,44 @@ static int av7110_dvb_c_switch(struct saa7146_fh *fh) | |||
212 | } | 228 | } |
213 | 229 | ||
214 | if (0 != av7110->current_input) { | 230 | if (0 != av7110->current_input) { |
231 | dprintk(1, "switching to analog TV:\n"); | ||
215 | adswitch = 1; | 232 | adswitch = 1; |
216 | source = SAA7146_HPS_SOURCE_PORT_B; | 233 | source = SAA7146_HPS_SOURCE_PORT_B; |
217 | sync = SAA7146_HPS_SYNC_PORT_B; | 234 | sync = SAA7146_HPS_SYNC_PORT_B; |
218 | memcpy(standard, analog_standard, sizeof(struct saa7146_standard) * 2); | 235 | memcpy(standard, analog_standard, sizeof(struct saa7146_standard) * 2); |
219 | dprintk(1, "switching to analog TV\n"); | ||
220 | msp_writereg(av7110, MSP_WR_DSP, 0x0008, 0x0000); // loudspeaker source | ||
221 | msp_writereg(av7110, MSP_WR_DSP, 0x0009, 0x0000); // headphone source | ||
222 | msp_writereg(av7110, MSP_WR_DSP, 0x000a, 0x0000); // SCART 1 source | ||
223 | msp_writereg(av7110, MSP_WR_DSP, 0x000e, 0x3000); // FM matrix, mono | ||
224 | msp_writereg(av7110, MSP_WR_DSP, 0x0000, 0x4f00); // loudspeaker + headphone | ||
225 | msp_writereg(av7110, MSP_WR_DSP, 0x0007, 0x4f00); // SCART 1 volume | ||
226 | 236 | ||
227 | if (av7110->analog_tuner_flags & ANALOG_TUNER_VES1820) { | 237 | switch (av7110->current_input) { |
228 | if (ves1820_writereg(dev, 0x09, 0x0f, 0x60)) | 238 | case 1: |
229 | dprintk(1, "setting band in demodulator failed.\n"); | 239 | dprintk(1, "switching SAA7113 to Analog Tuner Input.\n"); |
230 | } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) { | 240 | msp_writereg(av7110, MSP_WR_DSP, 0x0008, 0x0000); // loudspeaker source |
231 | saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTHI); // TDA9198 pin9(STD) | 241 | msp_writereg(av7110, MSP_WR_DSP, 0x0009, 0x0000); // headphone source |
232 | saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTHI); // TDA9198 pin30(VIF) | 242 | msp_writereg(av7110, MSP_WR_DSP, 0x000a, 0x0000); // SCART 1 source |
243 | msp_writereg(av7110, MSP_WR_DSP, 0x000e, 0x3000); // FM matrix, mono | ||
244 | msp_writereg(av7110, MSP_WR_DSP, 0x0000, 0x4f00); // loudspeaker + headphone | ||
245 | msp_writereg(av7110, MSP_WR_DSP, 0x0007, 0x4f00); // SCART 1 volume | ||
246 | |||
247 | if (av7110->analog_tuner_flags & ANALOG_TUNER_VES1820) { | ||
248 | if (ves1820_writereg(dev, 0x09, 0x0f, 0x60)) | ||
249 | dprintk(1, "setting band in demodulator failed.\n"); | ||
250 | } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) { | ||
251 | saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTHI); // TDA9198 pin9(STD) | ||
252 | saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTHI); // TDA9198 pin30(VIF) | ||
253 | } | ||
254 | if (i2c_writereg(av7110, 0x48, 0x02, 0xd0) != 1) | ||
255 | dprintk(1, "saa7113 write failed @ card %d", av7110->dvb_adapter.num); | ||
256 | break; | ||
257 | case 2: | ||
258 | dprintk(1, "switching SAA7113 to Video AV CVBS Input.\n"); | ||
259 | if (i2c_writereg(av7110, 0x48, 0x02, 0xd2) != 1) | ||
260 | dprintk(1, "saa7113 write failed @ card %d", av7110->dvb_adapter.num); | ||
261 | break; | ||
262 | case 3: | ||
263 | dprintk(1, "switching SAA7113 to Video AV Y/C Input.\n"); | ||
264 | if (i2c_writereg(av7110, 0x48, 0x02, 0xd9) != 1) | ||
265 | dprintk(1, "saa7113 write failed @ card %d", av7110->dvb_adapter.num); | ||
266 | break; | ||
267 | default: | ||
268 | dprintk(1, "switching SAA7113 to Input: AV7110: SAA7113: invalid input.\n"); | ||
233 | } | 269 | } |
234 | } else { | 270 | } else { |
235 | adswitch = 0; | 271 | adswitch = 0; |
@@ -300,7 +336,6 @@ static int av7110_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) | |||
300 | // FIXME: standard / stereo detection is still broken | 336 | // FIXME: standard / stereo detection is still broken |
301 | msp_readreg(av7110, MSP_RD_DEM, 0x007e, &stereo_det); | 337 | msp_readreg(av7110, MSP_RD_DEM, 0x007e, &stereo_det); |
302 | dprintk(1, "VIDIOC_G_TUNER: msp3400 TV standard detection: 0x%04x\n", stereo_det); | 338 | dprintk(1, "VIDIOC_G_TUNER: msp3400 TV standard detection: 0x%04x\n", stereo_det); |
303 | |||
304 | msp_readreg(av7110, MSP_RD_DSP, 0x0018, &stereo_det); | 339 | msp_readreg(av7110, MSP_RD_DSP, 0x0018, &stereo_det); |
305 | dprintk(1, "VIDIOC_G_TUNER: msp3400 stereo detection: 0x%04x\n", stereo_det); | 340 | dprintk(1, "VIDIOC_G_TUNER: msp3400 stereo detection: 0x%04x\n", stereo_det); |
306 | stereo = (s8)(stereo_det >> 8); | 341 | stereo = (s8)(stereo_det >> 8); |
@@ -310,7 +345,7 @@ static int av7110_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) | |||
310 | t->audmode = V4L2_TUNER_MODE_STEREO; | 345 | t->audmode = V4L2_TUNER_MODE_STEREO; |
311 | } | 346 | } |
312 | else if (stereo < -0x10) { | 347 | else if (stereo < -0x10) { |
313 | /* bilingual*/ | 348 | /* bilingual */ |
314 | t->rxsubchans = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2; | 349 | t->rxsubchans = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2; |
315 | t->audmode = V4L2_TUNER_MODE_LANG1; | 350 | t->audmode = V4L2_TUNER_MODE_LANG1; |
316 | } | 351 | } |
@@ -344,7 +379,7 @@ static int av7110_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) | |||
344 | fm_matrix = 0x3000; // mono | 379 | fm_matrix = 0x3000; // mono |
345 | src = 0x0010; | 380 | src = 0x0010; |
346 | break; | 381 | break; |
347 | default: /* case V4L2_TUNER_MODE_MONO: {*/ | 382 | default: /* case V4L2_TUNER_MODE_MONO: */ |
348 | dprintk(2, "VIDIOC_S_TUNER: TDA9840_SET_MONO\n"); | 383 | dprintk(2, "VIDIOC_S_TUNER: TDA9840_SET_MONO\n"); |
349 | fm_matrix = 0x3000; // mono | 384 | fm_matrix = 0x3000; // mono |
350 | src = 0x0030; | 385 | src = 0x0030; |
@@ -406,7 +441,7 @@ static int av7110_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) | |||
406 | dprintk(2, "VIDIOC_ENUMINPUT: %d\n", i->index); | 441 | dprintk(2, "VIDIOC_ENUMINPUT: %d\n", i->index); |
407 | 442 | ||
408 | if (av7110->analog_tuner_flags) { | 443 | if (av7110->analog_tuner_flags) { |
409 | if (i->index < 0 || i->index >= 2) | 444 | if (i->index < 0 || i->index >= 4) |
410 | return -EINVAL; | 445 | return -EINVAL; |
411 | } else { | 446 | } else { |
412 | if (i->index != 0) | 447 | if (i->index != 0) |
@@ -433,10 +468,9 @@ static int av7110_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) | |||
433 | if (!av7110->analog_tuner_flags) | 468 | if (!av7110->analog_tuner_flags) |
434 | return 0; | 469 | return 0; |
435 | 470 | ||
436 | if (input < 0 || input >= 2) | 471 | if (input < 0 || input >= 4) |
437 | return -EINVAL; | 472 | return -EINVAL; |
438 | 473 | ||
439 | /* FIXME: switch inputs here */ | ||
440 | av7110->current_input = input; | 474 | av7110->current_input = input; |
441 | return av7110_dvb_c_switch(fh); | 475 | return av7110_dvb_c_switch(fh); |
442 | } | 476 | } |
diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c index 9746d2bb916f..7692cd23f839 100644 --- a/drivers/media/dvb/ttpci/budget-av.c +++ b/drivers/media/dvb/ttpci/budget-av.c | |||
@@ -192,7 +192,7 @@ static int ciintf_slot_reset(struct dvb_ca_en50221 *ca, int slot) | |||
192 | { | 192 | { |
193 | struct budget_av *budget_av = (struct budget_av *) ca->data; | 193 | struct budget_av *budget_av = (struct budget_av *) ca->data; |
194 | struct saa7146_dev *saa = budget_av->budget.dev; | 194 | struct saa7146_dev *saa = budget_av->budget.dev; |
195 | int timeout = 50; // 5 seconds (4.4.6 Ready) | 195 | int timeout = 500; // 5 seconds (4.4.6 Ready) |
196 | 196 | ||
197 | if (slot != 0) | 197 | if (slot != 0) |
198 | return -EINVAL; | 198 | return -EINVAL; |
@@ -217,7 +217,6 @@ static int ciintf_slot_reset(struct dvb_ca_en50221 *ca, int slot) | |||
217 | { | 217 | { |
218 | printk(KERN_ERR "budget-av: cam reset failed (timeout).\n"); | 218 | printk(KERN_ERR "budget-av: cam reset failed (timeout).\n"); |
219 | saa7146_setgpio(saa, 2, SAA7146_GPIO_OUTHI); /* disable card */ | 219 | saa7146_setgpio(saa, 2, SAA7146_GPIO_OUTHI); /* disable card */ |
220 | saa7146_setgpio(saa, 0, SAA7146_GPIO_OUTHI); /* Vcc off */ | ||
221 | return -ETIMEDOUT; | 220 | return -ETIMEDOUT; |
222 | } | 221 | } |
223 | 222 | ||
@@ -276,7 +275,6 @@ static int ciintf_poll_slot_status(struct dvb_ca_en50221 *ca, int slot, int open | |||
276 | { | 275 | { |
277 | printk(KERN_INFO "budget-av: cam ejected\n"); | 276 | printk(KERN_INFO "budget-av: cam ejected\n"); |
278 | saa7146_setgpio(saa, 2, SAA7146_GPIO_OUTHI); /* disable card */ | 277 | saa7146_setgpio(saa, 2, SAA7146_GPIO_OUTHI); /* disable card */ |
279 | saa7146_setgpio(saa, 0, SAA7146_GPIO_OUTHI); /* Vcc off */ | ||
280 | budget_av->slot_status = 0; | 278 | budget_av->slot_status = 0; |
281 | } | 279 | } |
282 | } | 280 | } |
@@ -453,9 +451,9 @@ static int philips_su1278_ty_ci_set_symbol_rate(struct dvb_frontend *fe, u32 sra | |||
453 | } | 451 | } |
454 | 452 | ||
455 | static int philips_su1278_ty_ci_pll_set(struct dvb_frontend *fe, | 453 | static int philips_su1278_ty_ci_pll_set(struct dvb_frontend *fe, |
454 | struct i2c_adapter *i2c, | ||
456 | struct dvb_frontend_parameters *params) | 455 | struct dvb_frontend_parameters *params) |
457 | { | 456 | { |
458 | struct budget_av *budget_av = (struct budget_av *) fe->dvb->priv; | ||
459 | u32 div; | 457 | u32 div; |
460 | u8 buf[4]; | 458 | u8 buf[4]; |
461 | struct i2c_msg msg = {.addr = 0x61,.flags = 0,.buf = buf,.len = sizeof(buf) }; | 459 | struct i2c_msg msg = {.addr = 0x61,.flags = 0,.buf = buf,.len = sizeof(buf) }; |
@@ -481,7 +479,7 @@ static int philips_su1278_ty_ci_pll_set(struct dvb_frontend *fe, | |||
481 | else if (params->frequency < 2150000) | 479 | else if (params->frequency < 2150000) |
482 | buf[3] |= 0xC0; | 480 | buf[3] |= 0xC0; |
483 | 481 | ||
484 | if (i2c_transfer(&budget_av->budget.i2c_adap, &msg, 1) != 1) | 482 | if (i2c_transfer(i2c, &msg, 1) != 1) |
485 | return -EIO; | 483 | return -EIO; |
486 | return 0; | 484 | return 0; |
487 | } | 485 | } |
@@ -745,6 +743,7 @@ static void frontend_init(struct budget_av *budget_av) | |||
745 | case SUBID_DVBC_KNC1_PLUS: | 743 | case SUBID_DVBC_KNC1_PLUS: |
746 | case SUBID_DVBT_KNC1_PLUS: | 744 | case SUBID_DVBT_KNC1_PLUS: |
747 | // Enable / PowerON Frontend | 745 | // Enable / PowerON Frontend |
746 | saa7146_setgpio(saa, 0, SAA7146_GPIO_OUTLO); | ||
748 | saa7146_setgpio(saa, 3, SAA7146_GPIO_OUTHI); | 747 | saa7146_setgpio(saa, 3, SAA7146_GPIO_OUTHI); |
749 | break; | 748 | break; |
750 | } | 749 | } |
diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index a1267054bc01..2980db3ef22f 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c | |||
@@ -40,6 +40,7 @@ | |||
40 | 40 | ||
41 | #include "dvb_ca_en50221.h" | 41 | #include "dvb_ca_en50221.h" |
42 | #include "stv0299.h" | 42 | #include "stv0299.h" |
43 | #include "stv0297.h" | ||
43 | #include "tda1004x.h" | 44 | #include "tda1004x.h" |
44 | 45 | ||
45 | #define DEBIADDR_IR 0x1234 | 46 | #define DEBIADDR_IR 0x1234 |
@@ -548,9 +549,8 @@ static int alps_bsru6_set_symbol_rate(struct dvb_frontend *fe, u32 srate, u32 ra | |||
548 | return 0; | 549 | return 0; |
549 | } | 550 | } |
550 | 551 | ||
551 | static int alps_bsru6_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | 552 | static int alps_bsru6_pll_set(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters *params) |
552 | { | 553 | { |
553 | struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv; | ||
554 | u8 buf[4]; | 554 | u8 buf[4]; |
555 | u32 div; | 555 | u32 div; |
556 | struct i2c_msg msg = {.addr = 0x61,.flags = 0,.buf = buf,.len = sizeof(buf) }; | 556 | struct i2c_msg msg = {.addr = 0x61,.flags = 0,.buf = buf,.len = sizeof(buf) }; |
@@ -567,7 +567,7 @@ static int alps_bsru6_pll_set(struct dvb_frontend *fe, struct dvb_frontend_param | |||
567 | if (params->frequency > 1530000) | 567 | if (params->frequency > 1530000) |
568 | buf[3] = 0xc0; | 568 | buf[3] = 0xc0; |
569 | 569 | ||
570 | if (i2c_transfer(&budget_ci->budget.i2c_adap, &msg, 1) != 1) | 570 | if (i2c_transfer(i2c, &msg, 1) != 1) |
571 | return -EIO; | 571 | return -EIO; |
572 | return 0; | 572 | return 0; |
573 | } | 573 | } |
@@ -669,9 +669,9 @@ static int philips_su1278_tt_set_symbol_rate(struct dvb_frontend *fe, u32 srate, | |||
669 | } | 669 | } |
670 | 670 | ||
671 | static int philips_su1278_tt_pll_set(struct dvb_frontend *fe, | 671 | static int philips_su1278_tt_pll_set(struct dvb_frontend *fe, |
672 | struct i2c_adapter *i2c, | ||
672 | struct dvb_frontend_parameters *params) | 673 | struct dvb_frontend_parameters *params) |
673 | { | 674 | { |
674 | struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv; | ||
675 | u32 div; | 675 | u32 div; |
676 | u8 buf[4]; | 676 | u8 buf[4]; |
677 | struct i2c_msg msg = {.addr = 0x60,.flags = 0,.buf = buf,.len = sizeof(buf) }; | 677 | struct i2c_msg msg = {.addr = 0x60,.flags = 0,.buf = buf,.len = sizeof(buf) }; |
@@ -697,7 +697,7 @@ static int philips_su1278_tt_pll_set(struct dvb_frontend *fe, | |||
697 | else if (params->frequency < 2150000) | 697 | else if (params->frequency < 2150000) |
698 | buf[3] |= 0xC0; | 698 | buf[3] |= 0xC0; |
699 | 699 | ||
700 | if (i2c_transfer(&budget_ci->budget.i2c_adap, &msg, 1) != 1) | 700 | if (i2c_transfer(i2c, &msg, 1) != 1) |
701 | return -EIO; | 701 | return -EIO; |
702 | return 0; | 702 | return 0; |
703 | } | 703 | } |
@@ -848,6 +848,180 @@ static struct tda1004x_config philips_tdm1316l_config = { | |||
848 | .request_firmware = philips_tdm1316l_request_firmware, | 848 | .request_firmware = philips_tdm1316l_request_firmware, |
849 | }; | 849 | }; |
850 | 850 | ||
851 | static int dvbc_philips_tdm1316l_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | ||
852 | { | ||
853 | struct budget_ci *budget_ci = (struct budget_ci *) fe->dvb->priv; | ||
854 | u8 tuner_buf[5]; | ||
855 | struct i2c_msg tuner_msg = {.addr = budget_ci->tuner_pll_address, | ||
856 | .flags = 0, | ||
857 | .buf = tuner_buf, | ||
858 | .len = sizeof(tuner_buf) }; | ||
859 | int tuner_frequency = 0; | ||
860 | u8 band, cp, filter; | ||
861 | |||
862 | // determine charge pump | ||
863 | tuner_frequency = params->frequency + 36125000; | ||
864 | if (tuner_frequency < 87000000) | ||
865 | return -EINVAL; | ||
866 | else if (tuner_frequency < 130000000) { | ||
867 | cp = 3; | ||
868 | band = 1; | ||
869 | } else if (tuner_frequency < 160000000) { | ||
870 | cp = 5; | ||
871 | band = 1; | ||
872 | } else if (tuner_frequency < 200000000) { | ||
873 | cp = 6; | ||
874 | band = 1; | ||
875 | } else if (tuner_frequency < 290000000) { | ||
876 | cp = 3; | ||
877 | band = 2; | ||
878 | } else if (tuner_frequency < 420000000) { | ||
879 | cp = 5; | ||
880 | band = 2; | ||
881 | } else if (tuner_frequency < 480000000) { | ||
882 | cp = 6; | ||
883 | band = 2; | ||
884 | } else if (tuner_frequency < 620000000) { | ||
885 | cp = 3; | ||
886 | band = 4; | ||
887 | } else if (tuner_frequency < 830000000) { | ||
888 | cp = 5; | ||
889 | band = 4; | ||
890 | } else if (tuner_frequency < 895000000) { | ||
891 | cp = 7; | ||
892 | band = 4; | ||
893 | } else | ||
894 | return -EINVAL; | ||
895 | |||
896 | // assume PLL filter should always be 8MHz for the moment. | ||
897 | filter = 1; | ||
898 | |||
899 | // calculate divisor | ||
900 | tuner_frequency = (params->frequency + 36125000 + (62500/2)) / 62500; | ||
901 | |||
902 | // setup tuner buffer | ||
903 | tuner_buf[0] = tuner_frequency >> 8; | ||
904 | tuner_buf[1] = tuner_frequency & 0xff; | ||
905 | tuner_buf[2] = 0xc8; | ||
906 | tuner_buf[3] = (cp << 5) | (filter << 3) | band; | ||
907 | tuner_buf[4] = 0x80; | ||
908 | |||
909 | stv0297_enable_plli2c(fe); | ||
910 | if (i2c_transfer(&budget_ci->budget.i2c_adap, &tuner_msg, 1) != 1) | ||
911 | return -EIO; | ||
912 | |||
913 | msleep(50); | ||
914 | |||
915 | stv0297_enable_plli2c(fe); | ||
916 | if (i2c_transfer(&budget_ci->budget.i2c_adap, &tuner_msg, 1) != 1) | ||
917 | return -EIO; | ||
918 | |||
919 | msleep(1); | ||
920 | |||
921 | return 0; | ||
922 | } | ||
923 | |||
924 | static u8 dvbc_philips_tdm1316l_inittab[] = { | ||
925 | 0x80, 0x01, | ||
926 | 0x80, 0x00, | ||
927 | 0x81, 0x01, | ||
928 | 0x81, 0x00, | ||
929 | 0x00, 0x09, | ||
930 | 0x01, 0x69, | ||
931 | 0x03, 0x00, | ||
932 | 0x04, 0x00, | ||
933 | 0x07, 0x00, | ||
934 | 0x08, 0x00, | ||
935 | 0x20, 0x00, | ||
936 | 0x21, 0x40, | ||
937 | 0x22, 0x00, | ||
938 | 0x23, 0x00, | ||
939 | 0x24, 0x40, | ||
940 | 0x25, 0x88, | ||
941 | 0x30, 0xff, | ||
942 | 0x31, 0x00, | ||
943 | 0x32, 0xff, | ||
944 | 0x33, 0x00, | ||
945 | 0x34, 0x50, | ||
946 | 0x35, 0x7f, | ||
947 | 0x36, 0x00, | ||
948 | 0x37, 0x20, | ||
949 | 0x38, 0x00, | ||
950 | 0x40, 0x1c, | ||
951 | 0x41, 0xff, | ||
952 | 0x42, 0x29, | ||
953 | 0x43, 0x20, | ||
954 | 0x44, 0xff, | ||
955 | 0x45, 0x00, | ||
956 | 0x46, 0x00, | ||
957 | 0x49, 0x04, | ||
958 | 0x4a, 0x00, | ||
959 | 0x4b, 0x7b, | ||
960 | 0x52, 0x30, | ||
961 | 0x55, 0xae, | ||
962 | 0x56, 0x47, | ||
963 | 0x57, 0xe1, | ||
964 | 0x58, 0x3a, | ||
965 | 0x5a, 0x1e, | ||
966 | 0x5b, 0x34, | ||
967 | 0x60, 0x00, | ||
968 | 0x63, 0x00, | ||
969 | 0x64, 0x00, | ||
970 | 0x65, 0x00, | ||
971 | 0x66, 0x00, | ||
972 | 0x67, 0x00, | ||
973 | 0x68, 0x00, | ||
974 | 0x69, 0x00, | ||
975 | 0x6a, 0x02, | ||
976 | 0x6b, 0x00, | ||
977 | 0x70, 0xff, | ||
978 | 0x71, 0x00, | ||
979 | 0x72, 0x00, | ||
980 | 0x73, 0x00, | ||
981 | 0x74, 0x0c, | ||
982 | 0x80, 0x00, | ||
983 | 0x81, 0x00, | ||
984 | 0x82, 0x00, | ||
985 | 0x83, 0x00, | ||
986 | 0x84, 0x04, | ||
987 | 0x85, 0x80, | ||
988 | 0x86, 0x24, | ||
989 | 0x87, 0x78, | ||
990 | 0x88, 0x10, | ||
991 | 0x89, 0x00, | ||
992 | 0x90, 0x01, | ||
993 | 0x91, 0x01, | ||
994 | 0xa0, 0x04, | ||
995 | 0xa1, 0x00, | ||
996 | 0xa2, 0x00, | ||
997 | 0xb0, 0x91, | ||
998 | 0xb1, 0x0b, | ||
999 | 0xc0, 0x53, | ||
1000 | 0xc1, 0x70, | ||
1001 | 0xc2, 0x12, | ||
1002 | 0xd0, 0x00, | ||
1003 | 0xd1, 0x00, | ||
1004 | 0xd2, 0x00, | ||
1005 | 0xd3, 0x00, | ||
1006 | 0xd4, 0x00, | ||
1007 | 0xd5, 0x00, | ||
1008 | 0xde, 0x00, | ||
1009 | 0xdf, 0x00, | ||
1010 | 0x61, 0x38, | ||
1011 | 0x62, 0x0a, | ||
1012 | 0x53, 0x13, | ||
1013 | 0x59, 0x08, | ||
1014 | 0xff, 0xff, | ||
1015 | }; | ||
1016 | |||
1017 | static struct stv0297_config dvbc_philips_tdm1316l_config = { | ||
1018 | .demod_address = 0x1c, | ||
1019 | .inittab = dvbc_philips_tdm1316l_inittab, | ||
1020 | .invert = 0, | ||
1021 | .pll_set = dvbc_philips_tdm1316l_pll_set, | ||
1022 | }; | ||
1023 | |||
1024 | |||
851 | 1025 | ||
852 | 1026 | ||
853 | static void frontend_init(struct budget_ci *budget_ci) | 1027 | static void frontend_init(struct budget_ci *budget_ci) |
@@ -869,6 +1043,15 @@ static void frontend_init(struct budget_ci *budget_ci) | |||
869 | } | 1043 | } |
870 | break; | 1044 | break; |
871 | 1045 | ||
1046 | case 0x1010: // TT DVB-C CI budget (stv0297/Philips tdm1316l(tda6651tt)) | ||
1047 | budget_ci->tuner_pll_address = 0x61; | ||
1048 | budget_ci->budget.dvb_frontend = | ||
1049 | stv0297_attach(&dvbc_philips_tdm1316l_config, &budget_ci->budget.i2c_adap); | ||
1050 | if (budget_ci->budget.dvb_frontend) { | ||
1051 | break; | ||
1052 | } | ||
1053 | break; | ||
1054 | |||
872 | case 0x1011: // Hauppauge/TT Nova-T budget (tda10045/Philips tdm1316l(tda6651tt) + TDA9889) | 1055 | case 0x1011: // Hauppauge/TT Nova-T budget (tda10045/Philips tdm1316l(tda6651tt) + TDA9889) |
873 | budget_ci->tuner_pll_address = 0x63; | 1056 | budget_ci->tuner_pll_address = 0x63; |
874 | budget_ci->budget.dvb_frontend = | 1057 | budget_ci->budget.dvb_frontend = |
@@ -878,7 +1061,7 @@ static void frontend_init(struct budget_ci *budget_ci) | |||
878 | } | 1061 | } |
879 | break; | 1062 | break; |
880 | 1063 | ||
881 | case 0x1012: // Hauppauge/TT Nova-T CI budget (tda10045/Philips tdm1316l(tda6651tt) + TDA9889) | 1064 | case 0x1012: // TT DVB-T CI budget (tda10046/Philips tdm1316l(tda6651tt)) |
882 | budget_ci->tuner_pll_address = 0x60; | 1065 | budget_ci->tuner_pll_address = 0x60; |
883 | budget_ci->budget.dvb_frontend = | 1066 | budget_ci->budget.dvb_frontend = |
884 | tda10046_attach(&philips_tdm1316l_config, &budget_ci->budget.i2c_adap); | 1067 | tda10046_attach(&philips_tdm1316l_config, &budget_ci->budget.i2c_adap); |
@@ -966,10 +1149,12 @@ static struct saa7146_extension budget_extension; | |||
966 | MAKE_BUDGET_INFO(ttbci, "TT-Budget/WinTV-NOVA-CI PCI", BUDGET_TT_HW_DISEQC); | 1149 | MAKE_BUDGET_INFO(ttbci, "TT-Budget/WinTV-NOVA-CI PCI", BUDGET_TT_HW_DISEQC); |
967 | MAKE_BUDGET_INFO(ttbt2, "TT-Budget/WinTV-NOVA-T PCI", BUDGET_TT); | 1150 | MAKE_BUDGET_INFO(ttbt2, "TT-Budget/WinTV-NOVA-T PCI", BUDGET_TT); |
968 | MAKE_BUDGET_INFO(ttbtci, "TT-Budget-T-CI PCI", BUDGET_TT); | 1151 | MAKE_BUDGET_INFO(ttbtci, "TT-Budget-T-CI PCI", BUDGET_TT); |
1152 | MAKE_BUDGET_INFO(ttbcci, "TT-Budget-C-CI PCI", BUDGET_TT); | ||
969 | 1153 | ||
970 | static struct pci_device_id pci_tbl[] = { | 1154 | static struct pci_device_id pci_tbl[] = { |
971 | MAKE_EXTENSION_PCI(ttbci, 0x13c2, 0x100c), | 1155 | MAKE_EXTENSION_PCI(ttbci, 0x13c2, 0x100c), |
972 | MAKE_EXTENSION_PCI(ttbci, 0x13c2, 0x100f), | 1156 | MAKE_EXTENSION_PCI(ttbci, 0x13c2, 0x100f), |
1157 | MAKE_EXTENSION_PCI(ttbcci, 0x13c2, 0x1010), | ||
973 | MAKE_EXTENSION_PCI(ttbt2, 0x13c2, 0x1011), | 1158 | MAKE_EXTENSION_PCI(ttbt2, 0x13c2, 0x1011), |
974 | MAKE_EXTENSION_PCI(ttbtci, 0x13c2, 0x1012), | 1159 | MAKE_EXTENSION_PCI(ttbtci, 0x13c2, 0x1012), |
975 | { | 1160 | { |
diff --git a/drivers/media/dvb/ttpci/budget-patch.c b/drivers/media/dvb/ttpci/budget-patch.c index 8142e26b47f5..b1f21ef0e3b3 100644 --- a/drivers/media/dvb/ttpci/budget-patch.c +++ b/drivers/media/dvb/ttpci/budget-patch.c | |||
@@ -353,9 +353,8 @@ static int alps_bsru6_set_symbol_rate(struct dvb_frontend* fe, u32 srate, u32 ra | |||
353 | return 0; | 353 | return 0; |
354 | } | 354 | } |
355 | 355 | ||
356 | static int alps_bsru6_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 356 | static int alps_bsru6_pll_set(struct dvb_frontend* fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters* params) |
357 | { | 357 | { |
358 | struct budget_patch* budget = (struct budget_patch*) fe->dvb->priv; | ||
359 | u8 data[4]; | 358 | u8 data[4]; |
360 | u32 div; | 359 | u32 div; |
361 | struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) }; | 360 | struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) }; |
@@ -370,7 +369,7 @@ static int alps_bsru6_pll_set(struct dvb_frontend* fe, struct dvb_frontend_param | |||
370 | 369 | ||
371 | if (params->frequency > 1530000) data[3] = 0xc0; | 370 | if (params->frequency > 1530000) data[3] = 0xc0; |
372 | 371 | ||
373 | if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO; | 372 | if (i2c_transfer(i2c, &msg, 1) != 1) return -EIO; |
374 | return 0; | 373 | return 0; |
375 | } | 374 | } |
376 | 375 | ||
diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c index 9961917e8a7f..43d6c8268642 100644 --- a/drivers/media/dvb/ttpci/budget.c +++ b/drivers/media/dvb/ttpci/budget.c | |||
@@ -332,9 +332,8 @@ static int alps_bsru6_set_symbol_rate(struct dvb_frontend* fe, u32 srate, u32 ra | |||
332 | return 0; | 332 | return 0; |
333 | } | 333 | } |
334 | 334 | ||
335 | static int alps_bsru6_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 335 | static int alps_bsru6_pll_set(struct dvb_frontend* fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters* params) |
336 | { | 336 | { |
337 | struct budget* budget = (struct budget*) fe->dvb->priv; | ||
338 | u8 data[4]; | 337 | u8 data[4]; |
339 | u32 div; | 338 | u32 div; |
340 | struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) }; | 339 | struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) }; |
@@ -349,7 +348,7 @@ static int alps_bsru6_pll_set(struct dvb_frontend* fe, struct dvb_frontend_param | |||
349 | 348 | ||
350 | if (params->frequency > 1530000) data[3] = 0xc0; | 349 | if (params->frequency > 1530000) data[3] = 0xc0; |
351 | 350 | ||
352 | if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO; | 351 | if (i2c_transfer(i2c, &msg, 1) != 1) return -EIO; |
353 | return 0; | 352 | return 0; |
354 | } | 353 | } |
355 | 354 | ||
@@ -481,6 +480,7 @@ static int s5h1420_pll_set(struct dvb_frontend* fe, struct dvb_frontend_paramete | |||
481 | 480 | ||
482 | static struct s5h1420_config s5h1420_config = { | 481 | static struct s5h1420_config s5h1420_config = { |
483 | .demod_address = 0x53, | 482 | .demod_address = 0x53, |
483 | .invert = 1, | ||
484 | .pll_set = s5h1420_pll_set, | 484 | .pll_set = s5h1420_pll_set, |
485 | }; | 485 | }; |
486 | 486 | ||
diff --git a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c index 7daf7b1598a0..d200ab0ad9e7 100644 --- a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +++ b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
19 | #include <linux/time.h> | 19 | #include <linux/time.h> |
20 | #include <linux/errno.h> | 20 | #include <linux/errno.h> |
21 | #include <linux/jiffies.h> | ||
21 | #include <asm/semaphore.h> | 22 | #include <asm/semaphore.h> |
22 | 23 | ||
23 | #include "dvb_frontend.h" | 24 | #include "dvb_frontend.h" |
@@ -570,7 +571,8 @@ static void ttusb_handle_sec_data(struct ttusb_channel *channel, | |||
570 | const u8 * data, int len); | 571 | const u8 * data, int len); |
571 | #endif | 572 | #endif |
572 | 573 | ||
573 | static int numpkt = 0, lastj, numts, numstuff, numsec, numinvalid; | 574 | static int numpkt = 0, numts, numstuff, numsec, numinvalid; |
575 | static unsigned long lastj; | ||
574 | 576 | ||
575 | static void ttusb_process_muxpack(struct ttusb *ttusb, const u8 * muxpack, | 577 | static void ttusb_process_muxpack(struct ttusb *ttusb, const u8 * muxpack, |
576 | int len) | 578 | int len) |
@@ -779,7 +781,7 @@ static void ttusb_iso_irq(struct urb *urb, struct pt_regs *ptregs) | |||
779 | u8 *data; | 781 | u8 *data; |
780 | int len; | 782 | int len; |
781 | numpkt++; | 783 | numpkt++; |
782 | if ((jiffies - lastj) >= HZ) { | 784 | if (time_after_eq(jiffies, lastj + HZ)) { |
783 | #if DEBUG > 2 | 785 | #if DEBUG > 2 |
784 | printk | 786 | printk |
785 | ("frames/s: %d (ts: %d, stuff %d, sec: %d, invalid: %d, all: %d)\n", | 787 | ("frames/s: %d (ts: %d, stuff %d, sec: %d, invalid: %d, all: %d)\n", |
@@ -1299,7 +1301,7 @@ static int alps_stv0299_set_symbol_rate(struct dvb_frontend *fe, u32 srate, u32 | |||
1299 | return 0; | 1301 | return 0; |
1300 | } | 1302 | } |
1301 | 1303 | ||
1302 | static int philips_tsa5059_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | 1304 | static int philips_tsa5059_pll_set(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters *params) |
1303 | { | 1305 | { |
1304 | struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv; | 1306 | struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv; |
1305 | u8 buf[4]; | 1307 | u8 buf[4]; |
@@ -1322,7 +1324,7 @@ static int philips_tsa5059_pll_set(struct dvb_frontend *fe, struct dvb_frontend_ | |||
1322 | if (ttusb->revision == TTUSB_REV_2_2) | 1324 | if (ttusb->revision == TTUSB_REV_2_2) |
1323 | buf[3] |= 0x20; | 1325 | buf[3] |= 0x20; |
1324 | 1326 | ||
1325 | if (i2c_transfer(&ttusb->i2c_adap, &msg, 1) != 1) | 1327 | if (i2c_transfer(i2c, &msg, 1) != 1) |
1326 | return -EIO; | 1328 | return -EIO; |
1327 | 1329 | ||
1328 | return 0; | 1330 | return 0; |
diff --git a/drivers/media/dvb/ttusb-dec/ttusb_dec.c b/drivers/media/dvb/ttusb-dec/ttusb_dec.c index 45c9a9a08e4d..3d08fc83a754 100644 --- a/drivers/media/dvb/ttusb-dec/ttusb_dec.c +++ b/drivers/media/dvb/ttusb-dec/ttusb_dec.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/spinlock.h> | 29 | #include <linux/spinlock.h> |
30 | #include <linux/usb.h> | 30 | #include <linux/usb.h> |
31 | #include <linux/version.h> | ||
32 | #include <linux/interrupt.h> | 31 | #include <linux/interrupt.h> |
33 | #include <linux/firmware.h> | 32 | #include <linux/firmware.h> |
34 | #include <linux/crc32.h> | 33 | #include <linux/crc32.h> |
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 16c85c081e6e..93570355819a 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -22,12 +22,21 @@ config VIDEO_BT848 | |||
22 | the Miro, Hauppauge and STB boards. Please read the material in | 22 | the Miro, Hauppauge and STB boards. Please read the material in |
23 | <file:Documentation/video4linux/bttv/> for more information. | 23 | <file:Documentation/video4linux/bttv/> for more information. |
24 | 24 | ||
25 | If you say Y or M here, you need to say Y or M to "I2C support" and | ||
26 | "I2C bit-banging interfaces" in the device drivers section. | ||
27 | |||
28 | To compile this driver as a module, choose M here: the | 25 | To compile this driver as a module, choose M here: the |
29 | module will be called bttv. | 26 | module will be called bttv. |
30 | 27 | ||
28 | config VIDEO_SAA6588 | ||
29 | tristate "SAA6588 Radio Chip RDS decoder support on BT848 cards" | ||
30 | depends on VIDEO_DEV && I2C && VIDEO_BT848 | ||
31 | |||
32 | help | ||
33 | Support for Radio Data System (RDS) decoder. This allows seeing | ||
34 | radio station identification transmitted using this standard. | ||
35 | Currentlly, it works only with bt8x8 chips. | ||
36 | |||
37 | To compile this driver as a module, choose M here: the | ||
38 | module will be called saa6588. | ||
39 | |||
31 | config VIDEO_PMS | 40 | config VIDEO_PMS |
32 | tristate "Mediavision Pro Movie Studio Video For Linux" | 41 | tristate "Mediavision Pro Movie Studio Video For Linux" |
33 | depends on VIDEO_DEV && ISA | 42 | depends on VIDEO_DEV && ISA |
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index 3e6f5347da21..046b82de9285 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile | |||
@@ -5,6 +5,7 @@ | |||
5 | bttv-objs := bttv-driver.o bttv-cards.o bttv-if.o \ | 5 | bttv-objs := bttv-driver.o bttv-cards.o bttv-if.o \ |
6 | bttv-risc.o bttv-vbi.o bttv-i2c.o bttv-gpio.o | 6 | bttv-risc.o bttv-vbi.o bttv-i2c.o bttv-gpio.o |
7 | zoran-objs := zr36120.o zr36120_i2c.o zr36120_mem.o | 7 | zoran-objs := zr36120.o zr36120_i2c.o zr36120_mem.o |
8 | rds-objs := saa6588.o | ||
8 | zr36067-objs := zoran_procfs.o zoran_device.o \ | 9 | zr36067-objs := zoran_procfs.o zoran_device.o \ |
9 | zoran_driver.o zoran_card.o | 10 | zoran_driver.o zoran_card.o |
10 | tuner-objs := tuner-core.o tuner-simple.o mt20xx.o tda8290.o tea5767.o | 11 | tuner-objs := tuner-core.o tuner-simple.o mt20xx.o tda8290.o tea5767.o |
@@ -15,6 +16,7 @@ obj-$(CONFIG_VIDEO_BT848) += bttv.o msp3400.o tvaudio.o \ | |||
15 | obj-$(CONFIG_SOUND_TVMIXER) += tvmixer.o | 16 | obj-$(CONFIG_SOUND_TVMIXER) += tvmixer.o |
16 | 17 | ||
17 | obj-$(CONFIG_VIDEO_ZR36120) += zoran.o | 18 | obj-$(CONFIG_VIDEO_ZR36120) += zoran.o |
19 | obj-$(CONFIG_VIDEO_SAA6588) += rds.o | ||
18 | obj-$(CONFIG_VIDEO_SAA5246A) += saa5246a.o | 20 | obj-$(CONFIG_VIDEO_SAA5246A) += saa5246a.o |
19 | obj-$(CONFIG_VIDEO_SAA5249) += saa5249.o | 21 | obj-$(CONFIG_VIDEO_SAA5249) += saa5249.o |
20 | obj-$(CONFIG_VIDEO_CQCAM) += c-qcam.o | 22 | obj-$(CONFIG_VIDEO_CQCAM) += c-qcam.o |
diff --git a/drivers/media/video/btcx-risc.c b/drivers/media/video/btcx-risc.c index 7f2d515d2873..a48de3c0e3f0 100644 --- a/drivers/media/video/btcx-risc.c +++ b/drivers/media/video/btcx-risc.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | $Id: btcx-risc.c,v 1.6 2005/02/21 13:57:59 kraxel Exp $ | ||
3 | 2 | ||
4 | btcx-risc.c | 3 | btcx-risc.c |
5 | 4 | ||
diff --git a/drivers/media/video/btcx-risc.h b/drivers/media/video/btcx-risc.h index 41f60395a520..503e6c6d7b69 100644 --- a/drivers/media/video/btcx-risc.h +++ b/drivers/media/video/btcx-risc.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: btcx-risc.h,v 1.2 2004/09/15 16:15:24 kraxel Exp $ | ||
3 | */ | 2 | */ |
4 | struct btcx_riscmem { | 3 | struct btcx_riscmem { |
5 | unsigned int size; | 4 | unsigned int size; |
diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c index a97b9b958ed6..190977a1e549 100644 --- a/drivers/media/video/bttv-cards.c +++ b/drivers/media/video/bttv-cards.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | $Id: bttv-cards.c,v 1.54 2005/07/19 18:26:46 mkrufky Exp $ | ||
3 | 2 | ||
4 | bttv-cards.c | 3 | bttv-cards.c |
5 | 4 | ||
@@ -169,10 +168,10 @@ static struct CARD { | |||
169 | { 0xd01810fc, BTTV_GVBCTV5PCI, "I-O Data Co. GV-BCTV5/PCI" }, | 168 | { 0xd01810fc, BTTV_GVBCTV5PCI, "I-O Data Co. GV-BCTV5/PCI" }, |
170 | 169 | ||
171 | { 0x001211bd, BTTV_PINNACLE, "Pinnacle PCTV" }, | 170 | { 0x001211bd, BTTV_PINNACLE, "Pinnacle PCTV" }, |
172 | // some cards ship with byteswapped IDs ... | 171 | /* some cards ship with byteswapped IDs ... */ |
173 | { 0x1200bd11, BTTV_PINNACLE, "Pinnacle PCTV [bswap]" }, | 172 | { 0x1200bd11, BTTV_PINNACLE, "Pinnacle PCTV [bswap]" }, |
174 | { 0xff00bd11, BTTV_PINNACLE, "Pinnacle PCTV [bswap]" }, | 173 | { 0xff00bd11, BTTV_PINNACLE, "Pinnacle PCTV [bswap]" }, |
175 | // this seems to happen as well ... | 174 | /* this seems to happen as well ... */ |
176 | { 0xff1211bd, BTTV_PINNACLE, "Pinnacle PCTV" }, | 175 | { 0xff1211bd, BTTV_PINNACLE, "Pinnacle PCTV" }, |
177 | 176 | ||
178 | { 0x3000121a, BTTV_VOODOOTV_FM, "3Dfx VoodooTV FM/ VoodooTV 200" }, | 177 | { 0x3000121a, BTTV_VOODOOTV_FM, "3Dfx VoodooTV FM/ VoodooTV 200" }, |
@@ -200,12 +199,12 @@ static struct CARD { | |||
200 | 199 | ||
201 | { 0x1123153b, BTTV_TERRATVRADIO, "Terratec TV Radio+" }, | 200 | { 0x1123153b, BTTV_TERRATVRADIO, "Terratec TV Radio+" }, |
202 | { 0x1127153b, BTTV_TERRATV, "Terratec TV+ (V1.05)" }, | 201 | { 0x1127153b, BTTV_TERRATV, "Terratec TV+ (V1.05)" }, |
203 | // clashes with FlyVideo | 202 | /* clashes with FlyVideo |
204 | //{ 0x18521852, BTTV_TERRATV, "Terratec TV+ (V1.10)" }, | 203 | *{ 0x18521852, BTTV_TERRATV, "Terratec TV+ (V1.10)" }, */ |
205 | { 0x1134153b, BTTV_TERRATVALUE, "Terratec TValue (LR102)" }, | 204 | { 0x1134153b, BTTV_TERRATVALUE, "Terratec TValue (LR102)" }, |
206 | { 0x1135153b, BTTV_TERRATVALUER, "Terratec TValue Radio" }, // LR102 | 205 | { 0x1135153b, BTTV_TERRATVALUER, "Terratec TValue Radio" }, /* LR102 */ |
207 | { 0x5018153b, BTTV_TERRATVALUE, "Terratec TValue" }, // ?? | 206 | { 0x5018153b, BTTV_TERRATVALUE, "Terratec TValue" }, /* ?? */ |
208 | { 0xff3b153b, BTTV_TERRATVALUER, "Terratec TValue Radio" }, // ?? | 207 | { 0xff3b153b, BTTV_TERRATVALUER, "Terratec TValue Radio" }, /* ?? */ |
209 | 208 | ||
210 | { 0x400015b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV" }, | 209 | { 0x400015b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV" }, |
211 | { 0x400a15b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV" }, | 210 | { 0x400a15b0, BTTV_ZOLTRIX_GENIE, "Zoltrix Genie TV" }, |
@@ -287,10 +286,12 @@ static struct CARD { | |||
287 | { 0x01071805, BTTV_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #3" }, | 286 | { 0x01071805, BTTV_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #3" }, |
288 | { 0x01081805, BTTV_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #4" }, | 287 | { 0x01081805, BTTV_PICOLO_TETRA_CHIP, "Picolo Tetra Chip #4" }, |
289 | 288 | ||
290 | // likely broken, vendor id doesn't match the other magic views ... | 289 | { 0x15409511, BTTV_ACORP_Y878F, "Acorp Y878F" }, |
291 | //{ 0xa0fca04f, BTTV_MAGICTVIEW063, "Guillemot Maxi TV Video 3" }, | ||
292 | 290 | ||
293 | // DVB cards (using pci function .1 for mpeg data xfer) | 291 | /* likely broken, vendor id doesn't match the other magic views ... |
292 | * { 0xa0fca04f, BTTV_MAGICTVIEW063, "Guillemot Maxi TV Video 3" }, */ | ||
293 | |||
294 | /* DVB cards (using pci function .1 for mpeg data xfer) */ | ||
294 | { 0x01010071, BTTV_NEBULA_DIGITV, "Nebula Electronics DigiTV" }, | 295 | { 0x01010071, BTTV_NEBULA_DIGITV, "Nebula Electronics DigiTV" }, |
295 | { 0x07611461, BTTV_AVDVBT_761, "AverMedia AverTV DVB-T 761" }, | 296 | { 0x07611461, BTTV_AVDVBT_761, "AverMedia AverTV DVB-T 761" }, |
296 | { 0x001c11bd, BTTV_PINNACLESAT, "Pinnacle PCTV Sat" }, | 297 | { 0x001c11bd, BTTV_PINNACLESAT, "Pinnacle PCTV Sat" }, |
@@ -298,7 +299,8 @@ static struct CARD { | |||
298 | { 0x00011822, BTTV_TWINHAN_DST, "Twinhan VisionPlus DVB" }, | 299 | { 0x00011822, BTTV_TWINHAN_DST, "Twinhan VisionPlus DVB" }, |
299 | { 0xfc00270f, BTTV_TWINHAN_DST, "ChainTech digitop DST-1000 DVB-S" }, | 300 | { 0xfc00270f, BTTV_TWINHAN_DST, "ChainTech digitop DST-1000 DVB-S" }, |
300 | { 0x07711461, BTTV_AVDVBT_771, "AVermedia AverTV DVB-T 771" }, | 301 | { 0x07711461, BTTV_AVDVBT_771, "AVermedia AverTV DVB-T 771" }, |
301 | { 0xdb1018ac, BTTV_DVICO_DVBT_LITE, "DVICO FusionHDTV DVB-T Lite" }, | 302 | { 0xdb1018ac, BTTV_DVICO_DVBT_LITE, "DViCO FusionHDTV DVB-T Lite" }, |
303 | { 0xd50018ac, BTTV_DVICO_FUSIONHDTV_5_LITE, "DViCO FusionHDTV 5 Lite" }, | ||
302 | 304 | ||
303 | { 0, -1, NULL } | 305 | { 0, -1, NULL } |
304 | }; | 306 | }; |
@@ -316,6 +318,7 @@ struct tvcard bttv_tvcards[] = { | |||
316 | .svhs = 2, | 318 | .svhs = 2, |
317 | .muxsel = { 2, 3, 1, 0}, | 319 | .muxsel = { 2, 3, 1, 0}, |
318 | .tuner_type = -1, | 320 | .tuner_type = -1, |
321 | .tuner_addr = ADDR_UNSET, | ||
319 | },{ | 322 | },{ |
320 | .name = "MIRO PCTV", | 323 | .name = "MIRO PCTV", |
321 | .video_inputs = 4, | 324 | .video_inputs = 4, |
@@ -327,6 +330,7 @@ struct tvcard bttv_tvcards[] = { | |||
327 | .audiomux = { 2, 0, 0, 0, 10}, | 330 | .audiomux = { 2, 0, 0, 0, 10}, |
328 | .needs_tvaudio = 1, | 331 | .needs_tvaudio = 1, |
329 | .tuner_type = -1, | 332 | .tuner_type = -1, |
333 | .tuner_addr = ADDR_UNSET, | ||
330 | },{ | 334 | },{ |
331 | .name = "Hauppauge (bt848)", | 335 | .name = "Hauppauge (bt848)", |
332 | .video_inputs = 4, | 336 | .video_inputs = 4, |
@@ -338,6 +342,7 @@ struct tvcard bttv_tvcards[] = { | |||
338 | .audiomux = { 0, 1, 2, 3, 4}, | 342 | .audiomux = { 0, 1, 2, 3, 4}, |
339 | .needs_tvaudio = 1, | 343 | .needs_tvaudio = 1, |
340 | .tuner_type = -1, | 344 | .tuner_type = -1, |
345 | .tuner_addr = ADDR_UNSET, | ||
341 | },{ | 346 | },{ |
342 | .name = "STB, Gateway P/N 6000699 (bt848)", | 347 | .name = "STB, Gateway P/N 6000699 (bt848)", |
343 | .video_inputs = 3, | 348 | .video_inputs = 3, |
@@ -350,6 +355,7 @@ struct tvcard bttv_tvcards[] = { | |||
350 | .no_msp34xx = 1, | 355 | .no_msp34xx = 1, |
351 | .needs_tvaudio = 1, | 356 | .needs_tvaudio = 1, |
352 | .tuner_type = TUNER_PHILIPS_NTSC, | 357 | .tuner_type = TUNER_PHILIPS_NTSC, |
358 | .tuner_addr = ADDR_UNSET, | ||
353 | .pll = PLL_28, | 359 | .pll = PLL_28, |
354 | .has_radio = 1, | 360 | .has_radio = 1, |
355 | },{ | 361 | },{ |
@@ -365,6 +371,7 @@ struct tvcard bttv_tvcards[] = { | |||
365 | .audiomux = { 0 }, | 371 | .audiomux = { 0 }, |
366 | .needs_tvaudio = 0, | 372 | .needs_tvaudio = 0, |
367 | .tuner_type = 4, | 373 | .tuner_type = 4, |
374 | .tuner_addr = ADDR_UNSET, | ||
368 | },{ | 375 | },{ |
369 | .name = "Diamond DTV2000", | 376 | .name = "Diamond DTV2000", |
370 | .video_inputs = 4, | 377 | .video_inputs = 4, |
@@ -376,6 +383,7 @@ struct tvcard bttv_tvcards[] = { | |||
376 | .audiomux = { 0, 1, 0, 1, 3}, | 383 | .audiomux = { 0, 1, 0, 1, 3}, |
377 | .needs_tvaudio = 1, | 384 | .needs_tvaudio = 1, |
378 | .tuner_type = -1, | 385 | .tuner_type = -1, |
386 | .tuner_addr = ADDR_UNSET, | ||
379 | },{ | 387 | },{ |
380 | .name = "AVerMedia TVPhone", | 388 | .name = "AVerMedia TVPhone", |
381 | .video_inputs = 3, | 389 | .video_inputs = 3, |
@@ -388,6 +396,7 @@ struct tvcard bttv_tvcards[] = { | |||
388 | /* 0x04 for some cards ?? */ | 396 | /* 0x04 for some cards ?? */ |
389 | .needs_tvaudio = 1, | 397 | .needs_tvaudio = 1, |
390 | .tuner_type = -1, | 398 | .tuner_type = -1, |
399 | .tuner_addr = ADDR_UNSET, | ||
391 | .audio_hook = avermedia_tvphone_audio, | 400 | .audio_hook = avermedia_tvphone_audio, |
392 | .has_remote = 1, | 401 | .has_remote = 1, |
393 | },{ | 402 | },{ |
@@ -401,6 +410,7 @@ struct tvcard bttv_tvcards[] = { | |||
401 | .audiomux = {0 }, | 410 | .audiomux = {0 }, |
402 | .needs_tvaudio = 1, | 411 | .needs_tvaudio = 1, |
403 | .tuner_type = -1, | 412 | .tuner_type = -1, |
413 | .tuner_addr = ADDR_UNSET, | ||
404 | },{ | 414 | },{ |
405 | 415 | ||
406 | /* ---- card 0x08 ---------------------------------- */ | 416 | /* ---- card 0x08 ---------------------------------- */ |
@@ -415,6 +425,7 @@ struct tvcard bttv_tvcards[] = { | |||
415 | .needs_tvaudio = 1, | 425 | .needs_tvaudio = 1, |
416 | .pll = PLL_28, | 426 | .pll = PLL_28, |
417 | .tuner_type = -1, | 427 | .tuner_type = -1, |
428 | .tuner_addr = ADDR_UNSET, | ||
418 | },{ | 429 | },{ |
419 | .name = "IMS/IXmicro TurboTV", | 430 | .name = "IMS/IXmicro TurboTV", |
420 | .video_inputs = 3, | 431 | .video_inputs = 3, |
@@ -427,6 +438,7 @@ struct tvcard bttv_tvcards[] = { | |||
427 | .needs_tvaudio = 0, | 438 | .needs_tvaudio = 0, |
428 | .pll = PLL_28, | 439 | .pll = PLL_28, |
429 | .tuner_type = TUNER_TEMIC_PAL, | 440 | .tuner_type = TUNER_TEMIC_PAL, |
441 | .tuner_addr = ADDR_UNSET, | ||
430 | },{ | 442 | },{ |
431 | .name = "Hauppauge (bt878)", | 443 | .name = "Hauppauge (bt878)", |
432 | .video_inputs = 4, | 444 | .video_inputs = 4, |
@@ -439,6 +451,7 @@ struct tvcard bttv_tvcards[] = { | |||
439 | .needs_tvaudio = 1, | 451 | .needs_tvaudio = 1, |
440 | .pll = PLL_28, | 452 | .pll = PLL_28, |
441 | .tuner_type = -1, | 453 | .tuner_type = -1, |
454 | .tuner_addr = ADDR_UNSET, | ||
442 | },{ | 455 | },{ |
443 | .name = "MIRO PCTV pro", | 456 | .name = "MIRO PCTV pro", |
444 | .video_inputs = 3, | 457 | .video_inputs = 3, |
@@ -450,6 +463,7 @@ struct tvcard bttv_tvcards[] = { | |||
450 | .audiomux = { 0x20001,0x10001, 0, 0,10}, | 463 | .audiomux = { 0x20001,0x10001, 0, 0,10}, |
451 | .needs_tvaudio = 1, | 464 | .needs_tvaudio = 1, |
452 | .tuner_type = -1, | 465 | .tuner_type = -1, |
466 | .tuner_addr = ADDR_UNSET, | ||
453 | },{ | 467 | },{ |
454 | 468 | ||
455 | /* ---- card 0x0c ---------------------------------- */ | 469 | /* ---- card 0x0c ---------------------------------- */ |
@@ -463,6 +477,7 @@ struct tvcard bttv_tvcards[] = { | |||
463 | .audiomux = { 13, 14, 11, 7, 0, 0}, | 477 | .audiomux = { 13, 14, 11, 7, 0, 0}, |
464 | .needs_tvaudio = 1, | 478 | .needs_tvaudio = 1, |
465 | .tuner_type = -1, | 479 | .tuner_type = -1, |
480 | .tuner_addr = ADDR_UNSET, | ||
466 | },{ | 481 | },{ |
467 | .name = "AVerMedia TVCapture 98", | 482 | .name = "AVerMedia TVCapture 98", |
468 | .video_inputs = 3, | 483 | .video_inputs = 3, |
@@ -476,6 +491,7 @@ struct tvcard bttv_tvcards[] = { | |||
476 | .msp34xx_alt = 1, | 491 | .msp34xx_alt = 1, |
477 | .pll = PLL_28, | 492 | .pll = PLL_28, |
478 | .tuner_type = TUNER_PHILIPS_PAL, | 493 | .tuner_type = TUNER_PHILIPS_PAL, |
494 | .tuner_addr = ADDR_UNSET, | ||
479 | .audio_hook = avermedia_tv_stereo_audio, | 495 | .audio_hook = avermedia_tv_stereo_audio, |
480 | },{ | 496 | },{ |
481 | .name = "Aimslab Video Highway Xtreme (VHX)", | 497 | .name = "Aimslab Video Highway Xtreme (VHX)", |
@@ -489,6 +505,7 @@ struct tvcard bttv_tvcards[] = { | |||
489 | .needs_tvaudio = 1, | 505 | .needs_tvaudio = 1, |
490 | .pll = PLL_28, | 506 | .pll = PLL_28, |
491 | .tuner_type = -1, | 507 | .tuner_type = -1, |
508 | .tuner_addr = ADDR_UNSET, | ||
492 | },{ | 509 | },{ |
493 | .name = "Zoltrix TV-Max", | 510 | .name = "Zoltrix TV-Max", |
494 | .video_inputs = 3, | 511 | .video_inputs = 3, |
@@ -500,6 +517,7 @@ struct tvcard bttv_tvcards[] = { | |||
500 | .audiomux = {0 , 0, 1 , 0, 10}, | 517 | .audiomux = {0 , 0, 1 , 0, 10}, |
501 | .needs_tvaudio = 1, | 518 | .needs_tvaudio = 1, |
502 | .tuner_type = -1, | 519 | .tuner_type = -1, |
520 | .tuner_addr = ADDR_UNSET, | ||
503 | },{ | 521 | },{ |
504 | 522 | ||
505 | /* ---- card 0x10 ---------------------------------- */ | 523 | /* ---- card 0x10 ---------------------------------- */ |
@@ -510,7 +528,7 @@ struct tvcard bttv_tvcards[] = { | |||
510 | .svhs = 2, | 528 | .svhs = 2, |
511 | .gpiomask = 0x01fe00, | 529 | .gpiomask = 0x01fe00, |
512 | .muxsel = { 2, 3, 1, 1}, | 530 | .muxsel = { 2, 3, 1, 1}, |
513 | // 2003-10-20 by "Anton A. Arapov" <arapov@mail.ru> | 531 | /* 2003-10-20 by "Anton A. Arapov" <arapov@mail.ru> */ |
514 | .audiomux = { 0x001e00, 0, 0x018000, 0x014000, 0x002000, 0 }, | 532 | .audiomux = { 0x001e00, 0, 0x018000, 0x014000, 0x002000, 0 }, |
515 | .needs_tvaudio = 1, | 533 | .needs_tvaudio = 1, |
516 | .pll = PLL_28, | 534 | .pll = PLL_28, |
@@ -526,6 +544,7 @@ struct tvcard bttv_tvcards[] = { | |||
526 | .audiomux = { 0x4fa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007}, | 544 | .audiomux = { 0x4fa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007}, |
527 | .needs_tvaudio = 1, | 545 | .needs_tvaudio = 1, |
528 | .tuner_type = -1, | 546 | .tuner_type = -1, |
547 | .tuner_addr = ADDR_UNSET, | ||
529 | .audio_hook = winview_audio, | 548 | .audio_hook = winview_audio, |
530 | .has_radio = 1, | 549 | .has_radio = 1, |
531 | },{ | 550 | },{ |
@@ -539,6 +558,7 @@ struct tvcard bttv_tvcards[] = { | |||
539 | .audiomux = {1, 0, 0, 0, 0}, | 558 | .audiomux = {1, 0, 0, 0, 0}, |
540 | .needs_tvaudio = 1, | 559 | .needs_tvaudio = 1, |
541 | .tuner_type = -1, | 560 | .tuner_type = -1, |
561 | .tuner_addr = ADDR_UNSET, | ||
542 | },{ | 562 | },{ |
543 | .name = "Lifeview FlyVideo II EZ /FlyKit LR38 Bt848 (capture only)", | 563 | .name = "Lifeview FlyVideo II EZ /FlyKit LR38 Bt848 (capture only)", |
544 | .video_inputs = 4, | 564 | .video_inputs = 4, |
@@ -550,6 +570,7 @@ struct tvcard bttv_tvcards[] = { | |||
550 | .audiomux = { 0 }, | 570 | .audiomux = { 0 }, |
551 | .no_msp34xx = 1, | 571 | .no_msp34xx = 1, |
552 | .tuner_type = -1, | 572 | .tuner_type = -1, |
573 | .tuner_addr = ADDR_UNSET, | ||
553 | },{ | 574 | },{ |
554 | 575 | ||
555 | /* ---- card 0x14 ---------------------------------- */ | 576 | /* ---- card 0x14 ---------------------------------- */ |
@@ -560,10 +581,11 @@ struct tvcard bttv_tvcards[] = { | |||
560 | .svhs = 2, | 581 | .svhs = 2, |
561 | .muxsel = {2, 3, 1, 1}, | 582 | .muxsel = {2, 3, 1, 1}, |
562 | .tuner_type = -1, | 583 | .tuner_type = -1, |
584 | .tuner_addr = ADDR_UNSET, | ||
563 | },{ | 585 | },{ |
564 | .name = "Lifeview FlyVideo 98/ Lucky Star Image World ConferenceTV LR50", | 586 | .name = "Lifeview FlyVideo 98/ Lucky Star Image World ConferenceTV LR50", |
565 | .video_inputs = 4, | 587 | .video_inputs = 4, |
566 | .audio_inputs = 2, // tuner, line in | 588 | .audio_inputs = 2, /* tuner, line in */ |
567 | .tuner = 0, | 589 | .tuner = 0, |
568 | .svhs = 2, | 590 | .svhs = 2, |
569 | .gpiomask = 0x1800, | 591 | .gpiomask = 0x1800, |
@@ -571,6 +593,7 @@ struct tvcard bttv_tvcards[] = { | |||
571 | .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800}, | 593 | .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800}, |
572 | .pll = PLL_28, | 594 | .pll = PLL_28, |
573 | .tuner_type = TUNER_PHILIPS_PAL_I, | 595 | .tuner_type = TUNER_PHILIPS_PAL_I, |
596 | .tuner_addr = ADDR_UNSET, | ||
574 | },{ | 597 | },{ |
575 | .name = "Askey CPH050/ Phoebe Tv Master + FM", | 598 | .name = "Askey CPH050/ Phoebe Tv Master + FM", |
576 | .video_inputs = 3, | 599 | .video_inputs = 3, |
@@ -583,6 +606,7 @@ struct tvcard bttv_tvcards[] = { | |||
583 | .needs_tvaudio = 1, | 606 | .needs_tvaudio = 1, |
584 | .pll = PLL_28, | 607 | .pll = PLL_28, |
585 | .tuner_type = -1, | 608 | .tuner_type = -1, |
609 | .tuner_addr = ADDR_UNSET, | ||
586 | },{ | 610 | },{ |
587 | .name = "Modular Technology MM201/MM202/MM205/MM210/MM215 PCTV, bt878", | 611 | .name = "Modular Technology MM201/MM202/MM205/MM210/MM215 PCTV, bt878", |
588 | .video_inputs = 3, | 612 | .video_inputs = 3, |
@@ -591,11 +615,12 @@ struct tvcard bttv_tvcards[] = { | |||
591 | .svhs = -1, | 615 | .svhs = -1, |
592 | .gpiomask = 7, | 616 | .gpiomask = 7, |
593 | .muxsel = { 2, 3, -1 }, | 617 | .muxsel = { 2, 3, -1 }, |
594 | .digital_mode = DIGITAL_MODE_CAMERA, | 618 | .digital_mode = DIGITAL_MODE_CAMERA, |
595 | .audiomux = { 0, 0, 0, 0, 0 }, | 619 | .audiomux = { 0, 0, 0, 0, 0 }, |
596 | .no_msp34xx = 1, | 620 | .no_msp34xx = 1, |
597 | .pll = PLL_28, | 621 | .pll = PLL_28, |
598 | .tuner_type = TUNER_ALPS_TSBB5_PAL_I, | 622 | .tuner_type = TUNER_ALPS_TSBB5_PAL_I, |
623 | .tuner_addr = ADDR_UNSET, | ||
599 | },{ | 624 | },{ |
600 | 625 | ||
601 | /* ---- card 0x18 ---------------------------------- */ | 626 | /* ---- card 0x18 ---------------------------------- */ |
@@ -610,6 +635,7 @@ struct tvcard bttv_tvcards[] = { | |||
610 | .needs_tvaudio = 1, | 635 | .needs_tvaudio = 1, |
611 | .pll = PLL_28, | 636 | .pll = PLL_28, |
612 | .tuner_type = -1, | 637 | .tuner_type = -1, |
638 | .tuner_addr = ADDR_UNSET, | ||
613 | .has_remote = 1, | 639 | .has_remote = 1, |
614 | },{ | 640 | },{ |
615 | .name = "Terratec TerraTV+ Version 1.0 (Bt848)/ Terra TValue Version 1.0/ Vobis TV-Boostar", | 641 | .name = "Terratec TerraTV+ Version 1.0 (Bt848)/ Terra TValue Version 1.0/ Vobis TV-Boostar", |
@@ -622,6 +648,7 @@ struct tvcard bttv_tvcards[] = { | |||
622 | .audiomux = { 0x20000, 0x30000, 0x10000, 0, 0x40000}, | 648 | .audiomux = { 0x20000, 0x30000, 0x10000, 0, 0x40000}, |
623 | .needs_tvaudio = 0, | 649 | .needs_tvaudio = 0, |
624 | .tuner_type = TUNER_PHILIPS_PAL, | 650 | .tuner_type = TUNER_PHILIPS_PAL, |
651 | .tuner_addr = ADDR_UNSET, | ||
625 | .audio_hook = terratv_audio, | 652 | .audio_hook = terratv_audio, |
626 | },{ | 653 | },{ |
627 | .name = "Hauppauge WinCam newer (bt878)", | 654 | .name = "Hauppauge WinCam newer (bt878)", |
@@ -634,6 +661,7 @@ struct tvcard bttv_tvcards[] = { | |||
634 | .audiomux = { 0, 1, 2, 3, 4}, | 661 | .audiomux = { 0, 1, 2, 3, 4}, |
635 | .needs_tvaudio = 1, | 662 | .needs_tvaudio = 1, |
636 | .tuner_type = -1, | 663 | .tuner_type = -1, |
664 | .tuner_addr = ADDR_UNSET, | ||
637 | },{ | 665 | },{ |
638 | .name = "Lifeview FlyVideo 98/ MAXI TV Video PCI2 LR50", | 666 | .name = "Lifeview FlyVideo 98/ MAXI TV Video PCI2 LR50", |
639 | .video_inputs = 4, | 667 | .video_inputs = 4, |
@@ -645,6 +673,7 @@ struct tvcard bttv_tvcards[] = { | |||
645 | .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800}, | 673 | .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800}, |
646 | .pll = PLL_28, | 674 | .pll = PLL_28, |
647 | .tuner_type = TUNER_PHILIPS_SECAM, | 675 | .tuner_type = TUNER_PHILIPS_SECAM, |
676 | .tuner_addr = ADDR_UNSET, | ||
648 | },{ | 677 | },{ |
649 | 678 | ||
650 | /* ---- card 0x1c ---------------------------------- */ | 679 | /* ---- card 0x1c ---------------------------------- */ |
@@ -658,37 +687,38 @@ struct tvcard bttv_tvcards[] = { | |||
658 | .audiomux = { 0x20000, 0x30000, 0x10000, 0x00000, 0x40000}, | 687 | .audiomux = { 0x20000, 0x30000, 0x10000, 0x00000, 0x40000}, |
659 | .needs_tvaudio = 0, | 688 | .needs_tvaudio = 0, |
660 | .tuner_type = TUNER_PHILIPS_PAL, | 689 | .tuner_type = TUNER_PHILIPS_PAL, |
690 | .tuner_addr = ADDR_UNSET, | ||
661 | .audio_hook = terratv_audio, | 691 | .audio_hook = terratv_audio, |
662 | /* GPIO wiring: | 692 | /* GPIO wiring: |
663 | External 20 pin connector (for Active Radio Upgrade board) | 693 | External 20 pin connector (for Active Radio Upgrade board) |
664 | gpio00: i2c-sda | 694 | gpio00: i2c-sda |
665 | gpio01: i2c-scl | 695 | gpio01: i2c-scl |
666 | gpio02: om5610-data | 696 | gpio02: om5610-data |
667 | gpio03: om5610-clk | 697 | gpio03: om5610-clk |
668 | gpio04: om5610-wre | 698 | gpio04: om5610-wre |
669 | gpio05: om5610-stereo | 699 | gpio05: om5610-stereo |
670 | gpio06: rds6588-davn | 700 | gpio06: rds6588-davn |
671 | gpio07: Pin 7 n.c. | 701 | gpio07: Pin 7 n.c. |
672 | gpio08: nIOW | 702 | gpio08: nIOW |
673 | gpio09+10: nIOR, nSEL ?? (bt878) | 703 | gpio09+10: nIOR, nSEL ?? (bt878) |
674 | gpio09: nIOR (bt848) | 704 | gpio09: nIOR (bt848) |
675 | gpio10: nSEL (bt848) | 705 | gpio10: nSEL (bt848) |
676 | Sound Routing: | 706 | Sound Routing: |
677 | gpio16: u2-A0 (1st 4052bt) | 707 | gpio16: u2-A0 (1st 4052bt) |
678 | gpio17: u2-A1 | 708 | gpio17: u2-A1 |
679 | gpio18: u2-nEN | 709 | gpio18: u2-nEN |
680 | gpio19: u4-A0 (2nd 4052) | 710 | gpio19: u4-A0 (2nd 4052) |
681 | gpio20: u4-A1 | 711 | gpio20: u4-A1 |
682 | u4-nEN - GND | 712 | u4-nEN - GND |
683 | Btspy: | 713 | Btspy: |
684 | 00000 : Cdrom (internal audio input) | 714 | 00000 : Cdrom (internal audio input) |
685 | 10000 : ext. Video audio input | 715 | 10000 : ext. Video audio input |
686 | 20000 : TV Mono | 716 | 20000 : TV Mono |
687 | a0000 : TV Mono/2 | 717 | a0000 : TV Mono/2 |
688 | 1a0000 : TV Stereo | 718 | 1a0000 : TV Stereo |
689 | 30000 : Radio | 719 | 30000 : Radio |
690 | 40000 : Mute | 720 | 40000 : Mute |
691 | */ | 721 | */ |
692 | 722 | ||
693 | },{ | 723 | },{ |
694 | /* Jannik Fritsch <jannik@techfak.uni-bielefeld.de> */ | 724 | /* Jannik Fritsch <jannik@techfak.uni-bielefeld.de> */ |
@@ -702,6 +732,7 @@ struct tvcard bttv_tvcards[] = { | |||
702 | .audiomux = { 0 }, | 732 | .audiomux = { 0 }, |
703 | .needs_tvaudio = 1, | 733 | .needs_tvaudio = 1, |
704 | .tuner_type = -1, | 734 | .tuner_type = -1, |
735 | .tuner_addr = ADDR_UNSET, | ||
705 | .muxsel_hook = PXC200_muxsel, | 736 | .muxsel_hook = PXC200_muxsel, |
706 | 737 | ||
707 | },{ | 738 | },{ |
@@ -710,11 +741,12 @@ struct tvcard bttv_tvcards[] = { | |||
710 | .audio_inputs = 1, | 741 | .audio_inputs = 1, |
711 | .tuner = 0, | 742 | .tuner = 0, |
712 | .svhs = 2, | 743 | .svhs = 2, |
713 | .gpiomask = 0x1800, //0x8dfe00 | 744 | .gpiomask = 0x1800, /* 0x8dfe00 */ |
714 | .muxsel = { 2, 3, 1, 1}, | 745 | .muxsel = { 2, 3, 1, 1}, |
715 | .audiomux = { 0, 0x0800, 0x1000, 0x1000, 0x1800, 0 }, | 746 | .audiomux = { 0, 0x0800, 0x1000, 0x1000, 0x1800, 0 }, |
716 | .pll = PLL_28, | 747 | .pll = PLL_28, |
717 | .tuner_type = -1, | 748 | .tuner_type = -1, |
749 | .tuner_addr = ADDR_UNSET, | ||
718 | },{ | 750 | },{ |
719 | .name = "Formac iProTV, Formac ProTV I (bt848)", | 751 | .name = "Formac iProTV, Formac ProTV I (bt848)", |
720 | .video_inputs = 4, | 752 | .video_inputs = 4, |
@@ -726,6 +758,7 @@ struct tvcard bttv_tvcards[] = { | |||
726 | .audiomux = { 1, 0, 0, 0, 0 }, | 758 | .audiomux = { 1, 0, 0, 0, 0 }, |
727 | .pll = PLL_28, | 759 | .pll = PLL_28, |
728 | .tuner_type = TUNER_PHILIPS_PAL, | 760 | .tuner_type = TUNER_PHILIPS_PAL, |
761 | .tuner_addr = ADDR_UNSET, | ||
729 | },{ | 762 | },{ |
730 | 763 | ||
731 | /* ---- card 0x20 ---------------------------------- */ | 764 | /* ---- card 0x20 ---------------------------------- */ |
@@ -739,6 +772,7 @@ struct tvcard bttv_tvcards[] = { | |||
739 | .audiomux = { 0 }, | 772 | .audiomux = { 0 }, |
740 | .needs_tvaudio = 0, | 773 | .needs_tvaudio = 0, |
741 | .tuner_type = 4, | 774 | .tuner_type = 4, |
775 | .tuner_addr = ADDR_UNSET, | ||
742 | },{ | 776 | },{ |
743 | .name = "Terratec TerraTValue Version Bt878", | 777 | .name = "Terratec TerraTValue Version Bt878", |
744 | .video_inputs = 3, | 778 | .video_inputs = 3, |
@@ -751,31 +785,33 @@ struct tvcard bttv_tvcards[] = { | |||
751 | .needs_tvaudio = 1, | 785 | .needs_tvaudio = 1, |
752 | .pll = PLL_28, | 786 | .pll = PLL_28, |
753 | .tuner_type = TUNER_PHILIPS_PAL, | 787 | .tuner_type = TUNER_PHILIPS_PAL, |
788 | .tuner_addr = ADDR_UNSET, | ||
754 | },{ | 789 | },{ |
755 | .name = "Leadtek WinFast 2000/ WinFast 2000 XP", | 790 | .name = "Leadtek WinFast 2000/ WinFast 2000 XP", |
756 | .video_inputs = 4, | 791 | .video_inputs = 4, |
757 | .audio_inputs = 1, | 792 | .audio_inputs = 1, |
758 | .tuner = 0, | 793 | .tuner = 0, |
759 | .svhs = 2, | 794 | .svhs = 2, |
760 | .muxsel = { 2, 3, 1, 1, 0}, // TV, CVid, SVid, CVid over SVid connector | 795 | .muxsel = { 2, 3, 1, 1, 0}, /* TV, CVid, SVid, CVid over SVid connector */ |
761 | /* Alexander Varakin <avarakin@hotmail.com> [stereo version] */ | 796 | /* Alexander Varakin <avarakin@hotmail.com> [stereo version] */ |
762 | .gpiomask = 0xb33000, | 797 | .gpiomask = 0xb33000, |
763 | .audiomux = { 0x122000,0x1000,0x0000,0x620000,0x800000 }, | 798 | .audiomux = { 0x122000,0x1000,0x0000,0x620000,0x800000 }, |
764 | /* Audio Routing for "WinFast 2000 XP" (no tv stereo !) | 799 | /* Audio Routing for "WinFast 2000 XP" (no tv stereo !) |
765 | gpio23 -- hef4052:nEnable (0x800000) | 800 | gpio23 -- hef4052:nEnable (0x800000) |
766 | gpio12 -- hef4052:A1 | 801 | gpio12 -- hef4052:A1 |
767 | gpio13 -- hef4052:A0 | 802 | gpio13 -- hef4052:A0 |
768 | 0x0000: external audio | 803 | 0x0000: external audio |
769 | 0x1000: FM | 804 | 0x1000: FM |
770 | 0x2000: TV | 805 | 0x2000: TV |
771 | 0x3000: n.c. | 806 | 0x3000: n.c. |
772 | Note: There exists another variant "Winfast 2000" with tv stereo !? | 807 | Note: There exists another variant "Winfast 2000" with tv stereo !? |
773 | Note: eeprom only contains FF and pci subsystem id 107d:6606 | 808 | Note: eeprom only contains FF and pci subsystem id 107d:6606 |
774 | */ | 809 | */ |
775 | .needs_tvaudio = 0, | 810 | .needs_tvaudio = 0, |
776 | .pll = PLL_28, | 811 | .pll = PLL_28, |
777 | .has_radio = 1, | 812 | .has_radio = 1, |
778 | .tuner_type = 5, // default for now, gpio reads BFFF06 for Pal bg+dk | 813 | .tuner_type = 5, /* default for now, gpio reads BFFF06 for Pal bg+dk */ |
814 | .tuner_addr = ADDR_UNSET, | ||
779 | .audio_hook = winfast2000_audio, | 815 | .audio_hook = winfast2000_audio, |
780 | .has_remote = 1, | 816 | .has_remote = 1, |
781 | },{ | 817 | },{ |
@@ -789,6 +825,7 @@ struct tvcard bttv_tvcards[] = { | |||
789 | .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800}, | 825 | .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800}, |
790 | .pll = PLL_28, | 826 | .pll = PLL_28, |
791 | .tuner_type = -1, | 827 | .tuner_type = -1, |
828 | .tuner_addr = ADDR_UNSET, | ||
792 | },{ | 829 | },{ |
793 | 830 | ||
794 | /* ---- card 0x24 ---------------------------------- */ | 831 | /* ---- card 0x24 ---------------------------------- */ |
@@ -802,6 +839,7 @@ struct tvcard bttv_tvcards[] = { | |||
802 | .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 }, | 839 | .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 }, |
803 | .pll = PLL_28, | 840 | .pll = PLL_28, |
804 | .tuner_type = -1, | 841 | .tuner_type = -1, |
842 | .tuner_addr = ADDR_UNSET, | ||
805 | .has_radio = 1, | 843 | .has_radio = 1, |
806 | },{ | 844 | },{ |
807 | .name = "Prolink PixelView PlayTV pro", | 845 | .name = "Prolink PixelView PlayTV pro", |
@@ -815,6 +853,7 @@ struct tvcard bttv_tvcards[] = { | |||
815 | .no_msp34xx = 1, | 853 | .no_msp34xx = 1, |
816 | .pll = PLL_28, | 854 | .pll = PLL_28, |
817 | .tuner_type = -1, | 855 | .tuner_type = -1, |
856 | .tuner_addr = ADDR_UNSET, | ||
818 | },{ | 857 | },{ |
819 | .name = "Askey CPH06X TView99", | 858 | .name = "Askey CPH06X TView99", |
820 | .video_inputs = 4, | 859 | .video_inputs = 4, |
@@ -827,6 +866,7 @@ struct tvcard bttv_tvcards[] = { | |||
827 | .needs_tvaudio = 1, | 866 | .needs_tvaudio = 1, |
828 | .pll = PLL_28, | 867 | .pll = PLL_28, |
829 | .tuner_type = 1, | 868 | .tuner_type = 1, |
869 | .tuner_addr = ADDR_UNSET, | ||
830 | .has_remote = 1, | 870 | .has_remote = 1, |
831 | },{ | 871 | },{ |
832 | .name = "Pinnacle PCTV Studio/Rave", | 872 | .name = "Pinnacle PCTV Studio/Rave", |
@@ -840,6 +880,7 @@ struct tvcard bttv_tvcards[] = { | |||
840 | .needs_tvaudio = 0, | 880 | .needs_tvaudio = 0, |
841 | .pll = PLL_28, | 881 | .pll = PLL_28, |
842 | .tuner_type = -1, | 882 | .tuner_type = -1, |
883 | .tuner_addr = ADDR_UNSET, | ||
843 | },{ | 884 | },{ |
844 | 885 | ||
845 | /* ---- card 0x28 ---------------------------------- */ | 886 | /* ---- card 0x28 ---------------------------------- */ |
@@ -854,6 +895,7 @@ struct tvcard bttv_tvcards[] = { | |||
854 | .no_msp34xx = 1, | 895 | .no_msp34xx = 1, |
855 | .needs_tvaudio = 1, | 896 | .needs_tvaudio = 1, |
856 | .tuner_type = TUNER_PHILIPS_NTSC, | 897 | .tuner_type = TUNER_PHILIPS_NTSC, |
898 | .tuner_addr = ADDR_UNSET, | ||
857 | .pll = PLL_28, | 899 | .pll = PLL_28, |
858 | .has_radio = 1, | 900 | .has_radio = 1, |
859 | },{ | 901 | },{ |
@@ -868,6 +910,7 @@ struct tvcard bttv_tvcards[] = { | |||
868 | .needs_tvaudio = 1, | 910 | .needs_tvaudio = 1, |
869 | .pll = PLL_28, | 911 | .pll = PLL_28, |
870 | .tuner_type = -1, | 912 | .tuner_type = -1, |
913 | .tuner_addr = ADDR_UNSET, | ||
871 | .has_radio = 1, | 914 | .has_radio = 1, |
872 | .audio_hook = avermedia_tvphone_audio, | 915 | .audio_hook = avermedia_tvphone_audio, |
873 | },{ | 916 | },{ |
@@ -883,6 +926,7 @@ struct tvcard bttv_tvcards[] = { | |||
883 | .no_msp34xx = 1, | 926 | .no_msp34xx = 1, |
884 | .pll = PLL_28, | 927 | .pll = PLL_28, |
885 | .tuner_type = 1, | 928 | .tuner_type = 1, |
929 | .tuner_addr = ADDR_UNSET, | ||
886 | },{ | 930 | },{ |
887 | .name = "Little OnAir TV", | 931 | .name = "Little OnAir TV", |
888 | .video_inputs = 3, | 932 | .video_inputs = 3, |
@@ -894,6 +938,7 @@ struct tvcard bttv_tvcards[] = { | |||
894 | .audiomux = {0xff9ff6, 0xff9ff6, 0xff1ff7, 0, 0xff3ffc}, | 938 | .audiomux = {0xff9ff6, 0xff9ff6, 0xff1ff7, 0, 0xff3ffc}, |
895 | .no_msp34xx = 1, | 939 | .no_msp34xx = 1, |
896 | .tuner_type = -1, | 940 | .tuner_type = -1, |
941 | .tuner_addr = ADDR_UNSET, | ||
897 | },{ | 942 | },{ |
898 | 943 | ||
899 | /* ---- card 0x2c ---------------------------------- */ | 944 | /* ---- card 0x2c ---------------------------------- */ |
@@ -908,6 +953,7 @@ struct tvcard bttv_tvcards[] = { | |||
908 | .no_msp34xx = 1, | 953 | .no_msp34xx = 1, |
909 | .pll = PLL_NONE, | 954 | .pll = PLL_NONE, |
910 | .tuner_type = -1, | 955 | .tuner_type = -1, |
956 | .tuner_addr = ADDR_UNSET, | ||
911 | },{ | 957 | },{ |
912 | .name = "MATRIX-Vision MV-Delta 2", | 958 | .name = "MATRIX-Vision MV-Delta 2", |
913 | .video_inputs = 5, | 959 | .video_inputs = 5, |
@@ -920,6 +966,7 @@ struct tvcard bttv_tvcards[] = { | |||
920 | .no_msp34xx = 1, | 966 | .no_msp34xx = 1, |
921 | .pll = PLL_28, | 967 | .pll = PLL_28, |
922 | .tuner_type = -1, | 968 | .tuner_type = -1, |
969 | .tuner_addr = ADDR_UNSET, | ||
923 | },{ | 970 | },{ |
924 | .name = "Zoltrix Genie TV/FM", | 971 | .name = "Zoltrix Genie TV/FM", |
925 | .video_inputs = 3, | 972 | .video_inputs = 3, |
@@ -932,6 +979,7 @@ struct tvcard bttv_tvcards[] = { | |||
932 | .no_msp34xx = 1, | 979 | .no_msp34xx = 1, |
933 | .pll = PLL_28, | 980 | .pll = PLL_28, |
934 | .tuner_type = 21, | 981 | .tuner_type = 21, |
982 | .tuner_addr = ADDR_UNSET, | ||
935 | },{ | 983 | },{ |
936 | .name = "Terratec TV/Radio+", | 984 | .name = "Terratec TV/Radio+", |
937 | .video_inputs = 3, | 985 | .video_inputs = 3, |
@@ -945,6 +993,7 @@ struct tvcard bttv_tvcards[] = { | |||
945 | .no_msp34xx = 1, | 993 | .no_msp34xx = 1, |
946 | .pll = PLL_35, | 994 | .pll = PLL_35, |
947 | .tuner_type = 1, | 995 | .tuner_type = 1, |
996 | .tuner_addr = ADDR_UNSET, | ||
948 | .has_radio = 1, | 997 | .has_radio = 1, |
949 | },{ | 998 | },{ |
950 | 999 | ||
@@ -960,6 +1009,7 @@ struct tvcard bttv_tvcards[] = { | |||
960 | .needs_tvaudio = 1, | 1009 | .needs_tvaudio = 1, |
961 | .pll = PLL_28, | 1010 | .pll = PLL_28, |
962 | .tuner_type = -1, | 1011 | .tuner_type = -1, |
1012 | .tuner_addr = ADDR_UNSET, | ||
963 | },{ | 1013 | },{ |
964 | .name = "IODATA GV-BCTV3/PCI", | 1014 | .name = "IODATA GV-BCTV3/PCI", |
965 | .video_inputs = 3, | 1015 | .video_inputs = 3, |
@@ -972,6 +1022,7 @@ struct tvcard bttv_tvcards[] = { | |||
972 | .no_msp34xx = 1, | 1022 | .no_msp34xx = 1, |
973 | .pll = PLL_28, | 1023 | .pll = PLL_28, |
974 | .tuner_type = TUNER_ALPS_TSHC6_NTSC, | 1024 | .tuner_type = TUNER_ALPS_TSHC6_NTSC, |
1025 | .tuner_addr = ADDR_UNSET, | ||
975 | .audio_hook = gvbctv3pci_audio, | 1026 | .audio_hook = gvbctv3pci_audio, |
976 | },{ | 1027 | },{ |
977 | .name = "Prolink PV-BT878P+4E / PixelView PlayTV PAK / Lenco MXTV-9578 CP", | 1028 | .name = "Prolink PV-BT878P+4E / PixelView PlayTV PAK / Lenco MXTV-9578 CP", |
@@ -986,6 +1037,7 @@ struct tvcard bttv_tvcards[] = { | |||
986 | .no_msp34xx = 1, | 1037 | .no_msp34xx = 1, |
987 | .pll = PLL_28, | 1038 | .pll = PLL_28, |
988 | .tuner_type = TUNER_PHILIPS_PAL_I, | 1039 | .tuner_type = TUNER_PHILIPS_PAL_I, |
1040 | .tuner_addr = ADDR_UNSET, | ||
989 | .has_remote = 1, | 1041 | .has_remote = 1, |
990 | /* GPIO wiring: (different from Rev.4C !) | 1042 | /* GPIO wiring: (different from Rev.4C !) |
991 | GPIO17: U4.A0 (first hef4052bt) | 1043 | GPIO17: U4.A0 (first hef4052bt) |
@@ -994,8 +1046,8 @@ struct tvcard bttv_tvcards[] = { | |||
994 | GPIO21: U4.nEN | 1046 | GPIO21: U4.nEN |
995 | GPIO22: BT832 Reset Line | 1047 | GPIO22: BT832 Reset Line |
996 | GPIO23: A5,A0, U5,nEN | 1048 | GPIO23: A5,A0, U5,nEN |
997 | Note: At i2c=0x8a is a Bt832 chip, which changes to 0x88 after being reset via GPIO22 | 1049 | Note: At i2c=0x8a is a Bt832 chip, which changes to 0x88 after being reset via GPIO22 |
998 | */ | 1050 | */ |
999 | },{ | 1051 | },{ |
1000 | .name = "Eagle Wireless Capricorn2 (bt878A)", | 1052 | .name = "Eagle Wireless Capricorn2 (bt878A)", |
1001 | .video_inputs = 4, | 1053 | .video_inputs = 4, |
@@ -1007,6 +1059,7 @@ struct tvcard bttv_tvcards[] = { | |||
1007 | .audiomux = { 0, 1, 2, 3, 4}, | 1059 | .audiomux = { 0, 1, 2, 3, 4}, |
1008 | .pll = PLL_28, | 1060 | .pll = PLL_28, |
1009 | .tuner_type = -1 /* TUNER_ALPS_TMDH2_NTSC */, | 1061 | .tuner_type = -1 /* TUNER_ALPS_TMDH2_NTSC */, |
1062 | .tuner_addr = ADDR_UNSET, | ||
1010 | },{ | 1063 | },{ |
1011 | 1064 | ||
1012 | /* ---- card 0x34 ---------------------------------- */ | 1065 | /* ---- card 0x34 ---------------------------------- */ |
@@ -1020,20 +1073,21 @@ struct tvcard bttv_tvcards[] = { | |||
1020 | .muxsel = { 2, 3, 1, 1}, | 1073 | .muxsel = { 2, 3, 1, 1}, |
1021 | .audiomux = { 1, 0xd0001, 0, 0, 10}, | 1074 | .audiomux = { 1, 0xd0001, 0, 0, 10}, |
1022 | /* sound path (5 sources): | 1075 | /* sound path (5 sources): |
1023 | MUX1 (mask 0x03), Enable Pin 0x08 (0=enable, 1=disable) | 1076 | MUX1 (mask 0x03), Enable Pin 0x08 (0=enable, 1=disable) |
1024 | 0= ext. Audio IN | 1077 | 0= ext. Audio IN |
1025 | 1= from MUX2 | 1078 | 1= from MUX2 |
1026 | 2= Mono TV sound from Tuner | 1079 | 2= Mono TV sound from Tuner |
1027 | 3= not connected | 1080 | 3= not connected |
1028 | MUX2 (mask 0x30000): | 1081 | MUX2 (mask 0x30000): |
1029 | 0,2,3= from MSP34xx | 1082 | 0,2,3= from MSP34xx |
1030 | 1= FM stereo Radio from Tuner */ | 1083 | 1= FM stereo Radio from Tuner */ |
1031 | .needs_tvaudio = 0, | 1084 | .needs_tvaudio = 0, |
1032 | .pll = PLL_28, | 1085 | .pll = PLL_28, |
1033 | .tuner_type = -1, | 1086 | .tuner_type = -1, |
1087 | .tuner_addr = ADDR_UNSET, | ||
1034 | },{ | 1088 | },{ |
1035 | /* Claas Langbehn <claas@bigfoot.com>, | 1089 | /* Claas Langbehn <claas@bigfoot.com>, |
1036 | Sven Grothklags <sven@upb.de> */ | 1090 | Sven Grothklags <sven@upb.de> */ |
1037 | .name = "Typhoon TView RDS + FM Stereo / KNC1 TV Station RDS", | 1091 | .name = "Typhoon TView RDS + FM Stereo / KNC1 TV Station RDS", |
1038 | .video_inputs = 4, | 1092 | .video_inputs = 4, |
1039 | .audio_inputs = 3, | 1093 | .audio_inputs = 3, |
@@ -1045,10 +1099,11 @@ struct tvcard bttv_tvcards[] = { | |||
1045 | .needs_tvaudio = 1, | 1099 | .needs_tvaudio = 1, |
1046 | .pll = PLL_28, | 1100 | .pll = PLL_28, |
1047 | .tuner_type = TUNER_PHILIPS_PAL, | 1101 | .tuner_type = TUNER_PHILIPS_PAL, |
1102 | .tuner_addr = ADDR_UNSET, | ||
1048 | .has_radio = 1, | 1103 | .has_radio = 1, |
1049 | },{ | 1104 | },{ |
1050 | /* Tim Röstermundt <rosterm@uni-muenster.de> | 1105 | /* Tim Röstermundt <rosterm@uni-muenster.de> |
1051 | in de.comp.os.unix.linux.hardware: | 1106 | in de.comp.os.unix.linux.hardware: |
1052 | options bttv card=0 pll=1 radio=1 gpiomask=0x18e0 | 1107 | options bttv card=0 pll=1 radio=1 gpiomask=0x18e0 |
1053 | audiomux=0x44c71f,0x44d71f,0,0x44d71f,0x44dfff | 1108 | audiomux=0x44c71f,0x44d71f,0,0x44d71f,0x44dfff |
1054 | options tuner type=5 */ | 1109 | options tuner type=5 */ |
@@ -1060,15 +1115,16 @@ struct tvcard bttv_tvcards[] = { | |||
1060 | .gpiomask = 0x18e0, | 1115 | .gpiomask = 0x18e0, |
1061 | .muxsel = { 2, 3, 1, 1}, | 1116 | .muxsel = { 2, 3, 1, 1}, |
1062 | .audiomux = { 0x0000,0x0800,0x1000,0x1000,0x18e0 }, | 1117 | .audiomux = { 0x0000,0x0800,0x1000,0x1000,0x18e0 }, |
1063 | /* For cards with tda9820/tda9821: | 1118 | /* For cards with tda9820/tda9821: |
1064 | 0x0000: Tuner normal stereo | 1119 | 0x0000: Tuner normal stereo |
1065 | 0x0080: Tuner A2 SAP (second audio program = Zweikanalton) | 1120 | 0x0080: Tuner A2 SAP (second audio program = Zweikanalton) |
1066 | 0x0880: Tuner A2 stereo */ | 1121 | 0x0880: Tuner A2 stereo */ |
1067 | .pll = PLL_28, | 1122 | .pll = PLL_28, |
1068 | .tuner_type = -1, | 1123 | .tuner_type = -1, |
1124 | .tuner_addr = ADDR_UNSET, | ||
1069 | },{ | 1125 | },{ |
1070 | /* Miguel Angel Alvarez <maacruz@navegalia.com> | 1126 | /* Miguel Angel Alvarez <maacruz@navegalia.com> |
1071 | old Easy TV BT848 version (model CPH031) */ | 1127 | old Easy TV BT848 version (model CPH031) */ |
1072 | .name = "Askey CPH031/ BESTBUY Easy TV", | 1128 | .name = "Askey CPH031/ BESTBUY Easy TV", |
1073 | .video_inputs = 4, | 1129 | .video_inputs = 4, |
1074 | .audio_inputs = 1, | 1130 | .audio_inputs = 1, |
@@ -1080,6 +1136,7 @@ struct tvcard bttv_tvcards[] = { | |||
1080 | .needs_tvaudio = 0, | 1136 | .needs_tvaudio = 0, |
1081 | .pll = PLL_28, | 1137 | .pll = PLL_28, |
1082 | .tuner_type = TUNER_TEMIC_PAL, | 1138 | .tuner_type = TUNER_TEMIC_PAL, |
1139 | .tuner_addr = ADDR_UNSET, | ||
1083 | },{ | 1140 | },{ |
1084 | 1141 | ||
1085 | /* ---- card 0x38 ---------------------------------- */ | 1142 | /* ---- card 0x38 ---------------------------------- */ |
@@ -1094,10 +1151,11 @@ struct tvcard bttv_tvcards[] = { | |||
1094 | .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 }, | 1151 | .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 }, |
1095 | .pll = PLL_28, | 1152 | .pll = PLL_28, |
1096 | .tuner_type = 5, | 1153 | .tuner_type = 5, |
1154 | .tuner_addr = ADDR_UNSET, | ||
1097 | },{ | 1155 | },{ |
1098 | /* This is the ultimate cheapo capture card | 1156 | /* This is the ultimate cheapo capture card |
1099 | * just a BT848A on a small PCB! | 1157 | * just a BT848A on a small PCB! |
1100 | * Steve Hosgood <steve@equiinet.com> */ | 1158 | * Steve Hosgood <steve@equiinet.com> */ |
1101 | .name = "GrandTec 'Grand Video Capture' (Bt848)", | 1159 | .name = "GrandTec 'Grand Video Capture' (Bt848)", |
1102 | .video_inputs = 2, | 1160 | .video_inputs = 2, |
1103 | .audio_inputs = 0, | 1161 | .audio_inputs = 0, |
@@ -1110,19 +1168,21 @@ struct tvcard bttv_tvcards[] = { | |||
1110 | .no_msp34xx = 1, | 1168 | .no_msp34xx = 1, |
1111 | .pll = PLL_35, | 1169 | .pll = PLL_35, |
1112 | .tuner_type = -1, | 1170 | .tuner_type = -1, |
1171 | .tuner_addr = ADDR_UNSET, | ||
1113 | },{ | 1172 | },{ |
1114 | /* Daniel Herrington <daniel.herrington@home.com> */ | 1173 | /* Daniel Herrington <daniel.herrington@home.com> */ |
1115 | .name = "Askey CPH060/ Phoebe TV Master Only (No FM)", | 1174 | .name = "Askey CPH060/ Phoebe TV Master Only (No FM)", |
1116 | .video_inputs = 3, | 1175 | .video_inputs = 3, |
1117 | .audio_inputs = 1, | 1176 | .audio_inputs = 1, |
1118 | .tuner = 0, | 1177 | .tuner = 0, |
1119 | .svhs = 2, | 1178 | .svhs = 2, |
1120 | .gpiomask = 0xe00, | 1179 | .gpiomask = 0xe00, |
1121 | .muxsel = { 2, 3, 1, 1}, | 1180 | .muxsel = { 2, 3, 1, 1}, |
1122 | .audiomux = { 0x400, 0x400, 0x400, 0x400, 0x800, 0x400 }, | 1181 | .audiomux = { 0x400, 0x400, 0x400, 0x400, 0x800, 0x400 }, |
1123 | .needs_tvaudio = 1, | 1182 | .needs_tvaudio = 1, |
1124 | .pll = PLL_28, | 1183 | .pll = PLL_28, |
1125 | .tuner_type = TUNER_TEMIC_4036FY5_NTSC, | 1184 | .tuner_type = TUNER_TEMIC_4036FY5_NTSC, |
1185 | .tuner_addr = ADDR_UNSET, | ||
1126 | },{ | 1186 | },{ |
1127 | /* Matti Mottus <mottus@physic.ut.ee> */ | 1187 | /* Matti Mottus <mottus@physic.ut.ee> */ |
1128 | .name = "Askey CPH03x TV Capturer", | 1188 | .name = "Askey CPH03x TV Capturer", |
@@ -1130,11 +1190,12 @@ struct tvcard bttv_tvcards[] = { | |||
1130 | .audio_inputs = 1, | 1190 | .audio_inputs = 1, |
1131 | .tuner = 0, | 1191 | .tuner = 0, |
1132 | .svhs = 2, | 1192 | .svhs = 2, |
1133 | .gpiomask = 0x03000F, | 1193 | .gpiomask = 0x03000F, |
1134 | .muxsel = { 2, 3, 1, 0}, | 1194 | .muxsel = { 2, 3, 1, 0}, |
1135 | .audiomux = { 2,0,0,0,1 }, | 1195 | .audiomux = { 2,0,0,0,1 }, |
1136 | .pll = PLL_28, | 1196 | .pll = PLL_28, |
1137 | .tuner_type = 0, | 1197 | .tuner_type = 0, |
1198 | .tuner_addr = ADDR_UNSET, | ||
1138 | },{ | 1199 | },{ |
1139 | 1200 | ||
1140 | /* ---- card 0x3c ---------------------------------- */ | 1201 | /* ---- card 0x3c ---------------------------------- */ |
@@ -1149,7 +1210,7 @@ struct tvcard bttv_tvcards[] = { | |||
1149 | .audiomux = { 2, 0, 0, 1, 8}, | 1210 | .audiomux = { 2, 0, 0, 1, 8}, |
1150 | .pll = PLL_35, | 1211 | .pll = PLL_35, |
1151 | .tuner_type = TUNER_TEMIC_PAL, | 1212 | .tuner_type = TUNER_TEMIC_PAL, |
1152 | 1213 | .tuner_addr = ADDR_UNSET, | |
1153 | },{ | 1214 | },{ |
1154 | /* Adrian Cox <adrian@humboldt.co.uk */ | 1215 | /* Adrian Cox <adrian@humboldt.co.uk */ |
1155 | .name = "AG Electronics GMV1", | 1216 | .name = "AG Electronics GMV1", |
@@ -1164,10 +1225,11 @@ struct tvcard bttv_tvcards[] = { | |||
1164 | .needs_tvaudio = 0, | 1225 | .needs_tvaudio = 0, |
1165 | .pll = PLL_28, | 1226 | .pll = PLL_28, |
1166 | .tuner_type = -1, | 1227 | .tuner_type = -1, |
1228 | .tuner_addr = ADDR_UNSET, | ||
1167 | },{ | 1229 | },{ |
1168 | /* Miguel Angel Alvarez <maacruz@navegalia.com> | 1230 | /* Miguel Angel Alvarez <maacruz@navegalia.com> |
1169 | new Easy TV BT878 version (model CPH061) | 1231 | new Easy TV BT878 version (model CPH061) |
1170 | special thanks to Informatica Mieres for providing the card */ | 1232 | special thanks to Informatica Mieres for providing the card */ |
1171 | .name = "Askey CPH061/ BESTBUY Easy TV (bt878)", | 1233 | .name = "Askey CPH061/ BESTBUY Easy TV (bt878)", |
1172 | .video_inputs = 3, | 1234 | .video_inputs = 3, |
1173 | .audio_inputs = 2, | 1235 | .audio_inputs = 2, |
@@ -1179,6 +1241,7 @@ struct tvcard bttv_tvcards[] = { | |||
1179 | .needs_tvaudio = 0, | 1241 | .needs_tvaudio = 0, |
1180 | .pll = PLL_28, | 1242 | .pll = PLL_28, |
1181 | .tuner_type = TUNER_PHILIPS_PAL, | 1243 | .tuner_type = TUNER_PHILIPS_PAL, |
1244 | .tuner_addr = ADDR_UNSET, | ||
1182 | },{ | 1245 | },{ |
1183 | /* Lukas Gebauer <geby@volny.cz> */ | 1246 | /* Lukas Gebauer <geby@volny.cz> */ |
1184 | .name = "ATI TV-Wonder", | 1247 | .name = "ATI TV-Wonder", |
@@ -1191,6 +1254,7 @@ struct tvcard bttv_tvcards[] = { | |||
1191 | .audiomux = { 0xbffe, 0, 0xbfff, 0, 0xbffe}, | 1254 | .audiomux = { 0xbffe, 0, 0xbfff, 0, 0xbffe}, |
1192 | .pll = PLL_28, | 1255 | .pll = PLL_28, |
1193 | .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL, | 1256 | .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL, |
1257 | .tuner_addr = ADDR_UNSET, | ||
1194 | },{ | 1258 | },{ |
1195 | 1259 | ||
1196 | /* ---- card 0x40 ---------------------------------- */ | 1260 | /* ---- card 0x40 ---------------------------------- */ |
@@ -1206,6 +1270,7 @@ struct tvcard bttv_tvcards[] = { | |||
1206 | .no_msp34xx = 1, | 1270 | .no_msp34xx = 1, |
1207 | .pll = PLL_28, | 1271 | .pll = PLL_28, |
1208 | .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL, | 1272 | .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL, |
1273 | .tuner_addr = ADDR_UNSET, | ||
1209 | },{ | 1274 | },{ |
1210 | /* DeeJay <deejay@westel900.net (2000S) */ | 1275 | /* DeeJay <deejay@westel900.net (2000S) */ |
1211 | .name = "Lifeview FlyVideo 2000S LR90", | 1276 | .name = "Lifeview FlyVideo 2000S LR90", |
@@ -1216,7 +1281,7 @@ struct tvcard bttv_tvcards[] = { | |||
1216 | .gpiomask = 0x18e0, | 1281 | .gpiomask = 0x18e0, |
1217 | .muxsel = { 2, 3, 0, 1}, | 1282 | .muxsel = { 2, 3, 0, 1}, |
1218 | /* Radio changed from 1e80 to 0x800 to make | 1283 | /* Radio changed from 1e80 to 0x800 to make |
1219 | FlyVideo2000S in .hu happy (gm)*/ | 1284 | FlyVideo2000S in .hu happy (gm)*/ |
1220 | /* -dk-???: set mute=0x1800 for tda9874h daughterboard */ | 1285 | /* -dk-???: set mute=0x1800 for tda9874h daughterboard */ |
1221 | .audiomux = { 0x0000,0x0800,0x1000,0x1000,0x1800, 0x1080 }, | 1286 | .audiomux = { 0x0000,0x0800,0x1000,0x1000,0x1800, 0x1080 }, |
1222 | .audio_hook = fv2000s_audio, | 1287 | .audio_hook = fv2000s_audio, |
@@ -1225,6 +1290,7 @@ struct tvcard bttv_tvcards[] = { | |||
1225 | .needs_tvaudio = 1, | 1290 | .needs_tvaudio = 1, |
1226 | .pll = PLL_28, | 1291 | .pll = PLL_28, |
1227 | .tuner_type = 5, | 1292 | .tuner_type = 5, |
1293 | .tuner_addr = ADDR_UNSET, | ||
1228 | },{ | 1294 | },{ |
1229 | .name = "Terratec TValueRadio", | 1295 | .name = "Terratec TValueRadio", |
1230 | .video_inputs = 3, | 1296 | .video_inputs = 3, |
@@ -1237,6 +1303,7 @@ struct tvcard bttv_tvcards[] = { | |||
1237 | .needs_tvaudio = 1, | 1303 | .needs_tvaudio = 1, |
1238 | .pll = PLL_28, | 1304 | .pll = PLL_28, |
1239 | .tuner_type = TUNER_PHILIPS_PAL, | 1305 | .tuner_type = TUNER_PHILIPS_PAL, |
1306 | .tuner_addr = ADDR_UNSET, | ||
1240 | .has_radio = 1, | 1307 | .has_radio = 1, |
1241 | },{ | 1308 | },{ |
1242 | /* TANAKA Kei <peg00625@nifty.com> */ | 1309 | /* TANAKA Kei <peg00625@nifty.com> */ |
@@ -1251,25 +1318,27 @@ struct tvcard bttv_tvcards[] = { | |||
1251 | .no_msp34xx = 1, | 1318 | .no_msp34xx = 1, |
1252 | .pll = PLL_28, | 1319 | .pll = PLL_28, |
1253 | .tuner_type = TUNER_SHARP_2U5JF5540_NTSC, | 1320 | .tuner_type = TUNER_SHARP_2U5JF5540_NTSC, |
1321 | .tuner_addr = ADDR_UNSET, | ||
1254 | .audio_hook = gvbctv3pci_audio, | 1322 | .audio_hook = gvbctv3pci_audio, |
1255 | },{ | 1323 | },{ |
1256 | 1324 | ||
1257 | /* ---- card 0x44 ---------------------------------- */ | 1325 | /* ---- card 0x44 ---------------------------------- */ |
1258 | .name = "3Dfx VoodooTV FM (Euro), VoodooTV 200 (USA)", | 1326 | .name = "3Dfx VoodooTV FM (Euro), VoodooTV 200 (USA)", |
1259 | // try "insmod msp3400 simple=0" if you have | 1327 | /* try "insmod msp3400 simple=0" if you have |
1260 | // sound problems with this card. | 1328 | * sound problems with this card. */ |
1261 | .video_inputs = 4, | 1329 | .video_inputs = 4, |
1262 | .audio_inputs = 1, | 1330 | .audio_inputs = 1, |
1263 | .tuner = 0, | 1331 | .tuner = 0, |
1264 | .svhs = -1, | 1332 | .svhs = -1, |
1265 | .gpiomask = 0x4f8a00, | 1333 | .gpiomask = 0x4f8a00, |
1266 | // 0x100000: 1=MSP enabled (0=disable again) | 1334 | /* 0x100000: 1=MSP enabled (0=disable again) |
1267 | // 0x010000: Connected to "S0" on tda9880 (0=Pal/BG, 1=NTSC) | 1335 | * 0x010000: Connected to "S0" on tda9880 (0=Pal/BG, 1=NTSC) */ |
1268 | .audiomux = {0x947fff, 0x987fff,0x947fff,0x947fff, 0x947fff}, | 1336 | .audiomux = {0x947fff, 0x987fff,0x947fff,0x947fff, 0x947fff}, |
1269 | // tvtuner, radio, external,internal, mute, stereo | 1337 | /* tvtuner, radio, external,internal, mute, stereo |
1270 | /* tuner, Composit, SVid, Composit-on-Svid-adapter*/ | 1338 | * tuner, Composit, SVid, Composit-on-Svid-adapter */ |
1271 | .muxsel = { 2, 3 ,0 ,1}, | 1339 | .muxsel = { 2, 3 ,0 ,1}, |
1272 | .tuner_type = TUNER_MT2032, | 1340 | .tuner_type = TUNER_MT2032, |
1341 | .tuner_addr = ADDR_UNSET, | ||
1273 | .pll = PLL_28, | 1342 | .pll = PLL_28, |
1274 | .has_radio = 1, | 1343 | .has_radio = 1, |
1275 | },{ | 1344 | },{ |
@@ -1279,22 +1348,24 @@ struct tvcard bttv_tvcards[] = { | |||
1279 | .audio_inputs = 0, | 1348 | .audio_inputs = 0, |
1280 | .tuner = -1, | 1349 | .tuner = -1, |
1281 | .tuner_type = -1, | 1350 | .tuner_type = -1, |
1351 | .tuner_addr = ADDR_UNSET, | ||
1282 | .pll = PLL_28, | 1352 | .pll = PLL_28, |
1283 | .muxsel = { 2 }, | 1353 | .muxsel = { 2 }, |
1284 | .gpiomask = 0 | 1354 | .gpiomask = 0 |
1285 | },{ | 1355 | },{ |
1286 | /* Tomasz Pyra <hellfire@sedez.iq.pl> */ | 1356 | /* Tomasz Pyra <hellfire@sedez.iq.pl> */ |
1287 | .name = "Prolink Pixelview PV-BT878P+ (Rev.4C,8E)", | 1357 | .name = "Prolink Pixelview PV-BT878P+ (Rev.4C,8E)", |
1288 | .video_inputs = 3, | 1358 | .video_inputs = 3, |
1289 | .audio_inputs = 4, | 1359 | .audio_inputs = 4, |
1290 | .tuner = 0, | 1360 | .tuner = 0, |
1291 | .svhs = 2, | 1361 | .svhs = 2, |
1292 | .gpiomask = 15, | 1362 | .gpiomask = 15, |
1293 | .muxsel = { 2, 3, 1, 1}, | 1363 | .muxsel = { 2, 3, 1, 1}, |
1294 | .audiomux = { 0, 0, 11, 7, 13, 0}, // TV and Radio with same GPIO ! | 1364 | .audiomux = { 0, 0, 11, 7, 13, 0}, /* TV and Radio with same GPIO ! */ |
1295 | .needs_tvaudio = 1, | 1365 | .needs_tvaudio = 1, |
1296 | .pll = PLL_28, | 1366 | .pll = PLL_28, |
1297 | .tuner_type = 25, | 1367 | .tuner_type = 25, |
1368 | .tuner_addr = ADDR_UNSET, | ||
1298 | .has_remote = 1, | 1369 | .has_remote = 1, |
1299 | /* GPIO wiring: | 1370 | /* GPIO wiring: |
1300 | GPIO0: U4.A0 (hef4052bt) | 1371 | GPIO0: U4.A0 (hef4052bt) |
@@ -1302,16 +1373,18 @@ struct tvcard bttv_tvcards[] = { | |||
1302 | GPIO2: U4.A1 (second hef4052bt) | 1373 | GPIO2: U4.A1 (second hef4052bt) |
1303 | GPIO3: U4.nEN, U5.A0, A5.nEN | 1374 | GPIO3: U4.nEN, U5.A0, A5.nEN |
1304 | GPIO8-15: vrd866b ? | 1375 | GPIO8-15: vrd866b ? |
1305 | */ | 1376 | */ |
1306 | },{ | 1377 | },{ |
1307 | .name = "Lifeview FlyVideo 98EZ (capture only) LR51", | 1378 | .name = "Lifeview FlyVideo 98EZ (capture only) LR51", |
1308 | .video_inputs = 4, | 1379 | .video_inputs = 4, |
1309 | .audio_inputs = 0, | 1380 | .audio_inputs = 0, |
1310 | .tuner = -1, | 1381 | .tuner = -1, |
1311 | .svhs = 2, | 1382 | .svhs = 2, |
1312 | .muxsel = { 2, 3, 1, 1}, // AV1, AV2, SVHS, CVid adapter on SVHS | 1383 | .muxsel = { 2, 3, 1, 1}, /* AV1, AV2, SVHS, CVid adapter on SVHS */ |
1313 | .pll = PLL_28, | 1384 | .pll = PLL_28, |
1314 | .no_msp34xx = 1, | 1385 | .no_msp34xx = 1, |
1386 | .tuner_type = UNSET, | ||
1387 | .tuner_addr = ADDR_UNSET, | ||
1315 | },{ | 1388 | },{ |
1316 | 1389 | ||
1317 | /* ---- card 0x48 ---------------------------------- */ | 1390 | /* ---- card 0x48 ---------------------------------- */ |
@@ -1329,8 +1402,9 @@ struct tvcard bttv_tvcards[] = { | |||
1329 | .no_tda9875 = 1, | 1402 | .no_tda9875 = 1, |
1330 | .pll = PLL_28, | 1403 | .pll = PLL_28, |
1331 | .tuner_type = 5, | 1404 | .tuner_type = 5, |
1332 | .audio_hook = pvbt878p9b_audio, // Note: not all cards have stereo | 1405 | .tuner_addr = ADDR_UNSET, |
1333 | .has_radio = 1, // Note: not all cards have radio | 1406 | .audio_hook = pvbt878p9b_audio, /* Note: not all cards have stereo */ |
1407 | .has_radio = 1, /* Note: not all cards have radio */ | ||
1334 | .has_remote = 1, | 1408 | .has_remote = 1, |
1335 | /* GPIO wiring: | 1409 | /* GPIO wiring: |
1336 | GPIO0: A0 hef4052 | 1410 | GPIO0: A0 hef4052 |
@@ -1338,7 +1412,7 @@ struct tvcard bttv_tvcards[] = { | |||
1338 | GPIO3: nEN hef4052 | 1412 | GPIO3: nEN hef4052 |
1339 | GPIO8-15: vrd866b | 1413 | GPIO8-15: vrd866b |
1340 | GPIO20,22,23: R30,R29,R28 | 1414 | GPIO20,22,23: R30,R29,R28 |
1341 | */ | 1415 | */ |
1342 | },{ | 1416 | },{ |
1343 | /* Clay Kunz <ckunz@mail.arc.nasa.gov> */ | 1417 | /* Clay Kunz <ckunz@mail.arc.nasa.gov> */ |
1344 | /* you must jumper JP5 for the card to work */ | 1418 | /* you must jumper JP5 for the card to work */ |
@@ -1352,6 +1426,7 @@ struct tvcard bttv_tvcards[] = { | |||
1352 | .audiomux = { 0 }, | 1426 | .audiomux = { 0 }, |
1353 | .needs_tvaudio = 0, | 1427 | .needs_tvaudio = 0, |
1354 | .tuner_type = -1, | 1428 | .tuner_type = -1, |
1429 | .tuner_addr = ADDR_UNSET, | ||
1355 | },{ | 1430 | },{ |
1356 | /* Miguel Freitas <miguel@cetuc.puc-rio.br> */ | 1431 | /* Miguel Freitas <miguel@cetuc.puc-rio.br> */ |
1357 | .name = "RemoteVision MX (RV605)", | 1432 | .name = "RemoteVision MX (RV605)", |
@@ -1362,71 +1437,78 @@ struct tvcard bttv_tvcards[] = { | |||
1362 | .gpiomask = 0x00, | 1437 | .gpiomask = 0x00, |
1363 | .gpiomask2 = 0x07ff, | 1438 | .gpiomask2 = 0x07ff, |
1364 | .muxsel = { 0x33, 0x13, 0x23, 0x43, 0xf3, 0x73, 0xe3, 0x03, | 1439 | .muxsel = { 0x33, 0x13, 0x23, 0x43, 0xf3, 0x73, 0xe3, 0x03, |
1365 | 0xd3, 0xb3, 0xc3, 0x63, 0x93, 0x53, 0x83, 0xa3 }, | 1440 | 0xd3, 0xb3, 0xc3, 0x63, 0x93, 0x53, 0x83, 0xa3 }, |
1366 | .no_msp34xx = 1, | 1441 | .no_msp34xx = 1, |
1367 | .no_tda9875 = 1, | 1442 | .no_tda9875 = 1, |
1368 | .tuner_type = -1, | 1443 | .tuner_type = -1, |
1444 | .tuner_addr = ADDR_UNSET, | ||
1369 | .muxsel_hook = rv605_muxsel, | 1445 | .muxsel_hook = rv605_muxsel, |
1370 | },{ | 1446 | },{ |
1371 | .name = "Powercolor MTV878/ MTV878R/ MTV878F", | 1447 | .name = "Powercolor MTV878/ MTV878R/ MTV878F", |
1372 | .video_inputs = 3, | 1448 | .video_inputs = 3, |
1373 | .audio_inputs = 2, | 1449 | .audio_inputs = 2, |
1374 | .tuner = 0, | 1450 | .tuner = 0, |
1375 | .svhs = 2, | 1451 | .svhs = 2, |
1376 | .gpiomask = 0x1C800F, // Bit0-2: Audio select, 8-12:remote control 14:remote valid 15:remote reset | 1452 | .gpiomask = 0x1C800F, /* Bit0-2: Audio select, 8-12:remote control 14:remote valid 15:remote reset */ |
1377 | .muxsel = { 2, 1, 1, }, | 1453 | .muxsel = { 2, 1, 1, }, |
1378 | .audiomux = { 0, 1, 2, 2, 4 }, | 1454 | .audiomux = { 0, 1, 2, 2, 4 }, |
1379 | .needs_tvaudio = 0, | 1455 | .needs_tvaudio = 0, |
1380 | .tuner_type = TUNER_PHILIPS_PAL, | 1456 | .tuner_type = TUNER_PHILIPS_PAL, |
1457 | .tuner_addr = ADDR_UNSET, | ||
1381 | .pll = PLL_28, | 1458 | .pll = PLL_28, |
1382 | .has_radio = 1, | 1459 | .has_radio = 1, |
1383 | },{ | 1460 | },{ |
1384 | 1461 | ||
1385 | /* ---- card 0x4c ---------------------------------- */ | 1462 | /* ---- card 0x4c ---------------------------------- */ |
1386 | /* Masaki Suzuki <masaki@btree.org> */ | 1463 | /* Masaki Suzuki <masaki@btree.org> */ |
1387 | .name = "Canopus WinDVR PCI (COMPAQ Presario 3524JP, 5112JP)", | 1464 | .name = "Canopus WinDVR PCI (COMPAQ Presario 3524JP, 5112JP)", |
1388 | .video_inputs = 3, | 1465 | .video_inputs = 3, |
1389 | .audio_inputs = 1, | 1466 | .audio_inputs = 1, |
1390 | .tuner = 0, | 1467 | .tuner = 0, |
1391 | .svhs = 2, | 1468 | .svhs = 2, |
1392 | .gpiomask = 0x140007, | 1469 | .gpiomask = 0x140007, |
1393 | .muxsel = { 2, 3, 1, 1 }, | 1470 | .muxsel = { 2, 3, 1, 1 }, |
1394 | .audiomux = { 0, 1, 2, 3, 4, 0 }, | 1471 | .audiomux = { 0, 1, 2, 3, 4, 0 }, |
1395 | .tuner_type = TUNER_PHILIPS_NTSC, | 1472 | .tuner_type = TUNER_PHILIPS_NTSC, |
1396 | .audio_hook = windvr_audio, | 1473 | .tuner_addr = ADDR_UNSET, |
1397 | },{ | 1474 | .audio_hook = windvr_audio, |
1398 | .name = "GrandTec Multi Capture Card (Bt878)", | 1475 | },{ |
1399 | .video_inputs = 4, | 1476 | .name = "GrandTec Multi Capture Card (Bt878)", |
1400 | .audio_inputs = 0, | 1477 | .video_inputs = 4, |
1401 | .tuner = -1, | 1478 | .audio_inputs = 0, |
1402 | .svhs = -1, | 1479 | .tuner = -1, |
1403 | .gpiomask = 0, | 1480 | .svhs = -1, |
1404 | .muxsel = { 2, 3, 1, 0 }, | 1481 | .gpiomask = 0, |
1405 | .audiomux = { 0 }, | 1482 | .muxsel = { 2, 3, 1, 0 }, |
1406 | .needs_tvaudio = 0, | 1483 | .audiomux = { 0 }, |
1407 | .no_msp34xx = 1, | 1484 | .needs_tvaudio = 0, |
1408 | .pll = PLL_28, | 1485 | .no_msp34xx = 1, |
1409 | .tuner_type = -1, | 1486 | .pll = PLL_28, |
1410 | },{ | 1487 | .tuner_type = -1, |
1411 | .name = "Jetway TV/Capture JW-TV878-FBK, Kworld KW-TV878RF", | 1488 | .tuner_addr = ADDR_UNSET, |
1412 | .video_inputs = 4, | 1489 | },{ |
1413 | .audio_inputs = 3, | 1490 | .name = "Jetway TV/Capture JW-TV878-FBK, Kworld KW-TV878RF", |
1414 | .tuner = 0, | 1491 | .video_inputs = 4, |
1415 | .svhs = 2, | 1492 | .audio_inputs = 3, |
1416 | .gpiomask = 7, | 1493 | .tuner = 0, |
1417 | .muxsel = { 2, 3, 1, 1 }, // Tuner, SVid, SVHS, SVid to SVHS connector | 1494 | .svhs = 2, |
1418 | .audiomux = { 0 ,0 ,4, 4,4,4},// Yes, this tuner uses the same audio output for TV and FM radio! | 1495 | .gpiomask = 7, |
1419 | // This card lacks external Audio In, so we mute it on Ext. & Int. | 1496 | .muxsel = { 2, 3, 1, 1 }, /* Tuner, SVid, SVHS, SVid to SVHS connector */ |
1420 | // The PCB can take a sbx1637/sbx1673, wiring unknown. | 1497 | .audiomux = { 0 ,0 ,4, 4,4,4},/* Yes, this tuner uses the same audio output for TV and FM radio! |
1421 | // This card lacks PCI subsystem ID, sigh. | 1498 | * This card lacks external Audio In, so we mute it on Ext. & Int. |
1422 | // audiomux=1: lower volume, 2+3: mute | 1499 | * The PCB can take a sbx1637/sbx1673, wiring unknown. |
1423 | // btwincap uses 0x80000/0x80003 | 1500 | * This card lacks PCI subsystem ID, sigh. |
1424 | .needs_tvaudio = 0, | 1501 | * audiomux=1: lower volume, 2+3: mute |
1425 | .no_msp34xx = 1, | 1502 | * btwincap uses 0x80000/0x80003 |
1426 | .pll = PLL_28, | 1503 | */ |
1427 | .tuner_type = 5, // Samsung TCPA9095PC27A (BG+DK), philips compatible, w/FM, stereo and | 1504 | .needs_tvaudio = 0, |
1428 | // radio signal strength indicators work fine. | 1505 | .no_msp34xx = 1, |
1429 | .has_radio = 1, | 1506 | .pll = PLL_28, |
1507 | .tuner_type = 5, | ||
1508 | .tuner_addr = ADDR_UNSET, | ||
1509 | /* Samsung TCPA9095PC27A (BG+DK), philips compatible, w/FM, stereo and | ||
1510 | radio signal strength indicators work fine. */ | ||
1511 | .has_radio = 1, | ||
1430 | /* GPIO Info: | 1512 | /* GPIO Info: |
1431 | GPIO0,1: HEF4052 A0,A1 | 1513 | GPIO0,1: HEF4052 A0,A1 |
1432 | GPIO2: HEF4052 nENABLE | 1514 | GPIO2: HEF4052 nENABLE |
@@ -1437,25 +1519,27 @@ struct tvcard bttv_tvcards[] = { | |||
1437 | GPIO22,23: ?? | 1519 | GPIO22,23: ?? |
1438 | ?? : mtu8b56ep microcontroller for IR (GPIO wiring unknown)*/ | 1520 | ?? : mtu8b56ep microcontroller for IR (GPIO wiring unknown)*/ |
1439 | },{ | 1521 | },{ |
1440 | /* Arthur Tetzlaff-Deas, DSP Design Ltd <software@dspdesign.com> */ | 1522 | /* Arthur Tetzlaff-Deas, DSP Design Ltd <software@dspdesign.com> */ |
1441 | .name = "DSP Design TCVIDEO", | 1523 | .name = "DSP Design TCVIDEO", |
1442 | .video_inputs = 4, | 1524 | .video_inputs = 4, |
1443 | .svhs = -1, | 1525 | .svhs = -1, |
1444 | .muxsel = { 2, 3, 1, 0}, | 1526 | .muxsel = { 2, 3, 1, 0}, |
1445 | .pll = PLL_28, | 1527 | .pll = PLL_28, |
1446 | .tuner_type = -1, | 1528 | .tuner_type = -1, |
1529 | .tuner_addr = ADDR_UNSET, | ||
1447 | },{ | 1530 | },{ |
1448 | 1531 | ||
1449 | /* ---- card 0x50 ---------------------------------- */ | 1532 | /* ---- card 0x50 ---------------------------------- */ |
1450 | .name = "Hauppauge WinTV PVR", | 1533 | .name = "Hauppauge WinTV PVR", |
1451 | .video_inputs = 4, | 1534 | .video_inputs = 4, |
1452 | .audio_inputs = 1, | 1535 | .audio_inputs = 1, |
1453 | .tuner = 0, | 1536 | .tuner = 0, |
1454 | .svhs = 2, | 1537 | .svhs = 2, |
1455 | .muxsel = { 2, 0, 1, 1}, | 1538 | .muxsel = { 2, 0, 1, 1}, |
1456 | .needs_tvaudio = 1, | 1539 | .needs_tvaudio = 1, |
1457 | .pll = PLL_28, | 1540 | .pll = PLL_28, |
1458 | .tuner_type = -1, | 1541 | .tuner_type = -1, |
1542 | .tuner_addr = ADDR_UNSET, | ||
1459 | 1543 | ||
1460 | .gpiomask = 7, | 1544 | .gpiomask = 7, |
1461 | .audiomux = {7}, | 1545 | .audiomux = {7}, |
@@ -1471,6 +1555,7 @@ struct tvcard bttv_tvcards[] = { | |||
1471 | .no_msp34xx = 1, | 1555 | .no_msp34xx = 1, |
1472 | .pll = PLL_28, | 1556 | .pll = PLL_28, |
1473 | .tuner_type = TUNER_PHILIPS_NTSC_M, | 1557 | .tuner_type = TUNER_PHILIPS_NTSC_M, |
1558 | .tuner_addr = ADDR_UNSET, | ||
1474 | .audio_hook = gvbctv5pci_audio, | 1559 | .audio_hook = gvbctv5pci_audio, |
1475 | .has_radio = 1, | 1560 | .has_radio = 1, |
1476 | },{ | 1561 | },{ |
@@ -1482,9 +1567,10 @@ struct tvcard bttv_tvcards[] = { | |||
1482 | .muxsel = { 3, 2, 0, 1 }, | 1567 | .muxsel = { 3, 2, 0, 1 }, |
1483 | .pll = PLL_28, | 1568 | .pll = PLL_28, |
1484 | .tuner_type = -1, | 1569 | .tuner_type = -1, |
1485 | .no_msp34xx = 1, | 1570 | .tuner_addr = ADDR_UNSET, |
1486 | .no_tda9875 = 1, | 1571 | .no_msp34xx = 1, |
1487 | .no_tda7432 = 1, | 1572 | .no_tda9875 = 1, |
1573 | .no_tda7432 = 1, | ||
1488 | },{ | 1574 | },{ |
1489 | .name = "Osprey 100/150 (848)", /* 0x04-54C0-C1 & older boards */ | 1575 | .name = "Osprey 100/150 (848)", /* 0x04-54C0-C1 & older boards */ |
1490 | .video_inputs = 3, | 1576 | .video_inputs = 3, |
@@ -1494,9 +1580,10 @@ struct tvcard bttv_tvcards[] = { | |||
1494 | .muxsel = { 2, 3, 1 }, | 1580 | .muxsel = { 2, 3, 1 }, |
1495 | .pll = PLL_28, | 1581 | .pll = PLL_28, |
1496 | .tuner_type = -1, | 1582 | .tuner_type = -1, |
1497 | .no_msp34xx = 1, | 1583 | .tuner_addr = ADDR_UNSET, |
1498 | .no_tda9875 = 1, | 1584 | .no_msp34xx = 1, |
1499 | .no_tda7432 = 1, | 1585 | .no_tda9875 = 1, |
1586 | .no_tda7432 = 1, | ||
1500 | },{ | 1587 | },{ |
1501 | 1588 | ||
1502 | /* ---- card 0x54 ---------------------------------- */ | 1589 | /* ---- card 0x54 ---------------------------------- */ |
@@ -1508,9 +1595,10 @@ struct tvcard bttv_tvcards[] = { | |||
1508 | .muxsel = { 3, 1 }, | 1595 | .muxsel = { 3, 1 }, |
1509 | .pll = PLL_28, | 1596 | .pll = PLL_28, |
1510 | .tuner_type = -1, | 1597 | .tuner_type = -1, |
1511 | .no_msp34xx = 1, | 1598 | .tuner_addr = ADDR_UNSET, |
1512 | .no_tda9875 = 1, | 1599 | .no_msp34xx = 1, |
1513 | .no_tda7432 = 1, | 1600 | .no_tda9875 = 1, |
1601 | .no_tda7432 = 1, | ||
1514 | },{ | 1602 | },{ |
1515 | .name = "Osprey 101/151", /* 0x1(4|5)-0004-C4 */ | 1603 | .name = "Osprey 101/151", /* 0x1(4|5)-0004-C4 */ |
1516 | .video_inputs = 1, | 1604 | .video_inputs = 1, |
@@ -1520,9 +1608,10 @@ struct tvcard bttv_tvcards[] = { | |||
1520 | .muxsel = { 0 }, | 1608 | .muxsel = { 0 }, |
1521 | .pll = PLL_28, | 1609 | .pll = PLL_28, |
1522 | .tuner_type = -1, | 1610 | .tuner_type = -1, |
1523 | .no_msp34xx = 1, | 1611 | .tuner_addr = ADDR_UNSET, |
1524 | .no_tda9875 = 1, | 1612 | .no_msp34xx = 1, |
1525 | .no_tda7432 = 1, | 1613 | .no_tda9875 = 1, |
1614 | .no_tda7432 = 1, | ||
1526 | },{ | 1615 | },{ |
1527 | .name = "Osprey 101/151 w/ svid", /* 0x(16|17|20)-00C4-C1 */ | 1616 | .name = "Osprey 101/151 w/ svid", /* 0x(16|17|20)-00C4-C1 */ |
1528 | .video_inputs = 2, | 1617 | .video_inputs = 2, |
@@ -1532,9 +1621,10 @@ struct tvcard bttv_tvcards[] = { | |||
1532 | .muxsel = { 0, 1 }, | 1621 | .muxsel = { 0, 1 }, |
1533 | .pll = PLL_28, | 1622 | .pll = PLL_28, |
1534 | .tuner_type = -1, | 1623 | .tuner_type = -1, |
1535 | .no_msp34xx = 1, | 1624 | .tuner_addr = ADDR_UNSET, |
1536 | .no_tda9875 = 1, | 1625 | .no_msp34xx = 1, |
1537 | .no_tda7432 = 1, | 1626 | .no_tda9875 = 1, |
1627 | .no_tda7432 = 1, | ||
1538 | },{ | 1628 | },{ |
1539 | .name = "Osprey 200/201/250/251", /* 0x1(8|9|E|F)-0004-C4 */ | 1629 | .name = "Osprey 200/201/250/251", /* 0x1(8|9|E|F)-0004-C4 */ |
1540 | .video_inputs = 1, | 1630 | .video_inputs = 1, |
@@ -1543,10 +1633,11 @@ struct tvcard bttv_tvcards[] = { | |||
1543 | .svhs = -1, | 1633 | .svhs = -1, |
1544 | .muxsel = { 0 }, | 1634 | .muxsel = { 0 }, |
1545 | .pll = PLL_28, | 1635 | .pll = PLL_28, |
1546 | .tuner_type = -1, | 1636 | .tuner_type = UNSET, |
1547 | .no_msp34xx = 1, | 1637 | .tuner_addr = ADDR_UNSET, |
1548 | .no_tda9875 = 1, | 1638 | .no_msp34xx = 1, |
1549 | .no_tda7432 = 1, | 1639 | .no_tda9875 = 1, |
1640 | .no_tda7432 = 1, | ||
1550 | },{ | 1641 | },{ |
1551 | 1642 | ||
1552 | /* ---- card 0x58 ---------------------------------- */ | 1643 | /* ---- card 0x58 ---------------------------------- */ |
@@ -1557,10 +1648,11 @@ struct tvcard bttv_tvcards[] = { | |||
1557 | .svhs = 1, | 1648 | .svhs = 1, |
1558 | .muxsel = { 0, 1 }, | 1649 | .muxsel = { 0, 1 }, |
1559 | .pll = PLL_28, | 1650 | .pll = PLL_28, |
1560 | .tuner_type = -1, | 1651 | .tuner_type = UNSET, |
1561 | .no_msp34xx = 1, | 1652 | .tuner_addr = ADDR_UNSET, |
1562 | .no_tda9875 = 1, | 1653 | .no_msp34xx = 1, |
1563 | .no_tda7432 = 1, | 1654 | .no_tda9875 = 1, |
1655 | .no_tda7432 = 1, | ||
1564 | },{ | 1656 | },{ |
1565 | .name = "Osprey 210/220", /* 0x1(A|B)-04C0-C1 */ | 1657 | .name = "Osprey 210/220", /* 0x1(A|B)-04C0-C1 */ |
1566 | .video_inputs = 2, | 1658 | .video_inputs = 2, |
@@ -1569,10 +1661,11 @@ struct tvcard bttv_tvcards[] = { | |||
1569 | .svhs = 1, | 1661 | .svhs = 1, |
1570 | .muxsel = { 2, 3 }, | 1662 | .muxsel = { 2, 3 }, |
1571 | .pll = PLL_28, | 1663 | .pll = PLL_28, |
1572 | .tuner_type = -1, | 1664 | .tuner_type = UNSET, |
1573 | .no_msp34xx = 1, | 1665 | .tuner_addr = ADDR_UNSET, |
1574 | .no_tda9875 = 1, | 1666 | .no_msp34xx = 1, |
1575 | .no_tda7432 = 1, | 1667 | .no_tda9875 = 1, |
1668 | .no_tda7432 = 1, | ||
1576 | },{ | 1669 | },{ |
1577 | .name = "Osprey 500", /* 500 */ | 1670 | .name = "Osprey 500", /* 500 */ |
1578 | .video_inputs = 2, | 1671 | .video_inputs = 2, |
@@ -1582,19 +1675,21 @@ struct tvcard bttv_tvcards[] = { | |||
1582 | .muxsel = { 2, 3 }, | 1675 | .muxsel = { 2, 3 }, |
1583 | .pll = PLL_28, | 1676 | .pll = PLL_28, |
1584 | .tuner_type = -1, | 1677 | .tuner_type = -1, |
1585 | .no_msp34xx = 1, | 1678 | .tuner_addr = ADDR_UNSET, |
1586 | .no_tda9875 = 1, | 1679 | .no_msp34xx = 1, |
1587 | .no_tda7432 = 1, | 1680 | .no_tda9875 = 1, |
1681 | .no_tda7432 = 1, | ||
1588 | },{ | 1682 | },{ |
1589 | .name = "Osprey 540", /* 540 */ | 1683 | .name = "Osprey 540", /* 540 */ |
1590 | .video_inputs = 4, | 1684 | .video_inputs = 4, |
1591 | .audio_inputs = 1, | 1685 | .audio_inputs = 1, |
1592 | .tuner = -1, | 1686 | .tuner = -1, |
1593 | .pll = PLL_28, | 1687 | .pll = PLL_28, |
1594 | .tuner_type = -1, | 1688 | .tuner_type = -1, |
1595 | .no_msp34xx = 1, | 1689 | .tuner_addr = ADDR_UNSET, |
1596 | .no_tda9875 = 1, | 1690 | .no_msp34xx = 1, |
1597 | .no_tda7432 = 1, | 1691 | .no_tda9875 = 1, |
1692 | .no_tda7432 = 1, | ||
1598 | },{ | 1693 | },{ |
1599 | 1694 | ||
1600 | /* ---- card 0x5C ---------------------------------- */ | 1695 | /* ---- card 0x5C ---------------------------------- */ |
@@ -1605,10 +1700,11 @@ struct tvcard bttv_tvcards[] = { | |||
1605 | .svhs = 1, | 1700 | .svhs = 1, |
1606 | .muxsel = { 2, 3 }, | 1701 | .muxsel = { 2, 3 }, |
1607 | .pll = PLL_28, | 1702 | .pll = PLL_28, |
1608 | .tuner_type = -1, | 1703 | .tuner_type = UNSET, |
1609 | .no_msp34xx = 1, | 1704 | .tuner_addr = ADDR_UNSET, |
1610 | .no_tda9875 = 1, | 1705 | .no_msp34xx = 1, |
1611 | .no_tda7432 = 1, /* must avoid, conflicts with the bt860 */ | 1706 | .no_tda9875 = 1, |
1707 | .no_tda7432 = 1, /* must avoid, conflicts with the bt860 */ | ||
1612 | },{ | 1708 | },{ |
1613 | /* M G Berberich <berberic@forwiss.uni-passau.de> */ | 1709 | /* M G Berberich <berberic@forwiss.uni-passau.de> */ |
1614 | .name = "IDS Eagle", | 1710 | .name = "IDS Eagle", |
@@ -1616,6 +1712,7 @@ struct tvcard bttv_tvcards[] = { | |||
1616 | .audio_inputs = 0, | 1712 | .audio_inputs = 0, |
1617 | .tuner = -1, | 1713 | .tuner = -1, |
1618 | .tuner_type = -1, | 1714 | .tuner_type = -1, |
1715 | .tuner_addr = ADDR_UNSET, | ||
1619 | .svhs = -1, | 1716 | .svhs = -1, |
1620 | .gpiomask = 0, | 1717 | .gpiomask = 0, |
1621 | .muxsel = { 0, 1, 2, 3 }, | 1718 | .muxsel = { 0, 1, 2, 3 }, |
@@ -1630,6 +1727,7 @@ struct tvcard bttv_tvcards[] = { | |||
1630 | .svhs = 1, | 1727 | .svhs = 1, |
1631 | .tuner = -1, | 1728 | .tuner = -1, |
1632 | .tuner_type = -1, | 1729 | .tuner_type = -1, |
1730 | .tuner_addr = ADDR_UNSET, | ||
1633 | .no_msp34xx = 1, | 1731 | .no_msp34xx = 1, |
1634 | .no_tda9875 = 1, | 1732 | .no_tda9875 = 1, |
1635 | .no_tda7432 = 1, | 1733 | .no_tda7432 = 1, |
@@ -1641,38 +1739,40 @@ struct tvcard bttv_tvcards[] = { | |||
1641 | .no_gpioirq = 1, | 1739 | .no_gpioirq = 1, |
1642 | .has_dvb = 1, | 1740 | .has_dvb = 1, |
1643 | },{ | 1741 | },{ |
1644 | .name = "Formac ProTV II (bt878)", | 1742 | .name = "Formac ProTV II (bt878)", |
1645 | .video_inputs = 4, | 1743 | .video_inputs = 4, |
1646 | .audio_inputs = 1, | 1744 | .audio_inputs = 1, |
1647 | .tuner = 0, | 1745 | .tuner = 0, |
1648 | .svhs = 3, | 1746 | .svhs = 3, |
1649 | .gpiomask = 2, | 1747 | .gpiomask = 2, |
1650 | // TV, Comp1, Composite over SVID con, SVID | 1748 | /* TV, Comp1, Composite over SVID con, SVID */ |
1651 | .muxsel = { 2, 3, 1, 1}, | 1749 | .muxsel = { 2, 3, 1, 1}, |
1652 | .audiomux = { 2, 2, 0, 0, 0 }, | 1750 | .audiomux = { 2, 2, 0, 0, 0 }, |
1653 | .pll = PLL_28, | 1751 | .pll = PLL_28, |
1654 | .has_radio = 1, | 1752 | .has_radio = 1, |
1655 | .tuner_type = TUNER_PHILIPS_PAL, | 1753 | .tuner_type = TUNER_PHILIPS_PAL, |
1656 | /* sound routing: | 1754 | .tuner_addr = ADDR_UNSET, |
1657 | GPIO=0x00,0x01,0x03: mute (?) | 1755 | /* sound routing: |
1658 | 0x02: both TV and radio (tuner: FM1216/I) | 1756 | GPIO=0x00,0x01,0x03: mute (?) |
1659 | The card has onboard audio connectors labeled "cdrom" and "board", | 1757 | 0x02: both TV and radio (tuner: FM1216/I) |
1660 | not soldered here, though unknown wiring. | 1758 | The card has onboard audio connectors labeled "cdrom" and "board", |
1661 | Card lacks: external audio in, pci subsystem id. | 1759 | not soldered here, though unknown wiring. |
1662 | */ | 1760 | Card lacks: external audio in, pci subsystem id. |
1761 | */ | ||
1663 | },{ | 1762 | },{ |
1664 | 1763 | ||
1665 | /* ---- card 0x60 ---------------------------------- */ | 1764 | /* ---- card 0x60 ---------------------------------- */ |
1666 | .name = "MachTV", | 1765 | .name = "MachTV", |
1667 | .video_inputs = 3, | 1766 | .video_inputs = 3, |
1668 | .audio_inputs = 1, | 1767 | .audio_inputs = 1, |
1669 | .tuner = 0, | 1768 | .tuner = 0, |
1670 | .svhs = -1, | 1769 | .svhs = -1, |
1671 | .gpiomask = 7, | 1770 | .gpiomask = 7, |
1672 | .muxsel = { 2, 3, 1, 1}, | 1771 | .muxsel = { 2, 3, 1, 1}, |
1673 | .audiomux = { 0, 1, 2, 3, 4}, | 1772 | .audiomux = { 0, 1, 2, 3, 4}, |
1674 | .needs_tvaudio = 1, | 1773 | .needs_tvaudio = 1, |
1675 | .tuner_type = 5, | 1774 | .tuner_type = 5, |
1775 | .tuner_addr = ADDR_UNSET, | ||
1676 | .pll = 1, | 1776 | .pll = 1, |
1677 | },{ | 1777 | },{ |
1678 | .name = "Euresys Picolo", | 1778 | .name = "Euresys Picolo", |
@@ -1686,6 +1786,8 @@ struct tvcard bttv_tvcards[] = { | |||
1686 | .no_tda7432 = 1, | 1786 | .no_tda7432 = 1, |
1687 | .muxsel = { 2, 0, 1}, | 1787 | .muxsel = { 2, 0, 1}, |
1688 | .pll = PLL_28, | 1788 | .pll = PLL_28, |
1789 | .tuner_type = UNSET, | ||
1790 | .tuner_addr = ADDR_UNSET, | ||
1689 | },{ | 1791 | },{ |
1690 | /* Luc Van Hoeylandt <luc@e-magic.be> */ | 1792 | /* Luc Van Hoeylandt <luc@e-magic.be> */ |
1691 | .name = "ProVideo PV150", /* 0x4f */ | 1793 | .name = "ProVideo PV150", /* 0x4f */ |
@@ -1699,7 +1801,8 @@ struct tvcard bttv_tvcards[] = { | |||
1699 | .needs_tvaudio = 0, | 1801 | .needs_tvaudio = 0, |
1700 | .no_msp34xx = 1, | 1802 | .no_msp34xx = 1, |
1701 | .pll = PLL_28, | 1803 | .pll = PLL_28, |
1702 | .tuner_type = -1, | 1804 | .tuner_type = UNSET, |
1805 | .tuner_addr = ADDR_UNSET, | ||
1703 | },{ | 1806 | },{ |
1704 | /* Hiroshi Takekawa <sian@big.or.jp> */ | 1807 | /* Hiroshi Takekawa <sian@big.or.jp> */ |
1705 | /* This card lacks subsystem ID */ | 1808 | /* This card lacks subsystem ID */ |
@@ -1716,78 +1819,85 @@ struct tvcard bttv_tvcards[] = { | |||
1716 | .no_msp34xx = 1, | 1819 | .no_msp34xx = 1, |
1717 | .pll = PLL_28, | 1820 | .pll = PLL_28, |
1718 | .tuner_type = 2, | 1821 | .tuner_type = 2, |
1822 | .tuner_addr = ADDR_UNSET, | ||
1719 | .audio_hook = adtvk503_audio, | 1823 | .audio_hook = adtvk503_audio, |
1720 | },{ | 1824 | },{ |
1721 | 1825 | ||
1722 | /* ---- card 0x64 ---------------------------------- */ | 1826 | /* ---- card 0x64 ---------------------------------- */ |
1723 | .name = "Hercules Smart TV Stereo", | 1827 | .name = "Hercules Smart TV Stereo", |
1724 | .video_inputs = 4, | 1828 | .video_inputs = 4, |
1725 | .audio_inputs = 1, | 1829 | .audio_inputs = 1, |
1726 | .tuner = 0, | 1830 | .tuner = 0, |
1727 | .svhs = 2, | 1831 | .svhs = 2, |
1728 | .gpiomask = 0x00, | 1832 | .gpiomask = 0x00, |
1729 | .muxsel = { 2, 3, 1, 1 }, | 1833 | .muxsel = { 2, 3, 1, 1 }, |
1730 | .needs_tvaudio = 1, | 1834 | .needs_tvaudio = 1, |
1731 | .no_msp34xx = 1, | 1835 | .no_msp34xx = 1, |
1732 | .pll = PLL_28, | 1836 | .pll = PLL_28, |
1733 | .tuner_type = 5, | 1837 | .tuner_type = 5, |
1838 | .tuner_addr = ADDR_UNSET, | ||
1734 | /* Notes: | 1839 | /* Notes: |
1735 | - card lacks subsystem ID | 1840 | - card lacks subsystem ID |
1736 | - stereo variant w/ daughter board with tda9874a @0xb0 | 1841 | - stereo variant w/ daughter board with tda9874a @0xb0 |
1737 | - Audio Routing: | 1842 | - Audio Routing: |
1738 | always from tda9874 independent of GPIO (?) | 1843 | always from tda9874 independent of GPIO (?) |
1739 | external line in: unknown | 1844 | external line in: unknown |
1740 | - Other chips: em78p156elp @ 0x96 (probably IR remote control) | 1845 | - Other chips: em78p156elp @ 0x96 (probably IR remote control) |
1741 | hef4053 (instead 4052) for unknown function | 1846 | hef4053 (instead 4052) for unknown function |
1847 | */ | ||
1848 | },{ | ||
1849 | .name = "Pace TV & Radio Card", | ||
1850 | .video_inputs = 4, | ||
1851 | .audio_inputs = 1, | ||
1852 | .tuner = 0, | ||
1853 | .svhs = 2, | ||
1854 | .muxsel = { 2, 3, 1, 1}, /* Tuner, CVid, SVid, CVid over SVid connector */ | ||
1855 | .gpiomask = 0, | ||
1856 | .no_tda9875 = 1, | ||
1857 | .no_tda7432 = 1, | ||
1858 | .tuner_type = 1, | ||
1859 | .tuner_addr = ADDR_UNSET, | ||
1860 | .has_radio = 1, | ||
1861 | .pll = PLL_28, | ||
1862 | /* Bt878, Bt832, FI1246 tuner; no pci subsystem id | ||
1863 | only internal line out: (4pin header) RGGL | ||
1864 | Radio must be decoded by msp3410d (not routed through)*/ | ||
1865 | /* | ||
1866 | .digital_mode = DIGITAL_MODE_CAMERA, todo! | ||
1742 | */ | 1867 | */ |
1743 | },{ | 1868 | },{ |
1744 | .name = "Pace TV & Radio Card", | 1869 | /* Chris Willing <chris@vislab.usyd.edu.au> */ |
1745 | .video_inputs = 4, | 1870 | .name = "IVC-200", |
1746 | .audio_inputs = 1, | 1871 | .video_inputs = 1, |
1747 | .tuner = 0, | 1872 | .audio_inputs = 0, |
1748 | .svhs = 2, | 1873 | .tuner = -1, |
1749 | .muxsel = { 2, 3, 1, 1}, // Tuner, CVid, SVid, CVid over SVid connector | 1874 | .tuner_type = -1, |
1750 | .gpiomask = 0, | 1875 | .tuner_addr = ADDR_UNSET, |
1751 | .no_tda9875 = 1, | 1876 | .svhs = -1, |
1752 | .no_tda7432 = 1, | 1877 | .gpiomask = 0xdf, |
1753 | .tuner_type = 1, | 1878 | .muxsel = { 2 }, |
1754 | .has_radio = 1, | 1879 | .pll = PLL_28, |
1755 | .pll = PLL_28, | ||
1756 | /* Bt878, Bt832, FI1246 tuner; no pci subsystem id | ||
1757 | only internal line out: (4pin header) RGGL | ||
1758 | Radio must be decoded by msp3410d (not routed through)*/ | ||
1759 | // .digital_mode = DIGITAL_MODE_CAMERA, // todo! | ||
1760 | },{ | ||
1761 | /* Chris Willing <chris@vislab.usyd.edu.au> */ | ||
1762 | .name = "IVC-200", | ||
1763 | .video_inputs = 1, | ||
1764 | .audio_inputs = 0, | ||
1765 | .tuner = -1, | ||
1766 | .tuner_type = -1, | ||
1767 | .svhs = -1, | ||
1768 | .gpiomask = 0xdf, | ||
1769 | .muxsel = { 2 }, | ||
1770 | .pll = PLL_28, | ||
1771 | },{ | 1880 | },{ |
1772 | .name = "Grand X-Guard / Trust 814PCI", | 1881 | .name = "Grand X-Guard / Trust 814PCI", |
1773 | .video_inputs = 16, | 1882 | .video_inputs = 16, |
1774 | .audio_inputs = 0, | 1883 | .audio_inputs = 0, |
1775 | .tuner = -1, | 1884 | .tuner = -1, |
1776 | .svhs = -1, | 1885 | .svhs = -1, |
1777 | .tuner_type = 4, | 1886 | .tuner_type = 4, |
1778 | .gpiomask2 = 0xff, | 1887 | .tuner_addr = ADDR_UNSET, |
1888 | .gpiomask2 = 0xff, | ||
1779 | .muxsel = { 2,2,2,2, 3,3,3,3, 1,1,1,1, 0,0,0,0 }, | 1889 | .muxsel = { 2,2,2,2, 3,3,3,3, 1,1,1,1, 0,0,0,0 }, |
1780 | .muxsel_hook = xguard_muxsel, | 1890 | .muxsel_hook = xguard_muxsel, |
1781 | .no_msp34xx = 1, | 1891 | .no_msp34xx = 1, |
1782 | .no_tda9875 = 1, | 1892 | .no_tda9875 = 1, |
1783 | .no_tda7432 = 1, | 1893 | .no_tda7432 = 1, |
1784 | .pll = PLL_28, | 1894 | .pll = PLL_28, |
1785 | },{ | 1895 | },{ |
1786 | 1896 | ||
1787 | /* ---- card 0x68 ---------------------------------- */ | 1897 | /* ---- card 0x68 ---------------------------------- */ |
1788 | .name = "Nebula Electronics DigiTV", | 1898 | .name = "Nebula Electronics DigiTV", |
1789 | .video_inputs = 1, | 1899 | .video_inputs = 1, |
1790 | .tuner = -1, | 1900 | .tuner = -1, |
1791 | .svhs = -1, | 1901 | .svhs = -1, |
1792 | .muxsel = { 2, 3, 1, 0}, | 1902 | .muxsel = { 2, 3, 1, 0}, |
1793 | .no_msp34xx = 1, | 1903 | .no_msp34xx = 1, |
@@ -1795,22 +1905,24 @@ struct tvcard bttv_tvcards[] = { | |||
1795 | .no_tda7432 = 1, | 1905 | .no_tda7432 = 1, |
1796 | .pll = PLL_28, | 1906 | .pll = PLL_28, |
1797 | .tuner_type = -1, | 1907 | .tuner_type = -1, |
1908 | .tuner_addr = ADDR_UNSET, | ||
1798 | .has_dvb = 1, | 1909 | .has_dvb = 1, |
1799 | .no_gpioirq = 1, | 1910 | .no_gpioirq = 1, |
1800 | },{ | 1911 | },{ |
1801 | /* Jorge Boncompte - DTI2 <jorge@dti2.net> */ | 1912 | /* Jorge Boncompte - DTI2 <jorge@dti2.net> */ |
1802 | .name = "ProVideo PV143", | 1913 | .name = "ProVideo PV143", |
1803 | .video_inputs = 4, | 1914 | .video_inputs = 4, |
1804 | .audio_inputs = 0, | 1915 | .audio_inputs = 0, |
1805 | .tuner = -1, | 1916 | .tuner = -1, |
1806 | .svhs = -1, | 1917 | .svhs = -1, |
1807 | .gpiomask = 0, | 1918 | .gpiomask = 0, |
1808 | .muxsel = { 2, 3, 1, 0 }, | 1919 | .muxsel = { 2, 3, 1, 0 }, |
1809 | .audiomux = { 0 }, | 1920 | .audiomux = { 0 }, |
1810 | .needs_tvaudio = 0, | 1921 | .needs_tvaudio = 0, |
1811 | .no_msp34xx = 1, | 1922 | .no_msp34xx = 1, |
1812 | .pll = PLL_28, | 1923 | .pll = PLL_28, |
1813 | .tuner_type = -1, | 1924 | .tuner_type = -1, |
1925 | .tuner_addr = ADDR_UNSET, | ||
1814 | },{ | 1926 | },{ |
1815 | /* M.Klahr@phytec.de */ | 1927 | /* M.Klahr@phytec.de */ |
1816 | .name = "PHYTEC VD-009-X1 MiniDIN (bt878)", | 1928 | .name = "PHYTEC VD-009-X1 MiniDIN (bt878)", |
@@ -1824,6 +1936,7 @@ struct tvcard bttv_tvcards[] = { | |||
1824 | .needs_tvaudio = 1, | 1936 | .needs_tvaudio = 1, |
1825 | .pll = PLL_28, | 1937 | .pll = PLL_28, |
1826 | .tuner_type = -1, | 1938 | .tuner_type = -1, |
1939 | .tuner_addr = ADDR_UNSET, | ||
1827 | },{ | 1940 | },{ |
1828 | .name = "PHYTEC VD-009-X1 Combi (bt878)", | 1941 | .name = "PHYTEC VD-009-X1 Combi (bt878)", |
1829 | .video_inputs = 4, | 1942 | .video_inputs = 4, |
@@ -1836,6 +1949,7 @@ struct tvcard bttv_tvcards[] = { | |||
1836 | .needs_tvaudio = 1, | 1949 | .needs_tvaudio = 1, |
1837 | .pll = PLL_28, | 1950 | .pll = PLL_28, |
1838 | .tuner_type = -1, | 1951 | .tuner_type = -1, |
1952 | .tuner_addr = ADDR_UNSET, | ||
1839 | },{ | 1953 | },{ |
1840 | 1954 | ||
1841 | /* ---- card 0x6c ---------------------------------- */ | 1955 | /* ---- card 0x6c ---------------------------------- */ |
@@ -1846,13 +1960,14 @@ struct tvcard bttv_tvcards[] = { | |||
1846 | .svhs = 9, | 1960 | .svhs = 9, |
1847 | .gpiomask = 0x00, | 1961 | .gpiomask = 0x00, |
1848 | .gpiomask2 = 0x03, /* gpiomask2 defines the bits used to switch audio | 1962 | .gpiomask2 = 0x03, /* gpiomask2 defines the bits used to switch audio |
1849 | via the upper nibble of muxsel. here: used for | 1963 | via the upper nibble of muxsel. here: used for |
1850 | xternal video-mux */ | 1964 | xternal video-mux */ |
1851 | .muxsel = { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x00 }, | 1965 | .muxsel = { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x00 }, |
1852 | .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */ | 1966 | .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */ |
1853 | .needs_tvaudio = 1, | 1967 | .needs_tvaudio = 1, |
1854 | .pll = PLL_28, | 1968 | .pll = PLL_28, |
1855 | .tuner_type = -1, | 1969 | .tuner_type = -1, |
1970 | .tuner_addr = ADDR_UNSET, | ||
1856 | },{ | 1971 | },{ |
1857 | .name = "PHYTEC VD-009 Combi (bt878)", | 1972 | .name = "PHYTEC VD-009 Combi (bt878)", |
1858 | .video_inputs = 10, | 1973 | .video_inputs = 10, |
@@ -1861,23 +1976,25 @@ struct tvcard bttv_tvcards[] = { | |||
1861 | .svhs = 9, | 1976 | .svhs = 9, |
1862 | .gpiomask = 0x00, | 1977 | .gpiomask = 0x00, |
1863 | .gpiomask2 = 0x03, /* gpiomask2 defines the bits used to switch audio | 1978 | .gpiomask2 = 0x03, /* gpiomask2 defines the bits used to switch audio |
1864 | via the upper nibble of muxsel. here: used for | 1979 | via the upper nibble of muxsel. here: used for |
1865 | xternal video-mux */ | 1980 | xternal video-mux */ |
1866 | .muxsel = { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x01 }, | 1981 | .muxsel = { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x01 }, |
1867 | .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */ | 1982 | .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */ |
1868 | .needs_tvaudio = 1, | 1983 | .needs_tvaudio = 1, |
1869 | .pll = PLL_28, | 1984 | .pll = PLL_28, |
1870 | .tuner_type = -1, | 1985 | .tuner_type = -1, |
1986 | .tuner_addr = ADDR_UNSET, | ||
1871 | },{ | 1987 | },{ |
1872 | .name = "IVC-100", | 1988 | .name = "IVC-100", |
1873 | .video_inputs = 4, | 1989 | .video_inputs = 4, |
1874 | .audio_inputs = 0, | 1990 | .audio_inputs = 0, |
1875 | .tuner = -1, | 1991 | .tuner = -1, |
1876 | .tuner_type = -1, | 1992 | .tuner_type = -1, |
1877 | .svhs = -1, | 1993 | .tuner_addr = ADDR_UNSET, |
1878 | .gpiomask = 0xdf, | 1994 | .svhs = -1, |
1879 | .muxsel = { 2, 3, 1, 0 }, | 1995 | .gpiomask = 0xdf, |
1880 | .pll = PLL_28, | 1996 | .muxsel = { 2, 3, 1, 0 }, |
1997 | .pll = PLL_28, | ||
1881 | },{ | 1998 | },{ |
1882 | /* IVC-120G - Alan Garfield <alan@fromorbit.com> */ | 1999 | /* IVC-120G - Alan Garfield <alan@fromorbit.com> */ |
1883 | .name = "IVC-120G", | 2000 | .name = "IVC-120G", |
@@ -1885,6 +2002,7 @@ struct tvcard bttv_tvcards[] = { | |||
1885 | .audio_inputs = 0, /* card has no audio */ | 2002 | .audio_inputs = 0, /* card has no audio */ |
1886 | .tuner = -1, /* card has no tuner */ | 2003 | .tuner = -1, /* card has no tuner */ |
1887 | .tuner_type = -1, | 2004 | .tuner_type = -1, |
2005 | .tuner_addr = ADDR_UNSET, | ||
1888 | .svhs = -1, /* card has no svhs */ | 2006 | .svhs = -1, /* card has no svhs */ |
1889 | .needs_tvaudio = 0, | 2007 | .needs_tvaudio = 0, |
1890 | .no_msp34xx = 1, | 2008 | .no_msp34xx = 1, |
@@ -1892,7 +2010,7 @@ struct tvcard bttv_tvcards[] = { | |||
1892 | .no_tda7432 = 1, | 2010 | .no_tda7432 = 1, |
1893 | .gpiomask = 0x00, | 2011 | .gpiomask = 0x00, |
1894 | .muxsel = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, | 2012 | .muxsel = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, |
1895 | 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10 }, | 2013 | 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10 }, |
1896 | .muxsel_hook = ivc120_muxsel, | 2014 | .muxsel_hook = ivc120_muxsel, |
1897 | .pll = PLL_28, | 2015 | .pll = PLL_28, |
1898 | },{ | 2016 | },{ |
@@ -1905,6 +2023,7 @@ struct tvcard bttv_tvcards[] = { | |||
1905 | .svhs = 2, | 2023 | .svhs = 2, |
1906 | .muxsel = { 2, 3, 1, 0}, | 2024 | .muxsel = { 2, 3, 1, 0}, |
1907 | .tuner_type = TUNER_PHILIPS_ATSC, | 2025 | .tuner_type = TUNER_PHILIPS_ATSC, |
2026 | .tuner_addr = ADDR_UNSET, | ||
1908 | .has_dvb = 1, | 2027 | .has_dvb = 1, |
1909 | },{ | 2028 | },{ |
1910 | .name = "Twinhan DST + clones", | 2029 | .name = "Twinhan DST + clones", |
@@ -1912,19 +2031,21 @@ struct tvcard bttv_tvcards[] = { | |||
1912 | .no_tda9875 = 1, | 2031 | .no_tda9875 = 1, |
1913 | .no_tda7432 = 1, | 2032 | .no_tda7432 = 1, |
1914 | .tuner_type = TUNER_ABSENT, | 2033 | .tuner_type = TUNER_ABSENT, |
2034 | .tuner_addr = ADDR_UNSET, | ||
1915 | .no_video = 1, | 2035 | .no_video = 1, |
1916 | .has_dvb = 1, | 2036 | .has_dvb = 1, |
1917 | },{ | 2037 | },{ |
1918 | .name = "Winfast VC100", | 2038 | .name = "Winfast VC100", |
1919 | .video_inputs = 3, | 2039 | .video_inputs = 3, |
1920 | .audio_inputs = 0, | 2040 | .audio_inputs = 0, |
1921 | .svhs = 1, | 2041 | .svhs = 1, |
1922 | .tuner = -1, // no tuner | 2042 | .tuner = -1, |
1923 | .muxsel = { 3, 1, 1, 3}, // Vid In, SVid In, Vid over SVid in connector | 2043 | .muxsel = { 3, 1, 1, 3}, /* Vid In, SVid In, Vid over SVid in connector */ |
1924 | .no_msp34xx = 1, | 2044 | .no_msp34xx = 1, |
1925 | .no_tda9875 = 1, | 2045 | .no_tda9875 = 1, |
1926 | .no_tda7432 = 1, | 2046 | .no_tda7432 = 1, |
1927 | .tuner_type = TUNER_ABSENT, | 2047 | .tuner_type = TUNER_ABSENT, |
2048 | .tuner_addr = ADDR_UNSET, | ||
1928 | .pll = PLL_28, | 2049 | .pll = PLL_28, |
1929 | },{ | 2050 | },{ |
1930 | .name = "Teppro TEV-560/InterVision IV-560", | 2051 | .name = "Teppro TEV-560/InterVision IV-560", |
@@ -1937,44 +2058,49 @@ struct tvcard bttv_tvcards[] = { | |||
1937 | .audiomux = { 1, 1, 1, 1, 0}, | 2058 | .audiomux = { 1, 1, 1, 1, 0}, |
1938 | .needs_tvaudio = 1, | 2059 | .needs_tvaudio = 1, |
1939 | .tuner_type = TUNER_PHILIPS_PAL, | 2060 | .tuner_type = TUNER_PHILIPS_PAL, |
2061 | .tuner_addr = ADDR_UNSET, | ||
1940 | .pll = PLL_35, | 2062 | .pll = PLL_35, |
1941 | },{ | 2063 | },{ |
1942 | 2064 | ||
1943 | /* ---- card 0x74 ---------------------------------- */ | 2065 | /* ---- card 0x74 ---------------------------------- */ |
1944 | .name = "SIMUS GVC1100", | 2066 | .name = "SIMUS GVC1100", |
1945 | .video_inputs = 4, | 2067 | .video_inputs = 4, |
1946 | .audio_inputs = 0, | 2068 | .audio_inputs = 0, |
1947 | .tuner = -1, | 2069 | .tuner = -1, |
1948 | .svhs = -1, | 2070 | .svhs = -1, |
1949 | .tuner_type = -1, | 2071 | .tuner_type = -1, |
1950 | .pll = PLL_28, | 2072 | .tuner_addr = ADDR_UNSET, |
1951 | .muxsel = { 2, 2, 2, 2}, | 2073 | .pll = PLL_28, |
1952 | .gpiomask = 0x3F, | 2074 | .muxsel = { 2, 2, 2, 2}, |
2075 | .gpiomask = 0x3F, | ||
1953 | .muxsel_hook = gvc1100_muxsel, | 2076 | .muxsel_hook = gvc1100_muxsel, |
1954 | },{ | 2077 | },{ |
1955 | /* Carlos Silva r3pek@r3pek.homelinux.org || card 0x75 */ | 2078 | /* Carlos Silva r3pek@r3pek.homelinux.org || card 0x75 */ |
1956 | .name = "NGS NGSTV+", | 2079 | .name = "NGS NGSTV+", |
1957 | .video_inputs = 3, | 2080 | .video_inputs = 3, |
1958 | .tuner = 0, | 2081 | .tuner = 0, |
1959 | .svhs = 2, | 2082 | .svhs = 2, |
1960 | .gpiomask = 0x008007, | 2083 | .gpiomask = 0x008007, |
1961 | .muxsel = {2, 3, 0, 0}, | 2084 | .muxsel = {2, 3, 0, 0}, |
1962 | .audiomux = {0, 0, 0, 0, 0x000003, 0}, | 2085 | .audiomux = {0, 0, 0, 0, 0x000003, 0}, |
1963 | .pll = PLL_28, | 2086 | .pll = PLL_28, |
1964 | .tuner_type = TUNER_PHILIPS_PAL, | 2087 | .tuner_type = TUNER_PHILIPS_PAL, |
1965 | .has_remote = 1, | 2088 | .tuner_addr = ADDR_UNSET, |
1966 | },{ | 2089 | .has_remote = 1, |
1967 | /* http://linuxmedialabs.com */ | 2090 | },{ |
1968 | .name = "LMLBT4", | 2091 | /* http://linuxmedialabs.com */ |
1969 | .video_inputs = 4, /* IN1,IN2,IN3,IN4 */ | 2092 | .name = "LMLBT4", |
1970 | .audio_inputs = 0, | 2093 | .video_inputs = 4, /* IN1,IN2,IN3,IN4 */ |
1971 | .tuner = -1, | 2094 | .audio_inputs = 0, |
1972 | .svhs = -1, | 2095 | .tuner = -1, |
1973 | .muxsel = { 2, 3, 1, 0 }, | 2096 | .svhs = -1, |
1974 | .no_msp34xx = 1, | 2097 | .muxsel = { 2, 3, 1, 0 }, |
1975 | .no_tda9875 = 1, | 2098 | .no_msp34xx = 1, |
1976 | .no_tda7432 = 1, | 2099 | .no_tda9875 = 1, |
1977 | .needs_tvaudio = 0, | 2100 | .no_tda7432 = 1, |
2101 | .needs_tvaudio = 0, | ||
2102 | .tuner_type = -1, | ||
2103 | .tuner_addr = ADDR_UNSET, | ||
1978 | },{ | 2104 | },{ |
1979 | /* Helmroos Harri <harri.helmroos@pp.inet.fi> */ | 2105 | /* Helmroos Harri <harri.helmroos@pp.inet.fi> */ |
1980 | .name = "Tekram M205 PRO", | 2106 | .name = "Tekram M205 PRO", |
@@ -1982,6 +2108,7 @@ struct tvcard bttv_tvcards[] = { | |||
1982 | .audio_inputs = 1, | 2108 | .audio_inputs = 1, |
1983 | .tuner = 0, | 2109 | .tuner = 0, |
1984 | .tuner_type = TUNER_PHILIPS_PAL, | 2110 | .tuner_type = TUNER_PHILIPS_PAL, |
2111 | .tuner_addr = ADDR_UNSET, | ||
1985 | .svhs = 2, | 2112 | .svhs = 2, |
1986 | .needs_tvaudio = 0, | 2113 | .needs_tvaudio = 0, |
1987 | .gpiomask = 0x68, | 2114 | .gpiomask = 0x68, |
@@ -2004,6 +2131,7 @@ struct tvcard bttv_tvcards[] = { | |||
2004 | .needs_tvaudio = 0, | 2131 | .needs_tvaudio = 0, |
2005 | .pll = PLL_28, | 2132 | .pll = PLL_28, |
2006 | .tuner_type = TUNER_PHILIPS_PAL, | 2133 | .tuner_type = TUNER_PHILIPS_PAL, |
2134 | .tuner_addr = ADDR_UNSET, | ||
2007 | .has_remote = 1, | 2135 | .has_remote = 1, |
2008 | .has_radio = 1, | 2136 | .has_radio = 1, |
2009 | },{ | 2137 | },{ |
@@ -2026,6 +2154,8 @@ struct tvcard bttv_tvcards[] = { | |||
2026 | .pll = PLL_28, | 2154 | .pll = PLL_28, |
2027 | .needs_tvaudio = 0, | 2155 | .needs_tvaudio = 0, |
2028 | .muxsel_hook = picolo_tetra_muxsel,/*Required as it doesn't follow the classic input selection policy*/ | 2156 | .muxsel_hook = picolo_tetra_muxsel,/*Required as it doesn't follow the classic input selection policy*/ |
2157 | .tuner_type = -1, | ||
2158 | .tuner_addr = ADDR_UNSET, | ||
2029 | },{ | 2159 | },{ |
2030 | /* Spirit TV Tuner from http://spiritmodems.com.au */ | 2160 | /* Spirit TV Tuner from http://spiritmodems.com.au */ |
2031 | /* Stafford Goodsell <surge@goliath.homeunix.org> */ | 2161 | /* Stafford Goodsell <surge@goliath.homeunix.org> */ |
@@ -2038,23 +2168,25 @@ struct tvcard bttv_tvcards[] = { | |||
2038 | .muxsel = { 2, 1, 1 }, | 2168 | .muxsel = { 2, 1, 1 }, |
2039 | .audiomux = { 0x02, 0x00, 0x00, 0x00, 0x00}, | 2169 | .audiomux = { 0x02, 0x00, 0x00, 0x00, 0x00}, |
2040 | .tuner_type = TUNER_TEMIC_PAL, | 2170 | .tuner_type = TUNER_TEMIC_PAL, |
2171 | .tuner_addr = ADDR_UNSET, | ||
2041 | .no_msp34xx = 1, | 2172 | .no_msp34xx = 1, |
2042 | .no_tda9875 = 1, | 2173 | .no_tda9875 = 1, |
2043 | },{ | 2174 | },{ |
2044 | /* Wolfram Joost <wojo@frokaschwei.de> */ | 2175 | /* Wolfram Joost <wojo@frokaschwei.de> */ |
2045 | .name = "AVerMedia AVerTV DVB-T 771", | 2176 | .name = "AVerMedia AVerTV DVB-T 771", |
2046 | .video_inputs = 2, | 2177 | .video_inputs = 2, |
2047 | .svhs = 1, | 2178 | .svhs = 1, |
2048 | .tuner = -1, | 2179 | .tuner = -1, |
2049 | .tuner_type = TUNER_ABSENT, | 2180 | .tuner_type = TUNER_ABSENT, |
2050 | .muxsel = { 3 , 3 }, | 2181 | .tuner_addr = ADDR_UNSET, |
2051 | .no_msp34xx = 1, | 2182 | .muxsel = { 3 , 3 }, |
2052 | .no_tda9875 = 1, | 2183 | .no_msp34xx = 1, |
2053 | .no_tda7432 = 1, | 2184 | .no_tda9875 = 1, |
2054 | .pll = PLL_28, | 2185 | .no_tda7432 = 1, |
2055 | .has_dvb = 1, | 2186 | .pll = PLL_28, |
2056 | .no_gpioirq = 1, | 2187 | .has_dvb = 1, |
2057 | .has_remote = 1, | 2188 | .no_gpioirq = 1, |
2189 | .has_remote = 1, | ||
2058 | },{ | 2190 | },{ |
2059 | /* ---- card 0x7c ---------------------------------- */ | 2191 | /* ---- card 0x7c ---------------------------------- */ |
2060 | /* Matt Jesson <dvb@jesson.eclipse.co.uk> */ | 2192 | /* Matt Jesson <dvb@jesson.eclipse.co.uk> */ |
@@ -2069,6 +2201,7 @@ struct tvcard bttv_tvcards[] = { | |||
2069 | .no_tda7432 = 1, | 2201 | .no_tda7432 = 1, |
2070 | .pll = PLL_28, | 2202 | .pll = PLL_28, |
2071 | .tuner_type = -1, | 2203 | .tuner_type = -1, |
2204 | .tuner_addr = ADDR_UNSET, | ||
2072 | .has_dvb = 1, | 2205 | .has_dvb = 1, |
2073 | .no_gpioirq = 1, | 2206 | .no_gpioirq = 1, |
2074 | .has_remote = 1, | 2207 | .has_remote = 1, |
@@ -2081,12 +2214,13 @@ struct tvcard bttv_tvcards[] = { | |||
2081 | .svhs = -1, | 2214 | .svhs = -1, |
2082 | .gpiomask = 0x0, | 2215 | .gpiomask = 0x0, |
2083 | .muxsel = { 2, 2, 2, 2, 2, 2, 2, 2, | 2216 | .muxsel = { 2, 2, 2, 2, 2, 2, 2, 2, |
2084 | 3, 3, 3, 3, 3, 3, 3, 3 }, | 2217 | 3, 3, 3, 3, 3, 3, 3, 3 }, |
2085 | .muxsel_hook = sigmaSQ_muxsel, | 2218 | .muxsel_hook = sigmaSQ_muxsel, |
2086 | .audiomux = { 0 }, | 2219 | .audiomux = { 0 }, |
2087 | .no_msp34xx = 1, | 2220 | .no_msp34xx = 1, |
2088 | .pll = PLL_28, | 2221 | .pll = PLL_28, |
2089 | .tuner_type = -1, | 2222 | .tuner_type = -1, |
2223 | .tuner_addr = ADDR_UNSET, | ||
2090 | },{ | 2224 | },{ |
2091 | /* andre.schwarz@matrix-vision.de */ | 2225 | /* andre.schwarz@matrix-vision.de */ |
2092 | .name = "MATRIX Vision Sigma-SLC", | 2226 | .name = "MATRIX Vision Sigma-SLC", |
@@ -2101,6 +2235,7 @@ struct tvcard bttv_tvcards[] = { | |||
2101 | .no_msp34xx = 1, | 2235 | .no_msp34xx = 1, |
2102 | .pll = PLL_28, | 2236 | .pll = PLL_28, |
2103 | .tuner_type = -1, | 2237 | .tuner_type = -1, |
2238 | .tuner_addr = ADDR_UNSET, | ||
2104 | },{ | 2239 | },{ |
2105 | /* BTTV_APAC_VIEWCOMP */ | 2240 | /* BTTV_APAC_VIEWCOMP */ |
2106 | /* Attila Kondoros <attila.kondoros@chello.hu> */ | 2241 | /* Attila Kondoros <attila.kondoros@chello.hu> */ |
@@ -2116,13 +2251,14 @@ struct tvcard bttv_tvcards[] = { | |||
2116 | .needs_tvaudio = 0, | 2251 | .needs_tvaudio = 0, |
2117 | .pll = PLL_28, | 2252 | .pll = PLL_28, |
2118 | .tuner_type = TUNER_PHILIPS_PAL, | 2253 | .tuner_type = TUNER_PHILIPS_PAL, |
2254 | .tuner_addr = ADDR_UNSET, | ||
2119 | .has_remote = 1, /* miniremote works, see ir-kbd-gpio.c */ | 2255 | .has_remote = 1, /* miniremote works, see ir-kbd-gpio.c */ |
2120 | .has_radio = 1, /* not every card has radio */ | 2256 | .has_radio = 1, /* not every card has radio */ |
2121 | },{ | 2257 | },{ |
2122 | 2258 | ||
2123 | /* ---- card 0x80 ---------------------------------- */ | 2259 | /* ---- card 0x80 ---------------------------------- */ |
2124 | /* Chris Pascoe <c.pascoe@itee.uq.edu.au> */ | 2260 | /* Chris Pascoe <c.pascoe@itee.uq.edu.au> */ |
2125 | .name = "DVICO FusionHDTV DVB-T Lite", | 2261 | .name = "DViCO FusionHDTV DVB-T Lite", |
2126 | .tuner = -1, | 2262 | .tuner = -1, |
2127 | .no_msp34xx = 1, | 2263 | .no_msp34xx = 1, |
2128 | .no_tda9875 = 1, | 2264 | .no_tda9875 = 1, |
@@ -2131,6 +2267,7 @@ struct tvcard bttv_tvcards[] = { | |||
2131 | .no_video = 1, | 2267 | .no_video = 1, |
2132 | .has_dvb = 1, | 2268 | .has_dvb = 1, |
2133 | .tuner_type = -1, | 2269 | .tuner_type = -1, |
2270 | .tuner_addr = ADDR_UNSET, | ||
2134 | },{ | 2271 | },{ |
2135 | /* Steven <photon38@pchome.com.tw> */ | 2272 | /* Steven <photon38@pchome.com.tw> */ |
2136 | .name = "V-Gear MyVCD", | 2273 | .name = "V-Gear MyVCD", |
@@ -2144,62 +2281,65 @@ struct tvcard bttv_tvcards[] = { | |||
2144 | .no_msp34xx = 1, | 2281 | .no_msp34xx = 1, |
2145 | .pll = PLL_28, | 2282 | .pll = PLL_28, |
2146 | .tuner_type = TUNER_PHILIPS_NTSC_M, | 2283 | .tuner_type = TUNER_PHILIPS_NTSC_M, |
2284 | .tuner_addr = ADDR_UNSET, | ||
2147 | .has_radio = 0, | 2285 | .has_radio = 0, |
2148 | // .has_remote = 1, | ||
2149 | },{ | 2286 | },{ |
2150 | /* Rick C <cryptdragoon@gmail.com> */ | 2287 | /* Rick C <cryptdragoon@gmail.com> */ |
2151 | .name = "Super TV Tuner", | 2288 | .name = "Super TV Tuner", |
2152 | .video_inputs = 4, | 2289 | .video_inputs = 4, |
2153 | .audio_inputs = 1, | 2290 | .audio_inputs = 1, |
2154 | .tuner = 0, | 2291 | .tuner = 0, |
2155 | .svhs = 2, | 2292 | .svhs = 2, |
2156 | .muxsel = { 2, 3, 1, 0}, | 2293 | .muxsel = { 2, 3, 1, 0}, |
2157 | .tuner_type = TUNER_PHILIPS_NTSC, | 2294 | .tuner_type = TUNER_PHILIPS_NTSC, |
2158 | .gpiomask = 0x008007, | 2295 | .tuner_addr = ADDR_UNSET, |
2159 | .audiomux = { 0, 0x000001,0,0, 0}, | 2296 | .gpiomask = 0x008007, |
2160 | .needs_tvaudio = 1, | 2297 | .audiomux = { 0, 0x000001,0,0, 0}, |
2161 | .has_radio = 1, | 2298 | .needs_tvaudio = 1, |
2162 | },{ | 2299 | .has_radio = 1, |
2163 | /* Chris Fanning <video4linux@haydon.net> */ | 2300 | },{ |
2164 | .name = "Tibet Systems 'Progress DVR' CS16", | 2301 | /* Chris Fanning <video4linux@haydon.net> */ |
2165 | .video_inputs = 16, | 2302 | .name = "Tibet Systems 'Progress DVR' CS16", |
2166 | .audio_inputs = 0, | 2303 | .video_inputs = 16, |
2167 | .tuner = -1, | 2304 | .audio_inputs = 0, |
2168 | .svhs = -1, | 2305 | .tuner = -1, |
2169 | .muxsel = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }, | 2306 | .svhs = -1, |
2170 | .pll = PLL_28, | 2307 | .muxsel = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }, |
2171 | .no_msp34xx = 1, | 2308 | .pll = PLL_28, |
2172 | .no_tda9875 = 1, | 2309 | .no_msp34xx = 1, |
2173 | .no_tda7432 = 1, | 2310 | .no_tda9875 = 1, |
2174 | .tuner_type = -1, | 2311 | .no_tda7432 = 1, |
2175 | .muxsel_hook = tibetCS16_muxsel, | 2312 | .tuner_type = -1, |
2313 | .tuner_addr = ADDR_UNSET, | ||
2314 | .muxsel_hook = tibetCS16_muxsel, | ||
2176 | }, | 2315 | }, |
2177 | { | 2316 | { |
2178 | /* Bill Brack <wbrack@mmm.com.hk> */ | 2317 | /* Bill Brack <wbrack@mmm.com.hk> */ |
2179 | /* | 2318 | /* |
2180 | * Note that, because of the card's wiring, the "master" | 2319 | * Note that, because of the card's wiring, the "master" |
2181 | * BT878A chip (i.e. the one which controls the analog switch | 2320 | * BT878A chip (i.e. the one which controls the analog switch |
2182 | * and must use this card type) is the 2nd one detected. The | 2321 | * and must use this card type) is the 2nd one detected. The |
2183 | * other 3 chips should use card type 0x85, whose description | 2322 | * other 3 chips should use card type 0x85, whose description |
2184 | * follows this one. There is a EEPROM on the card (which is | 2323 | * follows this one. There is a EEPROM on the card (which is |
2185 | * connected to the I2C of one of those other chips), but is | 2324 | * connected to the I2C of one of those other chips), but is |
2186 | * not currently handled. There is also a facility for a | 2325 | * not currently handled. There is also a facility for a |
2187 | * "monitor", which is also not currently implemented. | 2326 | * "monitor", which is also not currently implemented. |
2188 | */ | 2327 | */ |
2189 | .name = "Kodicom 4400R (master)", | 2328 | .name = "Kodicom 4400R (master)", |
2190 | .video_inputs = 16, | 2329 | .video_inputs = 16, |
2191 | .audio_inputs = 0, | 2330 | .audio_inputs = 0, |
2192 | .tuner = -1, | 2331 | .tuner = -1, |
2193 | .tuner_type = -1, | 2332 | .tuner_type = -1, |
2333 | .tuner_addr = ADDR_UNSET, | ||
2194 | .svhs = -1, | 2334 | .svhs = -1, |
2195 | /* GPIO bits 0-9 used for analog switch: | 2335 | /* GPIO bits 0-9 used for analog switch: |
2196 | * 00 - 03: camera selector | 2336 | * 00 - 03: camera selector |
2197 | * 04 - 06: channel (controller) selector | 2337 | * 04 - 06: channel (controller) selector |
2198 | * 07: data (1->on, 0->off) | 2338 | * 07: data (1->on, 0->off) |
2199 | * 08: strobe | 2339 | * 08: strobe |
2200 | * 09: reset | 2340 | * 09: reset |
2201 | * bit 16 is input from sync separator for the channel | 2341 | * bit 16 is input from sync separator for the channel |
2202 | */ | 2342 | */ |
2203 | .gpiomask = 0x0003ff, | 2343 | .gpiomask = 0x0003ff, |
2204 | .no_gpioirq = 1, | 2344 | .no_gpioirq = 1, |
2205 | .muxsel = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, | 2345 | .muxsel = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, |
@@ -2212,15 +2352,16 @@ struct tvcard bttv_tvcards[] = { | |||
2212 | { | 2352 | { |
2213 | /* Bill Brack <wbrack@mmm.com.hk> */ | 2353 | /* Bill Brack <wbrack@mmm.com.hk> */ |
2214 | /* Note that, for reasons unknown, the "master" BT878A chip (i.e. the | 2354 | /* Note that, for reasons unknown, the "master" BT878A chip (i.e. the |
2215 | * one which controls the analog switch, and must use the card type) | 2355 | * one which controls the analog switch, and must use the card type) |
2216 | * is the 2nd one detected. The other 3 chips should use this card | 2356 | * is the 2nd one detected. The other 3 chips should use this card |
2217 | * type | 2357 | * type |
2218 | */ | 2358 | */ |
2219 | .name = "Kodicom 4400R (slave)", | 2359 | .name = "Kodicom 4400R (slave)", |
2220 | .video_inputs = 16, | 2360 | .video_inputs = 16, |
2221 | .audio_inputs = 0, | 2361 | .audio_inputs = 0, |
2222 | .tuner = -1, | 2362 | .tuner = -1, |
2223 | .tuner_type = -1, | 2363 | .tuner_type = -1, |
2364 | .tuner_addr = ADDR_UNSET, | ||
2224 | .svhs = -1, | 2365 | .svhs = -1, |
2225 | .gpiomask = 0x010000, | 2366 | .gpiomask = 0x010000, |
2226 | .no_gpioirq = 1, | 2367 | .no_gpioirq = 1, |
@@ -2232,18 +2373,51 @@ struct tvcard bttv_tvcards[] = { | |||
2232 | .muxsel_hook = kodicom4400r_muxsel, | 2373 | .muxsel_hook = kodicom4400r_muxsel, |
2233 | }, | 2374 | }, |
2234 | { | 2375 | { |
2235 | /* ---- card 0x85---------------------------------- */ | 2376 | /* ---- card 0x86---------------------------------- */ |
2236 | /* Michael Henson <mhenson@clarityvi.com> */ | 2377 | /* Michael Henson <mhenson@clarityvi.com> */ |
2237 | /* Adlink RTV24 with special unlock codes */ | 2378 | /* Adlink RTV24 with special unlock codes */ |
2238 | .name = "Adlink RTV24", | 2379 | .name = "Adlink RTV24", |
2239 | .video_inputs = 4, | 2380 | .video_inputs = 4, |
2240 | .audio_inputs = 1, | 2381 | .audio_inputs = 1, |
2241 | .tuner = 0, | 2382 | .tuner = 0, |
2242 | .svhs = 2, | 2383 | .svhs = 2, |
2243 | .muxsel = { 2, 3, 1, 0}, | 2384 | .muxsel = { 2, 3, 1, 0}, |
2244 | .tuner_type = -1, | 2385 | .tuner_type = -1, |
2245 | .pll = PLL_28, | 2386 | .tuner_addr = ADDR_UNSET, |
2246 | 2387 | .pll = PLL_28, | |
2388 | }, | ||
2389 | { | ||
2390 | /* ---- card 0x87---------------------------------- */ | ||
2391 | /* Michael Krufky <mkrufky@m1k.net> */ | ||
2392 | .name = "DViCO FusionHDTV 5 Lite", | ||
2393 | .tuner = 0, | ||
2394 | .tuner_type = TUNER_LG_TDVS_H062F, | ||
2395 | .tuner_addr = ADDR_UNSET, | ||
2396 | .video_inputs = 2, | ||
2397 | .audio_inputs = 1, | ||
2398 | .svhs = 2, | ||
2399 | .muxsel = { 2, 3 }, | ||
2400 | .gpiomask = 0x00e00007, | ||
2401 | .audiomux = { 0x00400005, 0, 0, 0, 0, 0 }, | ||
2402 | .no_msp34xx = 1, | ||
2403 | .no_tda9875 = 1, | ||
2404 | .no_tda7432 = 1, | ||
2405 | },{ | ||
2406 | /* ---- card 0x88---------------------------------- */ | ||
2407 | /* Mauro Carvalho Chehab <mchehab@brturbo.com.br> */ | ||
2408 | .name = "Acorp Y878F", | ||
2409 | .video_inputs = 3, | ||
2410 | .audio_inputs = 1, | ||
2411 | .tuner = 0, | ||
2412 | .svhs = 2, | ||
2413 | .gpiomask = 0x01fe00, | ||
2414 | .muxsel = { 2, 3, 1, 1}, | ||
2415 | .audiomux = { 0x001e00, 0, 0x018000, 0x014000, 0x002000, 0 }, | ||
2416 | .needs_tvaudio = 1, | ||
2417 | .pll = PLL_28, | ||
2418 | .tuner_type = TUNER_YMEC_TVF66T5_B_DFF, | ||
2419 | .tuner_addr = 0xc1 >>1, | ||
2420 | .has_radio = 1, | ||
2247 | }}; | 2421 | }}; |
2248 | 2422 | ||
2249 | static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards); | 2423 | static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards); |
@@ -2355,32 +2529,32 @@ static void flyvideo_gpio(struct bttv *btv) | |||
2355 | int tuner=-1,ttype; | 2529 | int tuner=-1,ttype; |
2356 | 2530 | ||
2357 | gpio_inout(0xffffff, 0); | 2531 | gpio_inout(0xffffff, 0); |
2358 | udelay(8); // without this we would see the 0x1800 mask | 2532 | udelay(8); /* without this we would see the 0x1800 mask */ |
2359 | gpio = gpio_read(); | 2533 | gpio = gpio_read(); |
2360 | /* FIXME: must restore OUR_EN ??? */ | 2534 | /* FIXME: must restore OUR_EN ??? */ |
2361 | 2535 | ||
2362 | // all cards provide GPIO info, some have an additional eeprom | 2536 | /* all cards provide GPIO info, some have an additional eeprom |
2363 | // LR50: GPIO coding can be found lower right CP1 .. CP9 | 2537 | * LR50: GPIO coding can be found lower right CP1 .. CP9 |
2364 | // CP9=GPIO23 .. CP1=GPIO15; when OPEN, the corresponding GPIO reads 1. | 2538 | * CP9=GPIO23 .. CP1=GPIO15; when OPEN, the corresponding GPIO reads 1. |
2365 | // GPIO14-12: n.c. | 2539 | * GPIO14-12: n.c. |
2366 | // LR90: GP9=GPIO23 .. GP1=GPIO15 (right above the bt878) | 2540 | * LR90: GP9=GPIO23 .. GP1=GPIO15 (right above the bt878) |
2367 | |||
2368 | // lowest 3 bytes are remote control codes (no handshake needed) | ||
2369 | // xxxFFF: No remote control chip soldered | ||
2370 | // xxxF00(LR26/LR50), xxxFE0(LR90): Remote control chip (LVA001 or CF45) soldered | ||
2371 | // Note: Some bits are Audio_Mask ! | ||
2372 | 2541 | ||
2542 | * lowest 3 bytes are remote control codes (no handshake needed) | ||
2543 | * xxxFFF: No remote control chip soldered | ||
2544 | * xxxF00(LR26/LR50), xxxFE0(LR90): Remote control chip (LVA001 or CF45) soldered | ||
2545 | * Note: Some bits are Audio_Mask ! | ||
2546 | */ | ||
2373 | ttype=(gpio&0x0f0000)>>16; | 2547 | ttype=(gpio&0x0f0000)>>16; |
2374 | switch(ttype) { | 2548 | switch(ttype) { |
2375 | case 0x0: tuner=2; // NTSC, e.g. TPI8NSR11P | 2549 | case 0x0: tuner=2; /* NTSC, e.g. TPI8NSR11P */ |
2376 | break; | 2550 | break; |
2377 | case 0x2: tuner=39;// LG NTSC (newer TAPC series) TAPC-H701P | 2551 | case 0x2: tuner=39;/* LG NTSC (newer TAPC series) TAPC-H701P */ |
2378 | break; | 2552 | break; |
2379 | case 0x4: tuner=5; // Philips PAL TPI8PSB02P, TPI8PSB12P, TPI8PSB12D or FI1216, FM1216 | 2553 | case 0x4: tuner=5; /* Philips PAL TPI8PSB02P, TPI8PSB12P, TPI8PSB12D or FI1216, FM1216 */ |
2380 | break; | 2554 | break; |
2381 | case 0x6: tuner=37; // LG PAL (newer TAPC series) TAPC-G702P | 2555 | case 0x6: tuner=37;/* LG PAL (newer TAPC series) TAPC-G702P */ |
2382 | break; | 2556 | break; |
2383 | case 0xC: tuner=3; // Philips SECAM(+PAL) FQ1216ME or FI1216MF | 2557 | case 0xC: tuner=3; /* Philips SECAM(+PAL) FQ1216ME or FI1216MF */ |
2384 | break; | 2558 | break; |
2385 | default: | 2559 | default: |
2386 | printk(KERN_INFO "bttv%d: FlyVideo_gpio: unknown tuner type.\n", btv->c.nr); | 2560 | printk(KERN_INFO "bttv%d: FlyVideo_gpio: unknown tuner type.\n", btv->c.nr); |
@@ -2388,15 +2562,16 @@ static void flyvideo_gpio(struct bttv *btv) | |||
2388 | 2562 | ||
2389 | has_remote = gpio & 0x800000; | 2563 | has_remote = gpio & 0x800000; |
2390 | has_radio = gpio & 0x400000; | 2564 | has_radio = gpio & 0x400000; |
2391 | // unknown 0x200000; | 2565 | /* unknown 0x200000; |
2392 | // unknown2 0x100000; | 2566 | * unknown2 0x100000; */ |
2393 | is_capture_only = !(gpio & 0x008000); //GPIO15 | 2567 | is_capture_only = !(gpio & 0x008000); /* GPIO15 */ |
2394 | has_tda9820_tda9821 = !(gpio & 0x004000); | 2568 | has_tda9820_tda9821 = !(gpio & 0x004000); |
2395 | is_lr90 = !(gpio & 0x002000); // else LR26/LR50 (LR38/LR51 f. capture only) | 2569 | is_lr90 = !(gpio & 0x002000); /* else LR26/LR50 (LR38/LR51 f. capture only) */ |
2396 | // gpio & 0x001000 // output bit for audio routing | 2570 | /* |
2571 | * gpio & 0x001000 output bit for audio routing */ | ||
2397 | 2572 | ||
2398 | if(is_capture_only) | 2573 | if(is_capture_only) |
2399 | tuner=4; // No tuner present | 2574 | tuner=4; /* No tuner present */ |
2400 | 2575 | ||
2401 | printk(KERN_INFO "bttv%d: FlyVideo Radio=%s RemoteControl=%s Tuner=%d gpio=0x%06x\n", | 2576 | printk(KERN_INFO "bttv%d: FlyVideo Radio=%s RemoteControl=%s Tuner=%d gpio=0x%06x\n", |
2402 | btv->c.nr, has_radio? "yes":"no ", has_remote? "yes":"no ", tuner, gpio); | 2577 | btv->c.nr, has_radio? "yes":"no ", has_remote? "yes":"no ", tuner, gpio); |
@@ -2404,15 +2579,15 @@ static void flyvideo_gpio(struct bttv *btv) | |||
2404 | btv->c.nr, is_lr90?"yes":"no ", has_tda9820_tda9821?"yes":"no ", | 2579 | btv->c.nr, is_lr90?"yes":"no ", has_tda9820_tda9821?"yes":"no ", |
2405 | is_capture_only?"yes":"no "); | 2580 | is_capture_only?"yes":"no "); |
2406 | 2581 | ||
2407 | if(tuner!= -1) // only set if known tuner autodetected, else let insmod option through | 2582 | if(tuner!= -1) /* only set if known tuner autodetected, else let insmod option through */ |
2408 | btv->tuner_type = tuner; | 2583 | btv->tuner_type = tuner; |
2409 | btv->has_radio = has_radio; | 2584 | btv->has_radio = has_radio; |
2410 | 2585 | ||
2411 | // LR90 Audio Routing is done by 2 hef4052, so Audio_Mask has 4 bits: 0x001c80 | 2586 | /* LR90 Audio Routing is done by 2 hef4052, so Audio_Mask has 4 bits: 0x001c80 |
2412 | // LR26/LR50 only has 1 hef4052, Audio_Mask 0x000c00 | 2587 | * LR26/LR50 only has 1 hef4052, Audio_Mask 0x000c00 |
2413 | // Audio options: from tuner, from tda9821/tda9821(mono,stereo,sap), from tda9874, ext., mute | 2588 | * Audio options: from tuner, from tda9821/tda9821(mono,stereo,sap), from tda9874, ext., mute */ |
2414 | if(has_tda9820_tda9821) btv->audio_hook = lt9415_audio; | 2589 | if(has_tda9820_tda9821) btv->audio_hook = lt9415_audio; |
2415 | //todo: if(has_tda9874) btv->audio_hook = fv2000s_audio; | 2590 | /* todo: if(has_tda9874) btv->audio_hook = fv2000s_audio; */ |
2416 | } | 2591 | } |
2417 | 2592 | ||
2418 | static int miro_tunermap[] = { 0,6,2,3, 4,5,6,0, 3,0,4,5, 5,2,16,1, | 2593 | static int miro_tunermap[] = { 0,6,2,3, 4,5,6,0, 3,0,4,5, 5,2,16,1, |
@@ -2633,6 +2808,8 @@ void __devinit bttv_init_card1(struct bttv *btv) | |||
2633 | void __devinit bttv_init_card2(struct bttv *btv) | 2808 | void __devinit bttv_init_card2(struct bttv *btv) |
2634 | { | 2809 | { |
2635 | int tda9887; | 2810 | int tda9887; |
2811 | int addr=ADDR_UNSET; | ||
2812 | |||
2636 | btv->tuner_type = -1; | 2813 | btv->tuner_type = -1; |
2637 | 2814 | ||
2638 | if (BTTV_UNKNOWN == btv->c.type) { | 2815 | if (BTTV_UNKNOWN == btv->c.type) { |
@@ -2773,9 +2950,12 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
2773 | btv->pll.pll_current = -1; | 2950 | btv->pll.pll_current = -1; |
2774 | 2951 | ||
2775 | /* tuner configuration (from card list / autodetect / insmod option) */ | 2952 | /* tuner configuration (from card list / autodetect / insmod option) */ |
2776 | if (UNSET != bttv_tvcards[btv->c.type].tuner_type) | 2953 | if (ADDR_UNSET != bttv_tvcards[btv->c.type].tuner_addr) |
2954 | addr = bttv_tvcards[btv->c.type].tuner_addr; | ||
2955 | |||
2956 | if (UNSET != bttv_tvcards[btv->c.type].tuner_type) | ||
2777 | if(UNSET == btv->tuner_type) | 2957 | if(UNSET == btv->tuner_type) |
2778 | btv->tuner_type = bttv_tvcards[btv->c.type].tuner_type; | 2958 | btv->tuner_type = bttv_tvcards[btv->c.type].tuner_type; |
2779 | if (UNSET != tuner[btv->c.nr]) | 2959 | if (UNSET != tuner[btv->c.nr]) |
2780 | btv->tuner_type = tuner[btv->c.nr]; | 2960 | btv->tuner_type = tuner[btv->c.nr]; |
2781 | printk("bttv%d: using tuner=%d\n",btv->c.nr,btv->tuner_type); | 2961 | printk("bttv%d: using tuner=%d\n",btv->c.nr,btv->tuner_type); |
@@ -2787,7 +2967,7 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
2787 | 2967 | ||
2788 | tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV; | 2968 | tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV; |
2789 | tun_setup.type = btv->tuner_type; | 2969 | tun_setup.type = btv->tuner_type; |
2790 | tun_setup.addr = ADDR_UNSET; | 2970 | tun_setup.addr = addr; |
2791 | 2971 | ||
2792 | bttv_call_i2c_clients(btv, TUNER_SET_TYPE_ADDR, &tun_setup); | 2972 | bttv_call_i2c_clients(btv, TUNER_SET_TYPE_ADDR, &tun_setup); |
2793 | } | 2973 | } |
@@ -2880,7 +3060,7 @@ static void __devinit hauppauge_eeprom(struct bttv *btv) | |||
2880 | { | 3060 | { |
2881 | struct tveeprom tv; | 3061 | struct tveeprom tv; |
2882 | 3062 | ||
2883 | tveeprom_hauppauge_analog(&tv, eeprom_data); | 3063 | tveeprom_hauppauge_analog(&btv->i2c_client, &tv, eeprom_data); |
2884 | btv->tuner_type = tv.tuner_type; | 3064 | btv->tuner_type = tv.tuner_type; |
2885 | btv->has_radio = tv.has_radio; | 3065 | btv->has_radio = tv.has_radio; |
2886 | } | 3066 | } |
@@ -2902,7 +3082,7 @@ static int terratec_active_radio_upgrade(struct bttv *btv) | |||
2902 | btv->mbox_csel = 1 << 10; | 3082 | btv->mbox_csel = 1 << 10; |
2903 | 3083 | ||
2904 | freq=88000/62.5; | 3084 | freq=88000/62.5; |
2905 | tea5757_write(btv, 5 * freq + 0x358); // write 0x1ed8 | 3085 | tea5757_write(btv, 5 * freq + 0x358); /* write 0x1ed8 */ |
2906 | if (0x1ed8 == tea5757_read(btv)) { | 3086 | if (0x1ed8 == tea5757_read(btv)) { |
2907 | printk("bttv%d: Terratec Active Radio Upgrade found.\n", | 3087 | printk("bttv%d: Terratec Active Radio Upgrade found.\n", |
2908 | btv->c.nr); | 3088 | btv->c.nr); |
@@ -3073,7 +3253,7 @@ static void __devinit osprey_eeprom(struct bttv *btv) | |||
3073 | case 0x0060: | 3253 | case 0x0060: |
3074 | case 0x0070: | 3254 | case 0x0070: |
3075 | btv->c.type = BTTV_OSPREY2x0; | 3255 | btv->c.type = BTTV_OSPREY2x0; |
3076 | //enable output on select control lines | 3256 | /* enable output on select control lines */ |
3077 | gpio_inout(0xffffff,0x000303); | 3257 | gpio_inout(0xffffff,0x000303); |
3078 | break; | 3258 | break; |
3079 | default: | 3259 | default: |
@@ -3105,7 +3285,7 @@ static int tuner_1_table[] = { | |||
3105 | TUNER_TEMIC_NTSC, TUNER_TEMIC_PAL, | 3285 | TUNER_TEMIC_NTSC, TUNER_TEMIC_PAL, |
3106 | TUNER_TEMIC_PAL, TUNER_TEMIC_PAL, | 3286 | TUNER_TEMIC_PAL, TUNER_TEMIC_PAL, |
3107 | TUNER_TEMIC_PAL, TUNER_TEMIC_PAL, | 3287 | TUNER_TEMIC_PAL, TUNER_TEMIC_PAL, |
3108 | TUNER_TEMIC_4012FY5, TUNER_TEMIC_4012FY5, //TUNER_TEMIC_SECAM | 3288 | TUNER_TEMIC_4012FY5, TUNER_TEMIC_4012FY5, /* TUNER_TEMIC_SECAM */ |
3109 | TUNER_TEMIC_4012FY5, TUNER_TEMIC_PAL}; | 3289 | TUNER_TEMIC_4012FY5, TUNER_TEMIC_PAL}; |
3110 | 3290 | ||
3111 | static void __devinit avermedia_eeprom(struct bttv *btv) | 3291 | static void __devinit avermedia_eeprom(struct bttv *btv) |
@@ -3126,7 +3306,7 @@ static void __devinit avermedia_eeprom(struct bttv *btv) | |||
3126 | 3306 | ||
3127 | if (tuner_make == 4) | 3307 | if (tuner_make == 4) |
3128 | if(tuner_format == 0x09) | 3308 | if(tuner_format == 0x09) |
3129 | tuner = TUNER_LG_NTSC_NEW_TAPC; // TAPC-G702P | 3309 | tuner = TUNER_LG_NTSC_NEW_TAPC; /* TAPC-G702P */ |
3130 | 3310 | ||
3131 | printk(KERN_INFO "bttv%d: Avermedia eeprom[0x%02x%02x]: tuner=", | 3311 | printk(KERN_INFO "bttv%d: Avermedia eeprom[0x%02x%02x]: tuner=", |
3132 | btv->c.nr,eeprom_data[0x41],eeprom_data[0x42]); | 3312 | btv->c.nr,eeprom_data[0x41],eeprom_data[0x42]); |
@@ -3143,7 +3323,7 @@ static void __devinit avermedia_eeprom(struct bttv *btv) | |||
3143 | /* used on Voodoo TV/FM (Voodoo 200), S0 wired to 0x10000 */ | 3323 | /* used on Voodoo TV/FM (Voodoo 200), S0 wired to 0x10000 */ |
3144 | void bttv_tda9880_setnorm(struct bttv *btv, int norm) | 3324 | void bttv_tda9880_setnorm(struct bttv *btv, int norm) |
3145 | { | 3325 | { |
3146 | // fix up our card entry | 3326 | /* fix up our card entry */ |
3147 | if(norm==VIDEO_MODE_NTSC) { | 3327 | if(norm==VIDEO_MODE_NTSC) { |
3148 | bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[0]=0x957fff; | 3328 | bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[0]=0x957fff; |
3149 | bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[4]=0x957fff; | 3329 | bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[4]=0x957fff; |
@@ -3154,7 +3334,7 @@ void bttv_tda9880_setnorm(struct bttv *btv, int norm) | |||
3154 | bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[4]=0x947fff; | 3334 | bttv_tvcards[BTTV_VOODOOTV_FM].audiomux[4]=0x947fff; |
3155 | dprintk("bttv_tda9880_setnorm to PAL\n"); | 3335 | dprintk("bttv_tda9880_setnorm to PAL\n"); |
3156 | } | 3336 | } |
3157 | // set GPIO according | 3337 | /* set GPIO according */ |
3158 | gpio_bits(bttv_tvcards[btv->c.type].gpiomask, | 3338 | gpio_bits(bttv_tvcards[btv->c.type].gpiomask, |
3159 | bttv_tvcards[btv->c.type].audiomux[btv->audio]); | 3339 | bttv_tvcards[btv->c.type].audiomux[btv->audio]); |
3160 | } | 3340 | } |
@@ -3447,7 +3627,7 @@ static int tea5757_read(struct bttv *btv) | |||
3447 | udelay(10); | 3627 | udelay(10); |
3448 | timeout= jiffies + HZ; | 3628 | timeout= jiffies + HZ; |
3449 | 3629 | ||
3450 | // wait for DATA line to go low; error if it doesn't | 3630 | /* wait for DATA line to go low; error if it doesn't */ |
3451 | while (bus_in(btv,btv->mbox_data) && time_before(jiffies, timeout)) | 3631 | while (bus_in(btv,btv->mbox_data) && time_before(jiffies, timeout)) |
3452 | schedule(); | 3632 | schedule(); |
3453 | if (bus_in(btv,btv->mbox_data)) { | 3633 | if (bus_in(btv,btv->mbox_data)) { |
@@ -3574,8 +3754,8 @@ gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set) | |||
3574 | con = 0x300; | 3754 | con = 0x300; |
3575 | if (v->mode & VIDEO_SOUND_STEREO) | 3755 | if (v->mode & VIDEO_SOUND_STEREO) |
3576 | con = 0x200; | 3756 | con = 0x200; |
3577 | // if (v->mode & VIDEO_SOUND_MONO) | 3757 | /* if (v->mode & VIDEO_SOUND_MONO) |
3578 | // con = 0x100; | 3758 | * con = 0x100; */ |
3579 | gpio_bits(0x300, con); | 3759 | gpio_bits(0x300, con); |
3580 | } else { | 3760 | } else { |
3581 | v->mode = VIDEO_SOUND_STEREO | | 3761 | v->mode = VIDEO_SOUND_STEREO | |
@@ -3718,7 +3898,7 @@ lt9415_audio(struct bttv *btv, struct video_audio *v, int set) | |||
3718 | } | 3898 | } |
3719 | } | 3899 | } |
3720 | 3900 | ||
3721 | // TDA9821 on TerraTV+ Bt848, Bt878 | 3901 | /* TDA9821 on TerraTV+ Bt848, Bt878 */ |
3722 | static void | 3902 | static void |
3723 | terratv_audio(struct bttv *btv, struct video_audio *v, int set) | 3903 | terratv_audio(struct bttv *btv, struct video_audio *v, int set) |
3724 | { | 3904 | { |
@@ -3818,7 +3998,7 @@ fv2000s_audio(struct bttv *btv, struct video_audio *v, int set) | |||
3818 | } | 3998 | } |
3819 | if ((v->mode & (VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2)) | 3999 | if ((v->mode & (VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2)) |
3820 | || (v->mode & VIDEO_SOUND_STEREO)) { | 4000 | || (v->mode & VIDEO_SOUND_STEREO)) { |
3821 | val = 0x1080; //-dk-???: 0x0880, 0x0080, 0x1800 ... | 4001 | val = 0x1080; /*-dk-???: 0x0880, 0x0080, 0x1800 ... */ |
3822 | } | 4002 | } |
3823 | if (val != 0xffff) { | 4003 | if (val != 0xffff) { |
3824 | gpio_bits(0x1800, val); | 4004 | gpio_bits(0x1800, val); |
@@ -3869,10 +4049,10 @@ adtvk503_audio(struct bttv *btv, struct video_audio *v, int set) | |||
3869 | { | 4049 | { |
3870 | unsigned int con = 0xffffff; | 4050 | unsigned int con = 0xffffff; |
3871 | 4051 | ||
3872 | //btaor(0x1e0000, ~0x1e0000, BT848_GPIO_OUT_EN); | 4052 | /* btaor(0x1e0000, ~0x1e0000, BT848_GPIO_OUT_EN); */ |
3873 | 4053 | ||
3874 | if (set) { | 4054 | if (set) { |
3875 | //btor(***, BT848_GPIO_OUT_EN); | 4055 | /* btor(***, BT848_GPIO_OUT_EN); */ |
3876 | if (v->mode & VIDEO_SOUND_LANG1) | 4056 | if (v->mode & VIDEO_SOUND_LANG1) |
3877 | con = 0x00000000; | 4057 | con = 0x00000000; |
3878 | if (v->mode & VIDEO_SOUND_LANG2) | 4058 | if (v->mode & VIDEO_SOUND_LANG2) |
@@ -4079,14 +4259,14 @@ static void kodicom4400r_init(struct bttv *btv) | |||
4079 | master[btv->c.nr+2] = btv; | 4259 | master[btv->c.nr+2] = btv; |
4080 | } | 4260 | } |
4081 | 4261 | ||
4082 | // The Grandtec X-Guard framegrabber card uses two Dual 4-channel | 4262 | /* The Grandtec X-Guard framegrabber card uses two Dual 4-channel |
4083 | // video multiplexers to provide up to 16 video inputs. These | 4263 | * video multiplexers to provide up to 16 video inputs. These |
4084 | // multiplexers are controlled by the lower 8 GPIO pins of the | 4264 | * multiplexers are controlled by the lower 8 GPIO pins of the |
4085 | // bt878. The multiplexers probably Pericom PI5V331Q or similar. | 4265 | * bt878. The multiplexers probably Pericom PI5V331Q or similar. |
4086 | |||
4087 | // xxx0 is pin xxx of multiplexer U5, | ||
4088 | // yyy1 is pin yyy of multiplexer U2 | ||
4089 | 4266 | ||
4267 | * xxx0 is pin xxx of multiplexer U5, | ||
4268 | * yyy1 is pin yyy of multiplexer U2 | ||
4269 | */ | ||
4090 | #define ENA0 0x01 | 4270 | #define ENA0 0x01 |
4091 | #define ENB0 0x02 | 4271 | #define ENB0 0x02 |
4092 | #define ENA1 0x04 | 4272 | #define ENA1 0x04 |
@@ -4157,14 +4337,14 @@ static void picolo_tetra_muxsel (struct bttv* btv, unsigned int input) | |||
4157 | 4337 | ||
4158 | static void ivc120_muxsel(struct bttv *btv, unsigned int input) | 4338 | static void ivc120_muxsel(struct bttv *btv, unsigned int input) |
4159 | { | 4339 | { |
4160 | // Simple maths | 4340 | /* Simple maths */ |
4161 | int key = input % 4; | 4341 | int key = input % 4; |
4162 | int matrix = input / 4; | 4342 | int matrix = input / 4; |
4163 | 4343 | ||
4164 | dprintk("bttv%d: ivc120_muxsel: Input - %02d | TDA - %02d | In - %02d\n", | 4344 | dprintk("bttv%d: ivc120_muxsel: Input - %02d | TDA - %02d | In - %02d\n", |
4165 | btv->c.nr, input, matrix, key); | 4345 | btv->c.nr, input, matrix, key); |
4166 | 4346 | ||
4167 | // Handles the input selection on the TDA8540's | 4347 | /* Handles the input selection on the TDA8540's */ |
4168 | bttv_I2CWrite(btv, I2C_TDA8540_ALT3, 0x00, | 4348 | bttv_I2CWrite(btv, I2C_TDA8540_ALT3, 0x00, |
4169 | ((matrix == 3) ? (key | key << 2) : 0x00), 1); | 4349 | ((matrix == 3) ? (key | key << 2) : 0x00), 1); |
4170 | bttv_I2CWrite(btv, I2C_TDA8540_ALT4, 0x00, | 4350 | bttv_I2CWrite(btv, I2C_TDA8540_ALT4, 0x00, |
@@ -4174,17 +4354,17 @@ static void ivc120_muxsel(struct bttv *btv, unsigned int input) | |||
4174 | bttv_I2CWrite(btv, I2C_TDA8540_ALT6, 0x00, | 4354 | bttv_I2CWrite(btv, I2C_TDA8540_ALT6, 0x00, |
4175 | ((matrix == 2) ? (key | key << 2) : 0x00), 1); | 4355 | ((matrix == 2) ? (key | key << 2) : 0x00), 1); |
4176 | 4356 | ||
4177 | // Handles the output enables on the TDA8540's | 4357 | /* Handles the output enables on the TDA8540's */ |
4178 | bttv_I2CWrite(btv, I2C_TDA8540_ALT3, 0x02, | 4358 | bttv_I2CWrite(btv, I2C_TDA8540_ALT3, 0x02, |
4179 | ((matrix == 3) ? 0x03 : 0x00), 1); // 13 - 16 | 4359 | ((matrix == 3) ? 0x03 : 0x00), 1); /* 13 - 16 */ |
4180 | bttv_I2CWrite(btv, I2C_TDA8540_ALT4, 0x02, | 4360 | bttv_I2CWrite(btv, I2C_TDA8540_ALT4, 0x02, |
4181 | ((matrix == 0) ? 0x03 : 0x00), 1); // 1-4 | 4361 | ((matrix == 0) ? 0x03 : 0x00), 1); /* 1-4 */ |
4182 | bttv_I2CWrite(btv, I2C_TDA8540_ALT5, 0x02, | 4362 | bttv_I2CWrite(btv, I2C_TDA8540_ALT5, 0x02, |
4183 | ((matrix == 1) ? 0x03 : 0x00), 1); // 5-8 | 4363 | ((matrix == 1) ? 0x03 : 0x00), 1); /* 5-8 */ |
4184 | bttv_I2CWrite(btv, I2C_TDA8540_ALT6, 0x02, | 4364 | bttv_I2CWrite(btv, I2C_TDA8540_ALT6, 0x02, |
4185 | ((matrix == 2) ? 0x03 : 0x00), 1); // 9-12 | 4365 | ((matrix == 2) ? 0x03 : 0x00), 1); /* 9-12 */ |
4186 | 4366 | ||
4187 | // Selects MUX0 for input on the 878 | 4367 | /* Selects MUX0 for input on the 878 */ |
4188 | btaor((0)<<5, ~(3<<5), BT848_IFORM); | 4368 | btaor((0)<<5, ~(3<<5), BT848_IFORM); |
4189 | } | 4369 | } |
4190 | 4370 | ||
diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c index 087efb4dea09..a564321db2f0 100644 --- a/drivers/media/video/bttv-driver.c +++ b/drivers/media/video/bttv-driver.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | $Id: bttv-driver.c,v 1.52 2005/08/04 00:55:16 mchehab Exp $ | ||
3 | 2 | ||
4 | bttv - Bt848 frame grabber driver | 3 | bttv - Bt848 frame grabber driver |
5 | 4 | ||
@@ -42,6 +41,9 @@ | |||
42 | 41 | ||
43 | #include "bttvp.h" | 42 | #include "bttvp.h" |
44 | 43 | ||
44 | #include "rds.h" | ||
45 | |||
46 | |||
45 | unsigned int bttv_num; /* number of Bt848s in use */ | 47 | unsigned int bttv_num; /* number of Bt848s in use */ |
46 | struct bttv bttvs[BTTV_MAX]; | 48 | struct bttv bttvs[BTTV_MAX]; |
47 | 49 | ||
@@ -3128,15 +3130,12 @@ static int radio_open(struct inode *inode, struct file *file) | |||
3128 | 3130 | ||
3129 | dprintk("bttv%d: open called (radio)\n",btv->c.nr); | 3131 | dprintk("bttv%d: open called (radio)\n",btv->c.nr); |
3130 | down(&btv->lock); | 3132 | down(&btv->lock); |
3131 | if (btv->radio_user) { | 3133 | |
3132 | up(&btv->lock); | ||
3133 | return -EBUSY; | ||
3134 | } | ||
3135 | btv->radio_user++; | 3134 | btv->radio_user++; |
3135 | |||
3136 | file->private_data = btv; | 3136 | file->private_data = btv; |
3137 | 3137 | ||
3138 | i2c_vidiocschan(btv); | 3138 | bttv_call_i2c_clients(btv,AUDC_SET_RADIO,&btv->tuner_type); |
3139 | bttv_call_i2c_clients(btv,AUDC_SET_RADIO,&btv->tuner_type); | ||
3140 | audio_mux(btv,AUDIO_RADIO); | 3139 | audio_mux(btv,AUDIO_RADIO); |
3141 | 3140 | ||
3142 | up(&btv->lock); | 3141 | up(&btv->lock); |
@@ -3145,9 +3144,13 @@ static int radio_open(struct inode *inode, struct file *file) | |||
3145 | 3144 | ||
3146 | static int radio_release(struct inode *inode, struct file *file) | 3145 | static int radio_release(struct inode *inode, struct file *file) |
3147 | { | 3146 | { |
3148 | struct bttv *btv = file->private_data; | 3147 | struct bttv *btv = file->private_data; |
3148 | struct rds_command cmd; | ||
3149 | 3149 | ||
3150 | btv->radio_user--; | 3150 | btv->radio_user--; |
3151 | |||
3152 | bttv_call_i2c_clients(btv, RDS_CMD_CLOSE, &cmd); | ||
3153 | |||
3151 | return 0; | 3154 | return 0; |
3152 | } | 3155 | } |
3153 | 3156 | ||
@@ -3203,13 +3206,42 @@ static int radio_ioctl(struct inode *inode, struct file *file, | |||
3203 | return video_usercopy(inode, file, cmd, arg, radio_do_ioctl); | 3206 | return video_usercopy(inode, file, cmd, arg, radio_do_ioctl); |
3204 | } | 3207 | } |
3205 | 3208 | ||
3209 | static ssize_t radio_read(struct file *file, char __user *data, | ||
3210 | size_t count, loff_t *ppos) | ||
3211 | { | ||
3212 | struct bttv *btv = file->private_data; | ||
3213 | struct rds_command cmd; | ||
3214 | cmd.block_count = count/3; | ||
3215 | cmd.buffer = data; | ||
3216 | cmd.instance = file; | ||
3217 | cmd.result = -ENODEV; | ||
3218 | |||
3219 | bttv_call_i2c_clients(btv, RDS_CMD_READ, &cmd); | ||
3220 | |||
3221 | return cmd.result; | ||
3222 | } | ||
3223 | |||
3224 | static unsigned int radio_poll(struct file *file, poll_table *wait) | ||
3225 | { | ||
3226 | struct bttv *btv = file->private_data; | ||
3227 | struct rds_command cmd; | ||
3228 | cmd.instance = file; | ||
3229 | cmd.event_list = wait; | ||
3230 | cmd.result = -ENODEV; | ||
3231 | bttv_call_i2c_clients(btv, RDS_CMD_POLL, &cmd); | ||
3232 | |||
3233 | return cmd.result; | ||
3234 | } | ||
3235 | |||
3206 | static struct file_operations radio_fops = | 3236 | static struct file_operations radio_fops = |
3207 | { | 3237 | { |
3208 | .owner = THIS_MODULE, | 3238 | .owner = THIS_MODULE, |
3209 | .open = radio_open, | 3239 | .open = radio_open, |
3240 | .read = radio_read, | ||
3210 | .release = radio_release, | 3241 | .release = radio_release, |
3211 | .ioctl = radio_ioctl, | 3242 | .ioctl = radio_ioctl, |
3212 | .llseek = no_llseek, | 3243 | .llseek = no_llseek, |
3244 | .poll = radio_poll, | ||
3213 | }; | 3245 | }; |
3214 | 3246 | ||
3215 | static struct video_device radio_template = | 3247 | static struct video_device radio_template = |
@@ -4047,6 +4079,7 @@ static int bttv_suspend(struct pci_dev *pci_dev, pm_message_t state) | |||
4047 | struct bttv_buffer_set idle; | 4079 | struct bttv_buffer_set idle; |
4048 | unsigned long flags; | 4080 | unsigned long flags; |
4049 | 4081 | ||
4082 | dprintk("bttv%d: suspend %d\n", btv->c.nr, state.event); | ||
4050 | 4083 | ||
4051 | /* stop dma + irqs */ | 4084 | /* stop dma + irqs */ |
4052 | spin_lock_irqsave(&btv->s_lock,flags); | 4085 | spin_lock_irqsave(&btv->s_lock,flags); |
@@ -4079,15 +4112,29 @@ static int bttv_resume(struct pci_dev *pci_dev) | |||
4079 | { | 4112 | { |
4080 | struct bttv *btv = pci_get_drvdata(pci_dev); | 4113 | struct bttv *btv = pci_get_drvdata(pci_dev); |
4081 | unsigned long flags; | 4114 | unsigned long flags; |
4115 | int err; | ||
4082 | 4116 | ||
4083 | dprintk("bttv%d: resume\n", btv->c.nr); | 4117 | dprintk("bttv%d: resume\n", btv->c.nr); |
4084 | 4118 | ||
4085 | /* restore pci state */ | 4119 | /* restore pci state */ |
4086 | if (btv->state.disabled) { | 4120 | if (btv->state.disabled) { |
4087 | pci_enable_device(pci_dev); | 4121 | err=pci_enable_device(pci_dev); |
4122 | if (err) { | ||
4123 | printk(KERN_WARNING "bttv%d: Can't enable device.\n", | ||
4124 | btv->c.nr); | ||
4125 | return err; | ||
4126 | } | ||
4088 | btv->state.disabled = 0; | 4127 | btv->state.disabled = 0; |
4089 | } | 4128 | } |
4090 | pci_set_power_state(pci_dev, PCI_D0); | 4129 | err=pci_set_power_state(pci_dev, PCI_D0); |
4130 | if (err) { | ||
4131 | pci_disable_device(pci_dev); | ||
4132 | printk(KERN_WARNING "bttv%d: Can't enable device.\n", | ||
4133 | btv->c.nr); | ||
4134 | btv->state.disabled = 1; | ||
4135 | return err; | ||
4136 | } | ||
4137 | |||
4091 | pci_restore_state(pci_dev); | 4138 | pci_restore_state(pci_dev); |
4092 | 4139 | ||
4093 | /* restore bt878 state */ | 4140 | /* restore bt878 state */ |
diff --git a/drivers/media/video/bttv-gpio.c b/drivers/media/video/bttv-gpio.c index 77320cdf205f..6b280c03e398 100644 --- a/drivers/media/video/bttv-gpio.c +++ b/drivers/media/video/bttv-gpio.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | $Id: bttv-gpio.c,v 1.7 2005/02/16 12:14:10 kraxel Exp $ | ||
3 | 2 | ||
4 | bttv-gpio.c -- gpio sub drivers | 3 | bttv-gpio.c -- gpio sub drivers |
5 | 4 | ||
diff --git a/drivers/media/video/bttv-i2c.c b/drivers/media/video/bttv-i2c.c index 706dc48df962..e684df37eb0e 100644 --- a/drivers/media/video/bttv-i2c.c +++ b/drivers/media/video/bttv-i2c.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | $Id: bttv-i2c.c,v 1.25 2005/07/05 17:37:35 nsh Exp $ | ||
3 | 2 | ||
4 | bttv-i2c.c -- all the i2c code is here | 3 | bttv-i2c.c -- all the i2c code is here |
5 | 4 | ||
@@ -381,6 +380,7 @@ void __devinit bttv_readee(struct bttv *btv, unsigned char *eedata, int addr) | |||
381 | } | 380 | } |
382 | 381 | ||
383 | static char *i2c_devs[128] = { | 382 | static char *i2c_devs[128] = { |
383 | [ 0x1c >> 1 ] = "lgdt330x", | ||
384 | [ 0x30 >> 1 ] = "IR (hauppauge)", | 384 | [ 0x30 >> 1 ] = "IR (hauppauge)", |
385 | [ 0x80 >> 1 ] = "msp34xx", | 385 | [ 0x80 >> 1 ] = "msp34xx", |
386 | [ 0x86 >> 1 ] = "tda9887", | 386 | [ 0x86 >> 1 ] = "tda9887", |
diff --git a/drivers/media/video/bttv-if.c b/drivers/media/video/bttv-if.c index f7b5543a96a1..e8aada772b89 100644 --- a/drivers/media/video/bttv-if.c +++ b/drivers/media/video/bttv-if.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | $Id: bttv-if.c,v 1.4 2004/11/17 18:47:47 kraxel Exp $ | ||
3 | 2 | ||
4 | bttv-if.c -- old gpio interface to other kernel modules | 3 | bttv-if.c -- old gpio interface to other kernel modules |
5 | don't use in new code, will go away in 2.7 | 4 | don't use in new code, will go away in 2.7 |
diff --git a/drivers/media/video/bttv-risc.c b/drivers/media/video/bttv-risc.c index 9ed21fd190c6..a5ed99b89445 100644 --- a/drivers/media/video/bttv-risc.c +++ b/drivers/media/video/bttv-risc.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | $Id: bttv-risc.c,v 1.10 2004/11/19 18:07:12 kraxel Exp $ | ||
3 | 2 | ||
4 | bttv-risc.c -- interfaces to other kernel modules | 3 | bttv-risc.c -- interfaces to other kernel modules |
5 | 4 | ||
diff --git a/drivers/media/video/bttv-vbi.c b/drivers/media/video/bttv-vbi.c index 06f3e62b3e8d..f4f58c60f152 100644 --- a/drivers/media/video/bttv-vbi.c +++ b/drivers/media/video/bttv-vbi.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | $Id: bttv-vbi.c,v 1.9 2005/01/13 17:22:33 kraxel Exp $ | ||
3 | 2 | ||
4 | bttv - Bt848 frame grabber driver | 3 | bttv - Bt848 frame grabber driver |
5 | vbi interface | 4 | vbi interface |
diff --git a/drivers/media/video/bttv.h b/drivers/media/video/bttv.h index f2af9e1454f0..d254e90e3bb9 100644 --- a/drivers/media/video/bttv.h +++ b/drivers/media/video/bttv.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: bttv.h,v 1.22 2005/07/28 18:41:21 mchehab Exp $ | ||
3 | * | 2 | * |
4 | * bttv - Bt848 frame grabber driver | 3 | * bttv - Bt848 frame grabber driver |
5 | * | 4 | * |
@@ -218,6 +217,8 @@ struct tvcard | |||
218 | #define PLL_35 2 | 217 | #define PLL_35 2 |
219 | 218 | ||
220 | unsigned int tuner_type; | 219 | unsigned int tuner_type; |
220 | unsigned int tuner_addr; | ||
221 | |||
221 | unsigned int has_radio; | 222 | unsigned int has_radio; |
222 | void (*audio_hook)(struct bttv *btv, struct video_audio *v, int set); | 223 | void (*audio_hook)(struct bttv *btv, struct video_audio *v, int set); |
223 | void (*muxsel_hook)(struct bttv *btv, unsigned int input); | 224 | void (*muxsel_hook)(struct bttv *btv, unsigned int input); |
diff --git a/drivers/media/video/bttvp.h b/drivers/media/video/bttvp.h index aab094bc243d..9b0b7ca035f8 100644 --- a/drivers/media/video/bttvp.h +++ b/drivers/media/video/bttvp.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | $Id: bttvp.h,v 1.21 2005/07/15 21:44:14 mchehab Exp $ | ||
3 | 2 | ||
4 | bttv - Bt848 frame grabber driver | 3 | bttv - Bt848 frame grabber driver |
5 | 4 | ||
diff --git a/drivers/media/video/cpia_usb.c b/drivers/media/video/cpia_usb.c index cdda423386c5..9774e94d1e7d 100644 --- a/drivers/media/video/cpia_usb.c +++ b/drivers/media/video/cpia_usb.c | |||
@@ -445,10 +445,8 @@ static void cpia_usb_free_resources(struct usb_cpia *ucpia, int try) | |||
445 | ucpia->sbuf[1].urb = NULL; | 445 | ucpia->sbuf[1].urb = NULL; |
446 | } | 446 | } |
447 | 447 | ||
448 | if (ucpia->sbuf[1].data) { | 448 | kfree(ucpia->sbuf[1].data); |
449 | kfree(ucpia->sbuf[1].data); | 449 | ucpia->sbuf[1].data = NULL; |
450 | ucpia->sbuf[1].data = NULL; | ||
451 | } | ||
452 | 450 | ||
453 | if (ucpia->sbuf[0].urb) { | 451 | if (ucpia->sbuf[0].urb) { |
454 | usb_kill_urb(ucpia->sbuf[0].urb); | 452 | usb_kill_urb(ucpia->sbuf[0].urb); |
@@ -456,10 +454,8 @@ static void cpia_usb_free_resources(struct usb_cpia *ucpia, int try) | |||
456 | ucpia->sbuf[0].urb = NULL; | 454 | ucpia->sbuf[0].urb = NULL; |
457 | } | 455 | } |
458 | 456 | ||
459 | if (ucpia->sbuf[0].data) { | 457 | kfree(ucpia->sbuf[0].data); |
460 | kfree(ucpia->sbuf[0].data); | 458 | ucpia->sbuf[0].data = NULL; |
461 | ucpia->sbuf[0].data = NULL; | ||
462 | } | ||
463 | } | 459 | } |
464 | 460 | ||
465 | static int cpia_usb_close(void *privdata) | 461 | static int cpia_usb_close(void *privdata) |
@@ -623,20 +619,14 @@ static void cpia_disconnect(struct usb_interface *intf) | |||
623 | 619 | ||
624 | ucpia->curbuff = ucpia->workbuff = NULL; | 620 | ucpia->curbuff = ucpia->workbuff = NULL; |
625 | 621 | ||
626 | if (ucpia->buffers[2]) { | 622 | vfree(ucpia->buffers[2]); |
627 | vfree(ucpia->buffers[2]); | 623 | ucpia->buffers[2] = NULL; |
628 | ucpia->buffers[2] = NULL; | ||
629 | } | ||
630 | 624 | ||
631 | if (ucpia->buffers[1]) { | 625 | vfree(ucpia->buffers[1]); |
632 | vfree(ucpia->buffers[1]); | 626 | ucpia->buffers[1] = NULL; |
633 | ucpia->buffers[1] = NULL; | ||
634 | } | ||
635 | 627 | ||
636 | if (ucpia->buffers[0]) { | 628 | vfree(ucpia->buffers[0]); |
637 | vfree(ucpia->buffers[0]); | 629 | ucpia->buffers[0] = NULL; |
638 | ucpia->buffers[0] = NULL; | ||
639 | } | ||
640 | 630 | ||
641 | cam->lowlevel_data = NULL; | 631 | cam->lowlevel_data = NULL; |
642 | kfree(ucpia); | 632 | kfree(ucpia); |
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c index 4f39688f780a..0c0c59e94774 100644 --- a/drivers/media/video/cx88/cx88-blackbird.c +++ b/drivers/media/video/cx88/cx88-blackbird.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88-blackbird.c,v 1.27 2005/06/03 13:31:50 mchehab Exp $ | ||
3 | * | 2 | * |
4 | * Support for a cx23416 mpeg encoder via cx2388x host port. | 3 | * Support for a cx23416 mpeg encoder via cx2388x host port. |
5 | * "blackbird" reference design. | 4 | * "blackbird" reference design. |
@@ -62,7 +61,6 @@ static LIST_HEAD(cx8802_devlist); | |||
62 | #define IVTV_CMD_HW_BLOCKS_RST 0xFFFFFFFF | 61 | #define IVTV_CMD_HW_BLOCKS_RST 0xFFFFFFFF |
63 | 62 | ||
64 | /* Firmware API commands */ | 63 | /* Firmware API commands */ |
65 | /* #define IVTV_API_STD_TIMEOUT 0x00010000 // 65536, units?? */ | ||
66 | #define IVTV_API_STD_TIMEOUT 500 | 64 | #define IVTV_API_STD_TIMEOUT 500 |
67 | 65 | ||
68 | #define BLACKBIRD_API_PING 0x80 | 66 | #define BLACKBIRD_API_PING 0x80 |
@@ -696,7 +694,6 @@ static void blackbird_codec_settings(struct cx8802_dev *dev) | |||
696 | 694 | ||
697 | /* assign stream type */ | 695 | /* assign stream type */ |
698 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_STREAM_TYPE, 1, 0, BLACKBIRD_STREAM_PROGRAM); | 696 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_STREAM_TYPE, 1, 0, BLACKBIRD_STREAM_PROGRAM); |
699 | /* blackbird_api_cmd(dev, BLACKBIRD_API_SET_STREAM_TYPE, 1, 0, BLACKBIRD_STREAM_TRANSPORT); */ | ||
700 | 697 | ||
701 | /* assign output port */ | 698 | /* assign output port */ |
702 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_OUTPUT_PORT, 1, 0, BLACKBIRD_OUTPUT_PORT_STREAMING); /* Host */ | 699 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_OUTPUT_PORT, 1, 0, BLACKBIRD_OUTPUT_PORT_STREAMING); /* Host */ |
@@ -824,7 +821,8 @@ static int blackbird_initialize_codec(struct cx8802_dev *dev) | |||
824 | BLACKBIRD_CUSTOM_EXTENSION_USR_DATA, | 821 | BLACKBIRD_CUSTOM_EXTENSION_USR_DATA, |
825 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); | 822 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); |
826 | 823 | ||
827 | blackbird_api_cmd(dev, BLACKBIRD_API_INIT_VIDEO_INPUT, 0, 0); /* initialize the video input */ | 824 | /* initialize the video input */ |
825 | blackbird_api_cmd(dev, BLACKBIRD_API_INIT_VIDEO_INPUT, 0, 0); | ||
828 | 826 | ||
829 | msleep(1); | 827 | msleep(1); |
830 | 828 | ||
@@ -833,11 +831,12 @@ static int blackbird_initialize_codec(struct cx8802_dev *dev) | |||
833 | blackbird_api_cmd(dev, BLACKBIRD_API_MUTE_AUDIO, 1, 0, BLACKBIRD_UNMUTE); | 831 | blackbird_api_cmd(dev, BLACKBIRD_API_MUTE_AUDIO, 1, 0, BLACKBIRD_UNMUTE); |
834 | msleep(1); | 832 | msleep(1); |
835 | 833 | ||
836 | /* blackbird_api_cmd(dev, BLACKBIRD_API_BEGIN_CAPTURE, 2, 0, 0, 0x13); // start capturing to the host interface */ | 834 | /* start capturing to the host interface */ |
835 | /* blackbird_api_cmd(dev, BLACKBIRD_API_BEGIN_CAPTURE, 2, 0, 0, 0x13); */ | ||
837 | blackbird_api_cmd(dev, BLACKBIRD_API_BEGIN_CAPTURE, 2, 0, | 836 | blackbird_api_cmd(dev, BLACKBIRD_API_BEGIN_CAPTURE, 2, 0, |
838 | BLACKBIRD_MPEG_CAPTURE, | 837 | BLACKBIRD_MPEG_CAPTURE, |
839 | BLACKBIRD_RAW_BITS_NONE | 838 | BLACKBIRD_RAW_BITS_NONE |
840 | ); /* start capturing to the host interface */ | 839 | ); |
841 | msleep(10); | 840 | msleep(10); |
842 | 841 | ||
843 | blackbird_api_cmd(dev, BLACKBIRD_API_REFRESH_INPUT, 0,0); | 842 | blackbird_api_cmd(dev, BLACKBIRD_API_REFRESH_INPUT, 0,0); |
@@ -851,8 +850,8 @@ static int bb_buf_setup(struct videobuf_queue *q, | |||
851 | { | 850 | { |
852 | struct cx8802_fh *fh = q->priv_data; | 851 | struct cx8802_fh *fh = q->priv_data; |
853 | 852 | ||
854 | fh->dev->ts_packet_size = 512; | 853 | fh->dev->ts_packet_size = 188 * 4; /* was: 512 */ |
855 | fh->dev->ts_packet_count = 100; | 854 | fh->dev->ts_packet_count = 32; /* was: 100 */ |
856 | 855 | ||
857 | *size = fh->dev->ts_packet_size * fh->dev->ts_packet_count; | 856 | *size = fh->dev->ts_packet_size * fh->dev->ts_packet_count; |
858 | if (0 == *count) | 857 | if (0 == *count) |
@@ -900,12 +899,36 @@ static int mpeg_do_ioctl(struct inode *inode, struct file *file, | |||
900 | { | 899 | { |
901 | struct cx8802_fh *fh = file->private_data; | 900 | struct cx8802_fh *fh = file->private_data; |
902 | struct cx8802_dev *dev = fh->dev; | 901 | struct cx8802_dev *dev = fh->dev; |
902 | struct cx88_core *core = dev->core; | ||
903 | 903 | ||
904 | if (debug > 1) | 904 | if (debug > 1) |
905 | cx88_print_ioctl(dev->core->name,cmd); | 905 | cx88_print_ioctl(core->name,cmd); |
906 | 906 | ||
907 | switch (cmd) { | 907 | switch (cmd) { |
908 | 908 | ||
909 | /* --- capabilities ------------------------------------------ */ | ||
910 | case VIDIOC_QUERYCAP: | ||
911 | { | ||
912 | struct v4l2_capability *cap = arg; | ||
913 | |||
914 | memset(cap,0,sizeof(*cap)); | ||
915 | strcpy(cap->driver, "cx88_blackbird"); | ||
916 | strlcpy(cap->card, cx88_boards[core->board].name,sizeof(cap->card)); | ||
917 | sprintf(cap->bus_info,"PCI:%s",pci_name(dev->pci)); | ||
918 | cap->version = CX88_VERSION_CODE; | ||
919 | cap->capabilities = | ||
920 | V4L2_CAP_VIDEO_CAPTURE | | ||
921 | V4L2_CAP_READWRITE | | ||
922 | V4L2_CAP_STREAMING | | ||
923 | V4L2_CAP_VBI_CAPTURE | | ||
924 | V4L2_CAP_VIDEO_OVERLAY | | ||
925 | 0; | ||
926 | if (UNSET != core->tuner_type) | ||
927 | cap->capabilities |= V4L2_CAP_TUNER; | ||
928 | |||
929 | return 0; | ||
930 | } | ||
931 | |||
909 | /* --- capture ioctls ---------------------------------------- */ | 932 | /* --- capture ioctls ---------------------------------------- */ |
910 | case VIDIOC_ENUM_FMT: | 933 | case VIDIOC_ENUM_FMT: |
911 | { | 934 | { |
@@ -935,7 +958,11 @@ static int mpeg_do_ioctl(struct inode *inode, struct file *file, | |||
935 | f->fmt.pix.width = dev->width; | 958 | f->fmt.pix.width = dev->width; |
936 | f->fmt.pix.height = dev->height; | 959 | f->fmt.pix.height = dev->height; |
937 | f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG; | 960 | f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG; |
938 | f->fmt.pix.sizeimage = 1024 * 512 /* FIXME: BUFFER_SIZE */; | 961 | f->fmt.pix.field = V4L2_FIELD_NONE; |
962 | f->fmt.pix.bytesperline = 0; | ||
963 | f->fmt.pix.sizeimage = 188 * 4 * 1024; /* 1024 * 512 */ /* FIXME: BUFFER_SIZE */; | ||
964 | f->fmt.pix.colorspace = 0; | ||
965 | return 0; | ||
939 | } | 966 | } |
940 | 967 | ||
941 | /* --- streaming capture ------------------------------------- */ | 968 | /* --- streaming capture ------------------------------------- */ |
@@ -959,15 +986,25 @@ static int mpeg_do_ioctl(struct inode *inode, struct file *file, | |||
959 | return videobuf_streamoff(&fh->mpegq); | 986 | return videobuf_streamoff(&fh->mpegq); |
960 | 987 | ||
961 | default: | 988 | default: |
962 | return -EINVAL; | 989 | return cx88_do_ioctl( inode, file, 0, dev->core, cmd, arg, cx88_ioctl_hook ); |
963 | } | 990 | } |
964 | return 0; | 991 | return 0; |
965 | } | 992 | } |
966 | 993 | ||
994 | int (*cx88_ioctl_hook)(struct inode *inode, struct file *file, | ||
995 | unsigned int cmd, void *arg); | ||
996 | unsigned int (*cx88_ioctl_translator)(unsigned int cmd); | ||
997 | |||
998 | static unsigned int mpeg_translate_ioctl(unsigned int cmd) | ||
999 | { | ||
1000 | return cmd; | ||
1001 | } | ||
1002 | |||
967 | static int mpeg_ioctl(struct inode *inode, struct file *file, | 1003 | static int mpeg_ioctl(struct inode *inode, struct file *file, |
968 | unsigned int cmd, unsigned long arg) | 1004 | unsigned int cmd, unsigned long arg) |
969 | { | 1005 | { |
970 | return video_usercopy(inode, file, cmd, arg, mpeg_do_ioctl); | 1006 | cmd = cx88_ioctl_translator( cmd ); |
1007 | return video_usercopy(inode, file, cmd, arg, cx88_ioctl_hook); | ||
971 | } | 1008 | } |
972 | 1009 | ||
973 | static int mpeg_open(struct inode *inode, struct file *file) | 1010 | static int mpeg_open(struct inode *inode, struct file *file) |
@@ -1135,7 +1172,7 @@ static int __devinit blackbird_probe(struct pci_dev *pci_dev, | |||
1135 | dev->pci = pci_dev; | 1172 | dev->pci = pci_dev; |
1136 | dev->core = core; | 1173 | dev->core = core; |
1137 | dev->width = 720; | 1174 | dev->width = 720; |
1138 | dev->height = 480; | 1175 | dev->height = 576; |
1139 | 1176 | ||
1140 | err = cx8802_init_common(dev); | 1177 | err = cx8802_init_common(dev); |
1141 | if (0 != err) | 1178 | if (0 != err) |
@@ -1148,6 +1185,9 @@ static int __devinit blackbird_probe(struct pci_dev *pci_dev, | |||
1148 | 1185 | ||
1149 | list_add_tail(&dev->devlist,&cx8802_devlist); | 1186 | list_add_tail(&dev->devlist,&cx8802_devlist); |
1150 | blackbird_register_video(dev); | 1187 | blackbird_register_video(dev); |
1188 | |||
1189 | /* initial device configuration: needed ? */ | ||
1190 | |||
1151 | return 0; | 1191 | return 0; |
1152 | 1192 | ||
1153 | fail_free: | 1193 | fail_free: |
@@ -1202,6 +1242,8 @@ static int blackbird_init(void) | |||
1202 | printk(KERN_INFO "cx2388x: snapshot date %04d-%02d-%02d\n", | 1242 | printk(KERN_INFO "cx2388x: snapshot date %04d-%02d-%02d\n", |
1203 | SNAPSHOT/10000, (SNAPSHOT/100)%100, SNAPSHOT%100); | 1243 | SNAPSHOT/10000, (SNAPSHOT/100)%100, SNAPSHOT%100); |
1204 | #endif | 1244 | #endif |
1245 | cx88_ioctl_hook = mpeg_do_ioctl; | ||
1246 | cx88_ioctl_translator = mpeg_translate_ioctl; | ||
1205 | return pci_register_driver(&blackbird_pci_driver); | 1247 | return pci_register_driver(&blackbird_pci_driver); |
1206 | } | 1248 | } |
1207 | 1249 | ||
@@ -1213,6 +1255,9 @@ static void blackbird_fini(void) | |||
1213 | module_init(blackbird_init); | 1255 | module_init(blackbird_init); |
1214 | module_exit(blackbird_fini); | 1256 | module_exit(blackbird_fini); |
1215 | 1257 | ||
1258 | EXPORT_SYMBOL(cx88_ioctl_hook); | ||
1259 | EXPORT_SYMBOL(cx88_ioctl_translator); | ||
1260 | |||
1216 | /* ----------------------------------------------------------- */ | 1261 | /* ----------------------------------------------------------- */ |
1217 | /* | 1262 | /* |
1218 | * Local variables: | 1263 | * Local variables: |
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index ebf02a7f81e8..4da91d535a5b 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88-cards.c,v 1.90 2005/07/28 02:47:42 mkrufky Exp $ | ||
3 | * | 2 | * |
4 | * device driver for Conexant 2388x based TV cards | 3 | * device driver for Conexant 2388x based TV cards |
5 | * card-specific stuff. | 4 | * card-specific stuff. |
@@ -499,9 +498,6 @@ struct cx88_board cx88_boards[] = { | |||
499 | .input = {{ | 498 | .input = {{ |
500 | .type = CX88_VMUX_DVB, | 499 | .type = CX88_VMUX_DVB, |
501 | .vmux = 0, | 500 | .vmux = 0, |
502 | },{ | ||
503 | .type = CX88_VMUX_SVIDEO, | ||
504 | .vmux = 2, | ||
505 | }}, | 501 | }}, |
506 | .dvb = 1, | 502 | .dvb = 1, |
507 | }, | 503 | }, |
@@ -614,12 +610,12 @@ struct cx88_board cx88_boards[] = { | |||
614 | .input = {{ | 610 | .input = {{ |
615 | .type = CX88_VMUX_TELEVISION, | 611 | .type = CX88_VMUX_TELEVISION, |
616 | .vmux = 0, | 612 | .vmux = 0, |
617 | .gpio0 = 0xed12, // internal decoder | 613 | .gpio0 = 0xed12, /* internal decoder */ |
618 | .gpio2 = 0x00ff, | 614 | .gpio2 = 0x00ff, |
619 | },{ | 615 | },{ |
620 | .type = CX88_VMUX_DEBUG, | 616 | .type = CX88_VMUX_DEBUG, |
621 | .vmux = 0, | 617 | .vmux = 0, |
622 | .gpio0 = 0xff01, // mono from tuner chip | 618 | .gpio0 = 0xff01, /* mono from tuner chip */ |
623 | },{ | 619 | },{ |
624 | .type = CX88_VMUX_COMPOSITE1, | 620 | .type = CX88_VMUX_COMPOSITE1, |
625 | .vmux = 1, | 621 | .vmux = 1, |
@@ -715,19 +711,18 @@ struct cx88_board cx88_boards[] = { | |||
715 | .radio_type = UNSET, | 711 | .radio_type = UNSET, |
716 | .tuner_addr = ADDR_UNSET, | 712 | .tuner_addr = ADDR_UNSET, |
717 | .radio_addr = ADDR_UNSET, | 713 | .radio_addr = ADDR_UNSET, |
718 | /* See DViCO FusionHDTV 3 Gold-Q for GPIO documentation. */ | ||
719 | .input = {{ | 714 | .input = {{ |
720 | .type = CX88_VMUX_TELEVISION, | 715 | .type = CX88_VMUX_TELEVISION, |
721 | .vmux = 0, | 716 | .vmux = 0, |
722 | .gpio0 = 0x0f0d, | 717 | .gpio0 = 0x97ed, |
723 | },{ | 718 | },{ |
724 | .type = CX88_VMUX_COMPOSITE1, | 719 | .type = CX88_VMUX_COMPOSITE1, |
725 | .vmux = 1, | 720 | .vmux = 1, |
726 | .gpio0 = 0x0f00, | 721 | .gpio0 = 0x97e9, |
727 | },{ | 722 | },{ |
728 | .type = CX88_VMUX_SVIDEO, | 723 | .type = CX88_VMUX_SVIDEO, |
729 | .vmux = 2, | 724 | .vmux = 2, |
730 | .gpio0 = 0x0f00, | 725 | .gpio0 = 0x97e9, |
731 | }}, | 726 | }}, |
732 | .dvb = 1, | 727 | .dvb = 1, |
733 | }, | 728 | }, |
@@ -765,20 +760,21 @@ struct cx88_board cx88_boards[] = { | |||
765 | .radio_type = UNSET, | 760 | .radio_type = UNSET, |
766 | .tuner_addr = ADDR_UNSET, | 761 | .tuner_addr = ADDR_UNSET, |
767 | .radio_addr = ADDR_UNSET, | 762 | .radio_addr = ADDR_UNSET, |
768 | /* See DViCO FusionHDTV 3 Gold-Q for GPIO documentation. */ | 763 | .tda9887_conf = TDA9887_PRESENT, |
769 | .input = {{ | 764 | .input = {{ |
770 | .type = CX88_VMUX_TELEVISION, | 765 | .type = CX88_VMUX_TELEVISION, |
771 | .vmux = 0, | 766 | .vmux = 0, |
772 | .gpio0 = 0x0f0d, | 767 | .gpio0 = 0x87fd, |
773 | },{ | 768 | },{ |
774 | .type = CX88_VMUX_COMPOSITE1, | 769 | .type = CX88_VMUX_COMPOSITE1, |
775 | .vmux = 1, | 770 | .vmux = 1, |
776 | .gpio0 = 0x0f00, | 771 | .gpio0 = 0x87f9, |
777 | },{ | 772 | },{ |
778 | .type = CX88_VMUX_SVIDEO, | 773 | .type = CX88_VMUX_SVIDEO, |
779 | .vmux = 2, | 774 | .vmux = 2, |
780 | .gpio0 = 0x0f00, | 775 | .gpio0 = 0x87f9, |
781 | }}, | 776 | }}, |
777 | .dvb = 1, | ||
782 | }, | 778 | }, |
783 | }; | 779 | }; |
784 | const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards); | 780 | const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards); |
@@ -949,7 +945,7 @@ static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data) | |||
949 | { | 945 | { |
950 | struct tveeprom tv; | 946 | struct tveeprom tv; |
951 | 947 | ||
952 | tveeprom_hauppauge_analog(&tv, eeprom_data); | 948 | tveeprom_hauppauge_analog(&core->i2c_client, &tv, eeprom_data); |
953 | core->tuner_type = tv.tuner_type; | 949 | core->tuner_type = tv.tuner_type; |
954 | core->has_radio = tv.has_radio; | 950 | core->has_radio = tv.has_radio; |
955 | } | 951 | } |
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c index 5e868f5cd0c0..dc5c5c1f3461 100644 --- a/drivers/media/video/cx88/cx88-core.c +++ b/drivers/media/video/cx88/cx88-core.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88-core.c,v 1.33 2005/07/07 14:17:47 mchehab Exp $ | ||
3 | * | 2 | * |
4 | * device driver for Conexant 2388x based TV cards | 3 | * device driver for Conexant 2388x based TV cards |
5 | * driver core | 4 | * driver core |
@@ -876,7 +875,7 @@ static int set_tvaudio(struct cx88_core *core) | |||
876 | 875 | ||
877 | cx_andor(MO_AFECFG_IO, 0x1f, 0x0); | 876 | cx_andor(MO_AFECFG_IO, 0x1f, 0x0); |
878 | cx88_set_tvaudio(core); | 877 | cx88_set_tvaudio(core); |
879 | // cx88_set_stereo(dev,V4L2_TUNER_MODE_STEREO); | 878 | /* cx88_set_stereo(dev,V4L2_TUNER_MODE_STEREO); */ |
880 | 879 | ||
881 | cx_write(MO_AUDD_LNGTH, 128); /* fifo size */ | 880 | cx_write(MO_AUDD_LNGTH, 128); /* fifo size */ |
882 | cx_write(MO_AUDR_LNGTH, 128); /* fifo size */ | 881 | cx_write(MO_AUDR_LNGTH, 128); /* fifo size */ |
@@ -1087,10 +1086,17 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci) | |||
1087 | core->pci_bus = pci->bus->number; | 1086 | core->pci_bus = pci->bus->number; |
1088 | core->pci_slot = PCI_SLOT(pci->devfn); | 1087 | core->pci_slot = PCI_SLOT(pci->devfn); |
1089 | core->pci_irqmask = 0x00fc00; | 1088 | core->pci_irqmask = 0x00fc00; |
1089 | init_MUTEX(&core->lock); | ||
1090 | 1090 | ||
1091 | core->nr = cx88_devcount++; | 1091 | core->nr = cx88_devcount++; |
1092 | sprintf(core->name,"cx88[%d]",core->nr); | 1092 | sprintf(core->name,"cx88[%d]",core->nr); |
1093 | if (0 != get_ressources(core,pci)) { | 1093 | if (0 != get_ressources(core,pci)) { |
1094 | printk(KERN_ERR "CORE %s No more PCI ressources for " | ||
1095 | "subsystem: %04x:%04x, board: %s\n", | ||
1096 | core->name,pci->subsystem_vendor, | ||
1097 | pci->subsystem_device, | ||
1098 | cx88_boards[core->board].name); | ||
1099 | |||
1094 | cx88_devcount--; | 1100 | cx88_devcount--; |
1095 | goto fail_free; | 1101 | goto fail_free; |
1096 | } | 1102 | } |
@@ -1114,11 +1120,11 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci) | |||
1114 | core->board = CX88_BOARD_UNKNOWN; | 1120 | core->board = CX88_BOARD_UNKNOWN; |
1115 | cx88_card_list(core,pci); | 1121 | cx88_card_list(core,pci); |
1116 | } | 1122 | } |
1117 | printk(KERN_INFO "%s: subsystem: %04x:%04x, board: %s [card=%d,%s]\n", | 1123 | printk(KERN_INFO "CORE %s: subsystem: %04x:%04x, board: %s [card=%d,%s]\n", |
1118 | core->name,pci->subsystem_vendor, | 1124 | core->name,pci->subsystem_vendor, |
1119 | pci->subsystem_device,cx88_boards[core->board].name, | 1125 | pci->subsystem_device,cx88_boards[core->board].name, |
1120 | core->board, card[core->nr] == core->board ? | 1126 | core->board, card[core->nr] == core->board ? |
1121 | "insmod option" : "autodetected"); | 1127 | "insmod option" : "autodetected"); |
1122 | 1128 | ||
1123 | core->tuner_type = tuner[core->nr]; | 1129 | core->tuner_type = tuner[core->nr]; |
1124 | core->radio_type = radio[core->nr]; | 1130 | core->radio_type = radio[core->nr]; |
@@ -1202,4 +1208,5 @@ EXPORT_SYMBOL(cx88_core_put); | |||
1202 | * Local variables: | 1208 | * Local variables: |
1203 | * c-basic-offset: 8 | 1209 | * c-basic-offset: 8 |
1204 | * End: | 1210 | * End: |
1211 | * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off | ||
1205 | */ | 1212 | */ |
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index 78d223257a68..c9106b1d79df 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88-dvb.c,v 1.58 2005/08/07 09:24:08 mkrufky Exp $ | ||
3 | * | 2 | * |
4 | * device driver for Conexant 2388x based TV cards | 3 | * device driver for Conexant 2388x based TV cards |
5 | * MPEG Transport Stream (DVB) routines | 4 | * MPEG Transport Stream (DVB) routines |
@@ -29,7 +28,7 @@ | |||
29 | #include <linux/kthread.h> | 28 | #include <linux/kthread.h> |
30 | #include <linux/file.h> | 29 | #include <linux/file.h> |
31 | #include <linux/suspend.h> | 30 | #include <linux/suspend.h> |
32 | #include <linux/config.h> | 31 | |
33 | 32 | ||
34 | #include "cx88.h" | 33 | #include "cx88.h" |
35 | #include "dvb-pll.h" | 34 | #include "dvb-pll.h" |
@@ -210,16 +209,26 @@ static struct or51132_config pchdtv_hd3000 = { | |||
210 | static int lgdt330x_pll_set(struct dvb_frontend* fe, | 209 | static int lgdt330x_pll_set(struct dvb_frontend* fe, |
211 | struct dvb_frontend_parameters* params) | 210 | struct dvb_frontend_parameters* params) |
212 | { | 211 | { |
212 | /* FIXME make this routine use the tuner-simple code. | ||
213 | * It could probably be shared with a number of ATSC | ||
214 | * frontends. Many share the same tuner with analog TV. */ | ||
215 | |||
213 | struct cx8802_dev *dev= fe->dvb->priv; | 216 | struct cx8802_dev *dev= fe->dvb->priv; |
217 | struct cx88_core *core = dev->core; | ||
214 | u8 buf[4]; | 218 | u8 buf[4]; |
215 | struct i2c_msg msg = | 219 | struct i2c_msg msg = |
216 | { .addr = dev->core->pll_addr, .flags = 0, .buf = buf, .len = 4 }; | 220 | { .addr = dev->core->pll_addr, .flags = 0, .buf = buf, .len = 4 }; |
217 | int err; | 221 | int err; |
218 | 222 | ||
219 | dvb_pll_configure(dev->core->pll_desc, buf, params->frequency, 0); | 223 | /* Put the analog decoder in standby to keep it quiet */ |
224 | if (core->tda9887_conf) { | ||
225 | cx88_call_i2c_clients (dev->core, TUNER_SET_STANDBY, NULL); | ||
226 | } | ||
227 | |||
228 | dvb_pll_configure(core->pll_desc, buf, params->frequency, 0); | ||
220 | dprintk(1, "%s: tuner at 0x%02x bytes: 0x%02x 0x%02x 0x%02x 0x%02x\n", | 229 | dprintk(1, "%s: tuner at 0x%02x bytes: 0x%02x 0x%02x 0x%02x 0x%02x\n", |
221 | __FUNCTION__, msg.addr, buf[0],buf[1],buf[2],buf[3]); | 230 | __FUNCTION__, msg.addr, buf[0],buf[1],buf[2],buf[3]); |
222 | if ((err = i2c_transfer(&dev->core->i2c_adap, &msg, 1)) != 1) { | 231 | if ((err = i2c_transfer(&core->i2c_adap, &msg, 1)) != 1) { |
223 | printk(KERN_WARNING "cx88-dvb: %s error " | 232 | printk(KERN_WARNING "cx88-dvb: %s error " |
224 | "(addr %02x <- %02x, err = %i)\n", | 233 | "(addr %02x <- %02x, err = %i)\n", |
225 | __FUNCTION__, buf[0], buf[1], err); | 234 | __FUNCTION__, buf[0], buf[1], err); |
@@ -228,6 +237,13 @@ static int lgdt330x_pll_set(struct dvb_frontend* fe, | |||
228 | else | 237 | else |
229 | return -EREMOTEIO; | 238 | return -EREMOTEIO; |
230 | } | 239 | } |
240 | if (core->tuner_type == TUNER_LG_TDVS_H062F) { | ||
241 | /* Set the Auxiliary Byte. */ | ||
242 | buf[2] &= ~0x20; | ||
243 | buf[2] |= 0x18; | ||
244 | buf[3] = 0x50; | ||
245 | i2c_transfer(&core->i2c_adap, &msg, 1); | ||
246 | } | ||
231 | return 0; | 247 | return 0; |
232 | } | 248 | } |
233 | 249 | ||
@@ -261,6 +277,14 @@ static struct lgdt330x_config fusionhdtv_3_gold = { | |||
261 | .pll_set = lgdt330x_pll_set, | 277 | .pll_set = lgdt330x_pll_set, |
262 | .set_ts_params = lgdt330x_set_ts_param, | 278 | .set_ts_params = lgdt330x_set_ts_param, |
263 | }; | 279 | }; |
280 | |||
281 | static struct lgdt330x_config fusionhdtv_5_gold = { | ||
282 | .demod_address = 0x0e, | ||
283 | .demod_chip = LGDT3303, | ||
284 | .serial_mpeg = 0x40, /* TPSERIAL for 3303 in TOP_CONTROL */ | ||
285 | .pll_set = lgdt330x_pll_set, | ||
286 | .set_ts_params = lgdt330x_set_ts_param, | ||
287 | }; | ||
264 | #endif | 288 | #endif |
265 | 289 | ||
266 | static int dvb_register(struct cx8802_dev *dev) | 290 | static int dvb_register(struct cx8802_dev *dev) |
@@ -346,6 +370,22 @@ static int dvb_register(struct cx8802_dev *dev) | |||
346 | &dev->core->i2c_adap); | 370 | &dev->core->i2c_adap); |
347 | } | 371 | } |
348 | break; | 372 | break; |
373 | case CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD: | ||
374 | dev->ts_gen_cntrl = 0x08; | ||
375 | { | ||
376 | /* Do a hardware reset of chip before using it. */ | ||
377 | struct cx88_core *core = dev->core; | ||
378 | |||
379 | cx_clear(MO_GP0_IO, 1); | ||
380 | mdelay(100); | ||
381 | cx_set(MO_GP0_IO, 1); | ||
382 | mdelay(200); | ||
383 | dev->core->pll_addr = 0x61; | ||
384 | dev->core->pll_desc = &dvb_pll_tdvs_tua6034; | ||
385 | dev->dvb.frontend = lgdt330x_attach(&fusionhdtv_5_gold, | ||
386 | &dev->core->i2c_adap); | ||
387 | } | ||
388 | break; | ||
349 | #endif | 389 | #endif |
350 | default: | 390 | default: |
351 | printk("%s: The frontend of your DVB/ATSC card isn't supported yet\n", | 391 | printk("%s: The frontend of your DVB/ATSC card isn't supported yet\n", |
@@ -362,11 +402,6 @@ static int dvb_register(struct cx8802_dev *dev) | |||
362 | dev->dvb.frontend->ops->info.frequency_max = dev->core->pll_desc->max; | 402 | dev->dvb.frontend->ops->info.frequency_max = dev->core->pll_desc->max; |
363 | } | 403 | } |
364 | 404 | ||
365 | /* Copy the board name into the DVB structure */ | ||
366 | strlcpy(dev->dvb.frontend->ops->info.name, | ||
367 | cx88_boards[dev->core->board].name, | ||
368 | sizeof(dev->dvb.frontend->ops->info.name)); | ||
369 | |||
370 | /* register everything */ | 405 | /* register everything */ |
371 | return videobuf_dvb_register(&dev->dvb, THIS_MODULE, dev); | 406 | return videobuf_dvb_register(&dev->dvb, THIS_MODULE, dev); |
372 | } | 407 | } |
diff --git a/drivers/media/video/cx88/cx88-i2c.c b/drivers/media/video/cx88/cx88-i2c.c index 7f598039e025..761cebd40dbd 100644 --- a/drivers/media/video/cx88/cx88-i2c.c +++ b/drivers/media/video/cx88/cx88-i2c.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | $Id: cx88-i2c.c,v 1.30 2005/07/25 05:10:13 mkrufky Exp $ | ||
3 | 2 | ||
4 | cx88-i2c.c -- all the i2c code is here | 3 | cx88-i2c.c -- all the i2c code is here |
5 | 4 | ||
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index 214887798192..d81b21d6e05d 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88-input.c,v 1.15 2005/07/07 13:58:38 mchehab Exp $ | ||
3 | * | 2 | * |
4 | * Device driver for GPIO attached remote control interfaces | 3 | * Device driver for GPIO attached remote control interfaces |
5 | * on Conexant 2388x based TV/DVB cards. | 4 | * on Conexant 2388x based TV/DVB cards. |
@@ -212,6 +211,53 @@ static IR_KEYTAB_TYPE ir_codes_msi_tvanywhere[IR_KEYTAB_SIZE] = { | |||
212 | 211 | ||
213 | /* ---------------------------------------------------------------------- */ | 212 | /* ---------------------------------------------------------------------- */ |
214 | 213 | ||
214 | /* Cinergy 1400 DVB-T */ | ||
215 | static IR_KEYTAB_TYPE ir_codes_cinergy_1400[IR_KEYTAB_SIZE] = { | ||
216 | [0x01] = KEY_POWER, | ||
217 | [0x02] = KEY_1, | ||
218 | [0x03] = KEY_2, | ||
219 | [0x04] = KEY_3, | ||
220 | [0x05] = KEY_4, | ||
221 | [0x06] = KEY_5, | ||
222 | [0x07] = KEY_6, | ||
223 | [0x08] = KEY_7, | ||
224 | [0x09] = KEY_8, | ||
225 | [0x0a] = KEY_9, | ||
226 | [0x0c] = KEY_0, | ||
227 | |||
228 | [0x0b] = KEY_VIDEO, | ||
229 | [0x0d] = KEY_REFRESH, | ||
230 | [0x0e] = KEY_SELECT, | ||
231 | [0x0f] = KEY_EPG, | ||
232 | [0x10] = KEY_UP, | ||
233 | [0x11] = KEY_LEFT, | ||
234 | [0x12] = KEY_OK, | ||
235 | [0x13] = KEY_RIGHT, | ||
236 | [0x14] = KEY_DOWN, | ||
237 | [0x15] = KEY_TEXT, | ||
238 | [0x16] = KEY_INFO, | ||
239 | |||
240 | [0x17] = KEY_RED, | ||
241 | [0x18] = KEY_GREEN, | ||
242 | [0x19] = KEY_YELLOW, | ||
243 | [0x1a] = KEY_BLUE, | ||
244 | |||
245 | [0x1b] = KEY_CHANNELUP, | ||
246 | [0x1c] = KEY_VOLUMEUP, | ||
247 | [0x1d] = KEY_MUTE, | ||
248 | [0x1e] = KEY_VOLUMEDOWN, | ||
249 | [0x1f] = KEY_CHANNELDOWN, | ||
250 | |||
251 | [0x40] = KEY_PAUSE, | ||
252 | [0x4c] = KEY_PLAY, | ||
253 | [0x58] = KEY_RECORD, | ||
254 | [0x54] = KEY_PREVIOUS, | ||
255 | [0x48] = KEY_STOP, | ||
256 | [0x5c] = KEY_NEXT, | ||
257 | }; | ||
258 | |||
259 | /* ---------------------------------------------------------------------- */ | ||
260 | |||
215 | struct cx88_IR { | 261 | struct cx88_IR { |
216 | struct cx88_core *core; | 262 | struct cx88_core *core; |
217 | struct input_dev input; | 263 | struct input_dev input; |
@@ -241,7 +287,7 @@ module_param(ir_debug, int, 0644); /* debug level [IR] */ | |||
241 | MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]"); | 287 | MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]"); |
242 | 288 | ||
243 | #define ir_dprintk(fmt, arg...) if (ir_debug) \ | 289 | #define ir_dprintk(fmt, arg...) if (ir_debug) \ |
244 | printk(KERN_DEBUG "%s IR: " fmt , ir->core->name, ## arg) | 290 | printk(KERN_DEBUG "%s IR: " fmt , ir->core->name , ##arg) |
245 | 291 | ||
246 | /* ---------------------------------------------------------------------- */ | 292 | /* ---------------------------------------------------------------------- */ |
247 | 293 | ||
@@ -329,6 +375,11 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) | |||
329 | ir->mask_keyup = 0x60; | 375 | ir->mask_keyup = 0x60; |
330 | ir->polling = 50; /* ms */ | 376 | ir->polling = 50; /* ms */ |
331 | break; | 377 | break; |
378 | case CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1: | ||
379 | ir_codes = ir_codes_cinergy_1400; | ||
380 | ir_type = IR_TYPE_PD; | ||
381 | ir->sampling = 1; | ||
382 | break; | ||
332 | case CX88_BOARD_HAUPPAUGE: | 383 | case CX88_BOARD_HAUPPAUGE: |
333 | case CX88_BOARD_HAUPPAUGE_DVB_T1: | 384 | case CX88_BOARD_HAUPPAUGE_DVB_T1: |
334 | ir_codes = ir_codes_hauppauge_new; | 385 | ir_codes = ir_codes_hauppauge_new; |
@@ -394,6 +445,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) | |||
394 | ir->input.id.vendor = pci->vendor; | 445 | ir->input.id.vendor = pci->vendor; |
395 | ir->input.id.product = pci->device; | 446 | ir->input.id.product = pci->device; |
396 | } | 447 | } |
448 | ir->input.dev = &pci->dev; | ||
397 | 449 | ||
398 | /* record handles to ourself */ | 450 | /* record handles to ourself */ |
399 | ir->core = core; | 451 | ir->core = core; |
@@ -445,7 +497,7 @@ int cx88_ir_fini(struct cx88_core *core) | |||
445 | void cx88_ir_irq(struct cx88_core *core) | 497 | void cx88_ir_irq(struct cx88_core *core) |
446 | { | 498 | { |
447 | struct cx88_IR *ir = core->ir; | 499 | struct cx88_IR *ir = core->ir; |
448 | u32 samples, rc5; | 500 | u32 samples, ircode; |
449 | int i; | 501 | int i; |
450 | 502 | ||
451 | if (NULL == ir) | 503 | if (NULL == ir) |
@@ -477,13 +529,44 @@ void cx88_ir_irq(struct cx88_core *core) | |||
477 | 529 | ||
478 | /* decode it */ | 530 | /* decode it */ |
479 | switch (core->board) { | 531 | switch (core->board) { |
532 | case CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1: | ||
533 | ircode = ir_decode_pulsedistance(ir->samples, ir->scount, 1, 4); | ||
534 | |||
535 | if (ircode == 0xffffffff) { /* decoding error */ | ||
536 | ir_dprintk("pulse distance decoding error\n"); | ||
537 | break; | ||
538 | } | ||
539 | |||
540 | ir_dprintk("pulse distance decoded: %x\n", ircode); | ||
541 | |||
542 | if (ircode == 0) { /* key still pressed */ | ||
543 | ir_dprintk("pulse distance decoded repeat code\n"); | ||
544 | ir->release = jiffies + msecs_to_jiffies(120); | ||
545 | break; | ||
546 | } | ||
547 | |||
548 | if ((ircode & 0xffff) != 0xeb04) { /* wrong address */ | ||
549 | ir_dprintk("pulse distance decoded wrong address\n"); | ||
550 | break; | ||
551 | } | ||
552 | |||
553 | if (((~ircode >> 24) & 0xff) != ((ircode >> 16) & 0xff)) { /* wrong checksum */ | ||
554 | ir_dprintk("pulse distance decoded wrong check sum\n"); | ||
555 | break; | ||
556 | } | ||
557 | |||
558 | ir_dprintk("Key Code: %x\n", (ircode >> 16) & 0x7f); | ||
559 | |||
560 | ir_input_keydown(&ir->input, &ir->ir, (ircode >> 16) & 0x7f, (ircode >> 16) & 0xff); | ||
561 | ir->release = jiffies + msecs_to_jiffies(120); | ||
562 | break; | ||
480 | case CX88_BOARD_HAUPPAUGE: | 563 | case CX88_BOARD_HAUPPAUGE: |
481 | case CX88_BOARD_HAUPPAUGE_DVB_T1: | 564 | case CX88_BOARD_HAUPPAUGE_DVB_T1: |
482 | rc5 = ir_decode_biphase(ir->samples, ir->scount, 5, 7); | 565 | ircode = ir_decode_biphase(ir->samples, ir->scount, 5, 7); |
483 | ir_dprintk("biphase decoded: %x\n", rc5); | 566 | ir_dprintk("biphase decoded: %x\n", ircode); |
484 | if ((rc5 & 0xfffff000) != 0x3000) | 567 | if ((ircode & 0xfffff000) != 0x3000) |
485 | break; | 568 | break; |
486 | ir_input_keydown(&ir->input, &ir->ir, rc5 & 0x3f, rc5); | 569 | ir_input_keydown(&ir->input, &ir->ir, ircode & 0x3f, ircode); |
487 | ir->release = jiffies + msecs_to_jiffies(120); | 570 | ir->release = jiffies + msecs_to_jiffies(120); |
488 | break; | 571 | break; |
489 | } | 572 | } |
diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c index fe2767c0ff94..ee2300e1ae0b 100644 --- a/drivers/media/video/cx88/cx88-mpeg.c +++ b/drivers/media/video/cx88/cx88-mpeg.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88-mpeg.c,v 1.31 2005/07/07 14:17:47 mchehab Exp $ | ||
3 | * | 2 | * |
4 | * Support for the mpeg transport stream transfers | 3 | * Support for the mpeg transport stream transfers |
5 | * PCI function #2 of the cx2388x. | 4 | * PCI function #2 of the cx2388x. |
@@ -73,11 +72,15 @@ static int cx8802_start_dma(struct cx8802_dev *dev, | |||
73 | udelay(100); | 72 | udelay(100); |
74 | cx_write(MO_PINMUX_IO, 0x00); | 73 | cx_write(MO_PINMUX_IO, 0x00); |
75 | cx_write(TS_HW_SOP_CNTRL,0x47<<16|188<<4|0x01); | 74 | cx_write(TS_HW_SOP_CNTRL,0x47<<16|188<<4|0x01); |
76 | if ((core->board == CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q) || | 75 | switch (core->board) { |
77 | (core->board == CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T)) { | 76 | case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q: |
77 | case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T: | ||
78 | case CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD: | ||
78 | cx_write(TS_SOP_STAT, 1<<13); | 79 | cx_write(TS_SOP_STAT, 1<<13); |
79 | } else { | 80 | break; |
81 | default: | ||
80 | cx_write(TS_SOP_STAT, 0x00); | 82 | cx_write(TS_SOP_STAT, 0x00); |
83 | break; | ||
81 | } | 84 | } |
82 | cx_write(TS_GEN_CNTRL, dev->ts_gen_cntrl); | 85 | cx_write(TS_GEN_CNTRL, dev->ts_gen_cntrl); |
83 | udelay(100); | 86 | udelay(100); |
@@ -86,12 +89,10 @@ static int cx8802_start_dma(struct cx8802_dev *dev, | |||
86 | if (cx88_boards[core->board].blackbird) { | 89 | if (cx88_boards[core->board].blackbird) { |
87 | cx_write(MO_PINMUX_IO, 0x88); /* enable MPEG parallel IO */ | 90 | cx_write(MO_PINMUX_IO, 0x88); /* enable MPEG parallel IO */ |
88 | 91 | ||
89 | // cx_write(TS_F2_CMD_STAT_MM, 0x2900106); /* F2_CMD_STAT_MM defaults + master + memory space */ | ||
90 | cx_write(TS_GEN_CNTRL, 0x46); /* punctured clock TS & posedge driven & software reset */ | 92 | cx_write(TS_GEN_CNTRL, 0x46); /* punctured clock TS & posedge driven & software reset */ |
91 | udelay(100); | 93 | udelay(100); |
92 | 94 | ||
93 | cx_write(TS_HW_SOP_CNTRL, 0x408); /* mpeg start byte */ | 95 | cx_write(TS_HW_SOP_CNTRL, 0x408); /* mpeg start byte */ |
94 | //cx_write(TS_HW_SOP_CNTRL, 0x2F0BC0); /* mpeg start byte ts: 0x2F0BC0 ? */ | ||
95 | cx_write(TS_VALERR_CNTRL, 0x2000); | 96 | cx_write(TS_VALERR_CNTRL, 0x2000); |
96 | 97 | ||
97 | cx_write(TS_GEN_CNTRL, 0x06); /* punctured clock TS & posedge driven */ | 98 | cx_write(TS_GEN_CNTRL, 0x06); /* punctured clock TS & posedge driven */ |
@@ -106,7 +107,6 @@ static int cx8802_start_dma(struct cx8802_dev *dev, | |||
106 | dprintk( 0, "setting the interrupt mask\n" ); | 107 | dprintk( 0, "setting the interrupt mask\n" ); |
107 | cx_set(MO_PCI_INTMSK, core->pci_irqmask | 0x04); | 108 | cx_set(MO_PCI_INTMSK, core->pci_irqmask | 0x04); |
108 | cx_set(MO_TS_INTMSK, 0x1f0011); | 109 | cx_set(MO_TS_INTMSK, 0x1f0011); |
109 | //cx_write(MO_TS_INTMSK, 0x0f0011); | ||
110 | 110 | ||
111 | /* start dma */ | 111 | /* start dma */ |
112 | cx_set(MO_DEV_CNTRL2, (1<<5)); | 112 | cx_set(MO_DEV_CNTRL2, (1<<5)); |
@@ -206,7 +206,6 @@ void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf) | |||
206 | mod_timer(&q->timeout, jiffies+BUFFER_TIMEOUT); | 206 | mod_timer(&q->timeout, jiffies+BUFFER_TIMEOUT); |
207 | dprintk(0,"[%p/%d] %s - first active\n", | 207 | dprintk(0,"[%p/%d] %s - first active\n", |
208 | buf, buf->vb.i, __FUNCTION__); | 208 | buf, buf->vb.i, __FUNCTION__); |
209 | //udelay(100); | ||
210 | 209 | ||
211 | } else { | 210 | } else { |
212 | dprintk( 1, "queue is not empty - append to active\n" ); | 211 | dprintk( 1, "queue is not empty - append to active\n" ); |
@@ -217,7 +216,6 @@ void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf) | |||
217 | prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); | 216 | prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); |
218 | dprintk( 1, "[%p/%d] %s - append to active\n", | 217 | dprintk( 1, "[%p/%d] %s - append to active\n", |
219 | buf, buf->vb.i, __FUNCTION__); | 218 | buf, buf->vb.i, __FUNCTION__); |
220 | //udelay(100); | ||
221 | } | 219 | } |
222 | } | 220 | } |
223 | 221 | ||
@@ -387,7 +385,6 @@ int cx8802_init_common(struct cx8802_dev *dev) | |||
387 | dev->pci_lat,pci_resource_start(dev->pci,0)); | 385 | dev->pci_lat,pci_resource_start(dev->pci,0)); |
388 | 386 | ||
389 | /* initialize driver struct */ | 387 | /* initialize driver struct */ |
390 | init_MUTEX(&dev->lock); | ||
391 | spin_lock_init(&dev->slock); | 388 | spin_lock_init(&dev->slock); |
392 | 389 | ||
393 | /* init dma queue */ | 390 | /* init dma queue */ |
@@ -458,14 +455,28 @@ int cx8802_suspend_common(struct pci_dev *pci_dev, pm_message_t state) | |||
458 | 455 | ||
459 | int cx8802_resume_common(struct pci_dev *pci_dev) | 456 | int cx8802_resume_common(struct pci_dev *pci_dev) |
460 | { | 457 | { |
461 | struct cx8802_dev *dev = pci_get_drvdata(pci_dev); | 458 | struct cx8802_dev *dev = pci_get_drvdata(pci_dev); |
462 | struct cx88_core *core = dev->core; | 459 | struct cx88_core *core = dev->core; |
460 | int err; | ||
463 | 461 | ||
464 | if (dev->state.disabled) { | 462 | if (dev->state.disabled) { |
465 | pci_enable_device(pci_dev); | 463 | err=pci_enable_device(pci_dev); |
464 | if (err) { | ||
465 | printk(KERN_ERR "%s: can't enable device\n", | ||
466 | dev->core->name); | ||
467 | return err; | ||
468 | } | ||
466 | dev->state.disabled = 0; | 469 | dev->state.disabled = 0; |
467 | } | 470 | } |
468 | pci_set_power_state(pci_dev, PCI_D0); | 471 | err=pci_set_power_state(pci_dev, PCI_D0); |
472 | if (err) { | ||
473 | printk(KERN_ERR "%s: can't enable device\n", | ||
474 | dev->core->name); | ||
475 | pci_disable_device(pci_dev); | ||
476 | dev->state.disabled = 1; | ||
477 | |||
478 | return err; | ||
479 | } | ||
469 | pci_restore_state(pci_dev); | 480 | pci_restore_state(pci_dev); |
470 | 481 | ||
471 | /* FIXME: re-initialize hardware */ | 482 | /* FIXME: re-initialize hardware */ |
diff --git a/drivers/media/video/cx88/cx88-reg.h b/drivers/media/video/cx88/cx88-reg.h index 37f82662d265..0a3a62fc9bbb 100644 --- a/drivers/media/video/cx88/cx88-reg.h +++ b/drivers/media/video/cx88/cx88-reg.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | $Id: cx88-reg.h,v 1.8 2005/07/07 13:58:38 mchehab Exp $ | ||
3 | 2 | ||
4 | cx88x-hw.h - CX2388x register offsets | 3 | cx88x-hw.h - CX2388x register offsets |
5 | 4 | ||
@@ -40,6 +39,29 @@ | |||
40 | #define CX88X_EN_TBFX 0x02 | 39 | #define CX88X_EN_TBFX 0x02 |
41 | #define CX88X_EN_VSFX 0x04 | 40 | #define CX88X_EN_VSFX 0x04 |
42 | 41 | ||
42 | /* ---------------------------------------------------------------------- */ | ||
43 | /* PCI controller registers */ | ||
44 | |||
45 | /* Command and Status Register */ | ||
46 | #define F0_CMD_STAT_MM 0x2f0004 | ||
47 | #define F1_CMD_STAT_MM 0x2f0104 | ||
48 | #define F2_CMD_STAT_MM 0x2f0204 | ||
49 | #define F3_CMD_STAT_MM 0x2f0304 | ||
50 | #define F4_CMD_STAT_MM 0x2f0404 | ||
51 | |||
52 | /* Device Control #1 */ | ||
53 | #define F0_DEV_CNTRL1_MM 0x2f0040 | ||
54 | #define F1_DEV_CNTRL1_MM 0x2f0140 | ||
55 | #define F2_DEV_CNTRL1_MM 0x2f0240 | ||
56 | #define F3_DEV_CNTRL1_MM 0x2f0340 | ||
57 | #define F4_DEV_CNTRL1_MM 0x2f0440 | ||
58 | |||
59 | /* Device Control #1 */ | ||
60 | #define F0_BAR0_MM 0x2f0010 | ||
61 | #define F1_BAR0_MM 0x2f0110 | ||
62 | #define F2_BAR0_MM 0x2f0210 | ||
63 | #define F3_BAR0_MM 0x2f0310 | ||
64 | #define F4_BAR0_MM 0x2f0410 | ||
43 | 65 | ||
44 | /* ---------------------------------------------------------------------- */ | 66 | /* ---------------------------------------------------------------------- */ |
45 | /* DMA Controller registers */ | 67 | /* DMA Controller registers */ |
diff --git a/drivers/media/video/cx88/cx88-tvaudio.c b/drivers/media/video/cx88/cx88-tvaudio.c index 91207f10bae7..2765acee0285 100644 --- a/drivers/media/video/cx88/cx88-tvaudio.c +++ b/drivers/media/video/cx88/cx88-tvaudio.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | $Id: cx88-tvaudio.c,v 1.37 2005/07/07 13:58:38 mchehab Exp $ | ||
3 | 2 | ||
4 | cx88x-audio.c - Conexant CX23880/23881 audio downstream driver driver | 3 | cx88x-audio.c - Conexant CX23880/23881 audio downstream driver driver |
5 | 4 | ||
@@ -121,25 +120,19 @@ static void set_audio_registers(struct cx88_core *core, | |||
121 | } | 120 | } |
122 | 121 | ||
123 | static void set_audio_start(struct cx88_core *core, | 122 | static void set_audio_start(struct cx88_core *core, |
124 | u32 mode, u32 ctl) | 123 | u32 mode) |
125 | { | 124 | { |
126 | // mute | 125 | // mute |
127 | cx_write(AUD_VOL_CTL, (1 << 6)); | 126 | cx_write(AUD_VOL_CTL, (1 << 6)); |
128 | 127 | ||
129 | // increase level of input by 12dB | ||
130 | // cx_write(AUD_AFE_12DB_EN, 0x0001); | ||
131 | cx_write(AUD_AFE_12DB_EN, 0x0000); | ||
132 | |||
133 | // start programming | 128 | // start programming |
134 | cx_write(AUD_CTL, 0x0000); | 129 | cx_write(AUD_CTL, 0x0000); |
135 | cx_write(AUD_INIT, mode); | 130 | cx_write(AUD_INIT, mode); |
136 | cx_write(AUD_INIT_LD, 0x0001); | 131 | cx_write(AUD_INIT_LD, 0x0001); |
137 | cx_write(AUD_SOFT_RESET, 0x0001); | 132 | cx_write(AUD_SOFT_RESET, 0x0001); |
138 | |||
139 | cx_write(AUD_CTL, ctl); | ||
140 | } | 133 | } |
141 | 134 | ||
142 | static void set_audio_finish(struct cx88_core *core) | 135 | static void set_audio_finish(struct cx88_core *core, u32 ctl) |
143 | { | 136 | { |
144 | u32 volume; | 137 | u32 volume; |
145 | 138 | ||
@@ -154,25 +147,25 @@ static void set_audio_finish(struct cx88_core *core) | |||
154 | cx_write(AUD_I2SOUTPUTCNTL, 1); | 147 | cx_write(AUD_I2SOUTPUTCNTL, 1); |
155 | cx_write(AUD_I2SCNTL, 0); | 148 | cx_write(AUD_I2SCNTL, 0); |
156 | //cx_write(AUD_APB_IN_RATE_ADJ, 0); | 149 | //cx_write(AUD_APB_IN_RATE_ADJ, 0); |
150 | } else { | ||
151 | ctl |= EN_DAC_ENABLE; | ||
152 | cx_write(AUD_CTL, ctl); | ||
157 | } | 153 | } |
158 | 154 | ||
159 | // finish programming | 155 | /* finish programming */ |
160 | cx_write(AUD_SOFT_RESET, 0x0000); | 156 | cx_write(AUD_SOFT_RESET, 0x0000); |
161 | 157 | ||
162 | // start audio processing | 158 | /* unmute */ |
163 | cx_set(AUD_CTL, EN_DAC_ENABLE); | ||
164 | |||
165 | // unmute | ||
166 | volume = cx_sread(SHADOW_AUD_VOL_CTL); | 159 | volume = cx_sread(SHADOW_AUD_VOL_CTL); |
167 | cx_swrite(SHADOW_AUD_VOL_CTL, AUD_VOL_CTL, volume); | 160 | cx_swrite(SHADOW_AUD_VOL_CTL, AUD_VOL_CTL, volume); |
168 | } | 161 | } |
169 | 162 | ||
170 | /* ----------------------------------------------------------- */ | 163 | /* ----------------------------------------------------------- */ |
171 | 164 | ||
172 | static void set_audio_standard_BTSC(struct cx88_core *core, unsigned int sap) | 165 | static void set_audio_standard_BTSC(struct cx88_core *core, unsigned int sap, u32 mode) |
173 | { | 166 | { |
174 | static const struct rlist btsc[] = { | 167 | static const struct rlist btsc[] = { |
175 | /* from dscaler */ | 168 | { AUD_AFE_12DB_EN, 0x00000001 }, |
176 | { AUD_OUT1_SEL, 0x00000013 }, | 169 | { AUD_OUT1_SEL, 0x00000013 }, |
177 | { AUD_OUT1_SHIFT, 0x00000000 }, | 170 | { AUD_OUT1_SHIFT, 0x00000000 }, |
178 | { AUD_POLY0_DDS_CONSTANT, 0x0012010c }, | 171 | { AUD_POLY0_DDS_CONSTANT, 0x0012010c }, |
@@ -206,9 +199,10 @@ static void set_audio_standard_BTSC(struct cx88_core *core, unsigned int sap) | |||
206 | { AUD_RDSI_SHIFT, 0x00000000 }, | 199 | { AUD_RDSI_SHIFT, 0x00000000 }, |
207 | { AUD_RDSQ_SHIFT, 0x00000000 }, | 200 | { AUD_RDSQ_SHIFT, 0x00000000 }, |
208 | { AUD_POLYPH80SCALEFAC, 0x00000003 }, | 201 | { AUD_POLYPH80SCALEFAC, 0x00000003 }, |
209 | { /* end of list */ }, | 202 | { /* end of list */ }, |
210 | }; | 203 | }; |
211 | static const struct rlist btsc_sap[] = { | 204 | static const struct rlist btsc_sap[] = { |
205 | { AUD_AFE_12DB_EN, 0x00000001 }, | ||
212 | { AUD_DBX_IN_GAIN, 0x00007200 }, | 206 | { AUD_DBX_IN_GAIN, 0x00007200 }, |
213 | { AUD_DBX_WBE_GAIN, 0x00006200 }, | 207 | { AUD_DBX_WBE_GAIN, 0x00006200 }, |
214 | { AUD_DBX_SE_GAIN, 0x00006200 }, | 208 | { AUD_DBX_SE_GAIN, 0x00006200 }, |
@@ -259,371 +253,400 @@ static void set_audio_standard_BTSC(struct cx88_core *core, unsigned int sap) | |||
259 | { AUD_RDSI_SHIFT, 0x00000000 }, | 253 | { AUD_RDSI_SHIFT, 0x00000000 }, |
260 | { AUD_RDSQ_SHIFT, 0x00000000 }, | 254 | { AUD_RDSQ_SHIFT, 0x00000000 }, |
261 | { AUD_POLYPH80SCALEFAC, 0x00000003 }, | 255 | { AUD_POLYPH80SCALEFAC, 0x00000003 }, |
262 | { /* end of list */ }, | 256 | { /* end of list */ }, |
263 | }; | 257 | }; |
264 | 258 | ||
265 | // dscaler: exactly taken from driver, | 259 | mode |= EN_FMRADIO_EN_RDS; |
266 | // dscaler: don't know why to set EN_FMRADIO_EN_RDS | 260 | |
267 | if (sap) { | 261 | if (sap) { |
268 | dprintk("%s SAP (status: unknown)\n",__FUNCTION__); | 262 | dprintk("%s SAP (status: unknown)\n",__FUNCTION__); |
269 | set_audio_start(core, 0x0001, | 263 | set_audio_start(core, SEL_SAP); |
270 | EN_FMRADIO_EN_RDS | EN_BTSC_FORCE_SAP); | ||
271 | set_audio_registers(core, btsc_sap); | 264 | set_audio_registers(core, btsc_sap); |
265 | set_audio_finish(core, mode); | ||
272 | } else { | 266 | } else { |
273 | dprintk("%s (status: known-good)\n",__FUNCTION__); | 267 | dprintk("%s (status: known-good)\n",__FUNCTION__); |
274 | set_audio_start(core, 0x0001, | 268 | set_audio_start(core, SEL_BTSC); |
275 | EN_FMRADIO_EN_RDS | EN_BTSC_AUTO_STEREO); | ||
276 | set_audio_registers(core, btsc); | 269 | set_audio_registers(core, btsc); |
270 | set_audio_finish(core, mode); | ||
277 | } | 271 | } |
278 | set_audio_finish(core); | ||
279 | } | 272 | } |
280 | 273 | ||
281 | 274 | ||
282 | static void set_audio_standard_NICAM_L(struct cx88_core *core, int stereo) | 275 | static void set_audio_standard_NICAM_L(struct cx88_core *core, int stereo) |
283 | { | 276 | { |
284 | /* This is probably weird.. | 277 | /* This is probably weird.. |
285 | * Let's operate and find out. */ | 278 | * Let's operate and find out. */ |
286 | 279 | ||
287 | static const struct rlist nicam_l_mono[] = { | 280 | static const struct rlist nicam_l_mono[] = { |
288 | { AUD_ERRLOGPERIOD_R, 0x00000064 }, | 281 | { AUD_ERRLOGPERIOD_R, 0x00000064 }, |
289 | { AUD_ERRINTRPTTHSHLD1_R, 0x00000FFF }, | 282 | { AUD_ERRINTRPTTHSHLD1_R, 0x00000FFF }, |
290 | { AUD_ERRINTRPTTHSHLD2_R, 0x0000001F }, | 283 | { AUD_ERRINTRPTTHSHLD2_R, 0x0000001F }, |
291 | { AUD_ERRINTRPTTHSHLD3_R, 0x0000000F }, | 284 | { AUD_ERRINTRPTTHSHLD3_R, 0x0000000F }, |
292 | 285 | ||
293 | { AUD_PDF_DDS_CNST_BYTE2, 0x48 }, | 286 | { AUD_PDF_DDS_CNST_BYTE2, 0x48 }, |
294 | { AUD_PDF_DDS_CNST_BYTE1, 0x3D }, | 287 | { AUD_PDF_DDS_CNST_BYTE1, 0x3D }, |
295 | { AUD_QAM_MODE, 0x00 }, | 288 | { AUD_QAM_MODE, 0x00 }, |
296 | { AUD_PDF_DDS_CNST_BYTE0, 0xf5 }, | 289 | { AUD_PDF_DDS_CNST_BYTE0, 0xf5 }, |
297 | { AUD_PHACC_FREQ_8MSB, 0x3a }, | 290 | { AUD_PHACC_FREQ_8MSB, 0x3a }, |
298 | { AUD_PHACC_FREQ_8LSB, 0x4a }, | 291 | { AUD_PHACC_FREQ_8LSB, 0x4a }, |
299 | 292 | ||
300 | { AUD_DEEMPHGAIN_R, 0x6680 }, | 293 | { AUD_DEEMPHGAIN_R, 0x6680 }, |
301 | { AUD_DEEMPHNUMER1_R, 0x353DE }, | 294 | { AUD_DEEMPHNUMER1_R, 0x353DE }, |
302 | { AUD_DEEMPHNUMER2_R, 0x1B1 }, | 295 | { AUD_DEEMPHNUMER2_R, 0x1B1 }, |
303 | { AUD_DEEMPHDENOM1_R, 0x0F3D0 }, | 296 | { AUD_DEEMPHDENOM1_R, 0x0F3D0 }, |
304 | { AUD_DEEMPHDENOM2_R, 0x0 }, | 297 | { AUD_DEEMPHDENOM2_R, 0x0 }, |
305 | { AUD_FM_MODE_ENABLE, 0x7 }, | 298 | { AUD_FM_MODE_ENABLE, 0x7 }, |
306 | { AUD_POLYPH80SCALEFAC, 0x3 }, | 299 | { AUD_POLYPH80SCALEFAC, 0x3 }, |
307 | { AUD_AFE_12DB_EN, 0x1 }, | 300 | { AUD_AFE_12DB_EN, 0x1 }, |
308 | { AAGC_GAIN, 0x0 }, | 301 | { AAGC_GAIN, 0x0 }, |
309 | { AAGC_HYST, 0x18 }, | 302 | { AAGC_HYST, 0x18 }, |
310 | { AAGC_DEF, 0x20 }, | 303 | { AAGC_DEF, 0x20 }, |
311 | { AUD_DN0_FREQ, 0x0 }, | 304 | { AUD_DN0_FREQ, 0x0 }, |
312 | { AUD_POLY0_DDS_CONSTANT, 0x0E4DB2 }, | 305 | { AUD_POLY0_DDS_CONSTANT, 0x0E4DB2 }, |
313 | { AUD_DCOC_0_SRC, 0x21 }, | 306 | { AUD_DCOC_0_SRC, 0x21 }, |
314 | { AUD_IIR1_0_SEL, 0x0 }, | 307 | { AUD_IIR1_0_SEL, 0x0 }, |
315 | { AUD_IIR1_0_SHIFT, 0x7 }, | 308 | { AUD_IIR1_0_SHIFT, 0x7 }, |
316 | { AUD_IIR1_1_SEL, 0x2 }, | 309 | { AUD_IIR1_1_SEL, 0x2 }, |
317 | { AUD_IIR1_1_SHIFT, 0x0 }, | 310 | { AUD_IIR1_1_SHIFT, 0x0 }, |
318 | { AUD_DCOC_1_SRC, 0x3 }, | 311 | { AUD_DCOC_1_SRC, 0x3 }, |
319 | { AUD_DCOC1_SHIFT, 0x0 }, | 312 | { AUD_DCOC1_SHIFT, 0x0 }, |
320 | { AUD_DCOC_PASS_IN, 0x0 }, | 313 | { AUD_DCOC_PASS_IN, 0x0 }, |
321 | { AUD_IIR1_2_SEL, 0x23 }, | 314 | { AUD_IIR1_2_SEL, 0x23 }, |
322 | { AUD_IIR1_2_SHIFT, 0x0 }, | 315 | { AUD_IIR1_2_SHIFT, 0x0 }, |
323 | { AUD_IIR1_3_SEL, 0x4 }, | 316 | { AUD_IIR1_3_SEL, 0x4 }, |
324 | { AUD_IIR1_3_SHIFT, 0x7 }, | 317 | { AUD_IIR1_3_SHIFT, 0x7 }, |
325 | { AUD_IIR1_4_SEL, 0x5 }, | 318 | { AUD_IIR1_4_SEL, 0x5 }, |
326 | { AUD_IIR1_4_SHIFT, 0x7 }, | 319 | { AUD_IIR1_4_SHIFT, 0x7 }, |
327 | { AUD_IIR3_0_SEL, 0x7 }, | 320 | { AUD_IIR3_0_SEL, 0x7 }, |
328 | { AUD_IIR3_0_SHIFT, 0x0 }, | 321 | { AUD_IIR3_0_SHIFT, 0x0 }, |
329 | { AUD_DEEMPH0_SRC_SEL, 0x11 }, | 322 | { AUD_DEEMPH0_SRC_SEL, 0x11 }, |
330 | { AUD_DEEMPH0_SHIFT, 0x0 }, | 323 | { AUD_DEEMPH0_SHIFT, 0x0 }, |
331 | { AUD_DEEMPH0_G0, 0x7000 }, | 324 | { AUD_DEEMPH0_G0, 0x7000 }, |
332 | { AUD_DEEMPH0_A0, 0x0 }, | 325 | { AUD_DEEMPH0_A0, 0x0 }, |
333 | { AUD_DEEMPH0_B0, 0x0 }, | 326 | { AUD_DEEMPH0_B0, 0x0 }, |
334 | { AUD_DEEMPH0_A1, 0x0 }, | 327 | { AUD_DEEMPH0_A1, 0x0 }, |
335 | { AUD_DEEMPH0_B1, 0x0 }, | 328 | { AUD_DEEMPH0_B1, 0x0 }, |
336 | { AUD_DEEMPH1_SRC_SEL, 0x11 }, | 329 | { AUD_DEEMPH1_SRC_SEL, 0x11 }, |
337 | { AUD_DEEMPH1_SHIFT, 0x0 }, | 330 | { AUD_DEEMPH1_SHIFT, 0x0 }, |
338 | { AUD_DEEMPH1_G0, 0x7000 }, | 331 | { AUD_DEEMPH1_G0, 0x7000 }, |
339 | { AUD_DEEMPH1_A0, 0x0 }, | 332 | { AUD_DEEMPH1_A0, 0x0 }, |
340 | { AUD_DEEMPH1_B0, 0x0 }, | 333 | { AUD_DEEMPH1_B0, 0x0 }, |
341 | { AUD_DEEMPH1_A1, 0x0 }, | 334 | { AUD_DEEMPH1_A1, 0x0 }, |
342 | { AUD_DEEMPH1_B1, 0x0 }, | 335 | { AUD_DEEMPH1_B1, 0x0 }, |
343 | { AUD_OUT0_SEL, 0x3F }, | 336 | { AUD_OUT0_SEL, 0x3F }, |
344 | { AUD_OUT1_SEL, 0x3F }, | 337 | { AUD_OUT1_SEL, 0x3F }, |
345 | { AUD_DMD_RA_DDS, 0x0F5C285 }, | 338 | { AUD_DMD_RA_DDS, 0x0F5C285 }, |
346 | { AUD_PLL_INT, 0x1E }, | 339 | { AUD_PLL_INT, 0x1E }, |
347 | { AUD_PLL_DDS, 0x0 }, | 340 | { AUD_PLL_DDS, 0x0 }, |
348 | { AUD_PLL_FRAC, 0x0E542 }, | 341 | { AUD_PLL_FRAC, 0x0E542 }, |
349 | 342 | ||
350 | // setup QAM registers | 343 | // setup QAM registers |
351 | { AUD_RATE_ADJ1, 0x00000100 }, | 344 | { AUD_RATE_ADJ1, 0x00000100 }, |
352 | { AUD_RATE_ADJ2, 0x00000200 }, | 345 | { AUD_RATE_ADJ2, 0x00000200 }, |
353 | { AUD_RATE_ADJ3, 0x00000300 }, | 346 | { AUD_RATE_ADJ3, 0x00000300 }, |
354 | { AUD_RATE_ADJ4, 0x00000400 }, | 347 | { AUD_RATE_ADJ4, 0x00000400 }, |
355 | { AUD_RATE_ADJ5, 0x00000500 }, | 348 | { AUD_RATE_ADJ5, 0x00000500 }, |
356 | { AUD_RATE_THRES_DMD, 0x000000C0 }, | 349 | { AUD_RATE_THRES_DMD, 0x000000C0 }, |
357 | { /* end of list */ }, | 350 | { /* end of list */ }, |
358 | }; | 351 | }; |
359 | |||
360 | static const struct rlist nicam_l[] = { | ||
361 | // setup QAM registers | ||
362 | { AUD_RATE_ADJ1, 0x00000060 }, | ||
363 | { AUD_RATE_ADJ2, 0x000000F9 }, | ||
364 | { AUD_RATE_ADJ3, 0x000001CC }, | ||
365 | { AUD_RATE_ADJ4, 0x000002B3 }, | ||
366 | { AUD_RATE_ADJ5, 0x00000726 }, | ||
367 | { AUD_DEEMPHDENOM1_R, 0x0000F3D0 }, | ||
368 | { AUD_DEEMPHDENOM2_R, 0x00000000 }, | ||
369 | { AUD_ERRLOGPERIOD_R, 0x00000064 }, | ||
370 | { AUD_ERRINTRPTTHSHLD1_R, 0x00000FFF }, | ||
371 | { AUD_ERRINTRPTTHSHLD2_R, 0x0000001F }, | ||
372 | { AUD_ERRINTRPTTHSHLD3_R, 0x0000000F }, | ||
373 | { AUD_POLYPH80SCALEFAC, 0x00000003 }, | ||
374 | { AUD_DMD_RA_DDS, 0x00C00000 }, | ||
375 | { AUD_PLL_INT, 0x0000001E }, | ||
376 | { AUD_PLL_DDS, 0x00000000 }, | ||
377 | { AUD_PLL_FRAC, 0x0000E542 }, | ||
378 | { AUD_START_TIMER, 0x00000000 }, | ||
379 | { AUD_DEEMPHNUMER1_R, 0x000353DE }, | ||
380 | { AUD_DEEMPHNUMER2_R, 0x000001B1 }, | ||
381 | { AUD_PDF_DDS_CNST_BYTE2, 0x06 }, | ||
382 | { AUD_PDF_DDS_CNST_BYTE1, 0x82 }, | ||
383 | { AUD_QAM_MODE, 0x05 }, | ||
384 | { AUD_PDF_DDS_CNST_BYTE0, 0x12 }, | ||
385 | { AUD_PHACC_FREQ_8MSB, 0x34 }, | ||
386 | { AUD_PHACC_FREQ_8LSB, 0x4C }, | ||
387 | { AUD_DEEMPHGAIN_R, 0x00006680 }, | ||
388 | { AUD_RATE_THRES_DMD, 0x000000C0 }, | ||
389 | { /* end of list */ }, | ||
390 | } ; | ||
391 | dprintk("%s (status: devel), stereo : %d\n",__FUNCTION__,stereo); | ||
392 | |||
393 | if (!stereo) { | ||
394 | /* AM mono sound */ | ||
395 | set_audio_start(core, 0x0004, | ||
396 | 0x100c /* FIXME again */); | ||
397 | set_audio_registers(core, nicam_l_mono); | ||
398 | } else { | ||
399 | set_audio_start(core, 0x0010, | ||
400 | 0x1924 /* FIXME again */); | ||
401 | set_audio_registers(core, nicam_l); | ||
402 | } | ||
403 | set_audio_finish(core); | ||
404 | 352 | ||
353 | static const struct rlist nicam_l[] = { | ||
354 | // setup QAM registers | ||
355 | { AUD_RATE_ADJ1, 0x00000060 }, | ||
356 | { AUD_RATE_ADJ2, 0x000000F9 }, | ||
357 | { AUD_RATE_ADJ3, 0x000001CC }, | ||
358 | { AUD_RATE_ADJ4, 0x000002B3 }, | ||
359 | { AUD_RATE_ADJ5, 0x00000726 }, | ||
360 | { AUD_DEEMPHDENOM1_R, 0x0000F3D0 }, | ||
361 | { AUD_DEEMPHDENOM2_R, 0x00000000 }, | ||
362 | { AUD_ERRLOGPERIOD_R, 0x00000064 }, | ||
363 | { AUD_ERRINTRPTTHSHLD1_R, 0x00000FFF }, | ||
364 | { AUD_ERRINTRPTTHSHLD2_R, 0x0000001F }, | ||
365 | { AUD_ERRINTRPTTHSHLD3_R, 0x0000000F }, | ||
366 | { AUD_POLYPH80SCALEFAC, 0x00000003 }, | ||
367 | { AUD_DMD_RA_DDS, 0x00C00000 }, | ||
368 | { AUD_PLL_INT, 0x0000001E }, | ||
369 | { AUD_PLL_DDS, 0x00000000 }, | ||
370 | { AUD_PLL_FRAC, 0x0000E542 }, | ||
371 | { AUD_START_TIMER, 0x00000000 }, | ||
372 | { AUD_DEEMPHNUMER1_R, 0x000353DE }, | ||
373 | { AUD_DEEMPHNUMER2_R, 0x000001B1 }, | ||
374 | { AUD_PDF_DDS_CNST_BYTE2, 0x06 }, | ||
375 | { AUD_PDF_DDS_CNST_BYTE1, 0x82 }, | ||
376 | { AUD_QAM_MODE, 0x05 }, | ||
377 | { AUD_PDF_DDS_CNST_BYTE0, 0x12 }, | ||
378 | { AUD_PHACC_FREQ_8MSB, 0x34 }, | ||
379 | { AUD_PHACC_FREQ_8LSB, 0x4C }, | ||
380 | { AUD_DEEMPHGAIN_R, 0x00006680 }, | ||
381 | { AUD_RATE_THRES_DMD, 0x000000C0 }, | ||
382 | { /* end of list */ }, | ||
383 | } ; | ||
384 | dprintk("%s (status: devel), stereo : %d\n",__FUNCTION__,stereo); | ||
385 | |||
386 | if (!stereo) { | ||
387 | /* AM Mono */ | ||
388 | set_audio_start(core, SEL_A2); | ||
389 | set_audio_registers(core, nicam_l_mono); | ||
390 | set_audio_finish(core, EN_A2_FORCE_MONO1); | ||
391 | } else { | ||
392 | /* Nicam Stereo */ | ||
393 | set_audio_start(core, SEL_NICAM); | ||
394 | set_audio_registers(core, nicam_l); | ||
395 | set_audio_finish(core, 0x1924); /* FIXME */ | ||
396 | } | ||
405 | } | 397 | } |
406 | 398 | ||
407 | static void set_audio_standard_PAL_I(struct cx88_core *core, int stereo) | 399 | static void set_audio_standard_PAL_I(struct cx88_core *core, int stereo) |
408 | { | 400 | { |
409 | static const struct rlist pal_i_fm_mono[] = { | 401 | static const struct rlist pal_i_fm_mono[] = { |
410 | {AUD_ERRLOGPERIOD_R, 0x00000064}, | 402 | {AUD_ERRLOGPERIOD_R, 0x00000064}, |
411 | {AUD_ERRINTRPTTHSHLD1_R, 0x00000fff}, | 403 | {AUD_ERRINTRPTTHSHLD1_R, 0x00000fff}, |
412 | {AUD_ERRINTRPTTHSHLD2_R, 0x0000001f}, | 404 | {AUD_ERRINTRPTTHSHLD2_R, 0x0000001f}, |
413 | {AUD_ERRINTRPTTHSHLD3_R, 0x0000000f}, | 405 | {AUD_ERRINTRPTTHSHLD3_R, 0x0000000f}, |
414 | {AUD_PDF_DDS_CNST_BYTE2, 0x06}, | 406 | {AUD_PDF_DDS_CNST_BYTE2, 0x06}, |
415 | {AUD_PDF_DDS_CNST_BYTE1, 0x82}, | 407 | {AUD_PDF_DDS_CNST_BYTE1, 0x82}, |
416 | {AUD_PDF_DDS_CNST_BYTE0, 0x12}, | 408 | {AUD_PDF_DDS_CNST_BYTE0, 0x12}, |
417 | {AUD_QAM_MODE, 0x05}, | 409 | {AUD_QAM_MODE, 0x05}, |
418 | {AUD_PHACC_FREQ_8MSB, 0x3a}, | 410 | {AUD_PHACC_FREQ_8MSB, 0x3a}, |
419 | {AUD_PHACC_FREQ_8LSB, 0x93}, | 411 | {AUD_PHACC_FREQ_8LSB, 0x93}, |
420 | {AUD_DMD_RA_DDS, 0x002a4f2f}, | 412 | {AUD_DMD_RA_DDS, 0x002a4f2f}, |
421 | {AUD_PLL_INT, 0x0000001e}, | 413 | {AUD_PLL_INT, 0x0000001e}, |
422 | {AUD_PLL_DDS, 0x00000004}, | 414 | {AUD_PLL_DDS, 0x00000004}, |
423 | {AUD_PLL_FRAC, 0x0000e542}, | 415 | {AUD_PLL_FRAC, 0x0000e542}, |
424 | {AUD_RATE_ADJ1, 0x00000100}, | 416 | {AUD_RATE_ADJ1, 0x00000100}, |
425 | {AUD_RATE_ADJ2, 0x00000200}, | 417 | {AUD_RATE_ADJ2, 0x00000200}, |
426 | {AUD_RATE_ADJ3, 0x00000300}, | 418 | {AUD_RATE_ADJ3, 0x00000300}, |
427 | {AUD_RATE_ADJ4, 0x00000400}, | 419 | {AUD_RATE_ADJ4, 0x00000400}, |
428 | {AUD_RATE_ADJ5, 0x00000500}, | 420 | {AUD_RATE_ADJ5, 0x00000500}, |
429 | {AUD_THR_FR, 0x00000000}, | 421 | {AUD_THR_FR, 0x00000000}, |
430 | {AUD_PILOT_BQD_1_K0, 0x0000755b}, | 422 | {AUD_PILOT_BQD_1_K0, 0x0000755b}, |
431 | {AUD_PILOT_BQD_1_K1, 0x00551340}, | 423 | {AUD_PILOT_BQD_1_K1, 0x00551340}, |
432 | {AUD_PILOT_BQD_1_K2, 0x006d30be}, | 424 | {AUD_PILOT_BQD_1_K2, 0x006d30be}, |
433 | {AUD_PILOT_BQD_1_K3, 0xffd394af}, | 425 | {AUD_PILOT_BQD_1_K3, 0xffd394af}, |
434 | {AUD_PILOT_BQD_1_K4, 0x00400000}, | 426 | {AUD_PILOT_BQD_1_K4, 0x00400000}, |
435 | {AUD_PILOT_BQD_2_K0, 0x00040000}, | 427 | {AUD_PILOT_BQD_2_K0, 0x00040000}, |
436 | {AUD_PILOT_BQD_2_K1, 0x002a4841}, | 428 | {AUD_PILOT_BQD_2_K1, 0x002a4841}, |
437 | {AUD_PILOT_BQD_2_K2, 0x00400000}, | 429 | {AUD_PILOT_BQD_2_K2, 0x00400000}, |
438 | {AUD_PILOT_BQD_2_K3, 0x00000000}, | 430 | {AUD_PILOT_BQD_2_K3, 0x00000000}, |
439 | {AUD_PILOT_BQD_2_K4, 0x00000000}, | 431 | {AUD_PILOT_BQD_2_K4, 0x00000000}, |
440 | {AUD_MODE_CHG_TIMER, 0x00000060}, | 432 | {AUD_MODE_CHG_TIMER, 0x00000060}, |
441 | {AUD_AFE_12DB_EN, 0x00000001}, | 433 | {AUD_AFE_12DB_EN, 0x00000001}, |
442 | {AAGC_HYST, 0x0000000a}, | 434 | {AAGC_HYST, 0x0000000a}, |
443 | {AUD_CORDIC_SHIFT_0, 0x00000007}, | 435 | {AUD_CORDIC_SHIFT_0, 0x00000007}, |
444 | {AUD_CORDIC_SHIFT_1, 0x00000007}, | 436 | {AUD_CORDIC_SHIFT_1, 0x00000007}, |
445 | {AUD_C1_UP_THR, 0x00007000}, | 437 | {AUD_C1_UP_THR, 0x00007000}, |
446 | {AUD_C1_LO_THR, 0x00005400}, | 438 | {AUD_C1_LO_THR, 0x00005400}, |
447 | {AUD_C2_UP_THR, 0x00005400}, | 439 | {AUD_C2_UP_THR, 0x00005400}, |
448 | {AUD_C2_LO_THR, 0x00003000}, | 440 | {AUD_C2_LO_THR, 0x00003000}, |
449 | {AUD_DCOC_0_SRC, 0x0000001a}, | 441 | {AUD_DCOC_0_SRC, 0x0000001a}, |
450 | {AUD_DCOC0_SHIFT, 0x00000000}, | 442 | {AUD_DCOC0_SHIFT, 0x00000000}, |
451 | {AUD_DCOC_0_SHIFT_IN0, 0x0000000a}, | 443 | {AUD_DCOC_0_SHIFT_IN0, 0x0000000a}, |
452 | {AUD_DCOC_0_SHIFT_IN1, 0x00000008}, | 444 | {AUD_DCOC_0_SHIFT_IN1, 0x00000008}, |
453 | {AUD_DCOC_PASS_IN, 0x00000003}, | 445 | {AUD_DCOC_PASS_IN, 0x00000003}, |
454 | {AUD_IIR3_0_SEL, 0x00000021}, | 446 | {AUD_IIR3_0_SEL, 0x00000021}, |
455 | {AUD_DN2_AFC, 0x00000002}, | 447 | {AUD_DN2_AFC, 0x00000002}, |
456 | {AUD_DCOC_1_SRC, 0x0000001b}, | 448 | {AUD_DCOC_1_SRC, 0x0000001b}, |
457 | {AUD_DCOC1_SHIFT, 0x00000000}, | 449 | {AUD_DCOC1_SHIFT, 0x00000000}, |
458 | {AUD_DCOC_1_SHIFT_IN0, 0x0000000a}, | 450 | {AUD_DCOC_1_SHIFT_IN0, 0x0000000a}, |
459 | {AUD_DCOC_1_SHIFT_IN1, 0x00000008}, | 451 | {AUD_DCOC_1_SHIFT_IN1, 0x00000008}, |
460 | {AUD_IIR3_1_SEL, 0x00000023}, | 452 | {AUD_IIR3_1_SEL, 0x00000023}, |
461 | {AUD_DN0_FREQ, 0x000035a3}, | 453 | {AUD_DN0_FREQ, 0x000035a3}, |
462 | {AUD_DN2_FREQ, 0x000029c7}, | 454 | {AUD_DN2_FREQ, 0x000029c7}, |
463 | {AUD_CRDC0_SRC_SEL, 0x00000511}, | 455 | {AUD_CRDC0_SRC_SEL, 0x00000511}, |
464 | {AUD_IIR1_0_SEL, 0x00000001}, | 456 | {AUD_IIR1_0_SEL, 0x00000001}, |
465 | {AUD_IIR1_1_SEL, 0x00000000}, | 457 | {AUD_IIR1_1_SEL, 0x00000000}, |
466 | {AUD_IIR3_2_SEL, 0x00000003}, | 458 | {AUD_IIR3_2_SEL, 0x00000003}, |
467 | {AUD_IIR3_2_SHIFT, 0x00000000}, | 459 | {AUD_IIR3_2_SHIFT, 0x00000000}, |
468 | {AUD_IIR3_0_SEL, 0x00000002}, | 460 | {AUD_IIR3_0_SEL, 0x00000002}, |
469 | {AUD_IIR2_0_SEL, 0x00000021}, | 461 | {AUD_IIR2_0_SEL, 0x00000021}, |
470 | {AUD_IIR2_0_SHIFT, 0x00000002}, | 462 | {AUD_IIR2_0_SHIFT, 0x00000002}, |
471 | {AUD_DEEMPH0_SRC_SEL, 0x0000000b}, | 463 | {AUD_DEEMPH0_SRC_SEL, 0x0000000b}, |
472 | {AUD_DEEMPH1_SRC_SEL, 0x0000000b}, | 464 | {AUD_DEEMPH1_SRC_SEL, 0x0000000b}, |
473 | {AUD_POLYPH80SCALEFAC, 0x00000001}, | 465 | {AUD_POLYPH80SCALEFAC, 0x00000001}, |
474 | {AUD_START_TIMER, 0x00000000}, | 466 | {AUD_START_TIMER, 0x00000000}, |
475 | { /* end of list */ }, | 467 | { /* end of list */ }, |
476 | }; | 468 | }; |
477 | 469 | ||
478 | static const struct rlist pal_i_nicam[] = { | 470 | static const struct rlist pal_i_nicam[] = { |
479 | { AUD_RATE_ADJ1, 0x00000010 }, | 471 | { AUD_RATE_ADJ1, 0x00000010 }, |
480 | { AUD_RATE_ADJ2, 0x00000040 }, | 472 | { AUD_RATE_ADJ2, 0x00000040 }, |
481 | { AUD_RATE_ADJ3, 0x00000100 }, | 473 | { AUD_RATE_ADJ3, 0x00000100 }, |
482 | { AUD_RATE_ADJ4, 0x00000400 }, | 474 | { AUD_RATE_ADJ4, 0x00000400 }, |
483 | { AUD_RATE_ADJ5, 0x00001000 }, | 475 | { AUD_RATE_ADJ5, 0x00001000 }, |
484 | // { AUD_DMD_RA_DDS, 0x00c0d5ce }, | 476 | // { AUD_DMD_RA_DDS, 0x00c0d5ce }, |
485 | { AUD_DEEMPHGAIN_R, 0x000023c2 }, | 477 | { AUD_DEEMPHGAIN_R, 0x000023c2 }, |
486 | { AUD_DEEMPHNUMER1_R, 0x0002a7bc }, | 478 | { AUD_DEEMPHNUMER1_R, 0x0002a7bc }, |
487 | { AUD_DEEMPHNUMER2_R, 0x0003023e }, | 479 | { AUD_DEEMPHNUMER2_R, 0x0003023e }, |
488 | { AUD_DEEMPHDENOM1_R, 0x0000f3d0 }, | 480 | { AUD_DEEMPHDENOM1_R, 0x0000f3d0 }, |
489 | { AUD_DEEMPHDENOM2_R, 0x00000000 }, | 481 | { AUD_DEEMPHDENOM2_R, 0x00000000 }, |
490 | { AUD_DEEMPHDENOM2_R, 0x00000000 }, | 482 | { AUD_DEEMPHDENOM2_R, 0x00000000 }, |
491 | { AUD_ERRLOGPERIOD_R, 0x00000fff }, | 483 | { AUD_ERRLOGPERIOD_R, 0x00000fff }, |
492 | { AUD_ERRINTRPTTHSHLD1_R, 0x000003ff }, | 484 | { AUD_ERRINTRPTTHSHLD1_R, 0x000003ff }, |
493 | { AUD_ERRINTRPTTHSHLD2_R, 0x000000ff }, | 485 | { AUD_ERRINTRPTTHSHLD2_R, 0x000000ff }, |
494 | { AUD_ERRINTRPTTHSHLD3_R, 0x0000003f }, | 486 | { AUD_ERRINTRPTTHSHLD3_R, 0x0000003f }, |
495 | { AUD_POLYPH80SCALEFAC, 0x00000003 }, | 487 | { AUD_POLYPH80SCALEFAC, 0x00000003 }, |
496 | { AUD_PDF_DDS_CNST_BYTE2, 0x06 }, | 488 | { AUD_PDF_DDS_CNST_BYTE2, 0x06 }, |
497 | { AUD_PDF_DDS_CNST_BYTE1, 0x82 }, | 489 | { AUD_PDF_DDS_CNST_BYTE1, 0x82 }, |
498 | { AUD_PDF_DDS_CNST_BYTE0, 0x16 }, | 490 | { AUD_PDF_DDS_CNST_BYTE0, 0x16 }, |
499 | { AUD_QAM_MODE, 0x05 }, | 491 | { AUD_QAM_MODE, 0x05 }, |
500 | { AUD_PDF_DDS_CNST_BYTE0, 0x12 }, | 492 | { AUD_PDF_DDS_CNST_BYTE0, 0x12 }, |
501 | { AUD_PHACC_FREQ_8MSB, 0x3a }, | 493 | { AUD_PHACC_FREQ_8MSB, 0x3a }, |
502 | { AUD_PHACC_FREQ_8LSB, 0x93 }, | 494 | { AUD_PHACC_FREQ_8LSB, 0x93 }, |
503 | { /* end of list */ }, | 495 | { /* end of list */ }, |
504 | }; | 496 | }; |
505 | 497 | ||
506 | dprintk("%s (status: devel), stereo : %d\n",__FUNCTION__,stereo); | 498 | dprintk("%s (status: devel), stereo : %d\n",__FUNCTION__,stereo); |
507 | 499 | ||
508 | if (!stereo) { | 500 | if (!stereo) { |
509 | // FM mono | 501 | /* FM Mono */ |
510 | set_audio_start(core, 0x0004, EN_DMTRX_SUMDIFF | EN_A2_FORCE_MONO1); | 502 | set_audio_start(core, SEL_A2); |
511 | set_audio_registers(core, pal_i_fm_mono); | 503 | set_audio_registers(core, pal_i_fm_mono); |
512 | } else { | 504 | set_audio_finish(core, EN_DMTRX_SUMDIFF | EN_A2_FORCE_MONO1); |
513 | // Nicam Stereo | 505 | } else { |
514 | set_audio_start(core, 0x0010, EN_DMTRX_LR | EN_DMTRX_BYPASS | EN_NICAM_AUTO_STEREO); | 506 | /* Nicam Stereo */ |
507 | set_audio_start(core, SEL_NICAM); | ||
515 | set_audio_registers(core, pal_i_nicam); | 508 | set_audio_registers(core, pal_i_nicam); |
516 | } | 509 | set_audio_finish(core, EN_DMTRX_LR | EN_DMTRX_BYPASS | EN_NICAM_AUTO_STEREO); |
517 | set_audio_finish(core); | 510 | } |
518 | } | 511 | } |
519 | 512 | ||
520 | static void set_audio_standard_A2(struct cx88_core *core) | 513 | static void set_audio_standard_A2(struct cx88_core *core, u32 mode) |
521 | { | 514 | { |
522 | /* from dscaler cvs */ | ||
523 | static const struct rlist a2_common[] = { | 515 | static const struct rlist a2_common[] = { |
524 | { AUD_PDF_DDS_CNST_BYTE2, 0x06 }, | 516 | {AUD_ERRLOGPERIOD_R, 0x00000064}, |
525 | { AUD_PDF_DDS_CNST_BYTE1, 0x82 }, | 517 | {AUD_ERRINTRPTTHSHLD1_R, 0x00000fff}, |
526 | { AUD_PDF_DDS_CNST_BYTE0, 0x12 }, | 518 | {AUD_ERRINTRPTTHSHLD2_R, 0x0000001f}, |
527 | { AUD_QAM_MODE, 0x05 }, | 519 | {AUD_ERRINTRPTTHSHLD3_R, 0x0000000f}, |
528 | { AUD_PHACC_FREQ_8MSB, 0x34 }, | 520 | {AUD_PDF_DDS_CNST_BYTE2, 0x06}, |
529 | { AUD_PHACC_FREQ_8LSB, 0x4c }, | 521 | {AUD_PDF_DDS_CNST_BYTE1, 0x82}, |
530 | 522 | {AUD_PDF_DDS_CNST_BYTE0, 0x12}, | |
531 | { AUD_RATE_ADJ1, 0x00001000 }, | 523 | {AUD_QAM_MODE, 0x05}, |
532 | { AUD_RATE_ADJ2, 0x00002000 }, | 524 | {AUD_PHACC_FREQ_8MSB, 0x34}, |
533 | { AUD_RATE_ADJ3, 0x00003000 }, | 525 | {AUD_PHACC_FREQ_8LSB, 0x4c}, |
534 | { AUD_RATE_ADJ4, 0x00004000 }, | 526 | {AUD_RATE_ADJ1, 0x00000100}, |
535 | { AUD_RATE_ADJ5, 0x00005000 }, | 527 | {AUD_RATE_ADJ2, 0x00000200}, |
536 | { AUD_THR_FR, 0x00000000 }, | 528 | {AUD_RATE_ADJ3, 0x00000300}, |
537 | { AAGC_HYST, 0x0000001a }, | 529 | {AUD_RATE_ADJ4, 0x00000400}, |
538 | { AUD_PILOT_BQD_1_K0, 0x0000755b }, | 530 | {AUD_RATE_ADJ5, 0x00000500}, |
539 | { AUD_PILOT_BQD_1_K1, 0x00551340 }, | 531 | {AUD_THR_FR, 0x00000000}, |
540 | { AUD_PILOT_BQD_1_K2, 0x006d30be }, | 532 | {AAGC_HYST, 0x0000001a}, |
541 | { AUD_PILOT_BQD_1_K3, 0xffd394af }, | 533 | {AUD_PILOT_BQD_1_K0, 0x0000755b}, |
542 | { AUD_PILOT_BQD_1_K4, 0x00400000 }, | 534 | {AUD_PILOT_BQD_1_K1, 0x00551340}, |
543 | { AUD_PILOT_BQD_2_K0, 0x00040000 }, | 535 | {AUD_PILOT_BQD_1_K2, 0x006d30be}, |
544 | { AUD_PILOT_BQD_2_K1, 0x002a4841 }, | 536 | {AUD_PILOT_BQD_1_K3, 0xffd394af}, |
545 | { AUD_PILOT_BQD_2_K2, 0x00400000 }, | 537 | {AUD_PILOT_BQD_1_K4, 0x00400000}, |
546 | { AUD_PILOT_BQD_2_K3, 0x00000000 }, | 538 | {AUD_PILOT_BQD_2_K0, 0x00040000}, |
547 | { AUD_PILOT_BQD_2_K4, 0x00000000 }, | 539 | {AUD_PILOT_BQD_2_K1, 0x002a4841}, |
548 | { AUD_MODE_CHG_TIMER, 0x00000040 }, | 540 | {AUD_PILOT_BQD_2_K2, 0x00400000}, |
549 | { AUD_START_TIMER, 0x00000200 }, | 541 | {AUD_PILOT_BQD_2_K3, 0x00000000}, |
550 | { AUD_AFE_12DB_EN, 0x00000000 }, | 542 | {AUD_PILOT_BQD_2_K4, 0x00000000}, |
551 | { AUD_CORDIC_SHIFT_0, 0x00000007 }, | 543 | {AUD_MODE_CHG_TIMER, 0x00000040}, |
552 | { AUD_CORDIC_SHIFT_1, 0x00000007 }, | 544 | {AUD_AFE_12DB_EN, 0x00000001}, |
553 | { AUD_DEEMPH0_G0, 0x00000380 }, | 545 | {AUD_CORDIC_SHIFT_0, 0x00000007}, |
554 | { AUD_DEEMPH1_G0, 0x00000380 }, | 546 | {AUD_CORDIC_SHIFT_1, 0x00000007}, |
555 | { AUD_DCOC_0_SRC, 0x0000001a }, | 547 | {AUD_DEEMPH0_G0, 0x00000380}, |
556 | { AUD_DCOC0_SHIFT, 0x00000000 }, | 548 | {AUD_DEEMPH1_G0, 0x00000380}, |
557 | { AUD_DCOC_0_SHIFT_IN0, 0x0000000a }, | 549 | {AUD_DCOC_0_SRC, 0x0000001a}, |
558 | { AUD_DCOC_0_SHIFT_IN1, 0x00000008 }, | 550 | {AUD_DCOC0_SHIFT, 0x00000000}, |
559 | { AUD_DCOC_PASS_IN, 0x00000003 }, | 551 | {AUD_DCOC_0_SHIFT_IN0, 0x0000000a}, |
560 | { AUD_IIR3_0_SEL, 0x00000021 }, | 552 | {AUD_DCOC_0_SHIFT_IN1, 0x00000008}, |
561 | { AUD_DN2_AFC, 0x00000002 }, | 553 | {AUD_DCOC_PASS_IN, 0x00000003}, |
562 | { AUD_DCOC_1_SRC, 0x0000001b }, | 554 | {AUD_IIR3_0_SEL, 0x00000021}, |
563 | { AUD_DCOC1_SHIFT, 0x00000000 }, | 555 | {AUD_DN2_AFC, 0x00000002}, |
564 | { AUD_DCOC_1_SHIFT_IN0, 0x0000000a }, | 556 | {AUD_DCOC_1_SRC, 0x0000001b}, |
565 | { AUD_DCOC_1_SHIFT_IN1, 0x00000008 }, | 557 | {AUD_DCOC1_SHIFT, 0x00000000}, |
566 | { AUD_IIR3_1_SEL, 0x00000023 }, | 558 | {AUD_DCOC_1_SHIFT_IN0, 0x0000000a}, |
567 | { AUD_RDSI_SEL, 0x00000017 }, | 559 | {AUD_DCOC_1_SHIFT_IN1, 0x00000008}, |
568 | { AUD_RDSI_SHIFT, 0x00000000 }, | 560 | {AUD_IIR3_1_SEL, 0x00000023}, |
569 | { AUD_RDSQ_SEL, 0x00000017 }, | 561 | {AUD_RDSI_SEL, 0x00000017}, |
570 | { AUD_RDSQ_SHIFT, 0x00000000 }, | 562 | {AUD_RDSI_SHIFT, 0x00000000}, |
571 | { AUD_POLYPH80SCALEFAC, 0x00000001 }, | 563 | {AUD_RDSQ_SEL, 0x00000017}, |
564 | {AUD_RDSQ_SHIFT, 0x00000000}, | ||
565 | {AUD_PLL_INT, 0x0000001e}, | ||
566 | {AUD_PLL_DDS, 0x00000000}, | ||
567 | {AUD_PLL_FRAC, 0x0000e542}, | ||
568 | {AUD_POLYPH80SCALEFAC, 0x00000001}, | ||
569 | {AUD_START_TIMER, 0x00000000}, | ||
570 | { /* end of list */ }, | ||
571 | }; | ||
572 | 572 | ||
573 | static const struct rlist a2_bg[] = { | ||
574 | {AUD_DMD_RA_DDS, 0x002a4f2f}, | ||
575 | {AUD_C1_UP_THR, 0x00007000}, | ||
576 | {AUD_C1_LO_THR, 0x00005400}, | ||
577 | {AUD_C2_UP_THR, 0x00005400}, | ||
578 | {AUD_C2_LO_THR, 0x00003000}, | ||
573 | { /* end of list */ }, | 579 | { /* end of list */ }, |
574 | }; | 580 | }; |
575 | 581 | ||
576 | static const struct rlist a2_table1[] = { | 582 | static const struct rlist a2_dk[] = { |
577 | // PAL-BG | 583 | {AUD_DMD_RA_DDS, 0x002a4f2f}, |
578 | { AUD_DMD_RA_DDS, 0x002a73bd }, | 584 | {AUD_C1_UP_THR, 0x00007000}, |
579 | { AUD_C1_UP_THR, 0x00007000 }, | 585 | {AUD_C1_LO_THR, 0x00005400}, |
580 | { AUD_C1_LO_THR, 0x00005400 }, | 586 | {AUD_C2_UP_THR, 0x00005400}, |
581 | { AUD_C2_UP_THR, 0x00005400 }, | 587 | {AUD_C2_LO_THR, 0x00003000}, |
582 | { AUD_C2_LO_THR, 0x00003000 }, | 588 | {AUD_DN0_FREQ, 0x00003a1c}, |
589 | {AUD_DN2_FREQ, 0x0000d2e0}, | ||
583 | { /* end of list */ }, | 590 | { /* end of list */ }, |
584 | }; | 591 | }; |
585 | static const struct rlist a2_table2[] = { | 592 | /* unknown, probably NTSC-M */ |
586 | // PAL-DK | 593 | static const struct rlist a2_m[] = { |
587 | { AUD_DMD_RA_DDS, 0x002a73bd }, | 594 | {AUD_DMD_RA_DDS, 0x002a0425}, |
588 | { AUD_C1_UP_THR, 0x00007000 }, | 595 | {AUD_C1_UP_THR, 0x00003c00}, |
589 | { AUD_C1_LO_THR, 0x00005400 }, | 596 | {AUD_C1_LO_THR, 0x00003000}, |
590 | { AUD_C2_UP_THR, 0x00005400 }, | 597 | {AUD_C2_UP_THR, 0x00006000}, |
591 | { AUD_C2_LO_THR, 0x00003000 }, | 598 | {AUD_C2_LO_THR, 0x00003c00}, |
592 | { AUD_DN0_FREQ, 0x00003a1c }, | 599 | {AUD_DEEMPH0_A0, 0x00007a80}, |
593 | { AUD_DN2_FREQ, 0x0000d2e0 }, | 600 | {AUD_DEEMPH1_A0, 0x00007a80}, |
601 | {AUD_DEEMPH0_G0, 0x00001200}, | ||
602 | {AUD_DEEMPH1_G0, 0x00001200}, | ||
603 | {AUD_DN0_FREQ, 0x0000283b}, | ||
604 | {AUD_DN1_FREQ, 0x00003418}, | ||
605 | {AUD_DN2_FREQ, 0x000029c7}, | ||
606 | {AUD_POLY0_DDS_CONSTANT, 0x000a7540}, | ||
594 | { /* end of list */ }, | 607 | { /* end of list */ }, |
595 | }; | 608 | }; |
596 | static const struct rlist a2_table3[] = { | 609 | |
597 | // unknown, probably NTSC-M | 610 | static const struct rlist a2_deemph50[] = { |
598 | { AUD_DMD_RA_DDS, 0x002a2873 }, | 611 | {AUD_DEEMPH0_G0, 0x00000380}, |
599 | { AUD_C1_UP_THR, 0x00003c00 }, | 612 | {AUD_DEEMPH1_G0, 0x00000380}, |
600 | { AUD_C1_LO_THR, 0x00003000 }, | 613 | {AUD_DEEMPHGAIN_R, 0x000011e1}, |
601 | { AUD_C2_UP_THR, 0x00006000 }, | 614 | {AUD_DEEMPHNUMER1_R, 0x0002a7bc}, |
602 | { AUD_C2_LO_THR, 0x00003c00 }, | 615 | {AUD_DEEMPHNUMER2_R, 0x0003023c}, |
603 | { AUD_DN0_FREQ, 0x00002836 }, | 616 | { /* end of list */ }, |
604 | { AUD_DN1_FREQ, 0x00003418 }, | 617 | }; |
605 | { AUD_DN2_FREQ, 0x000029c7 }, | 618 | |
606 | { AUD_POLY0_DDS_CONSTANT, 0x000a7540 }, | 619 | static const struct rlist a2_deemph75[] = { |
620 | {AUD_DEEMPH0_G0, 0x00000480}, | ||
621 | {AUD_DEEMPH1_G0, 0x00000480}, | ||
622 | {AUD_DEEMPHGAIN_R, 0x00009000}, | ||
623 | {AUD_DEEMPHNUMER1_R, 0x000353de}, | ||
624 | {AUD_DEEMPHNUMER2_R, 0x000001b1}, | ||
607 | { /* end of list */ }, | 625 | { /* end of list */ }, |
608 | }; | 626 | }; |
609 | 627 | ||
610 | set_audio_start(core, 0x0004, EN_DMTRX_SUMDIFF | EN_A2_AUTO_STEREO); | 628 | set_audio_start(core, SEL_A2); |
611 | set_audio_registers(core, a2_common); | 629 | set_audio_registers(core, a2_common); |
612 | switch (core->tvaudio) { | 630 | switch (core->tvaudio) { |
613 | case WW_A2_BG: | 631 | case WW_A2_BG: |
614 | dprintk("%s PAL-BG A2 (status: known-good)\n",__FUNCTION__); | 632 | dprintk("%s PAL-BG A2 (status: known-good)\n",__FUNCTION__); |
615 | set_audio_registers(core, a2_table1); | 633 | set_audio_registers(core, a2_bg); |
634 | set_audio_registers(core, a2_deemph50); | ||
616 | break; | 635 | break; |
617 | case WW_A2_DK: | 636 | case WW_A2_DK: |
618 | dprintk("%s PAL-DK A2 (status: known-good)\n",__FUNCTION__); | 637 | dprintk("%s PAL-DK A2 (status: known-good)\n",__FUNCTION__); |
619 | set_audio_registers(core, a2_table2); | 638 | set_audio_registers(core, a2_dk); |
639 | set_audio_registers(core, a2_deemph50); | ||
620 | break; | 640 | break; |
621 | case WW_A2_M: | 641 | case WW_A2_M: |
622 | dprintk("%s NTSC-M A2 (status: unknown)\n",__FUNCTION__); | 642 | dprintk("%s NTSC-M A2 (status: unknown)\n",__FUNCTION__); |
623 | set_audio_registers(core, a2_table3); | 643 | set_audio_registers(core, a2_m); |
644 | set_audio_registers(core, a2_deemph75); | ||
624 | break; | 645 | break; |
625 | }; | 646 | }; |
626 | set_audio_finish(core); | 647 | |
648 | mode |= EN_FMRADIO_EN_RDS | EN_DMTRX_SUMDIFF; | ||
649 | set_audio_finish(core, mode); | ||
627 | } | 650 | } |
628 | 651 | ||
629 | static void set_audio_standard_EIAJ(struct cx88_core *core) | 652 | static void set_audio_standard_EIAJ(struct cx88_core *core) |
@@ -635,9 +658,9 @@ static void set_audio_standard_EIAJ(struct cx88_core *core) | |||
635 | }; | 658 | }; |
636 | dprintk("%s (status: unknown)\n",__FUNCTION__); | 659 | dprintk("%s (status: unknown)\n",__FUNCTION__); |
637 | 660 | ||
638 | set_audio_start(core, 0x0002, EN_EIAJ_AUTO_STEREO); | 661 | set_audio_start(core, SEL_EIAJ); |
639 | set_audio_registers(core, eiaj); | 662 | set_audio_registers(core, eiaj); |
640 | set_audio_finish(core); | 663 | set_audio_finish(core, EN_EIAJ_AUTO_STEREO); |
641 | } | 664 | } |
642 | 665 | ||
643 | static void set_audio_standard_FM(struct cx88_core *core, enum cx88_deemph_type deemph) | 666 | static void set_audio_standard_FM(struct cx88_core *core, enum cx88_deemph_type deemph) |
@@ -683,7 +706,7 @@ static void set_audio_standard_FM(struct cx88_core *core, enum cx88_deemph_type | |||
683 | }; | 706 | }; |
684 | 707 | ||
685 | dprintk("%s (status: unknown)\n",__FUNCTION__); | 708 | dprintk("%s (status: unknown)\n",__FUNCTION__); |
686 | set_audio_start(core, 0x0020, EN_FMRADIO_AUTO_STEREO); | 709 | set_audio_start(core, SEL_FMRADIO); |
687 | 710 | ||
688 | switch (deemph) | 711 | switch (deemph) |
689 | { | 712 | { |
@@ -700,7 +723,7 @@ static void set_audio_standard_FM(struct cx88_core *core, enum cx88_deemph_type | |||
700 | break; | 723 | break; |
701 | } | 724 | } |
702 | 725 | ||
703 | set_audio_finish(core); | 726 | set_audio_finish(core, EN_FMRADIO_AUTO_STEREO); |
704 | } | 727 | } |
705 | 728 | ||
706 | /* ----------------------------------------------------------- */ | 729 | /* ----------------------------------------------------------- */ |
@@ -709,7 +732,7 @@ void cx88_set_tvaudio(struct cx88_core *core) | |||
709 | { | 732 | { |
710 | switch (core->tvaudio) { | 733 | switch (core->tvaudio) { |
711 | case WW_BTSC: | 734 | case WW_BTSC: |
712 | set_audio_standard_BTSC(core,0); | 735 | set_audio_standard_BTSC(core, 0, EN_BTSC_AUTO_STEREO); |
713 | break; | 736 | break; |
714 | case WW_NICAM_BGDKL: | 737 | case WW_NICAM_BGDKL: |
715 | set_audio_standard_NICAM_L(core,0); | 738 | set_audio_standard_NICAM_L(core,0); |
@@ -720,7 +743,7 @@ void cx88_set_tvaudio(struct cx88_core *core) | |||
720 | case WW_A2_BG: | 743 | case WW_A2_BG: |
721 | case WW_A2_DK: | 744 | case WW_A2_DK: |
722 | case WW_A2_M: | 745 | case WW_A2_M: |
723 | set_audio_standard_A2(core); | 746 | set_audio_standard_A2(core, EN_A2_FORCE_MONO1); |
724 | break; | 747 | break; |
725 | case WW_EIAJ: | 748 | case WW_EIAJ: |
726 | set_audio_standard_EIAJ(core); | 749 | set_audio_standard_EIAJ(core); |
@@ -734,7 +757,7 @@ void cx88_set_tvaudio(struct cx88_core *core) | |||
734 | case WW_NONE: | 757 | case WW_NONE: |
735 | default: | 758 | default: |
736 | printk("%s/0: unknown tv audio mode [%d]\n", | 759 | printk("%s/0: unknown tv audio mode [%d]\n", |
737 | core->name, core->tvaudio); | 760 | core->name, core->tvaudio); |
738 | break; | 761 | break; |
739 | } | 762 | } |
740 | return; | 763 | return; |
@@ -769,6 +792,13 @@ void cx88_get_stereo(struct cx88_core *core, struct v4l2_tuner *t) | |||
769 | aud_ctl_names[cx_read(AUD_CTL) & 63]); | 792 | aud_ctl_names[cx_read(AUD_CTL) & 63]); |
770 | core->astat = reg; | 793 | core->astat = reg; |
771 | 794 | ||
795 | /* TODO | ||
796 | Reading from AUD_STATUS is not enough | ||
797 | for auto-detecting sap/dual-fm/nicam. | ||
798 | Add some code here later. | ||
799 | */ | ||
800 | |||
801 | # if 0 | ||
772 | t->capability = V4L2_TUNER_CAP_STEREO | V4L2_TUNER_CAP_SAP | | 802 | t->capability = V4L2_TUNER_CAP_STEREO | V4L2_TUNER_CAP_SAP | |
773 | V4L2_TUNER_CAP_LANG1 | V4L2_TUNER_CAP_LANG2; | 803 | V4L2_TUNER_CAP_LANG1 | V4L2_TUNER_CAP_LANG2; |
774 | t->rxsubchans = V4L2_TUNER_SUB_MONO; | 804 | t->rxsubchans = V4L2_TUNER_SUB_MONO; |
@@ -779,7 +809,7 @@ void cx88_get_stereo(struct cx88_core *core, struct v4l2_tuner *t) | |||
779 | t->capability = V4L2_TUNER_CAP_STEREO | | 809 | t->capability = V4L2_TUNER_CAP_STEREO | |
780 | V4L2_TUNER_CAP_SAP; | 810 | V4L2_TUNER_CAP_SAP; |
781 | t->rxsubchans = V4L2_TUNER_SUB_STEREO; | 811 | t->rxsubchans = V4L2_TUNER_SUB_STEREO; |
782 | if (1 == pilot) { | 812 | if (1 == pilot) { |
783 | /* SAP */ | 813 | /* SAP */ |
784 | t->rxsubchans |= V4L2_TUNER_SUB_SAP; | 814 | t->rxsubchans |= V4L2_TUNER_SUB_SAP; |
785 | } | 815 | } |
@@ -787,13 +817,13 @@ void cx88_get_stereo(struct cx88_core *core, struct v4l2_tuner *t) | |||
787 | case WW_A2_BG: | 817 | case WW_A2_BG: |
788 | case WW_A2_DK: | 818 | case WW_A2_DK: |
789 | case WW_A2_M: | 819 | case WW_A2_M: |
790 | if (1 == pilot) { | 820 | if (1 == pilot) { |
791 | /* stereo */ | 821 | /* stereo */ |
792 | t->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; | 822 | t->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; |
793 | if (0 == mode) | 823 | if (0 == mode) |
794 | t->audmode = V4L2_TUNER_MODE_STEREO; | 824 | t->audmode = V4L2_TUNER_MODE_STEREO; |
795 | } | 825 | } |
796 | if (2 == pilot) { | 826 | if (2 == pilot) { |
797 | /* dual language -- FIXME */ | 827 | /* dual language -- FIXME */ |
798 | t->rxsubchans = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2; | 828 | t->rxsubchans = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2; |
799 | t->audmode = V4L2_TUNER_MODE_LANG1; | 829 | t->audmode = V4L2_TUNER_MODE_LANG1; |
@@ -805,16 +835,17 @@ void cx88_get_stereo(struct cx88_core *core, struct v4l2_tuner *t) | |||
805 | t->rxsubchans |= V4L2_TUNER_SUB_STEREO; | 835 | t->rxsubchans |= V4L2_TUNER_SUB_STEREO; |
806 | } | 836 | } |
807 | break; | 837 | break; |
808 | case WW_SYSTEM_L_AM: | 838 | case WW_SYSTEM_L_AM: |
809 | if (0x0 == mode && !(cx_read(AUD_INIT) & 0x04)) { | 839 | if (0x0 == mode && !(cx_read(AUD_INIT) & 0x04)) { |
810 | t->audmode = V4L2_TUNER_MODE_STEREO; | 840 | t->audmode = V4L2_TUNER_MODE_STEREO; |
811 | t->rxsubchans |= V4L2_TUNER_SUB_STEREO; | 841 | t->rxsubchans |= V4L2_TUNER_SUB_STEREO; |
812 | } | 842 | } |
813 | break ; | 843 | break ; |
814 | default: | 844 | default: |
815 | /* nothing */ | 845 | /* nothing */ |
816 | break; | 846 | break; |
817 | } | 847 | } |
848 | # endif | ||
818 | return; | 849 | return; |
819 | } | 850 | } |
820 | 851 | ||
@@ -835,16 +866,16 @@ void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual) | |||
835 | case WW_BTSC: | 866 | case WW_BTSC: |
836 | switch (mode) { | 867 | switch (mode) { |
837 | case V4L2_TUNER_MODE_MONO: | 868 | case V4L2_TUNER_MODE_MONO: |
838 | ctl = EN_BTSC_FORCE_MONO; | 869 | set_audio_standard_BTSC(core, 0, EN_BTSC_FORCE_MONO); |
839 | mask = 0x3f; | ||
840 | break; | 870 | break; |
841 | case V4L2_TUNER_MODE_SAP: | 871 | case V4L2_TUNER_MODE_LANG1: |
842 | ctl = EN_BTSC_FORCE_SAP; | 872 | set_audio_standard_BTSC(core, 0, EN_BTSC_AUTO_STEREO); |
843 | mask = 0x3f; | 873 | break; |
874 | case V4L2_TUNER_MODE_LANG2: | ||
875 | set_audio_standard_BTSC(core, 1, EN_BTSC_FORCE_SAP); | ||
844 | break; | 876 | break; |
845 | case V4L2_TUNER_MODE_STEREO: | 877 | case V4L2_TUNER_MODE_STEREO: |
846 | ctl = EN_BTSC_AUTO_STEREO; | 878 | set_audio_standard_BTSC(core, 0, EN_BTSC_FORCE_STEREO); |
847 | mask = 0x3f; | ||
848 | break; | 879 | break; |
849 | } | 880 | } |
850 | break; | 881 | break; |
@@ -854,16 +885,13 @@ void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual) | |||
854 | switch (mode) { | 885 | switch (mode) { |
855 | case V4L2_TUNER_MODE_MONO: | 886 | case V4L2_TUNER_MODE_MONO: |
856 | case V4L2_TUNER_MODE_LANG1: | 887 | case V4L2_TUNER_MODE_LANG1: |
857 | ctl = EN_A2_FORCE_MONO1; | 888 | set_audio_standard_A2(core, EN_A2_FORCE_MONO1); |
858 | mask = 0x3f; | ||
859 | break; | 889 | break; |
860 | case V4L2_TUNER_MODE_LANG2: | 890 | case V4L2_TUNER_MODE_LANG2: |
861 | ctl = EN_A2_AUTO_MONO2; | 891 | set_audio_standard_A2(core, EN_A2_FORCE_MONO2); |
862 | mask = 0x3f; | ||
863 | break; | 892 | break; |
864 | case V4L2_TUNER_MODE_STEREO: | 893 | case V4L2_TUNER_MODE_STEREO: |
865 | ctl = EN_A2_AUTO_STEREO | EN_DMTRX_SUMR; | 894 | set_audio_standard_A2(core, EN_A2_FORCE_STEREO); |
866 | mask = 0x8bf; | ||
867 | break; | 895 | break; |
868 | } | 896 | } |
869 | break; | 897 | break; |
diff --git a/drivers/media/video/cx88/cx88-vbi.c b/drivers/media/video/cx88/cx88-vbi.c index 320d57888bbd..9bc6c8995581 100644 --- a/drivers/media/video/cx88/cx88-vbi.c +++ b/drivers/media/video/cx88/cx88-vbi.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88-vbi.c,v 1.17 2005/06/12 04:19:19 mchehab Exp $ | ||
3 | */ | 2 | */ |
4 | #include <linux/kernel.h> | 3 | #include <linux/kernel.h> |
5 | #include <linux/module.h> | 4 | #include <linux/module.h> |
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 5f58c103198a..3dbc074fb515 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88-video.c,v 1.82 2005/07/22 05:13:34 mkrufky Exp $ | ||
3 | * | 2 | * |
4 | * device driver for Conexant 2388x based TV cards | 3 | * device driver for Conexant 2388x based TV cards |
5 | * video4linux video interface | 4 | * video4linux video interface |
@@ -66,7 +65,7 @@ module_param(vid_limit,int,0644); | |||
66 | MODULE_PARM_DESC(vid_limit,"capture memory limit in megabytes"); | 65 | MODULE_PARM_DESC(vid_limit,"capture memory limit in megabytes"); |
67 | 66 | ||
68 | #define dprintk(level,fmt, arg...) if (video_debug >= level) \ | 67 | #define dprintk(level,fmt, arg...) if (video_debug >= level) \ |
69 | printk(KERN_DEBUG "%s/0: " fmt, dev->core->name , ## arg) | 68 | printk(KERN_DEBUG "%s/0: " fmt, core->name , ## arg) |
70 | 69 | ||
71 | /* ------------------------------------------------------------------ */ | 70 | /* ------------------------------------------------------------------ */ |
72 | 71 | ||
@@ -326,22 +325,23 @@ static const int CX8800_CTLS = ARRAY_SIZE(cx8800_ctls); | |||
326 | 325 | ||
327 | static int res_get(struct cx8800_dev *dev, struct cx8800_fh *fh, unsigned int bit) | 326 | static int res_get(struct cx8800_dev *dev, struct cx8800_fh *fh, unsigned int bit) |
328 | { | 327 | { |
328 | struct cx88_core *core = dev->core; | ||
329 | if (fh->resources & bit) | 329 | if (fh->resources & bit) |
330 | /* have it already allocated */ | 330 | /* have it already allocated */ |
331 | return 1; | 331 | return 1; |
332 | 332 | ||
333 | /* is it free? */ | 333 | /* is it free? */ |
334 | down(&dev->lock); | 334 | down(&core->lock); |
335 | if (dev->resources & bit) { | 335 | if (dev->resources & bit) { |
336 | /* no, someone else uses it */ | 336 | /* no, someone else uses it */ |
337 | up(&dev->lock); | 337 | up(&core->lock); |
338 | return 0; | 338 | return 0; |
339 | } | 339 | } |
340 | /* it's free, grab it */ | 340 | /* it's free, grab it */ |
341 | fh->resources |= bit; | 341 | fh->resources |= bit; |
342 | dev->resources |= bit; | 342 | dev->resources |= bit; |
343 | dprintk(1,"res: get %d\n",bit); | 343 | dprintk(1,"res: get %d\n",bit); |
344 | up(&dev->lock); | 344 | up(&core->lock); |
345 | return 1; | 345 | return 1; |
346 | } | 346 | } |
347 | 347 | ||
@@ -360,27 +360,29 @@ int res_locked(struct cx8800_dev *dev, unsigned int bit) | |||
360 | static | 360 | static |
361 | void res_free(struct cx8800_dev *dev, struct cx8800_fh *fh, unsigned int bits) | 361 | void res_free(struct cx8800_dev *dev, struct cx8800_fh *fh, unsigned int bits) |
362 | { | 362 | { |
363 | struct cx88_core *core = dev->core; | ||
363 | if ((fh->resources & bits) != bits) | 364 | if ((fh->resources & bits) != bits) |
364 | BUG(); | 365 | BUG(); |
365 | 366 | ||
366 | down(&dev->lock); | 367 | down(&core->lock); |
367 | fh->resources &= ~bits; | 368 | fh->resources &= ~bits; |
368 | dev->resources &= ~bits; | 369 | dev->resources &= ~bits; |
369 | dprintk(1,"res: put %d\n",bits); | 370 | dprintk(1,"res: put %d\n",bits); |
370 | up(&dev->lock); | 371 | up(&core->lock); |
371 | } | 372 | } |
372 | 373 | ||
373 | /* ------------------------------------------------------------------ */ | 374 | /* ------------------------------------------------------------------ */ |
374 | 375 | ||
375 | static int video_mux(struct cx8800_dev *dev, unsigned int input) | 376 | /* static int video_mux(struct cx8800_dev *dev, unsigned int input) */ |
377 | static int video_mux(struct cx88_core *core, unsigned int input) | ||
376 | { | 378 | { |
377 | struct cx88_core *core = dev->core; | 379 | /* struct cx88_core *core = dev->core; */ |
378 | 380 | ||
379 | dprintk(1,"video_mux: %d [vmux=%d,gpio=0x%x,0x%x,0x%x,0x%x]\n", | 381 | dprintk(1,"video_mux: %d [vmux=%d,gpio=0x%x,0x%x,0x%x,0x%x]\n", |
380 | input, INPUT(input)->vmux, | 382 | input, INPUT(input)->vmux, |
381 | INPUT(input)->gpio0,INPUT(input)->gpio1, | 383 | INPUT(input)->gpio0,INPUT(input)->gpio1, |
382 | INPUT(input)->gpio2,INPUT(input)->gpio3); | 384 | INPUT(input)->gpio2,INPUT(input)->gpio3); |
383 | dev->core->input = input; | 385 | core->input = input; |
384 | cx_andor(MO_INPUT_FORMAT, 0x03 << 14, INPUT(input)->vmux << 14); | 386 | cx_andor(MO_INPUT_FORMAT, 0x03 << 14, INPUT(input)->vmux << 14); |
385 | cx_write(MO_GP3_IO, INPUT(input)->gpio3); | 387 | cx_write(MO_GP3_IO, INPUT(input)->gpio3); |
386 | cx_write(MO_GP0_IO, INPUT(input)->gpio0); | 388 | cx_write(MO_GP0_IO, INPUT(input)->gpio0); |
@@ -413,9 +415,9 @@ static int start_video_dma(struct cx8800_dev *dev, | |||
413 | struct cx88_core *core = dev->core; | 415 | struct cx88_core *core = dev->core; |
414 | 416 | ||
415 | /* setup fifo + format */ | 417 | /* setup fifo + format */ |
416 | cx88_sram_channel_setup(dev->core, &cx88_sram_channels[SRAM_CH21], | 418 | cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH21], |
417 | buf->bpl, buf->risc.dma); | 419 | buf->bpl, buf->risc.dma); |
418 | cx88_set_scale(dev->core, buf->vb.width, buf->vb.height, buf->vb.field); | 420 | cx88_set_scale(core, buf->vb.width, buf->vb.height, buf->vb.field); |
419 | cx_write(MO_COLOR_CTRL, buf->fmt->cxformat | ColorFormatGamma); | 421 | cx_write(MO_COLOR_CTRL, buf->fmt->cxformat | ColorFormatGamma); |
420 | 422 | ||
421 | /* reset counter */ | 423 | /* reset counter */ |
@@ -424,6 +426,14 @@ static int start_video_dma(struct cx8800_dev *dev, | |||
424 | 426 | ||
425 | /* enable irqs */ | 427 | /* enable irqs */ |
426 | cx_set(MO_PCI_INTMSK, core->pci_irqmask | 0x01); | 428 | cx_set(MO_PCI_INTMSK, core->pci_irqmask | 0x01); |
429 | |||
430 | /* Enables corresponding bits at PCI_INT_STAT: | ||
431 | bits 0 to 4: video, audio, transport stream, VIP, Host | ||
432 | bit 7: timer | ||
433 | bits 8 and 9: DMA complete for: SRC, DST | ||
434 | bits 10 and 11: BERR signal asserted for RISC: RD, WR | ||
435 | bits 12 to 15: BERR signal asserted for: BRDG, SRC, DST, IPB | ||
436 | */ | ||
427 | cx_set(MO_VID_INTMSK, 0x0f0011); | 437 | cx_set(MO_VID_INTMSK, 0x0f0011); |
428 | 438 | ||
429 | /* enable capture */ | 439 | /* enable capture */ |
@@ -431,7 +441,7 @@ static int start_video_dma(struct cx8800_dev *dev, | |||
431 | 441 | ||
432 | /* start dma */ | 442 | /* start dma */ |
433 | cx_set(MO_DEV_CNTRL2, (1<<5)); | 443 | cx_set(MO_DEV_CNTRL2, (1<<5)); |
434 | cx_set(MO_VID_DMACNTRL, 0x11); | 444 | cx_set(MO_VID_DMACNTRL, 0x11); /* Planar Y and packed FIFO and RISC enable */ |
435 | 445 | ||
436 | return 0; | 446 | return 0; |
437 | } | 447 | } |
@@ -455,6 +465,7 @@ static int stop_video_dma(struct cx8800_dev *dev) | |||
455 | static int restart_video_queue(struct cx8800_dev *dev, | 465 | static int restart_video_queue(struct cx8800_dev *dev, |
456 | struct cx88_dmaqueue *q) | 466 | struct cx88_dmaqueue *q) |
457 | { | 467 | { |
468 | struct cx88_core *core = dev->core; | ||
458 | struct cx88_buffer *buf, *prev; | 469 | struct cx88_buffer *buf, *prev; |
459 | struct list_head *item; | 470 | struct list_head *item; |
460 | 471 | ||
@@ -524,12 +535,13 @@ buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, | |||
524 | { | 535 | { |
525 | struct cx8800_fh *fh = q->priv_data; | 536 | struct cx8800_fh *fh = q->priv_data; |
526 | struct cx8800_dev *dev = fh->dev; | 537 | struct cx8800_dev *dev = fh->dev; |
538 | struct cx88_core *core = dev->core; | ||
527 | struct cx88_buffer *buf = container_of(vb,struct cx88_buffer,vb); | 539 | struct cx88_buffer *buf = container_of(vb,struct cx88_buffer,vb); |
528 | int rc, init_buffer = 0; | 540 | int rc, init_buffer = 0; |
529 | 541 | ||
530 | BUG_ON(NULL == fh->fmt); | 542 | BUG_ON(NULL == fh->fmt); |
531 | if (fh->width < 48 || fh->width > norm_maxw(dev->core->tvnorm) || | 543 | if (fh->width < 48 || fh->width > norm_maxw(core->tvnorm) || |
532 | fh->height < 32 || fh->height > norm_maxh(dev->core->tvnorm)) | 544 | fh->height < 32 || fh->height > norm_maxh(core->tvnorm)) |
533 | return -EINVAL; | 545 | return -EINVAL; |
534 | buf->vb.size = (fh->width * fh->height * fh->fmt->depth) >> 3; | 546 | buf->vb.size = (fh->width * fh->height * fh->fmt->depth) >> 3; |
535 | if (0 != buf->vb.baddr && buf->vb.bsize < buf->vb.size) | 547 | if (0 != buf->vb.baddr && buf->vb.bsize < buf->vb.size) |
@@ -609,6 +621,7 @@ buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) | |||
609 | struct cx88_buffer *prev; | 621 | struct cx88_buffer *prev; |
610 | struct cx8800_fh *fh = vq->priv_data; | 622 | struct cx8800_fh *fh = vq->priv_data; |
611 | struct cx8800_dev *dev = fh->dev; | 623 | struct cx8800_dev *dev = fh->dev; |
624 | struct cx88_core *core = dev->core; | ||
612 | struct cx88_dmaqueue *q = &dev->vidq; | 625 | struct cx88_dmaqueue *q = &dev->vidq; |
613 | 626 | ||
614 | /* add jump to stopper */ | 627 | /* add jump to stopper */ |
@@ -701,6 +714,7 @@ static int video_open(struct inode *inode, struct file *file) | |||
701 | { | 714 | { |
702 | int minor = iminor(inode); | 715 | int minor = iminor(inode); |
703 | struct cx8800_dev *h,*dev = NULL; | 716 | struct cx8800_dev *h,*dev = NULL; |
717 | struct cx88_core *core; | ||
704 | struct cx8800_fh *fh; | 718 | struct cx8800_fh *fh; |
705 | struct list_head *list; | 719 | struct list_head *list; |
706 | enum v4l2_buf_type type = 0; | 720 | enum v4l2_buf_type type = 0; |
@@ -725,6 +739,8 @@ static int video_open(struct inode *inode, struct file *file) | |||
725 | if (NULL == dev) | 739 | if (NULL == dev) |
726 | return -ENODEV; | 740 | return -ENODEV; |
727 | 741 | ||
742 | core = dev->core; | ||
743 | |||
728 | dprintk(1,"open minor=%d radio=%d type=%s\n", | 744 | dprintk(1,"open minor=%d radio=%d type=%s\n", |
729 | minor,radio,v4l2_type_names[type]); | 745 | minor,radio,v4l2_type_names[type]); |
730 | 746 | ||
@@ -755,17 +771,16 @@ static int video_open(struct inode *inode, struct file *file) | |||
755 | fh); | 771 | fh); |
756 | 772 | ||
757 | if (fh->radio) { | 773 | if (fh->radio) { |
758 | struct cx88_core *core = dev->core; | ||
759 | int board = core->board; | 774 | int board = core->board; |
760 | dprintk(1,"video_open: setting radio device\n"); | 775 | dprintk(1,"video_open: setting radio device\n"); |
761 | cx_write(MO_GP3_IO, cx88_boards[board].radio.gpio3); | 776 | cx_write(MO_GP3_IO, cx88_boards[board].radio.gpio3); |
762 | cx_write(MO_GP0_IO, cx88_boards[board].radio.gpio0); | 777 | cx_write(MO_GP0_IO, cx88_boards[board].radio.gpio0); |
763 | cx_write(MO_GP1_IO, cx88_boards[board].radio.gpio1); | 778 | cx_write(MO_GP1_IO, cx88_boards[board].radio.gpio1); |
764 | cx_write(MO_GP2_IO, cx88_boards[board].radio.gpio2); | 779 | cx_write(MO_GP2_IO, cx88_boards[board].radio.gpio2); |
765 | dev->core->tvaudio = WW_FM; | 780 | core->tvaudio = WW_FM; |
766 | cx88_set_tvaudio(core); | 781 | cx88_set_tvaudio(core); |
767 | cx88_set_stereo(core,V4L2_TUNER_MODE_STEREO,1); | 782 | cx88_set_stereo(core,V4L2_TUNER_MODE_STEREO,1); |
768 | cx88_call_i2c_clients(dev->core,AUDC_SET_RADIO,NULL); | 783 | cx88_call_i2c_clients(core,AUDC_SET_RADIO,NULL); |
769 | } | 784 | } |
770 | 785 | ||
771 | return 0; | 786 | return 0; |
@@ -857,6 +872,9 @@ static int video_release(struct inode *inode, struct file *file) | |||
857 | videobuf_mmap_free(&fh->vbiq); | 872 | videobuf_mmap_free(&fh->vbiq); |
858 | file->private_data = NULL; | 873 | file->private_data = NULL; |
859 | kfree(fh); | 874 | kfree(fh); |
875 | |||
876 | cx88_call_i2c_clients (dev->core, TUNER_SET_STANDBY, NULL); | ||
877 | |||
860 | return 0; | 878 | return 0; |
861 | } | 879 | } |
862 | 880 | ||
@@ -870,9 +888,10 @@ video_mmap(struct file *file, struct vm_area_struct * vma) | |||
870 | 888 | ||
871 | /* ------------------------------------------------------------------ */ | 889 | /* ------------------------------------------------------------------ */ |
872 | 890 | ||
873 | static int get_control(struct cx8800_dev *dev, struct v4l2_control *ctl) | 891 | /* static int get_control(struct cx8800_dev *dev, struct v4l2_control *ctl) */ |
892 | static int get_control(struct cx88_core *core, struct v4l2_control *ctl) | ||
874 | { | 893 | { |
875 | struct cx88_core *core = dev->core; | 894 | /* struct cx88_core *core = dev->core; */ |
876 | struct cx88_ctrl *c = NULL; | 895 | struct cx88_ctrl *c = NULL; |
877 | u32 value; | 896 | u32 value; |
878 | int i; | 897 | int i; |
@@ -898,9 +917,10 @@ static int get_control(struct cx8800_dev *dev, struct v4l2_control *ctl) | |||
898 | return 0; | 917 | return 0; |
899 | } | 918 | } |
900 | 919 | ||
901 | static int set_control(struct cx8800_dev *dev, struct v4l2_control *ctl) | 920 | /* static int set_control(struct cx8800_dev *dev, struct v4l2_control *ctl) */ |
921 | static int set_control(struct cx88_core *core, struct v4l2_control *ctl) | ||
902 | { | 922 | { |
903 | struct cx88_core *core = dev->core; | 923 | /* struct cx88_core *core = dev->core; */ |
904 | struct cx88_ctrl *c = NULL; | 924 | struct cx88_ctrl *c = NULL; |
905 | u32 v_sat_value; | 925 | u32 v_sat_value; |
906 | u32 value; | 926 | u32 value; |
@@ -913,9 +933,9 @@ static int set_control(struct cx8800_dev *dev, struct v4l2_control *ctl) | |||
913 | return -EINVAL; | 933 | return -EINVAL; |
914 | 934 | ||
915 | if (ctl->value < c->v.minimum) | 935 | if (ctl->value < c->v.minimum) |
916 | return -ERANGE; | 936 | ctl->value = c->v.minimum; |
917 | if (ctl->value > c->v.maximum) | 937 | if (ctl->value > c->v.maximum) |
918 | return -ERANGE; | 938 | ctl->value = c->v.maximum; |
919 | switch (ctl->id) { | 939 | switch (ctl->id) { |
920 | case V4L2_CID_AUDIO_BALANCE: | 940 | case V4L2_CID_AUDIO_BALANCE: |
921 | value = (ctl->value < 0x40) ? (0x40 - ctl->value) : ctl->value; | 941 | value = (ctl->value < 0x40) ? (0x40 - ctl->value) : ctl->value; |
@@ -946,7 +966,8 @@ static int set_control(struct cx8800_dev *dev, struct v4l2_control *ctl) | |||
946 | return 0; | 966 | return 0; |
947 | } | 967 | } |
948 | 968 | ||
949 | static void init_controls(struct cx8800_dev *dev) | 969 | /* static void init_controls(struct cx8800_dev *dev) */ |
970 | static void init_controls(struct cx88_core *core) | ||
950 | { | 971 | { |
951 | static struct v4l2_control mute = { | 972 | static struct v4l2_control mute = { |
952 | .id = V4L2_CID_AUDIO_MUTE, | 973 | .id = V4L2_CID_AUDIO_MUTE, |
@@ -969,11 +990,11 @@ static void init_controls(struct cx8800_dev *dev) | |||
969 | .value = 0x80, | 990 | .value = 0x80, |
970 | }; | 991 | }; |
971 | 992 | ||
972 | set_control(dev,&mute); | 993 | set_control(core,&mute); |
973 | set_control(dev,&volume); | 994 | set_control(core,&volume); |
974 | set_control(dev,&hue); | 995 | set_control(core,&hue); |
975 | set_control(dev,&contrast); | 996 | set_control(core,&contrast); |
976 | set_control(dev,&brightness); | 997 | set_control(core,&brightness); |
977 | } | 998 | } |
978 | 999 | ||
979 | /* ------------------------------------------------------------------ */ | 1000 | /* ------------------------------------------------------------------ */ |
@@ -1004,6 +1025,8 @@ static int cx8800_g_fmt(struct cx8800_dev *dev, struct cx8800_fh *fh, | |||
1004 | static int cx8800_try_fmt(struct cx8800_dev *dev, struct cx8800_fh *fh, | 1025 | static int cx8800_try_fmt(struct cx8800_dev *dev, struct cx8800_fh *fh, |
1005 | struct v4l2_format *f) | 1026 | struct v4l2_format *f) |
1006 | { | 1027 | { |
1028 | struct cx88_core *core = dev->core; | ||
1029 | |||
1007 | switch (f->type) { | 1030 | switch (f->type) { |
1008 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: | 1031 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: |
1009 | { | 1032 | { |
@@ -1016,8 +1039,8 @@ static int cx8800_try_fmt(struct cx8800_dev *dev, struct cx8800_fh *fh, | |||
1016 | return -EINVAL; | 1039 | return -EINVAL; |
1017 | 1040 | ||
1018 | field = f->fmt.pix.field; | 1041 | field = f->fmt.pix.field; |
1019 | maxw = norm_maxw(dev->core->tvnorm); | 1042 | maxw = norm_maxw(core->tvnorm); |
1020 | maxh = norm_maxh(dev->core->tvnorm); | 1043 | maxh = norm_maxh(core->tvnorm); |
1021 | 1044 | ||
1022 | if (V4L2_FIELD_ANY == field) { | 1045 | if (V4L2_FIELD_ANY == field) { |
1023 | field = (f->fmt.pix.height > maxh/2) | 1046 | field = (f->fmt.pix.height > maxh/2) |
@@ -1101,12 +1124,14 @@ static int video_do_ioctl(struct inode *inode, struct file *file, | |||
1101 | if (video_debug > 1) | 1124 | if (video_debug > 1) |
1102 | cx88_print_ioctl(core->name,cmd); | 1125 | cx88_print_ioctl(core->name,cmd); |
1103 | switch (cmd) { | 1126 | switch (cmd) { |
1127 | |||
1128 | /* --- capabilities ------------------------------------------ */ | ||
1104 | case VIDIOC_QUERYCAP: | 1129 | case VIDIOC_QUERYCAP: |
1105 | { | 1130 | { |
1106 | struct v4l2_capability *cap = arg; | 1131 | struct v4l2_capability *cap = arg; |
1107 | 1132 | ||
1108 | memset(cap,0,sizeof(*cap)); | 1133 | memset(cap,0,sizeof(*cap)); |
1109 | strcpy(cap->driver, "cx8800"); | 1134 | strcpy(cap->driver, "cx8800"); |
1110 | strlcpy(cap->card, cx88_boards[core->board].name, | 1135 | strlcpy(cap->card, cx88_boards[core->board].name, |
1111 | sizeof(cap->card)); | 1136 | sizeof(cap->card)); |
1112 | sprintf(cap->bus_info,"PCI:%s",pci_name(dev->pci)); | 1137 | sprintf(cap->bus_info,"PCI:%s",pci_name(dev->pci)); |
@@ -1116,12 +1141,128 @@ static int video_do_ioctl(struct inode *inode, struct file *file, | |||
1116 | V4L2_CAP_READWRITE | | 1141 | V4L2_CAP_READWRITE | |
1117 | V4L2_CAP_STREAMING | | 1142 | V4L2_CAP_STREAMING | |
1118 | V4L2_CAP_VBI_CAPTURE | | 1143 | V4L2_CAP_VBI_CAPTURE | |
1144 | V4L2_CAP_VIDEO_OVERLAY | | ||
1119 | 0; | 1145 | 0; |
1120 | if (UNSET != core->tuner_type) | 1146 | if (UNSET != core->tuner_type) |
1121 | cap->capabilities |= V4L2_CAP_TUNER; | 1147 | cap->capabilities |= V4L2_CAP_TUNER; |
1122 | return 0; | 1148 | return 0; |
1123 | } | 1149 | } |
1124 | 1150 | ||
1151 | /* --- capture ioctls ---------------------------------------- */ | ||
1152 | case VIDIOC_ENUM_FMT: | ||
1153 | { | ||
1154 | struct v4l2_fmtdesc *f = arg; | ||
1155 | enum v4l2_buf_type type; | ||
1156 | unsigned int index; | ||
1157 | |||
1158 | index = f->index; | ||
1159 | type = f->type; | ||
1160 | switch (type) { | ||
1161 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: | ||
1162 | if (index >= ARRAY_SIZE(formats)) | ||
1163 | return -EINVAL; | ||
1164 | memset(f,0,sizeof(*f)); | ||
1165 | f->index = index; | ||
1166 | f->type = type; | ||
1167 | strlcpy(f->description,formats[index].name,sizeof(f->description)); | ||
1168 | f->pixelformat = formats[index].fourcc; | ||
1169 | break; | ||
1170 | default: | ||
1171 | return -EINVAL; | ||
1172 | } | ||
1173 | return 0; | ||
1174 | } | ||
1175 | case VIDIOC_G_FMT: | ||
1176 | { | ||
1177 | struct v4l2_format *f = arg; | ||
1178 | return cx8800_g_fmt(dev,fh,f); | ||
1179 | } | ||
1180 | case VIDIOC_S_FMT: | ||
1181 | { | ||
1182 | struct v4l2_format *f = arg; | ||
1183 | return cx8800_s_fmt(dev,fh,f); | ||
1184 | } | ||
1185 | case VIDIOC_TRY_FMT: | ||
1186 | { | ||
1187 | struct v4l2_format *f = arg; | ||
1188 | return cx8800_try_fmt(dev,fh,f); | ||
1189 | } | ||
1190 | |||
1191 | /* --- streaming capture ------------------------------------- */ | ||
1192 | case VIDIOCGMBUF: | ||
1193 | { | ||
1194 | struct video_mbuf *mbuf = arg; | ||
1195 | struct videobuf_queue *q; | ||
1196 | struct v4l2_requestbuffers req; | ||
1197 | unsigned int i; | ||
1198 | |||
1199 | q = get_queue(fh); | ||
1200 | memset(&req,0,sizeof(req)); | ||
1201 | req.type = q->type; | ||
1202 | req.count = 8; | ||
1203 | req.memory = V4L2_MEMORY_MMAP; | ||
1204 | err = videobuf_reqbufs(q,&req); | ||
1205 | if (err < 0) | ||
1206 | return err; | ||
1207 | memset(mbuf,0,sizeof(*mbuf)); | ||
1208 | mbuf->frames = req.count; | ||
1209 | mbuf->size = 0; | ||
1210 | for (i = 0; i < mbuf->frames; i++) { | ||
1211 | mbuf->offsets[i] = q->bufs[i]->boff; | ||
1212 | mbuf->size += q->bufs[i]->bsize; | ||
1213 | } | ||
1214 | return 0; | ||
1215 | } | ||
1216 | case VIDIOC_REQBUFS: | ||
1217 | return videobuf_reqbufs(get_queue(fh), arg); | ||
1218 | |||
1219 | case VIDIOC_QUERYBUF: | ||
1220 | return videobuf_querybuf(get_queue(fh), arg); | ||
1221 | |||
1222 | case VIDIOC_QBUF: | ||
1223 | return videobuf_qbuf(get_queue(fh), arg); | ||
1224 | |||
1225 | case VIDIOC_DQBUF: | ||
1226 | return videobuf_dqbuf(get_queue(fh), arg, | ||
1227 | file->f_flags & O_NONBLOCK); | ||
1228 | |||
1229 | case VIDIOC_STREAMON: | ||
1230 | { | ||
1231 | int res = get_ressource(fh); | ||
1232 | |||
1233 | if (!res_get(dev,fh,res)) | ||
1234 | return -EBUSY; | ||
1235 | return videobuf_streamon(get_queue(fh)); | ||
1236 | } | ||
1237 | case VIDIOC_STREAMOFF: | ||
1238 | { | ||
1239 | int res = get_ressource(fh); | ||
1240 | |||
1241 | err = videobuf_streamoff(get_queue(fh)); | ||
1242 | if (err < 0) | ||
1243 | return err; | ||
1244 | res_free(dev,fh,res); | ||
1245 | return 0; | ||
1246 | } | ||
1247 | |||
1248 | default: | ||
1249 | return cx88_do_ioctl( inode, file, fh->radio, core, cmd, arg, video_do_ioctl ); | ||
1250 | } | ||
1251 | return 0; | ||
1252 | } | ||
1253 | |||
1254 | int cx88_do_ioctl(struct inode *inode, struct file *file, int radio, | ||
1255 | struct cx88_core *core, unsigned int cmd, void *arg, v4l2_kioctl driver_ioctl) | ||
1256 | { | ||
1257 | int err; | ||
1258 | |||
1259 | if (video_debug > 1) | ||
1260 | cx88_print_ioctl(core->name,cmd); | ||
1261 | printk( KERN_INFO "CORE IOCTL: 0x%x\n", cmd ); | ||
1262 | cx88_print_ioctl(core->name,cmd); | ||
1263 | dprintk( 1, "CORE IOCTL: 0x%x\n", cmd ); | ||
1264 | |||
1265 | switch (cmd) { | ||
1125 | /* ---------- tv norms ---------- */ | 1266 | /* ---------- tv norms ---------- */ |
1126 | case VIDIOC_ENUMSTD: | 1267 | case VIDIOC_ENUMSTD: |
1127 | { | 1268 | { |
@@ -1156,9 +1297,9 @@ static int video_do_ioctl(struct inode *inode, struct file *file, | |||
1156 | if (i == ARRAY_SIZE(tvnorms)) | 1297 | if (i == ARRAY_SIZE(tvnorms)) |
1157 | return -EINVAL; | 1298 | return -EINVAL; |
1158 | 1299 | ||
1159 | down(&dev->lock); | 1300 | down(&core->lock); |
1160 | cx88_set_tvnorm(dev->core,&tvnorms[i]); | 1301 | cx88_set_tvnorm(core,&tvnorms[i]); |
1161 | up(&dev->lock); | 1302 | up(&core->lock); |
1162 | return 0; | 1303 | return 0; |
1163 | } | 1304 | } |
1164 | 1305 | ||
@@ -1199,7 +1340,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file, | |||
1199 | { | 1340 | { |
1200 | unsigned int *i = arg; | 1341 | unsigned int *i = arg; |
1201 | 1342 | ||
1202 | *i = dev->core->input; | 1343 | *i = core->input; |
1203 | return 0; | 1344 | return 0; |
1204 | } | 1345 | } |
1205 | case VIDIOC_S_INPUT: | 1346 | case VIDIOC_S_INPUT: |
@@ -1208,55 +1349,15 @@ static int video_do_ioctl(struct inode *inode, struct file *file, | |||
1208 | 1349 | ||
1209 | if (*i >= 4) | 1350 | if (*i >= 4) |
1210 | return -EINVAL; | 1351 | return -EINVAL; |
1211 | down(&dev->lock); | 1352 | down(&core->lock); |
1212 | cx88_newstation(core); | 1353 | cx88_newstation(core); |
1213 | video_mux(dev,*i); | 1354 | video_mux(core,*i); |
1214 | up(&dev->lock); | 1355 | up(&core->lock); |
1215 | return 0; | 1356 | return 0; |
1216 | } | 1357 | } |
1217 | 1358 | ||
1218 | 1359 | ||
1219 | 1360 | ||
1220 | /* --- capture ioctls ---------------------------------------- */ | ||
1221 | case VIDIOC_ENUM_FMT: | ||
1222 | { | ||
1223 | struct v4l2_fmtdesc *f = arg; | ||
1224 | enum v4l2_buf_type type; | ||
1225 | unsigned int index; | ||
1226 | |||
1227 | index = f->index; | ||
1228 | type = f->type; | ||
1229 | switch (type) { | ||
1230 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: | ||
1231 | if (index >= ARRAY_SIZE(formats)) | ||
1232 | return -EINVAL; | ||
1233 | memset(f,0,sizeof(*f)); | ||
1234 | f->index = index; | ||
1235 | f->type = type; | ||
1236 | strlcpy(f->description,formats[index].name,sizeof(f->description)); | ||
1237 | f->pixelformat = formats[index].fourcc; | ||
1238 | break; | ||
1239 | default: | ||
1240 | return -EINVAL; | ||
1241 | } | ||
1242 | return 0; | ||
1243 | } | ||
1244 | case VIDIOC_G_FMT: | ||
1245 | { | ||
1246 | struct v4l2_format *f = arg; | ||
1247 | return cx8800_g_fmt(dev,fh,f); | ||
1248 | } | ||
1249 | case VIDIOC_S_FMT: | ||
1250 | { | ||
1251 | struct v4l2_format *f = arg; | ||
1252 | return cx8800_s_fmt(dev,fh,f); | ||
1253 | } | ||
1254 | case VIDIOC_TRY_FMT: | ||
1255 | { | ||
1256 | struct v4l2_format *f = arg; | ||
1257 | return cx8800_try_fmt(dev,fh,f); | ||
1258 | } | ||
1259 | |||
1260 | /* --- controls ---------------------------------------------- */ | 1361 | /* --- controls ---------------------------------------------- */ |
1261 | case VIDIOC_QUERYCTRL: | 1362 | case VIDIOC_QUERYCTRL: |
1262 | { | 1363 | { |
@@ -1277,9 +1378,9 @@ static int video_do_ioctl(struct inode *inode, struct file *file, | |||
1277 | return 0; | 1378 | return 0; |
1278 | } | 1379 | } |
1279 | case VIDIOC_G_CTRL: | 1380 | case VIDIOC_G_CTRL: |
1280 | return get_control(dev,arg); | 1381 | return get_control(core,arg); |
1281 | case VIDIOC_S_CTRL: | 1382 | case VIDIOC_S_CTRL: |
1282 | return set_control(dev,arg); | 1383 | return set_control(core,arg); |
1283 | 1384 | ||
1284 | /* --- tuner ioctls ------------------------------------------ */ | 1385 | /* --- tuner ioctls ------------------------------------------ */ |
1285 | case VIDIOC_G_TUNER: | 1386 | case VIDIOC_G_TUNER: |
@@ -1323,10 +1424,11 @@ static int video_do_ioctl(struct inode *inode, struct file *file, | |||
1323 | if (UNSET == core->tuner_type) | 1424 | if (UNSET == core->tuner_type) |
1324 | return -EINVAL; | 1425 | return -EINVAL; |
1325 | 1426 | ||
1326 | f->type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; | 1427 | /* f->type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; */ |
1327 | f->frequency = dev->freq; | 1428 | f->type = radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; |
1429 | f->frequency = core->freq; | ||
1328 | 1430 | ||
1329 | cx88_call_i2c_clients(dev->core,VIDIOC_G_FREQUENCY,f); | 1431 | cx88_call_i2c_clients(core,VIDIOC_G_FREQUENCY,f); |
1330 | 1432 | ||
1331 | return 0; | 1433 | return 0; |
1332 | } | 1434 | } |
@@ -1338,83 +1440,26 @@ static int video_do_ioctl(struct inode *inode, struct file *file, | |||
1338 | return -EINVAL; | 1440 | return -EINVAL; |
1339 | if (f->tuner != 0) | 1441 | if (f->tuner != 0) |
1340 | return -EINVAL; | 1442 | return -EINVAL; |
1341 | if (0 == fh->radio && f->type != V4L2_TUNER_ANALOG_TV) | 1443 | if (0 == radio && f->type != V4L2_TUNER_ANALOG_TV) |
1342 | return -EINVAL; | 1444 | return -EINVAL; |
1343 | if (1 == fh->radio && f->type != V4L2_TUNER_RADIO) | 1445 | if (1 == radio && f->type != V4L2_TUNER_RADIO) |
1344 | return -EINVAL; | 1446 | return -EINVAL; |
1345 | down(&dev->lock); | 1447 | down(&core->lock); |
1346 | dev->freq = f->frequency; | 1448 | core->freq = f->frequency; |
1347 | cx88_newstation(core); | 1449 | cx88_newstation(core); |
1348 | cx88_call_i2c_clients(dev->core,VIDIOC_S_FREQUENCY,f); | 1450 | cx88_call_i2c_clients(core,VIDIOC_S_FREQUENCY,f); |
1349 | 1451 | ||
1350 | /* When changing channels it is required to reset TVAUDIO */ | 1452 | /* When changing channels it is required to reset TVAUDIO */ |
1351 | msleep (10); | 1453 | msleep (10); |
1352 | cx88_set_tvaudio(core); | 1454 | cx88_set_tvaudio(core); |
1353 | 1455 | ||
1354 | up(&dev->lock); | 1456 | up(&core->lock); |
1355 | return 0; | ||
1356 | } | ||
1357 | |||
1358 | /* --- streaming capture ------------------------------------- */ | ||
1359 | case VIDIOCGMBUF: | ||
1360 | { | ||
1361 | struct video_mbuf *mbuf = arg; | ||
1362 | struct videobuf_queue *q; | ||
1363 | struct v4l2_requestbuffers req; | ||
1364 | unsigned int i; | ||
1365 | |||
1366 | q = get_queue(fh); | ||
1367 | memset(&req,0,sizeof(req)); | ||
1368 | req.type = q->type; | ||
1369 | req.count = 8; | ||
1370 | req.memory = V4L2_MEMORY_MMAP; | ||
1371 | err = videobuf_reqbufs(q,&req); | ||
1372 | if (err < 0) | ||
1373 | return err; | ||
1374 | memset(mbuf,0,sizeof(*mbuf)); | ||
1375 | mbuf->frames = req.count; | ||
1376 | mbuf->size = 0; | ||
1377 | for (i = 0; i < mbuf->frames; i++) { | ||
1378 | mbuf->offsets[i] = q->bufs[i]->boff; | ||
1379 | mbuf->size += q->bufs[i]->bsize; | ||
1380 | } | ||
1381 | return 0; | ||
1382 | } | ||
1383 | case VIDIOC_REQBUFS: | ||
1384 | return videobuf_reqbufs(get_queue(fh), arg); | ||
1385 | |||
1386 | case VIDIOC_QUERYBUF: | ||
1387 | return videobuf_querybuf(get_queue(fh), arg); | ||
1388 | |||
1389 | case VIDIOC_QBUF: | ||
1390 | return videobuf_qbuf(get_queue(fh), arg); | ||
1391 | |||
1392 | case VIDIOC_DQBUF: | ||
1393 | return videobuf_dqbuf(get_queue(fh), arg, | ||
1394 | file->f_flags & O_NONBLOCK); | ||
1395 | |||
1396 | case VIDIOC_STREAMON: | ||
1397 | { | ||
1398 | int res = get_ressource(fh); | ||
1399 | |||
1400 | if (!res_get(dev,fh,res)) | ||
1401 | return -EBUSY; | ||
1402 | return videobuf_streamon(get_queue(fh)); | ||
1403 | } | ||
1404 | case VIDIOC_STREAMOFF: | ||
1405 | { | ||
1406 | int res = get_ressource(fh); | ||
1407 | |||
1408 | err = videobuf_streamoff(get_queue(fh)); | ||
1409 | if (err < 0) | ||
1410 | return err; | ||
1411 | res_free(dev,fh,res); | ||
1412 | return 0; | 1457 | return 0; |
1413 | } | 1458 | } |
1414 | 1459 | ||
1415 | default: | 1460 | default: |
1416 | return v4l_compat_translate_ioctl(inode,file,cmd,arg, | 1461 | return v4l_compat_translate_ioctl(inode,file,cmd,arg, |
1417 | video_do_ioctl); | 1462 | driver_ioctl); |
1418 | } | 1463 | } |
1419 | return 0; | 1464 | return 0; |
1420 | } | 1465 | } |
@@ -1461,7 +1506,7 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, | |||
1461 | memset(t,0,sizeof(*t)); | 1506 | memset(t,0,sizeof(*t)); |
1462 | strcpy(t->name, "Radio"); | 1507 | strcpy(t->name, "Radio"); |
1463 | 1508 | ||
1464 | cx88_call_i2c_clients(dev->core,VIDIOC_G_TUNER,t); | 1509 | cx88_call_i2c_clients(core,VIDIOC_G_TUNER,t); |
1465 | return 0; | 1510 | return 0; |
1466 | } | 1511 | } |
1467 | case VIDIOC_ENUMINPUT: | 1512 | case VIDIOC_ENUMINPUT: |
@@ -1501,8 +1546,8 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, | |||
1501 | if (v->tuner) /* Only tuner 0 */ | 1546 | if (v->tuner) /* Only tuner 0 */ |
1502 | return -EINVAL; | 1547 | return -EINVAL; |
1503 | 1548 | ||
1504 | cx88_call_i2c_clients(dev->core,VIDIOCSTUNER,v); | 1549 | cx88_call_i2c_clients(core,VIDIOCSTUNER,v); |
1505 | return 0; | 1550 | return 0; |
1506 | } | 1551 | } |
1507 | case VIDIOC_S_TUNER: | 1552 | case VIDIOC_S_TUNER: |
1508 | { | 1553 | { |
@@ -1511,7 +1556,7 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, | |||
1511 | if (0 != t->index) | 1556 | if (0 != t->index) |
1512 | return -EINVAL; | 1557 | return -EINVAL; |
1513 | 1558 | ||
1514 | cx88_call_i2c_clients(dev->core,VIDIOC_S_TUNER,t); | 1559 | cx88_call_i2c_clients(core,VIDIOC_S_TUNER,t); |
1515 | 1560 | ||
1516 | return 0; | 1561 | return 0; |
1517 | } | 1562 | } |
@@ -1569,7 +1614,7 @@ static void cx8800_vid_timeout(unsigned long data) | |||
1569 | struct cx88_buffer *buf; | 1614 | struct cx88_buffer *buf; |
1570 | unsigned long flags; | 1615 | unsigned long flags; |
1571 | 1616 | ||
1572 | cx88_sram_channel_dump(dev->core, &cx88_sram_channels[SRAM_CH21]); | 1617 | cx88_sram_channel_dump(core, &cx88_sram_channels[SRAM_CH21]); |
1573 | 1618 | ||
1574 | cx_clear(MO_VID_DMACNTRL, 0x11); | 1619 | cx_clear(MO_VID_DMACNTRL, 0x11); |
1575 | cx_clear(VID_CAPTURE_CONTROL, 0x06); | 1620 | cx_clear(VID_CAPTURE_CONTROL, 0x06); |
@@ -1614,14 +1659,14 @@ static void cx8800_vid_irq(struct cx8800_dev *dev) | |||
1614 | printk(KERN_WARNING "%s/0: video risc op code error\n",core->name); | 1659 | printk(KERN_WARNING "%s/0: video risc op code error\n",core->name); |
1615 | cx_clear(MO_VID_DMACNTRL, 0x11); | 1660 | cx_clear(MO_VID_DMACNTRL, 0x11); |
1616 | cx_clear(VID_CAPTURE_CONTROL, 0x06); | 1661 | cx_clear(VID_CAPTURE_CONTROL, 0x06); |
1617 | cx88_sram_channel_dump(dev->core, &cx88_sram_channels[SRAM_CH21]); | 1662 | cx88_sram_channel_dump(core, &cx88_sram_channels[SRAM_CH21]); |
1618 | } | 1663 | } |
1619 | 1664 | ||
1620 | /* risc1 y */ | 1665 | /* risc1 y */ |
1621 | if (status & 0x01) { | 1666 | if (status & 0x01) { |
1622 | spin_lock(&dev->slock); | 1667 | spin_lock(&dev->slock); |
1623 | count = cx_read(MO_VIDY_GPCNT); | 1668 | count = cx_read(MO_VIDY_GPCNT); |
1624 | cx88_wakeup(dev->core, &dev->vidq, count); | 1669 | cx88_wakeup(core, &dev->vidq, count); |
1625 | spin_unlock(&dev->slock); | 1670 | spin_unlock(&dev->slock); |
1626 | } | 1671 | } |
1627 | 1672 | ||
@@ -1629,7 +1674,7 @@ static void cx8800_vid_irq(struct cx8800_dev *dev) | |||
1629 | if (status & 0x08) { | 1674 | if (status & 0x08) { |
1630 | spin_lock(&dev->slock); | 1675 | spin_lock(&dev->slock); |
1631 | count = cx_read(MO_VBI_GPCNT); | 1676 | count = cx_read(MO_VBI_GPCNT); |
1632 | cx88_wakeup(dev->core, &dev->vbiq, count); | 1677 | cx88_wakeup(core, &dev->vbiq, count); |
1633 | spin_unlock(&dev->slock); | 1678 | spin_unlock(&dev->slock); |
1634 | } | 1679 | } |
1635 | 1680 | ||
@@ -1798,7 +1843,6 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, | |||
1798 | } | 1843 | } |
1799 | 1844 | ||
1800 | /* initialize driver struct */ | 1845 | /* initialize driver struct */ |
1801 | init_MUTEX(&dev->lock); | ||
1802 | spin_lock_init(&dev->slock); | 1846 | spin_lock_init(&dev->slock); |
1803 | core->tvnorm = tvnorms; | 1847 | core->tvnorm = tvnorms; |
1804 | 1848 | ||
@@ -1835,6 +1879,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, | |||
1835 | request_module("tuner"); | 1879 | request_module("tuner"); |
1836 | if (core->tda9887_conf) | 1880 | if (core->tda9887_conf) |
1837 | request_module("tda9887"); | 1881 | request_module("tda9887"); |
1882 | |||
1838 | /* register v4l devices */ | 1883 | /* register v4l devices */ |
1839 | dev->video_dev = cx88_vdev_init(core,dev->pci, | 1884 | dev->video_dev = cx88_vdev_init(core,dev->pci, |
1840 | &cx8800_video_template,"video"); | 1885 | &cx8800_video_template,"video"); |
@@ -1878,11 +1923,11 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, | |||
1878 | pci_set_drvdata(pci_dev,dev); | 1923 | pci_set_drvdata(pci_dev,dev); |
1879 | 1924 | ||
1880 | /* initial device configuration */ | 1925 | /* initial device configuration */ |
1881 | down(&dev->lock); | 1926 | down(&core->lock); |
1882 | init_controls(dev); | 1927 | init_controls(core); |
1883 | cx88_set_tvnorm(dev->core,tvnorms); | 1928 | cx88_set_tvnorm(core,tvnorms); |
1884 | video_mux(dev,0); | 1929 | video_mux(core,0); |
1885 | up(&dev->lock); | 1930 | up(&core->lock); |
1886 | 1931 | ||
1887 | /* start tvaudio thread */ | 1932 | /* start tvaudio thread */ |
1888 | if (core->tuner_type != TUNER_ABSENT) | 1933 | if (core->tuner_type != TUNER_ABSENT) |
@@ -1902,14 +1947,15 @@ fail_free: | |||
1902 | static void __devexit cx8800_finidev(struct pci_dev *pci_dev) | 1947 | static void __devexit cx8800_finidev(struct pci_dev *pci_dev) |
1903 | { | 1948 | { |
1904 | struct cx8800_dev *dev = pci_get_drvdata(pci_dev); | 1949 | struct cx8800_dev *dev = pci_get_drvdata(pci_dev); |
1950 | struct cx88_core *core = dev->core; | ||
1905 | 1951 | ||
1906 | /* stop thread */ | 1952 | /* stop thread */ |
1907 | if (dev->core->kthread) { | 1953 | if (core->kthread) { |
1908 | kthread_stop(dev->core->kthread); | 1954 | kthread_stop(core->kthread); |
1909 | dev->core->kthread = NULL; | 1955 | core->kthread = NULL; |
1910 | } | 1956 | } |
1911 | 1957 | ||
1912 | cx88_shutdown(dev->core); /* FIXME */ | 1958 | cx88_shutdown(core); /* FIXME */ |
1913 | pci_disable_device(pci_dev); | 1959 | pci_disable_device(pci_dev); |
1914 | 1960 | ||
1915 | /* unregister stuff */ | 1961 | /* unregister stuff */ |
@@ -1921,7 +1967,7 @@ static void __devexit cx8800_finidev(struct pci_dev *pci_dev) | |||
1921 | /* free memory */ | 1967 | /* free memory */ |
1922 | btcx_riscmem_free(dev->pci,&dev->vidq.stopper); | 1968 | btcx_riscmem_free(dev->pci,&dev->vidq.stopper); |
1923 | list_del(&dev->devlist); | 1969 | list_del(&dev->devlist); |
1924 | cx88_core_put(dev->core,dev->pci); | 1970 | cx88_core_put(core,dev->pci); |
1925 | kfree(dev); | 1971 | kfree(dev); |
1926 | } | 1972 | } |
1927 | 1973 | ||
@@ -1945,7 +1991,7 @@ static int cx8800_suspend(struct pci_dev *pci_dev, pm_message_t state) | |||
1945 | spin_unlock(&dev->slock); | 1991 | spin_unlock(&dev->slock); |
1946 | 1992 | ||
1947 | /* FIXME -- shutdown device */ | 1993 | /* FIXME -- shutdown device */ |
1948 | cx88_shutdown(dev->core); | 1994 | cx88_shutdown(core); |
1949 | 1995 | ||
1950 | pci_save_state(pci_dev); | 1996 | pci_save_state(pci_dev); |
1951 | if (0 != pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state))) { | 1997 | if (0 != pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state))) { |
@@ -1959,16 +2005,32 @@ static int cx8800_resume(struct pci_dev *pci_dev) | |||
1959 | { | 2005 | { |
1960 | struct cx8800_dev *dev = pci_get_drvdata(pci_dev); | 2006 | struct cx8800_dev *dev = pci_get_drvdata(pci_dev); |
1961 | struct cx88_core *core = dev->core; | 2007 | struct cx88_core *core = dev->core; |
2008 | int err; | ||
1962 | 2009 | ||
1963 | if (dev->state.disabled) { | 2010 | if (dev->state.disabled) { |
1964 | pci_enable_device(pci_dev); | 2011 | err=pci_enable_device(pci_dev); |
2012 | if (err) { | ||
2013 | printk(KERN_ERR "%s: can't enable device\n", | ||
2014 | core->name); | ||
2015 | return err; | ||
2016 | } | ||
2017 | |||
1965 | dev->state.disabled = 0; | 2018 | dev->state.disabled = 0; |
1966 | } | 2019 | } |
1967 | pci_set_power_state(pci_dev, PCI_D0); | 2020 | err= pci_set_power_state(pci_dev, PCI_D0); |
2021 | if (err) { | ||
2022 | printk(KERN_ERR "%s: can't enable device\n", | ||
2023 | core->name); | ||
2024 | |||
2025 | pci_disable_device(pci_dev); | ||
2026 | dev->state.disabled = 1; | ||
2027 | |||
2028 | return err; | ||
2029 | } | ||
1968 | pci_restore_state(pci_dev); | 2030 | pci_restore_state(pci_dev); |
1969 | 2031 | ||
1970 | /* FIXME: re-initialize hardware */ | 2032 | /* FIXME: re-initialize hardware */ |
1971 | cx88_reset(dev->core); | 2033 | cx88_reset(core); |
1972 | 2034 | ||
1973 | /* restart video+vbi capture */ | 2035 | /* restart video+vbi capture */ |
1974 | spin_lock(&dev->slock); | 2036 | spin_lock(&dev->slock); |
@@ -2030,6 +2092,8 @@ static void cx8800_fini(void) | |||
2030 | module_init(cx8800_init); | 2092 | module_init(cx8800_init); |
2031 | module_exit(cx8800_fini); | 2093 | module_exit(cx8800_fini); |
2032 | 2094 | ||
2095 | EXPORT_SYMBOL(cx88_do_ioctl); | ||
2096 | |||
2033 | /* ----------------------------------------------------------- */ | 2097 | /* ----------------------------------------------------------- */ |
2034 | /* | 2098 | /* |
2035 | * Local variables: | 2099 | * Local variables: |
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index da65dc92787c..f48dd4353568 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88.h,v 1.70 2005/07/24 17:44:09 mkrufky Exp $ | ||
3 | * | 2 | * |
4 | * v4l2 device driver for cx2388x based TV cards | 3 | * v4l2 device driver for cx2388x based TV cards |
5 | * | 4 | * |
@@ -35,7 +34,7 @@ | |||
35 | #include "btcx-risc.h" | 34 | #include "btcx-risc.h" |
36 | #include "cx88-reg.h" | 35 | #include "cx88-reg.h" |
37 | 36 | ||
38 | #include <linux/utsname.h> | 37 | #include <linux/version.h> |
39 | #define CX88_VERSION_CODE KERNEL_VERSION(0,0,5) | 38 | #define CX88_VERSION_CODE KERNEL_VERSION(0,0,5) |
40 | 39 | ||
41 | #ifndef TRUE | 40 | #ifndef TRUE |
@@ -48,6 +47,9 @@ | |||
48 | 47 | ||
49 | #define CX88_MAXBOARDS 8 | 48 | #define CX88_MAXBOARDS 8 |
50 | 49 | ||
50 | /* Max number of inputs by card */ | ||
51 | #define MAX_CX88_INPUT 8 | ||
52 | |||
51 | /* ----------------------------------------------------------- */ | 53 | /* ----------------------------------------------------------- */ |
52 | /* defines and enums */ | 54 | /* defines and enums */ |
53 | 55 | ||
@@ -199,7 +201,7 @@ struct cx88_board { | |||
199 | unsigned char tuner_addr; | 201 | unsigned char tuner_addr; |
200 | unsigned char radio_addr; | 202 | unsigned char radio_addr; |
201 | int tda9887_conf; | 203 | int tda9887_conf; |
202 | struct cx88_input input[8]; | 204 | struct cx88_input input[MAX_CX88_INPUT]; |
203 | struct cx88_input radio; | 205 | struct cx88_input radio; |
204 | int blackbird:1; | 206 | int blackbird:1; |
205 | int dvb:1; | 207 | int dvb:1; |
@@ -288,6 +290,11 @@ struct cx88_core { | |||
288 | 290 | ||
289 | /* IR remote control state */ | 291 | /* IR remote control state */ |
290 | struct cx88_IR *ir; | 292 | struct cx88_IR *ir; |
293 | |||
294 | struct semaphore lock; | ||
295 | |||
296 | /* various v4l controls */ | ||
297 | u32 freq; | ||
291 | }; | 298 | }; |
292 | 299 | ||
293 | struct cx8800_dev; | 300 | struct cx8800_dev; |
@@ -323,8 +330,7 @@ struct cx8800_suspend_state { | |||
323 | struct cx8800_dev { | 330 | struct cx8800_dev { |
324 | struct cx88_core *core; | 331 | struct cx88_core *core; |
325 | struct list_head devlist; | 332 | struct list_head devlist; |
326 | struct semaphore lock; | 333 | spinlock_t slock; |
327 | spinlock_t slock; | ||
328 | 334 | ||
329 | /* various device info */ | 335 | /* various device info */ |
330 | unsigned int resources; | 336 | unsigned int resources; |
@@ -342,7 +348,6 @@ struct cx8800_dev { | |||
342 | struct cx88_dmaqueue vbiq; | 348 | struct cx88_dmaqueue vbiq; |
343 | 349 | ||
344 | /* various v4l controls */ | 350 | /* various v4l controls */ |
345 | u32 freq; | ||
346 | 351 | ||
347 | /* other global state info */ | 352 | /* other global state info */ |
348 | struct cx8800_suspend_state state; | 353 | struct cx8800_suspend_state state; |
@@ -350,14 +355,8 @@ struct cx8800_dev { | |||
350 | 355 | ||
351 | /* ----------------------------------------------------------- */ | 356 | /* ----------------------------------------------------------- */ |
352 | /* function 1: audio/alsa stuff */ | 357 | /* function 1: audio/alsa stuff */ |
358 | /* =============> moved to cx88-alsa.c <====================== */ | ||
353 | 359 | ||
354 | struct cx8801_dev { | ||
355 | struct cx88_core *core; | ||
356 | |||
357 | /* pci i/o */ | ||
358 | struct pci_dev *pci; | ||
359 | unsigned char pci_rev,pci_lat; | ||
360 | }; | ||
361 | 360 | ||
362 | /* ----------------------------------------------------------- */ | 361 | /* ----------------------------------------------------------- */ |
363 | /* function 2: mpeg stuff */ | 362 | /* function 2: mpeg stuff */ |
@@ -373,8 +372,7 @@ struct cx8802_suspend_state { | |||
373 | 372 | ||
374 | struct cx8802_dev { | 373 | struct cx8802_dev { |
375 | struct cx88_core *core; | 374 | struct cx88_core *core; |
376 | struct semaphore lock; | 375 | spinlock_t slock; |
377 | spinlock_t slock; | ||
378 | 376 | ||
379 | /* pci i/o */ | 377 | /* pci i/o */ |
380 | struct pci_dev *pci; | 378 | struct pci_dev *pci; |
@@ -553,8 +551,21 @@ void cx8802_fini_common(struct cx8802_dev *dev); | |||
553 | int cx8802_suspend_common(struct pci_dev *pci_dev, pm_message_t state); | 551 | int cx8802_suspend_common(struct pci_dev *pci_dev, pm_message_t state); |
554 | int cx8802_resume_common(struct pci_dev *pci_dev); | 552 | int cx8802_resume_common(struct pci_dev *pci_dev); |
555 | 553 | ||
554 | /* ----------------------------------------------------------- */ | ||
555 | /* cx88-video.c */ | ||
556 | extern int cx88_do_ioctl(struct inode *inode, struct file *file, int radio, | ||
557 | struct cx88_core *core, unsigned int cmd, | ||
558 | void *arg, v4l2_kioctl driver_ioctl); | ||
559 | |||
560 | /* ----------------------------------------------------------- */ | ||
561 | /* cx88-blackbird.c */ | ||
562 | extern int (*cx88_ioctl_hook)(struct inode *inode, struct file *file, | ||
563 | unsigned int cmd, void *arg); | ||
564 | extern unsigned int (*cx88_ioctl_translator)(unsigned int cmd); | ||
565 | |||
556 | /* | 566 | /* |
557 | * Local variables: | 567 | * Local variables: |
558 | * c-basic-offset: 8 | 568 | * c-basic-offset: 8 |
559 | * End: | 569 | * End: |
570 | * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off | ||
560 | */ | 571 | */ |
diff --git a/drivers/media/video/ir-kbd-gpio.c b/drivers/media/video/ir-kbd-gpio.c index a565823330aa..cf292da8fdd5 100644 --- a/drivers/media/video/ir-kbd-gpio.c +++ b/drivers/media/video/ir-kbd-gpio.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: ir-kbd-gpio.c,v 1.13 2005/05/15 19:01:26 mchehab Exp $ | ||
3 | * | 2 | * |
4 | * Copyright (c) 2003 Gerd Knorr | 3 | * Copyright (c) 2003 Gerd Knorr |
5 | * Copyright (c) 2003 Pavel Machek | 4 | * Copyright (c) 2003 Pavel Machek |
@@ -354,6 +353,7 @@ static int ir_probe(struct device *dev) | |||
354 | ir->input.id.vendor = sub->core->pci->vendor; | 353 | ir->input.id.vendor = sub->core->pci->vendor; |
355 | ir->input.id.product = sub->core->pci->device; | 354 | ir->input.id.product = sub->core->pci->device; |
356 | } | 355 | } |
356 | ir->input.dev = &sub->core->pci->dev; | ||
357 | 357 | ||
358 | if (ir->polling) { | 358 | if (ir->polling) { |
359 | INIT_WORK(&ir->work, ir_work, ir); | 359 | INIT_WORK(&ir->work, ir_work, ir); |
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index 1e273ff3f956..67105b9804a2 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: ir-kbd-i2c.c,v 1.11 2005/07/07 16:42:11 mchehab Exp $ | ||
3 | * | 2 | * |
4 | * keyboard input driver for i2c IR remote controls | 3 | * keyboard input driver for i2c IR remote controls |
5 | * | 4 | * |
diff --git a/drivers/media/video/msp3400.c b/drivers/media/video/msp3400.c index ca02f6f14b00..f0d43fc2632f 100644 --- a/drivers/media/video/msp3400.c +++ b/drivers/media/video/msp3400.c | |||
@@ -124,10 +124,14 @@ module_param(standard, int, 0644); | |||
124 | module_param(amsound, int, 0644); | 124 | module_param(amsound, int, 0644); |
125 | module_param(dolby, int, 0644); | 125 | module_param(dolby, int, 0644); |
126 | 126 | ||
127 | MODULE_PARM_DESC(opmode, "Forces a MSP3400 opmode. 0=Manual, 1=Simple, 2=Simpler"); | ||
127 | MODULE_PARM_DESC(once, "No continuous stereo monitoring"); | 128 | MODULE_PARM_DESC(once, "No continuous stereo monitoring"); |
128 | MODULE_PARM_DESC(debug, "Enable debug messages"); | 129 | MODULE_PARM_DESC(debug, "Enable debug messages"); |
130 | MODULE_PARM_DESC(stereo_threshold, "Sets signal threshold to activate stereo"); | ||
129 | MODULE_PARM_DESC(standard, "Specify audio standard: 32 = NTSC, 64 = radio, Default: Autodetect"); | 131 | MODULE_PARM_DESC(standard, "Specify audio standard: 32 = NTSC, 64 = radio, Default: Autodetect"); |
130 | MODULE_PARM_DESC(amsound, "Hardwire AM sound at 6.5Hz (France), FM can autoscan"); | 132 | MODULE_PARM_DESC(amsound, "Hardwire AM sound at 6.5Hz (France), FM can autoscan"); |
133 | MODULE_PARM_DESC(dolby, "Activates Dolby processsing"); | ||
134 | |||
131 | 135 | ||
132 | MODULE_DESCRIPTION("device driver for msp34xx TV sound processor"); | 136 | MODULE_DESCRIPTION("device driver for msp34xx TV sound processor"); |
133 | MODULE_AUTHOR("Gerd Knorr"); | 137 | MODULE_AUTHOR("Gerd Knorr"); |
@@ -1452,7 +1456,7 @@ static int msp_attach(struct i2c_adapter *adap, int addr, int kind) | |||
1452 | client_template.addr = addr; | 1456 | client_template.addr = addr; |
1453 | 1457 | ||
1454 | if (-1 == msp3400c_reset(&client_template)) { | 1458 | if (-1 == msp3400c_reset(&client_template)) { |
1455 | dprintk("msp3400: no chip found\n"); | 1459 | dprintk("msp34xx: no chip found\n"); |
1456 | return -1; | 1460 | return -1; |
1457 | } | 1461 | } |
1458 | 1462 | ||
@@ -1478,7 +1482,7 @@ static int msp_attach(struct i2c_adapter *adap, int addr, int kind) | |||
1478 | if (-1 == msp3400c_reset(c)) { | 1482 | if (-1 == msp3400c_reset(c)) { |
1479 | kfree(msp); | 1483 | kfree(msp); |
1480 | kfree(c); | 1484 | kfree(c); |
1481 | dprintk("msp3400: no chip found\n"); | 1485 | dprintk("msp34xx: no chip found\n"); |
1482 | return -1; | 1486 | return -1; |
1483 | } | 1487 | } |
1484 | 1488 | ||
@@ -1488,7 +1492,7 @@ static int msp_attach(struct i2c_adapter *adap, int addr, int kind) | |||
1488 | if ((-1 == msp->rev1) || (0 == msp->rev1 && 0 == msp->rev2)) { | 1492 | if ((-1 == msp->rev1) || (0 == msp->rev1 && 0 == msp->rev2)) { |
1489 | kfree(msp); | 1493 | kfree(msp); |
1490 | kfree(c); | 1494 | kfree(c); |
1491 | printk("msp3400: error while reading chip version\n"); | 1495 | dprintk("msp34xx: error while reading chip version\n"); |
1492 | return -1; | 1496 | return -1; |
1493 | } | 1497 | } |
1494 | 1498 | ||
diff --git a/drivers/media/video/msp3400.h b/drivers/media/video/msp3400.h index 023f33056a4f..2d9ff40f0b09 100644 --- a/drivers/media/video/msp3400.h +++ b/drivers/media/video/msp3400.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: msp3400.h,v 1.3 2005/06/12 04:19:19 mchehab Exp $ | ||
3 | */ | 2 | */ |
4 | 3 | ||
5 | #ifndef MSP3400_H | 4 | #ifndef MSP3400_H |
diff --git a/drivers/media/video/mt20xx.c b/drivers/media/video/mt20xx.c index 2fb7c2d1787a..972aa5e0aeef 100644 --- a/drivers/media/video/mt20xx.c +++ b/drivers/media/video/mt20xx.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: mt20xx.c,v 1.5 2005/06/16 08:29:49 nsh Exp $ | ||
3 | * | 2 | * |
4 | * i2c tv tuner chip device driver | 3 | * i2c tv tuner chip device driver |
5 | * controls microtune tuners, mt2032 + mt2050 at the moment. | 4 | * controls microtune tuners, mt2032 + mt2050 at the moment. |
@@ -494,6 +493,7 @@ int microtune_init(struct i2c_client *c) | |||
494 | memset(buf,0,sizeof(buf)); | 493 | memset(buf,0,sizeof(buf)); |
495 | t->tv_freq = NULL; | 494 | t->tv_freq = NULL; |
496 | t->radio_freq = NULL; | 495 | t->radio_freq = NULL; |
496 | t->standby = NULL; | ||
497 | name = "unknown"; | 497 | name = "unknown"; |
498 | 498 | ||
499 | i2c_master_send(c,buf,1); | 499 | i2c_master_send(c,buf,1); |
diff --git a/drivers/media/video/rds.h b/drivers/media/video/rds.h new file mode 100644 index 000000000000..30337d0f1a87 --- /dev/null +++ b/drivers/media/video/rds.h | |||
@@ -0,0 +1,48 @@ | |||
1 | /* | ||
2 | |||
3 | Types and defines needed for RDS. This is included by | ||
4 | saa6588.c and every driver (e.g. bttv-driver.c) that wants | ||
5 | to use the saa6588 module. | ||
6 | |||
7 | Instead of having a seperate rds.h, I'd prefer to include | ||
8 | this stuff in one of the already existing files like tuner.h | ||
9 | |||
10 | (c) 2005 by Hans J. Koch | ||
11 | |||
12 | This program is free software; you can redistribute it and/or modify | ||
13 | it under the terms of the GNU General Public License as published by | ||
14 | the Free Software Foundation; either version 2 of the License, or | ||
15 | (at your option) any later version. | ||
16 | |||
17 | This program is distributed in the hope that it will be useful, | ||
18 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
20 | GNU General Public License for more details. | ||
21 | |||
22 | You should have received a copy of the GNU General Public License | ||
23 | along with this program; if not, write to the Free Software | ||
24 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
25 | |||
26 | */ | ||
27 | |||
28 | #ifndef _RDS_H | ||
29 | #define _RDS_H | ||
30 | |||
31 | struct rds_command { | ||
32 | unsigned int block_count; | ||
33 | int result; | ||
34 | unsigned char *buffer; | ||
35 | struct file *instance; | ||
36 | poll_table *event_list; | ||
37 | }; | ||
38 | |||
39 | #define RDS_CMD_OPEN _IOW('R',1,int) | ||
40 | #define RDS_CMD_CLOSE _IOW('R',2,int) | ||
41 | #define RDS_CMD_READ _IOR('R',3,int) | ||
42 | #define RDS_CMD_POLL _IOR('R',4,int) | ||
43 | |||
44 | #endif | ||
45 | |||
46 | |||
47 | |||
48 | |||
diff --git a/drivers/media/video/saa6588.c b/drivers/media/video/saa6588.c new file mode 100644 index 000000000000..1a657a70ff43 --- /dev/null +++ b/drivers/media/video/saa6588.c | |||
@@ -0,0 +1,534 @@ | |||
1 | /* | ||
2 | Driver for SAA6588 RDS decoder | ||
3 | |||
4 | (c) 2005 Hans J. Koch | ||
5 | |||
6 | This program is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published by | ||
8 | the Free Software Foundation; either version 2 of the License, or | ||
9 | (at your option) any later version. | ||
10 | |||
11 | This program is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | GNU General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | */ | ||
20 | |||
21 | |||
22 | #include <linux/module.h> | ||
23 | #include <linux/kernel.h> | ||
24 | #include <linux/i2c.h> | ||
25 | #include <linux/types.h> | ||
26 | #include <linux/videodev.h> | ||
27 | #include <linux/init.h> | ||
28 | #include <linux/errno.h> | ||
29 | #include <linux/slab.h> | ||
30 | #include <linux/poll.h> | ||
31 | #include <linux/wait.h> | ||
32 | #include <asm/uaccess.h> | ||
33 | |||
34 | #include <media/id.h> | ||
35 | |||
36 | #include "rds.h" | ||
37 | |||
38 | /* Addresses to scan */ | ||
39 | static unsigned short normal_i2c[] = { | ||
40 | 0x20 >> 1, | ||
41 | 0x22 >> 1, | ||
42 | I2C_CLIENT_END, | ||
43 | }; | ||
44 | |||
45 | I2C_CLIENT_INSMOD; | ||
46 | |||
47 | /* insmod options */ | ||
48 | static unsigned int debug = 0; | ||
49 | static unsigned int xtal = 0; | ||
50 | static unsigned int rbds = 0; | ||
51 | static unsigned int plvl = 0; | ||
52 | static unsigned int bufblocks = 100; | ||
53 | |||
54 | MODULE_PARM(debug, "i"); | ||
55 | MODULE_PARM_DESC(debug, "enable debug messages"); | ||
56 | MODULE_PARM(xtal, "i"); | ||
57 | MODULE_PARM_DESC(xtal, "select oscillator frequency (0..3), default 0"); | ||
58 | MODULE_PARM(rbds, "i"); | ||
59 | MODULE_PARM_DESC(rbds, "select mode, 0=RDS, 1=RBDS, default 0"); | ||
60 | MODULE_PARM(plvl, "i"); | ||
61 | MODULE_PARM_DESC(plvl, "select pause level (0..3), default 0"); | ||
62 | MODULE_PARM(bufblocks, "i"); | ||
63 | MODULE_PARM_DESC(bufblocks, "number of buffered blocks, default 100"); | ||
64 | |||
65 | MODULE_DESCRIPTION("v4l2 driver module for SAA6588 RDS decoder"); | ||
66 | MODULE_AUTHOR("Hans J. Koch <koch@hjk-az.de>"); | ||
67 | |||
68 | MODULE_LICENSE("GPL"); | ||
69 | |||
70 | /* ---------------------------------------------------------------------- */ | ||
71 | |||
72 | #define UNSET (-1U) | ||
73 | #define PREFIX "saa6588: " | ||
74 | #define dprintk if (debug) printk | ||
75 | |||
76 | struct saa6588 { | ||
77 | struct i2c_client client; | ||
78 | struct work_struct work; | ||
79 | struct timer_list timer; | ||
80 | spinlock_t lock; | ||
81 | unsigned char *buffer; | ||
82 | unsigned int buf_size; | ||
83 | unsigned int rd_index; | ||
84 | unsigned int wr_index; | ||
85 | unsigned int block_count; | ||
86 | unsigned char last_blocknum; | ||
87 | wait_queue_head_t read_queue; | ||
88 | int data_available_for_read; | ||
89 | }; | ||
90 | |||
91 | static struct i2c_driver driver; | ||
92 | static struct i2c_client client_template; | ||
93 | |||
94 | /* ---------------------------------------------------------------------- */ | ||
95 | |||
96 | /* | ||
97 | * SAA6588 defines | ||
98 | */ | ||
99 | |||
100 | /* Initialization and mode control byte (0w) */ | ||
101 | |||
102 | /* bit 0+1 (DAC0/DAC1) */ | ||
103 | #define cModeStandard 0x00 | ||
104 | #define cModeFastPI 0x01 | ||
105 | #define cModeReducedRequest 0x02 | ||
106 | #define cModeInvalid 0x03 | ||
107 | |||
108 | /* bit 2 (RBDS) */ | ||
109 | #define cProcessingModeRDS 0x00 | ||
110 | #define cProcessingModeRBDS 0x04 | ||
111 | |||
112 | /* bit 3+4 (SYM0/SYM1) */ | ||
113 | #define cErrCorrectionNone 0x00 | ||
114 | #define cErrCorrection2Bits 0x08 | ||
115 | #define cErrCorrection5Bits 0x10 | ||
116 | #define cErrCorrectionNoneRBDS 0x18 | ||
117 | |||
118 | /* bit 5 (NWSY) */ | ||
119 | #define cSyncNormal 0x00 | ||
120 | #define cSyncRestart 0x20 | ||
121 | |||
122 | /* bit 6 (TSQD) */ | ||
123 | #define cSigQualityDetectOFF 0x00 | ||
124 | #define cSigQualityDetectON 0x40 | ||
125 | |||
126 | /* bit 7 (SQCM) */ | ||
127 | #define cSigQualityTriggered 0x00 | ||
128 | #define cSigQualityContinous 0x80 | ||
129 | |||
130 | /* Pause level and flywheel control byte (1w) */ | ||
131 | |||
132 | /* bits 0..5 (FEB0..FEB5) */ | ||
133 | #define cFlywheelMaxBlocksMask 0x3F | ||
134 | #define cFlywheelDefault 0x20 | ||
135 | |||
136 | /* bits 6+7 (PL0/PL1) */ | ||
137 | #define cPauseLevel_11mV 0x00 | ||
138 | #define cPauseLevel_17mV 0x40 | ||
139 | #define cPauseLevel_27mV 0x80 | ||
140 | #define cPauseLevel_43mV 0xC0 | ||
141 | |||
142 | /* Pause time/oscillator frequency/quality detector control byte (1w) */ | ||
143 | |||
144 | /* bits 0..4 (SQS0..SQS4) */ | ||
145 | #define cQualityDetectSensMask 0x1F | ||
146 | #define cQualityDetectDefault 0x0F | ||
147 | |||
148 | /* bit 5 (SOSC) */ | ||
149 | #define cSelectOscFreqOFF 0x00 | ||
150 | #define cSelectOscFreqON 0x20 | ||
151 | |||
152 | /* bit 6+7 (PTF0/PTF1) */ | ||
153 | #define cOscFreq_4332kHz 0x00 | ||
154 | #define cOscFreq_8664kHz 0x40 | ||
155 | #define cOscFreq_12996kHz 0x80 | ||
156 | #define cOscFreq_17328kHz 0xC0 | ||
157 | |||
158 | /* ---------------------------------------------------------------------- */ | ||
159 | |||
160 | static int block_to_user_buf(struct saa6588 *s, unsigned char *user_buf) | ||
161 | { | ||
162 | int i; | ||
163 | |||
164 | if (s->rd_index == s->wr_index) { | ||
165 | if (debug > 2) | ||
166 | dprintk(PREFIX "Read: buffer empty.\n"); | ||
167 | return 0; | ||
168 | } | ||
169 | |||
170 | if (debug > 2) { | ||
171 | dprintk(PREFIX "Read: "); | ||
172 | for (i = s->rd_index; i < s->rd_index + 3; i++) | ||
173 | dprintk("0x%02x ", s->buffer[i]); | ||
174 | } | ||
175 | |||
176 | if (copy_to_user(user_buf, &s->buffer[s->rd_index], 3)) | ||
177 | return -EFAULT; | ||
178 | |||
179 | s->rd_index += 3; | ||
180 | if (s->rd_index >= s->buf_size) | ||
181 | s->rd_index = 0; | ||
182 | s->block_count--; | ||
183 | |||
184 | if (debug > 2) | ||
185 | dprintk("%d blocks total.\n", s->block_count); | ||
186 | |||
187 | return 1; | ||
188 | } | ||
189 | |||
190 | static void read_from_buf(struct saa6588 *s, struct rds_command *a) | ||
191 | { | ||
192 | unsigned long flags; | ||
193 | |||
194 | unsigned char *buf_ptr = a->buffer; /* This is a user space buffer! */ | ||
195 | unsigned int i; | ||
196 | unsigned int rd_blocks; | ||
197 | |||
198 | a->result = 0; | ||
199 | if (!a->buffer) | ||
200 | return; | ||
201 | |||
202 | while (!s->data_available_for_read) { | ||
203 | int ret = wait_event_interruptible(s->read_queue, | ||
204 | s->data_available_for_read); | ||
205 | if (ret == -ERESTARTSYS) { | ||
206 | a->result = -EINTR; | ||
207 | return; | ||
208 | } | ||
209 | } | ||
210 | |||
211 | spin_lock_irqsave(&s->lock, flags); | ||
212 | rd_blocks = a->block_count; | ||
213 | if (rd_blocks > s->block_count) | ||
214 | rd_blocks = s->block_count; | ||
215 | |||
216 | if (!rd_blocks) | ||
217 | return; | ||
218 | |||
219 | for (i = 0; i < rd_blocks; i++) { | ||
220 | if (block_to_user_buf(s, buf_ptr)) { | ||
221 | buf_ptr += 3; | ||
222 | a->result++; | ||
223 | } else | ||
224 | break; | ||
225 | } | ||
226 | a->result *= 3; | ||
227 | s->data_available_for_read = (s->block_count > 0); | ||
228 | spin_unlock_irqrestore(&s->lock, flags); | ||
229 | } | ||
230 | |||
231 | static void block_to_buf(struct saa6588 *s, unsigned char *blockbuf) | ||
232 | { | ||
233 | unsigned int i; | ||
234 | |||
235 | if (debug > 3) | ||
236 | dprintk(PREFIX "New block: "); | ||
237 | |||
238 | for (i = 0; i < 3; ++i) { | ||
239 | if (debug > 3) | ||
240 | dprintk("0x%02x ", blockbuf[i]); | ||
241 | s->buffer[s->wr_index] = blockbuf[i]; | ||
242 | s->wr_index++; | ||
243 | } | ||
244 | |||
245 | if (s->wr_index >= s->buf_size) | ||
246 | s->wr_index = 0; | ||
247 | |||
248 | if (s->wr_index == s->rd_index) { | ||
249 | s->rd_index++; | ||
250 | if (s->rd_index >= s->buf_size) | ||
251 | s->rd_index = 0; | ||
252 | } else | ||
253 | s->block_count++; | ||
254 | |||
255 | if (debug > 3) | ||
256 | dprintk("%d blocks total.\n", s->block_count); | ||
257 | } | ||
258 | |||
259 | static void saa6588_i2c_poll(struct saa6588 *s) | ||
260 | { | ||
261 | unsigned long flags; | ||
262 | unsigned char tmpbuf[6]; | ||
263 | unsigned char blocknum; | ||
264 | unsigned char tmp; | ||
265 | |||
266 | /* Although we only need 3 bytes, we have to read at least 6. | ||
267 | SAA6588 returns garbage otherwise */ | ||
268 | if (6 != i2c_master_recv(&s->client, &tmpbuf[0], 6)) { | ||
269 | if (debug > 1) | ||
270 | dprintk(PREFIX "read error!\n"); | ||
271 | return; | ||
272 | } | ||
273 | |||
274 | blocknum = tmpbuf[0] >> 5; | ||
275 | if (blocknum == s->last_blocknum) { | ||
276 | if (debug > 3) | ||
277 | dprintk("Saw block %d again.\n", blocknum); | ||
278 | return; | ||
279 | } | ||
280 | |||
281 | s->last_blocknum = blocknum; | ||
282 | |||
283 | /* | ||
284 | Byte order according to v4l2 specification: | ||
285 | |||
286 | Byte 0: Least Significant Byte of RDS Block | ||
287 | Byte 1: Most Significant Byte of RDS Block | ||
288 | Byte 2 Bit 7: Error bit. Indicates that an uncorrectable error | ||
289 | occurred during reception of this block. | ||
290 | Bit 6: Corrected bit. Indicates that an error was | ||
291 | corrected for this data block. | ||
292 | Bits 5-3: Received Offset. Indicates the offset received | ||
293 | by the sync system. | ||
294 | Bits 2-0: Offset Name. Indicates the offset applied to this data. | ||
295 | |||
296 | SAA6588 byte order is Status-MSB-LSB, so we have to swap the | ||
297 | first and the last of the 3 bytes block. | ||
298 | */ | ||
299 | |||
300 | tmp = tmpbuf[2]; | ||
301 | tmpbuf[2] = tmpbuf[0]; | ||
302 | tmpbuf[0] = tmp; | ||
303 | |||
304 | tmp = blocknum; | ||
305 | tmp |= blocknum << 3; /* Received offset == Offset Name (OK ?) */ | ||
306 | if ((tmpbuf[2] & 0x03) == 0x03) | ||
307 | tmp |= 0x80; /* uncorrectable error */ | ||
308 | else if ((tmpbuf[2] & 0x03) != 0x00) | ||
309 | tmp |= 0x40; /* corrected error */ | ||
310 | tmpbuf[2] = tmp; /* Is this enough ? Should we also check other bits ? */ | ||
311 | |||
312 | spin_lock_irqsave(&s->lock, flags); | ||
313 | block_to_buf(s, tmpbuf); | ||
314 | spin_unlock_irqrestore(&s->lock, flags); | ||
315 | s->data_available_for_read = 1; | ||
316 | wake_up_interruptible(&s->read_queue); | ||
317 | } | ||
318 | |||
319 | static void saa6588_timer(unsigned long data) | ||
320 | { | ||
321 | struct saa6588 *s = (struct saa6588 *)data; | ||
322 | |||
323 | schedule_work(&s->work); | ||
324 | } | ||
325 | |||
326 | static void saa6588_work(void *data) | ||
327 | { | ||
328 | struct saa6588 *s = (struct saa6588 *)data; | ||
329 | |||
330 | saa6588_i2c_poll(s); | ||
331 | mod_timer(&s->timer, jiffies + HZ / 50); /* 20 msec */ | ||
332 | } | ||
333 | |||
334 | static int saa6588_configure(struct saa6588 *s) | ||
335 | { | ||
336 | unsigned char buf[3]; | ||
337 | int rc; | ||
338 | |||
339 | buf[0] = cSyncRestart; | ||
340 | if (rbds) | ||
341 | buf[0] |= cProcessingModeRBDS; | ||
342 | |||
343 | buf[1] = cFlywheelDefault; | ||
344 | switch (plvl) { | ||
345 | case 0: | ||
346 | buf[1] |= cPauseLevel_11mV; | ||
347 | break; | ||
348 | case 1: | ||
349 | buf[1] |= cPauseLevel_17mV; | ||
350 | break; | ||
351 | case 2: | ||
352 | buf[1] |= cPauseLevel_27mV; | ||
353 | break; | ||
354 | case 3: | ||
355 | buf[1] |= cPauseLevel_43mV; | ||
356 | break; | ||
357 | default: /* nothing */ | ||
358 | break; | ||
359 | } | ||
360 | |||
361 | buf[2] = cQualityDetectDefault | cSelectOscFreqON; | ||
362 | |||
363 | switch (xtal) { | ||
364 | case 0: | ||
365 | buf[2] |= cOscFreq_4332kHz; | ||
366 | break; | ||
367 | case 1: | ||
368 | buf[2] |= cOscFreq_8664kHz; | ||
369 | break; | ||
370 | case 2: | ||
371 | buf[2] |= cOscFreq_12996kHz; | ||
372 | break; | ||
373 | case 3: | ||
374 | buf[2] |= cOscFreq_17328kHz; | ||
375 | break; | ||
376 | default: /* nothing */ | ||
377 | break; | ||
378 | } | ||
379 | |||
380 | dprintk(PREFIX "writing: 0w=0x%02x 1w=0x%02x 2w=0x%02x\n", | ||
381 | buf[0], buf[1], buf[2]); | ||
382 | |||
383 | if (3 != (rc = i2c_master_send(&s->client, buf, 3))) | ||
384 | printk(PREFIX "i2c i/o error: rc == %d (should be 3)\n", rc); | ||
385 | |||
386 | return 0; | ||
387 | } | ||
388 | |||
389 | /* ---------------------------------------------------------------------- */ | ||
390 | |||
391 | static int saa6588_attach(struct i2c_adapter *adap, int addr, int kind) | ||
392 | { | ||
393 | struct saa6588 *s; | ||
394 | client_template.adapter = adap; | ||
395 | client_template.addr = addr; | ||
396 | |||
397 | printk(PREFIX "chip found @ 0x%x\n", addr << 1); | ||
398 | |||
399 | if (NULL == (s = kmalloc(sizeof(*s), GFP_KERNEL))) | ||
400 | return -ENOMEM; | ||
401 | |||
402 | s->buf_size = bufblocks * 3; | ||
403 | |||
404 | if (NULL == (s->buffer = kmalloc(s->buf_size, GFP_KERNEL))) { | ||
405 | kfree(s); | ||
406 | return -ENOMEM; | ||
407 | } | ||
408 | s->client = client_template; | ||
409 | s->block_count = 0; | ||
410 | s->wr_index = 0; | ||
411 | s->rd_index = 0; | ||
412 | s->last_blocknum = 0xff; | ||
413 | init_waitqueue_head(&s->read_queue); | ||
414 | s->data_available_for_read = 0; | ||
415 | i2c_set_clientdata(&s->client, s); | ||
416 | i2c_attach_client(&s->client); | ||
417 | |||
418 | saa6588_configure(s); | ||
419 | |||
420 | /* start polling via eventd */ | ||
421 | INIT_WORK(&s->work, saa6588_work, s); | ||
422 | init_timer(&s->timer); | ||
423 | s->timer.function = saa6588_timer; | ||
424 | s->timer.data = (unsigned long)s; | ||
425 | schedule_work(&s->work); | ||
426 | |||
427 | return 0; | ||
428 | } | ||
429 | |||
430 | static int saa6588_probe(struct i2c_adapter *adap) | ||
431 | { | ||
432 | #ifdef I2C_CLASS_TV_ANALOG | ||
433 | if (adap->class & I2C_CLASS_TV_ANALOG) | ||
434 | return i2c_probe(adap, &addr_data, saa6588_attach); | ||
435 | #else | ||
436 | switch (adap->id) { | ||
437 | case I2C_ALGO_BIT | I2C_HW_B_BT848: | ||
438 | case I2C_ALGO_BIT | I2C_HW_B_RIVA: | ||
439 | case I2C_ALGO_SAA7134: | ||
440 | return i2c_probe(adap, &addr_data, saa6588_attach); | ||
441 | break; | ||
442 | } | ||
443 | #endif | ||
444 | return 0; | ||
445 | } | ||
446 | |||
447 | static int saa6588_detach(struct i2c_client *client) | ||
448 | { | ||
449 | struct saa6588 *s = i2c_get_clientdata(client); | ||
450 | |||
451 | del_timer_sync(&s->timer); | ||
452 | flush_scheduled_work(); | ||
453 | |||
454 | i2c_detach_client(client); | ||
455 | kfree(s->buffer); | ||
456 | kfree(s); | ||
457 | return 0; | ||
458 | } | ||
459 | |||
460 | static int saa6588_command(struct i2c_client *client, unsigned int cmd, | ||
461 | void *arg) | ||
462 | { | ||
463 | struct saa6588 *s = i2c_get_clientdata(client); | ||
464 | struct rds_command *a = (struct rds_command *)arg; | ||
465 | |||
466 | switch (cmd) { | ||
467 | /* --- open() for /dev/radio --- */ | ||
468 | case RDS_CMD_OPEN: | ||
469 | a->result = 0; /* return error if chip doesn't work ??? */ | ||
470 | break; | ||
471 | /* --- close() for /dev/radio --- */ | ||
472 | case RDS_CMD_CLOSE: | ||
473 | s->data_available_for_read = 1; | ||
474 | wake_up_interruptible(&s->read_queue); | ||
475 | a->result = 0; | ||
476 | break; | ||
477 | /* --- read() for /dev/radio --- */ | ||
478 | case RDS_CMD_READ: | ||
479 | read_from_buf(s, a); | ||
480 | break; | ||
481 | /* --- poll() for /dev/radio --- */ | ||
482 | case RDS_CMD_POLL: | ||
483 | a->result = 0; | ||
484 | if (s->data_available_for_read) { | ||
485 | a->result |= POLLIN | POLLRDNORM; | ||
486 | } | ||
487 | poll_wait(a->instance, &s->read_queue, a->event_list); | ||
488 | break; | ||
489 | |||
490 | default: | ||
491 | /* nothing */ | ||
492 | break; | ||
493 | } | ||
494 | return 0; | ||
495 | } | ||
496 | |||
497 | /* ----------------------------------------------------------------------- */ | ||
498 | |||
499 | static struct i2c_driver driver = { | ||
500 | .owner = THIS_MODULE, | ||
501 | .name = "i2c saa6588 driver", | ||
502 | .id = -1, /* FIXME */ | ||
503 | .flags = I2C_DF_NOTIFY, | ||
504 | .attach_adapter = saa6588_probe, | ||
505 | .detach_client = saa6588_detach, | ||
506 | .command = saa6588_command, | ||
507 | }; | ||
508 | |||
509 | static struct i2c_client client_template = { | ||
510 | .name = "saa6588", | ||
511 | .flags = I2C_CLIENT_ALLOW_USE, | ||
512 | .driver = &driver, | ||
513 | }; | ||
514 | |||
515 | static int __init saa6588_init_module(void) | ||
516 | { | ||
517 | return i2c_add_driver(&driver); | ||
518 | } | ||
519 | |||
520 | static void __exit saa6588_cleanup_module(void) | ||
521 | { | ||
522 | i2c_del_driver(&driver); | ||
523 | } | ||
524 | |||
525 | module_init(saa6588_init_module); | ||
526 | module_exit(saa6588_cleanup_module); | ||
527 | |||
528 | /* | ||
529 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
530 | * --------------------------------------------------------------------------- | ||
531 | * Local variables: | ||
532 | * c-basic-offset: 8 | ||
533 | * End: | ||
534 | */ | ||
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 88b71a20b602..acc7a4335e23 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-cards.c,v 1.80 2005/07/07 01:49:30 mkrufky Exp $ | ||
3 | * | 2 | * |
4 | * device driver for philips saa7134 based TV cards | 3 | * device driver for philips saa7134 based TV cards |
5 | * card-specific stuff. | 4 | * card-specific stuff. |
@@ -1373,7 +1372,7 @@ struct saa7134_board saa7134_boards[] = { | |||
1373 | .inputs = {{ | 1372 | .inputs = {{ |
1374 | .name = name_comp1, | 1373 | .name = name_comp1, |
1375 | .vmux = 1, | 1374 | .vmux = 1, |
1376 | .amux = LINE2, | 1375 | .amux = LINE1, |
1377 | },{ | 1376 | },{ |
1378 | .name = name_tv, | 1377 | .name = name_tv, |
1379 | .vmux = 3, | 1378 | .vmux = 3, |
@@ -1382,7 +1381,7 @@ struct saa7134_board saa7134_boards[] = { | |||
1382 | },{ | 1381 | },{ |
1383 | .name = name_svideo, | 1382 | .name = name_svideo, |
1384 | .vmux = 8, | 1383 | .vmux = 8, |
1385 | .amux = LINE2, | 1384 | .amux = LINE1, |
1386 | }}, | 1385 | }}, |
1387 | .radio = { | 1386 | .radio = { |
1388 | .name = name_radio, | 1387 | .name = name_radio, |
@@ -2001,6 +2000,115 @@ struct saa7134_board saa7134_boards[] = { | |||
2001 | .gpio = 0x000, | 2000 | .gpio = 0x000, |
2002 | }, | 2001 | }, |
2003 | }, | 2002 | }, |
2003 | [SAA7134_BOARD_FLYTV_DIGIMATRIX] = { | ||
2004 | .name = "FlyTV mini Asus Digimatrix", | ||
2005 | .audio_clock = 0x00200000, | ||
2006 | .tuner_type = TUNER_LG_NTSC_TALN_MINI, | ||
2007 | .radio_type = UNSET, | ||
2008 | .tuner_addr = ADDR_UNSET, | ||
2009 | .radio_addr = ADDR_UNSET, | ||
2010 | .inputs = {{ | ||
2011 | .name = name_tv, | ||
2012 | .vmux = 1, | ||
2013 | .amux = TV, | ||
2014 | .tv = 1, | ||
2015 | },{ | ||
2016 | .name = name_tv_mono, | ||
2017 | .vmux = 1, | ||
2018 | .amux = LINE2, | ||
2019 | .tv = 1, | ||
2020 | },{ | ||
2021 | .name = name_comp1, | ||
2022 | .vmux = 0, | ||
2023 | .amux = LINE2, | ||
2024 | },{ | ||
2025 | .name = name_comp2, | ||
2026 | .vmux = 3, | ||
2027 | .amux = LINE2, | ||
2028 | },{ | ||
2029 | .name = name_svideo, | ||
2030 | .vmux = 8, | ||
2031 | .amux = LINE2, | ||
2032 | }}, | ||
2033 | .radio = { | ||
2034 | .name = name_radio, /* radio unconfirmed */ | ||
2035 | .amux = LINE2, | ||
2036 | }, | ||
2037 | }, | ||
2038 | [SAA7134_BOARD_KWORLD_TERMINATOR] = { | ||
2039 | /* Kworld V-Stream Studio TV Terminator */ | ||
2040 | /* "James Webb <jrwebb@qwest.net> */ | ||
2041 | .name = "V-Stream Studio TV Terminator", | ||
2042 | .audio_clock = 0x00187de7, | ||
2043 | .tuner_type = TUNER_PHILIPS_TDA8290, | ||
2044 | .radio_type = UNSET, | ||
2045 | .tuner_addr = ADDR_UNSET, | ||
2046 | .radio_addr = ADDR_UNSET, | ||
2047 | .gpiomask = 1 << 21, | ||
2048 | .inputs = {{ | ||
2049 | .name = name_tv, | ||
2050 | .vmux = 1, | ||
2051 | .amux = TV, | ||
2052 | .gpio = 0x0000000, | ||
2053 | .tv = 1, | ||
2054 | },{ | ||
2055 | .name = name_comp1, /* Composite input */ | ||
2056 | .vmux = 3, | ||
2057 | .amux = LINE2, | ||
2058 | .gpio = 0x0000000, | ||
2059 | },{ | ||
2060 | .name = name_svideo, /* S-Video input */ | ||
2061 | .vmux = 8, | ||
2062 | .amux = LINE2, | ||
2063 | .gpio = 0x0000000, | ||
2064 | }}, | ||
2065 | .radio = { | ||
2066 | .name = name_radio, | ||
2067 | .amux = TV, | ||
2068 | .gpio = 0x0200000, | ||
2069 | }, | ||
2070 | }, | ||
2071 | [SAA7134_BOARD_YUAN_TUN900] = { | ||
2072 | /* FIXME: | ||
2073 | * S-Video and composite sources untested. | ||
2074 | * Radio not working. | ||
2075 | * Remote control not yet implemented. | ||
2076 | * From : codemaster@webgeeks.be */ | ||
2077 | .name = "Yuan TUN-900 (saa7135)", | ||
2078 | .audio_clock = 0x00187de7, | ||
2079 | .tuner_type = TUNER_PHILIPS_TDA8290, | ||
2080 | .radio_type = UNSET, | ||
2081 | .tuner_addr= ADDR_UNSET, | ||
2082 | .radio_addr= ADDR_UNSET, | ||
2083 | .gpiomask = 0x00010003, | ||
2084 | .inputs = {{ | ||
2085 | .name = name_tv, | ||
2086 | .vmux = 1, | ||
2087 | .amux = TV, | ||
2088 | .tv = 1, | ||
2089 | .gpio = 0x01, | ||
2090 | },{ | ||
2091 | .name = name_comp1, | ||
2092 | .vmux = 0, | ||
2093 | .amux = LINE2, | ||
2094 | .gpio = 0x02, | ||
2095 | },{ | ||
2096 | .name = name_svideo, | ||
2097 | .vmux = 6, | ||
2098 | .amux = LINE2, | ||
2099 | .gpio = 0x02, | ||
2100 | }}, | ||
2101 | .radio = { | ||
2102 | .name = name_radio, | ||
2103 | .amux = LINE1, | ||
2104 | .gpio = 0x00010003, | ||
2105 | }, | ||
2106 | .mute = { | ||
2107 | .name = name_mute, | ||
2108 | .amux = TV, | ||
2109 | .gpio = 0x01, | ||
2110 | }, | ||
2111 | }, | ||
2004 | }; | 2112 | }; |
2005 | 2113 | ||
2006 | 2114 | ||
@@ -2272,12 +2380,6 @@ struct pci_device_id saa7134_pci_tbl[] = { | |||
2272 | .driver_data = SAA7134_BOARD_VIDEOMATE_TV_PVR, | 2380 | .driver_data = SAA7134_BOARD_VIDEOMATE_TV_PVR, |
2273 | },{ | 2381 | },{ |
2274 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2382 | .vendor = PCI_VENDOR_ID_PHILIPS, |
2275 | .device = PCI_DEVICE_ID_PHILIPS_SAA7130, | ||
2276 | .subvendor = 0x1131, | ||
2277 | .subdevice = 0, | ||
2278 | .driver_data = SAA7134_BOARD_SABRENT_SBTTVFM, | ||
2279 | },{ | ||
2280 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
2281 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2383 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
2282 | .subvendor = 0x1461, /* Avermedia Technologies Inc */ | 2384 | .subvendor = 0x1461, /* Avermedia Technologies Inc */ |
2283 | .subdevice = 0x9715, | 2385 | .subdevice = 0x9715, |
@@ -2346,6 +2448,18 @@ struct pci_device_id saa7134_pci_tbl[] = { | |||
2346 | .subvendor = 0x4e42, | 2448 | .subvendor = 0x4e42, |
2347 | .subdevice = 0x0502, | 2449 | .subdevice = 0x0502, |
2348 | .driver_data = SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS, | 2450 | .driver_data = SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS, |
2451 | },{ | ||
2452 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
2453 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | ||
2454 | .subvendor = 0x1043, | ||
2455 | .subdevice = 0x0210, /* mini pci NTSC version */ | ||
2456 | .driver_data = SAA7134_BOARD_FLYTV_DIGIMATRIX, | ||
2457 | },{ | ||
2458 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
2459 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | ||
2460 | .subvendor = 0x1043, | ||
2461 | .subdevice = 0x0210, /* mini pci PAL/SECAM version */ | ||
2462 | .driver_data = SAA7134_BOARD_FLYTV_DIGIMATRIX, | ||
2349 | 2463 | ||
2350 | },{ | 2464 | },{ |
2351 | /* --- boards without eeprom + subsystem ID --- */ | 2465 | /* --- boards without eeprom + subsystem ID --- */ |
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index 1dbe61755e9f..e5e36f3c6250 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-core.c,v 1.39 2005/07/05 17:37:35 nsh Exp $ | ||
3 | * | 2 | * |
4 | * device driver for philips saa7134 based TV cards | 3 | * device driver for philips saa7134 based TV cards |
5 | * driver core | 4 | * driver core |
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index 8be6a90358c8..639ae51a052d 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-dvb.c,v 1.23 2005/07/24 22:12:47 mkrufky Exp $ | ||
3 | * | 2 | * |
4 | * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] | 3 | * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] |
5 | * | 4 | * |
@@ -29,7 +28,6 @@ | |||
29 | #include <linux/delay.h> | 28 | #include <linux/delay.h> |
30 | #include <linux/kthread.h> | 29 | #include <linux/kthread.h> |
31 | #include <linux/suspend.h> | 30 | #include <linux/suspend.h> |
32 | #include <linux/config.h> | ||
33 | 31 | ||
34 | 32 | ||
35 | #include "saa7134-reg.h" | 33 | #include "saa7134-reg.h" |
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c index c85348d0239f..77b627eb6483 100644 --- a/drivers/media/video/saa7134/saa7134-empress.c +++ b/drivers/media/video/saa7134/saa7134-empress.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-empress.c,v 1.11 2005/05/22 19:23:39 nsh Exp $ | ||
3 | * | 2 | * |
4 | * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] | 3 | * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] |
5 | * | 4 | * |
diff --git a/drivers/media/video/saa7134/saa7134-i2c.c b/drivers/media/video/saa7134/saa7134-i2c.c index eae6b529713f..711aa8e85fac 100644 --- a/drivers/media/video/saa7134/saa7134-i2c.c +++ b/drivers/media/video/saa7134/saa7134-i2c.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-i2c.c,v 1.22 2005/07/22 04:09:41 mkrufky Exp $ | ||
3 | * | 2 | * |
4 | * device driver for philips saa7134 based TV cards | 3 | * device driver for philips saa7134 based TV cards |
5 | * i2c interface support | 4 | * i2c interface support |
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 213740122fe6..1f456c4d76f2 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-input.c,v 1.21 2005/06/22 23:37:34 nsh Exp $ | ||
3 | * | 2 | * |
4 | * handle saa7134 IR remotes via linux kernel input layer. | 3 | * handle saa7134 IR remotes via linux kernel input layer. |
5 | * | 4 | * |
@@ -565,6 +564,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) | |||
565 | ir->dev.id.vendor = dev->pci->vendor; | 564 | ir->dev.id.vendor = dev->pci->vendor; |
566 | ir->dev.id.product = dev->pci->device; | 565 | ir->dev.id.product = dev->pci->device; |
567 | } | 566 | } |
567 | ir->dev.dev = &dev->pci->dev; | ||
568 | 568 | ||
569 | /* all done */ | 569 | /* all done */ |
570 | dev->remote = ir; | 570 | dev->remote = ir; |
diff --git a/drivers/media/video/saa7134/saa7134-oss.c b/drivers/media/video/saa7134/saa7134-oss.c index b5bede95dbf5..c20630c82f1c 100644 --- a/drivers/media/video/saa7134/saa7134-oss.c +++ b/drivers/media/video/saa7134/saa7134-oss.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-oss.c,v 1.17 2005/06/28 23:41:47 mkrufky Exp $ | ||
3 | * | 2 | * |
4 | * device driver for philips saa7134 based TV cards | 3 | * device driver for philips saa7134 based TV cards |
5 | * oss dsp interface | 4 | * oss dsp interface |
diff --git a/drivers/media/video/saa7134/saa7134-reg.h b/drivers/media/video/saa7134/saa7134-reg.h index 87734f22af7d..ae0c7a165390 100644 --- a/drivers/media/video/saa7134/saa7134-reg.h +++ b/drivers/media/video/saa7134/saa7134-reg.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-reg.h,v 1.2 2004/09/15 16:15:24 kraxel Exp $ | ||
3 | * | 2 | * |
4 | * philips saa7134 registers | 3 | * philips saa7134 registers |
5 | */ | 4 | */ |
diff --git a/drivers/media/video/saa7134/saa7134-ts.c b/drivers/media/video/saa7134/saa7134-ts.c index 4dd9f1b23928..463885601ab4 100644 --- a/drivers/media/video/saa7134/saa7134-ts.c +++ b/drivers/media/video/saa7134/saa7134-ts.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-ts.c,v 1.15 2005/06/14 22:48:18 hhackmann Exp $ | ||
3 | * | 2 | * |
4 | * device driver for philips saa7134 based TV cards | 3 | * device driver for philips saa7134 based TV cards |
5 | * video4linux video interface | 4 | * video4linux video interface |
diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c index eeafa5a71d2b..badf2f9e3072 100644 --- a/drivers/media/video/saa7134/saa7134-tvaudio.c +++ b/drivers/media/video/saa7134/saa7134-tvaudio.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-tvaudio.c,v 1.30 2005/06/28 23:41:47 mkrufky Exp $ | ||
3 | * | 2 | * |
4 | * device driver for philips saa7134 based TV cards | 3 | * device driver for philips saa7134 based TV cards |
5 | * tv audio decoder (fm stereo, nicam, ...) | 4 | * tv audio decoder (fm stereo, nicam, ...) |
diff --git a/drivers/media/video/saa7134/saa7134-vbi.c b/drivers/media/video/saa7134/saa7134-vbi.c index 29e51cad2aaf..f4aee0af80e1 100644 --- a/drivers/media/video/saa7134/saa7134-vbi.c +++ b/drivers/media/video/saa7134/saa7134-vbi.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-vbi.c,v 1.7 2005/05/24 23:13:06 nsh Exp $ | ||
3 | * | 2 | * |
4 | * device driver for philips saa7134 based TV cards | 3 | * device driver for philips saa7134 based TV cards |
5 | * video4linux video interface | 4 | * video4linux video interface |
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index a4c2f751d097..35e5e85f669a 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-video.c,v 1.36 2005/06/28 23:41:47 mkrufky Exp $ | ||
3 | * | 2 | * |
4 | * device driver for philips saa7134 based TV cards | 3 | * device driver for philips saa7134 based TV cards |
5 | * video4linux video interface | 4 | * video4linux video interface |
@@ -1368,29 +1367,7 @@ static int video_release(struct inode *inode, struct file *file) | |||
1368 | saa_andorb(SAA7134_OFMT_DATA_A, 0x1f, 0); | 1367 | saa_andorb(SAA7134_OFMT_DATA_A, 0x1f, 0); |
1369 | saa_andorb(SAA7134_OFMT_DATA_B, 0x1f, 0); | 1368 | saa_andorb(SAA7134_OFMT_DATA_B, 0x1f, 0); |
1370 | 1369 | ||
1371 | if (dev->tuner_type == TUNER_PHILIPS_TDA8290) { | 1370 | saa7134_i2c_call_clients(dev, TUNER_SET_STANDBY, NULL); |
1372 | u8 data[2]; | ||
1373 | int ret; | ||
1374 | struct i2c_msg msg = {.addr=I2C_ADDR_TDA8290, .flags=0, .buf=data, .len = 2}; | ||
1375 | data[0] = 0x21; | ||
1376 | data[1] = 0xc0; | ||
1377 | ret = i2c_transfer(&dev->i2c_adap, &msg, 1); | ||
1378 | if (ret != 1) | ||
1379 | printk(KERN_ERR "TDA8290 access failure\n"); | ||
1380 | msg.addr = I2C_ADDR_TDA8275; | ||
1381 | data[0] = 0x30; | ||
1382 | data[1] = 0xd0; | ||
1383 | ret = i2c_transfer(&dev->i2c_adap, &msg, 1); | ||
1384 | if (ret != 1) | ||
1385 | printk(KERN_ERR "TDA8275 access failure\n"); | ||
1386 | msg.addr = I2C_ADDR_TDA8290; | ||
1387 | data[0] = 0x21; | ||
1388 | data[1] = 0x80; | ||
1389 | i2c_transfer(&dev->i2c_adap, &msg, 1); | ||
1390 | data[0] = 0x00; | ||
1391 | data[1] = 0x02; | ||
1392 | i2c_transfer(&dev->i2c_adap, &msg, 1); | ||
1393 | } | ||
1394 | 1371 | ||
1395 | /* free stuff */ | 1372 | /* free stuff */ |
1396 | videobuf_mmap_free(&fh->cap); | 1373 | videobuf_mmap_free(&fh->cap); |
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index 2af0cb2a731b..3ea09142ec9c 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134.h,v 1.49 2005/07/13 17:25:25 mchehab Exp $ | ||
3 | * | 2 | * |
4 | * v4l2 device driver for philips saa7134 based TV cards | 3 | * v4l2 device driver for philips saa7134 based TV cards |
5 | * | 4 | * |
@@ -185,6 +184,9 @@ struct saa7134_format { | |||
185 | #define SAA7134_BOARD_PHILIPS_TOUGH 61 | 184 | #define SAA7134_BOARD_PHILIPS_TOUGH 61 |
186 | #define SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII 62 | 185 | #define SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII 62 |
187 | #define SAA7134_BOARD_KWORLD_XPERT 63 | 186 | #define SAA7134_BOARD_KWORLD_XPERT 63 |
187 | #define SAA7134_BOARD_FLYTV_DIGIMATRIX 64 | ||
188 | #define SAA7134_BOARD_KWORLD_TERMINATOR 65 | ||
189 | #define SAA7134_BOARD_YUAN_TUN900 66 | ||
188 | 190 | ||
189 | #define SAA7134_MAXBOARDS 8 | 191 | #define SAA7134_MAXBOARDS 8 |
190 | #define SAA7134_INPUT_MAX 8 | 192 | #define SAA7134_INPUT_MAX 8 |
diff --git a/drivers/media/video/stradis.c b/drivers/media/video/stradis.c index b57743571087..d4497dbae05c 100644 --- a/drivers/media/video/stradis.c +++ b/drivers/media/video/stradis.c | |||
@@ -2184,30 +2184,18 @@ static void release_saa(void) | |||
2184 | vfree(saa->vidbuf); | 2184 | vfree(saa->vidbuf); |
2185 | vfree(saa->audbuf); | 2185 | vfree(saa->audbuf); |
2186 | vfree(saa->osdbuf); | 2186 | vfree(saa->osdbuf); |
2187 | if (saa->dmavid2) | 2187 | kfree(saa->dmavid2); |
2188 | kfree((void *) saa->dmavid2); | ||
2189 | saa->audbuf = saa->vidbuf = saa->osdbuf = NULL; | 2188 | saa->audbuf = saa->vidbuf = saa->osdbuf = NULL; |
2190 | saa->dmavid2 = NULL; | 2189 | saa->dmavid2 = NULL; |
2191 | if (saa->dmadebi) | 2190 | kfree(saa->dmadebi); |
2192 | kfree((void *) saa->dmadebi); | 2191 | kfree(saa->dmavid1); |
2193 | if (saa->dmavid1) | 2192 | kfree(saa->dmavid3); |
2194 | kfree((void *) saa->dmavid1); | 2193 | kfree(saa->dmaa1in); |
2195 | if (saa->dmavid2) | 2194 | kfree(saa->dmaa1out); |
2196 | kfree((void *) saa->dmavid2); | 2195 | kfree(saa->dmaa2in); |
2197 | if (saa->dmavid3) | 2196 | kfree(saa->dmaa2out); |
2198 | kfree((void *) saa->dmavid3); | 2197 | kfree(saa->dmaRPS1); |
2199 | if (saa->dmaa1in) | 2198 | kfree(saa->dmaRPS2); |
2200 | kfree((void *) saa->dmaa1in); | ||
2201 | if (saa->dmaa1out) | ||
2202 | kfree((void *) saa->dmaa1out); | ||
2203 | if (saa->dmaa2in) | ||
2204 | kfree((void *) saa->dmaa2in); | ||
2205 | if (saa->dmaa2out) | ||
2206 | kfree((void *) saa->dmaa2out); | ||
2207 | if (saa->dmaRPS1) | ||
2208 | kfree((void *) saa->dmaRPS1); | ||
2209 | if (saa->dmaRPS2) | ||
2210 | kfree((void *) saa->dmaRPS2); | ||
2211 | free_irq(saa->irq, saa); | 2199 | free_irq(saa->irq, saa); |
2212 | if (saa->saa7146_mem) | 2200 | if (saa->saa7146_mem) |
2213 | iounmap(saa->saa7146_mem); | 2201 | iounmap(saa->saa7146_mem); |
diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c index a8b6a8df5109..c65f0c7680a2 100644 --- a/drivers/media/video/tda8290.c +++ b/drivers/media/video/tda8290.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: tda8290.c,v 1.15 2005/07/08 20:21:33 mchehab Exp $ | ||
3 | * | 2 | * |
4 | * i2c tv tuner chip device driver | 3 | * i2c tv tuner chip device driver |
5 | * controls the philips tda8290+75 tuner chip combo. | 4 | * controls the philips tda8290+75 tuner chip combo. |
@@ -9,6 +8,9 @@ | |||
9 | #include <linux/delay.h> | 8 | #include <linux/delay.h> |
10 | #include <media/tuner.h> | 9 | #include <media/tuner.h> |
11 | 10 | ||
11 | #define I2C_ADDR_TDA8290 0x4b | ||
12 | #define I2C_ADDR_TDA8275 0x61 | ||
13 | |||
12 | /* ---------------------------------------------------------------------- */ | 14 | /* ---------------------------------------------------------------------- */ |
13 | 15 | ||
14 | struct freq_entry { | 16 | struct freq_entry { |
@@ -75,10 +77,12 @@ static unsigned char i2c_init_tda8275[14] = { 0x00, 0x00, 0x00, 0x00, | |||
75 | static unsigned char i2c_set_VS[2] = { 0x30, 0x6F }; | 77 | static unsigned char i2c_set_VS[2] = { 0x30, 0x6F }; |
76 | static unsigned char i2c_set_GP01_CF[2] = { 0x20, 0x0B }; | 78 | static unsigned char i2c_set_GP01_CF[2] = { 0x20, 0x0B }; |
77 | static unsigned char i2c_tda8290_reset[2] = { 0x00, 0x00 }; | 79 | static unsigned char i2c_tda8290_reset[2] = { 0x00, 0x00 }; |
80 | static unsigned char i2c_tda8290_standby[2] = { 0x00, 0x02 }; | ||
78 | static unsigned char i2c_gainset_off[2] = { 0x28, 0x14 }; | 81 | static unsigned char i2c_gainset_off[2] = { 0x28, 0x14 }; |
79 | static unsigned char i2c_gainset_on[2] = { 0x28, 0x54 }; | 82 | static unsigned char i2c_gainset_on[2] = { 0x28, 0x54 }; |
80 | static unsigned char i2c_agc3_00[2] = { 0x80, 0x00 }; | 83 | static unsigned char i2c_agc3_00[2] = { 0x80, 0x00 }; |
81 | static unsigned char i2c_agc2_BF[2] = { 0x60, 0xBF }; | 84 | static unsigned char i2c_agc2_BF[2] = { 0x60, 0xBF }; |
85 | static unsigned char i2c_cb1_D0[2] = { 0x30, 0xD0 }; | ||
82 | static unsigned char i2c_cb1_D2[2] = { 0x30, 0xD2 }; | 86 | static unsigned char i2c_cb1_D2[2] = { 0x30, 0xD2 }; |
83 | static unsigned char i2c_cb1_56[2] = { 0x30, 0x56 }; | 87 | static unsigned char i2c_cb1_56[2] = { 0x30, 0x56 }; |
84 | static unsigned char i2c_cb1_52[2] = { 0x30, 0x52 }; | 88 | static unsigned char i2c_cb1_52[2] = { 0x30, 0x52 }; |
@@ -117,6 +121,13 @@ static struct i2c_msg i2c_msg_epilog[] = { | |||
117 | { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_gainset_on), i2c_gainset_on }, | 121 | { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_gainset_on), i2c_gainset_on }, |
118 | }; | 122 | }; |
119 | 123 | ||
124 | static struct i2c_msg i2c_msg_standby[] = { | ||
125 | { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_enable_bridge), i2c_enable_bridge }, | ||
126 | { I2C_ADDR_TDA8275, 0, ARRAY_SIZE(i2c_cb1_D0), i2c_cb1_D0 }, | ||
127 | { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_disable_bridge), i2c_disable_bridge }, | ||
128 | { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_tda8290_standby), i2c_tda8290_standby }, | ||
129 | }; | ||
130 | |||
120 | static int tda8290_tune(struct i2c_client *c) | 131 | static int tda8290_tune(struct i2c_client *c) |
121 | { | 132 | { |
122 | struct tuner *t = i2c_get_clientdata(c); | 133 | struct tuner *t = i2c_get_clientdata(c); |
@@ -205,6 +216,11 @@ static int has_signal(struct i2c_client *c) | |||
205 | return (afc & 0x80)? 65535:0; | 216 | return (afc & 0x80)? 65535:0; |
206 | } | 217 | } |
207 | 218 | ||
219 | static void standby(struct i2c_client *c) | ||
220 | { | ||
221 | i2c_transfer(c->adapter, i2c_msg_standby, ARRAY_SIZE(i2c_msg_standby)); | ||
222 | } | ||
223 | |||
208 | int tda8290_init(struct i2c_client *c) | 224 | int tda8290_init(struct i2c_client *c) |
209 | { | 225 | { |
210 | struct tuner *t = i2c_get_clientdata(c); | 226 | struct tuner *t = i2c_get_clientdata(c); |
@@ -214,6 +230,7 @@ int tda8290_init(struct i2c_client *c) | |||
214 | t->tv_freq = set_tv_freq; | 230 | t->tv_freq = set_tv_freq; |
215 | t->radio_freq = set_radio_freq; | 231 | t->radio_freq = set_radio_freq; |
216 | t->has_signal = has_signal; | 232 | t->has_signal = has_signal; |
233 | t->standby = standby; | ||
217 | 234 | ||
218 | i2c_master_send(c, i2c_enable_bridge, ARRAY_SIZE(i2c_enable_bridge)); | 235 | i2c_master_send(c, i2c_enable_bridge, ARRAY_SIZE(i2c_enable_bridge)); |
219 | i2c_transfer(c->adapter, i2c_msg_init, ARRAY_SIZE(i2c_msg_init)); | 236 | i2c_transfer(c->adapter, i2c_msg_init, ARRAY_SIZE(i2c_msg_init)); |
diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c index d60fc562aecd..0456dda2624d 100644 --- a/drivers/media/video/tda9887.c +++ b/drivers/media/video/tda9887.c | |||
@@ -23,6 +23,7 @@ | |||
23 | TDA9887 (world), TDA9885 (USA) | 23 | TDA9887 (world), TDA9885 (USA) |
24 | Note: OP2 of tda988x must be set to 1, else MT2032 is disabled! | 24 | Note: OP2 of tda988x must be set to 1, else MT2032 is disabled! |
25 | - KNC One TV-Station RDS (saa7134) | 25 | - KNC One TV-Station RDS (saa7134) |
26 | - Hauppauge PVR-150/500 (possibly more) | ||
26 | */ | 27 | */ |
27 | 28 | ||
28 | 29 | ||
@@ -49,7 +50,7 @@ MODULE_LICENSE("GPL"); | |||
49 | struct tda9887 { | 50 | struct tda9887 { |
50 | struct i2c_client client; | 51 | struct i2c_client client; |
51 | v4l2_std_id std; | 52 | v4l2_std_id std; |
52 | unsigned int radio; | 53 | enum tuner_mode mode; |
53 | unsigned int config; | 54 | unsigned int config; |
54 | unsigned int pinnacle_id; | 55 | unsigned int pinnacle_id; |
55 | unsigned int using_v4l2; | 56 | unsigned int using_v4l2; |
@@ -196,7 +197,7 @@ static struct tvnorm tvnorms[] = { | |||
196 | .b = ( cNegativeFmTV | | 197 | .b = ( cNegativeFmTV | |
197 | cQSS ), | 198 | cQSS ), |
198 | .c = ( cDeemphasisON | | 199 | .c = ( cDeemphasisON | |
199 | cDeemphasis50 ), | 200 | cDeemphasis75 ), |
200 | .e = ( cGating_36 | | 201 | .e = ( cGating_36 | |
201 | cAudioIF_4_5 | | 202 | cAudioIF_4_5 | |
202 | cVideoIF_45_75 ), | 203 | cVideoIF_45_75 ), |
@@ -364,7 +365,7 @@ static int tda9887_set_tvnorm(struct tda9887 *t, char *buf) | |||
364 | struct tvnorm *norm = NULL; | 365 | struct tvnorm *norm = NULL; |
365 | int i; | 366 | int i; |
366 | 367 | ||
367 | if (t->radio) { | 368 | if (t->mode == T_RADIO) { |
368 | if (t->radio_mode == V4L2_TUNER_MODE_MONO) | 369 | if (t->radio_mode == V4L2_TUNER_MODE_MONO) |
369 | norm = &radio_mono; | 370 | norm = &radio_mono; |
370 | else | 371 | else |
@@ -378,7 +379,7 @@ static int tda9887_set_tvnorm(struct tda9887 *t, char *buf) | |||
378 | } | 379 | } |
379 | } | 380 | } |
380 | if (NULL == norm) { | 381 | if (NULL == norm) { |
381 | dprintk(PREFIX "Oops: no tvnorm entry found\n"); | 382 | dprintk(PREFIX "Unsupported tvnorm entry - audio muted\n"); |
382 | return -1; | 383 | return -1; |
383 | } | 384 | } |
384 | 385 | ||
@@ -519,6 +520,12 @@ static int tda9887_fixup_std(struct tda9887 *t) | |||
519 | dprintk(PREFIX "insmod fixup: PAL => PAL-DK\n"); | 520 | dprintk(PREFIX "insmod fixup: PAL => PAL-DK\n"); |
520 | t->std = V4L2_STD_PAL_DK; | 521 | t->std = V4L2_STD_PAL_DK; |
521 | break; | 522 | break; |
523 | case '-': | ||
524 | /* default parameter, do nothing */ | ||
525 | break; | ||
526 | default: | ||
527 | printk(PREFIX "pal= argument not recognised\n"); | ||
528 | break; | ||
522 | } | 529 | } |
523 | } | 530 | } |
524 | if ((t->std & V4L2_STD_SECAM) == V4L2_STD_SECAM) { | 531 | if ((t->std & V4L2_STD_SECAM) == V4L2_STD_SECAM) { |
@@ -535,6 +542,12 @@ static int tda9887_fixup_std(struct tda9887 *t) | |||
535 | dprintk(PREFIX "insmod fixup: SECAM => SECAM-L\n"); | 542 | dprintk(PREFIX "insmod fixup: SECAM => SECAM-L\n"); |
536 | t->std = V4L2_STD_SECAM_L; | 543 | t->std = V4L2_STD_SECAM_L; |
537 | break; | 544 | break; |
545 | case '-': | ||
546 | /* default parameter, do nothing */ | ||
547 | break; | ||
548 | default: | ||
549 | printk(PREFIX "secam= argument not recognised\n"); | ||
550 | break; | ||
538 | } | 551 | } |
539 | } | 552 | } |
540 | return 0; | 553 | return 0; |
@@ -569,6 +582,10 @@ static int tda9887_configure(struct tda9887 *t) | |||
569 | tda9887_set_config(t,buf); | 582 | tda9887_set_config(t,buf); |
570 | tda9887_set_insmod(t,buf); | 583 | tda9887_set_insmod(t,buf); |
571 | 584 | ||
585 | if (t->mode == T_STANDBY) { | ||
586 | buf[1] |= cForcedMuteAudioON; | ||
587 | } | ||
588 | |||
572 | 589 | ||
573 | dprintk(PREFIX "writing: b=0x%02x c=0x%02x e=0x%02x\n", | 590 | dprintk(PREFIX "writing: b=0x%02x c=0x%02x e=0x%02x\n", |
574 | buf[1],buf[2],buf[3]); | 591 | buf[1],buf[2],buf[3]); |
@@ -653,10 +670,17 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
653 | 670 | ||
654 | /* --- configuration --- */ | 671 | /* --- configuration --- */ |
655 | case AUDC_SET_RADIO: | 672 | case AUDC_SET_RADIO: |
656 | t->radio = 1; | 673 | { |
674 | t->mode = T_RADIO; | ||
657 | tda9887_configure(t); | 675 | tda9887_configure(t); |
658 | break; | 676 | break; |
659 | 677 | } | |
678 | case TUNER_SET_STANDBY: | ||
679 | { | ||
680 | t->mode = T_STANDBY; | ||
681 | tda9887_configure(t); | ||
682 | break; | ||
683 | } | ||
660 | case AUDC_CONFIG_PINNACLE: | 684 | case AUDC_CONFIG_PINNACLE: |
661 | { | 685 | { |
662 | int *i = arg; | 686 | int *i = arg; |
@@ -689,7 +713,7 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
689 | struct video_channel *vc = arg; | 713 | struct video_channel *vc = arg; |
690 | 714 | ||
691 | CHECK_V4L2; | 715 | CHECK_V4L2; |
692 | t->radio = 0; | 716 | t->mode = T_ANALOG_TV; |
693 | if (vc->norm < ARRAY_SIZE(map)) | 717 | if (vc->norm < ARRAY_SIZE(map)) |
694 | t->std = map[vc->norm]; | 718 | t->std = map[vc->norm]; |
695 | tda9887_fixup_std(t); | 719 | tda9887_fixup_std(t); |
@@ -701,7 +725,7 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
701 | v4l2_std_id *id = arg; | 725 | v4l2_std_id *id = arg; |
702 | 726 | ||
703 | SWITCH_V4L2; | 727 | SWITCH_V4L2; |
704 | t->radio = 0; | 728 | t->mode = T_ANALOG_TV; |
705 | t->std = *id; | 729 | t->std = *id; |
706 | tda9887_fixup_std(t); | 730 | tda9887_fixup_std(t); |
707 | tda9887_configure(t); | 731 | tda9887_configure(t); |
@@ -713,14 +737,14 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
713 | 737 | ||
714 | SWITCH_V4L2; | 738 | SWITCH_V4L2; |
715 | if (V4L2_TUNER_ANALOG_TV == f->type) { | 739 | if (V4L2_TUNER_ANALOG_TV == f->type) { |
716 | if (t->radio == 0) | 740 | if (t->mode == T_ANALOG_TV) |
717 | return 0; | 741 | return 0; |
718 | t->radio = 0; | 742 | t->mode = T_ANALOG_TV; |
719 | } | 743 | } |
720 | if (V4L2_TUNER_RADIO == f->type) { | 744 | if (V4L2_TUNER_RADIO == f->type) { |
721 | if (t->radio == 1) | 745 | if (t->mode == T_RADIO) |
722 | return 0; | 746 | return 0; |
723 | t->radio = 1; | 747 | t->mode = T_RADIO; |
724 | } | 748 | } |
725 | tda9887_configure(t); | 749 | tda9887_configure(t); |
726 | break; | 750 | break; |
@@ -735,7 +759,7 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
735 | }; | 759 | }; |
736 | struct v4l2_tuner* tuner = arg; | 760 | struct v4l2_tuner* tuner = arg; |
737 | 761 | ||
738 | if (t->radio) { | 762 | if (t->mode == T_RADIO) { |
739 | __u8 reg = 0; | 763 | __u8 reg = 0; |
740 | tuner->afc=0; | 764 | tuner->afc=0; |
741 | if (1 == i2c_master_recv(&t->client,®,1)) | 765 | if (1 == i2c_master_recv(&t->client,®,1)) |
@@ -747,7 +771,7 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
747 | { | 771 | { |
748 | struct v4l2_tuner* tuner = arg; | 772 | struct v4l2_tuner* tuner = arg; |
749 | 773 | ||
750 | if (t->radio) { | 774 | if (t->mode == T_RADIO) { |
751 | t->radio_mode = tuner->audmode; | 775 | t->radio_mode = tuner->audmode; |
752 | tda9887_configure (t); | 776 | tda9887_configure (t); |
753 | } | 777 | } |
diff --git a/drivers/media/video/tea5767.c b/drivers/media/video/tea5767.c index cebcc1fa68d1..38bf50943798 100644 --- a/drivers/media/video/tea5767.c +++ b/drivers/media/video/tea5767.c | |||
@@ -2,7 +2,6 @@ | |||
2 | * For Philips TEA5767 FM Chip used on some TV Cards like Prolink Pixelview | 2 | * For Philips TEA5767 FM Chip used on some TV Cards like Prolink Pixelview |
3 | * I2C address is allways 0xC0. | 3 | * I2C address is allways 0xC0. |
4 | * | 4 | * |
5 | * $Id: tea5767.c,v 1.27 2005/07/31 12:10:56 mchehab Exp $ | ||
6 | * | 5 | * |
7 | * Copyright (c) 2005 Mauro Carvalho Chehab (mchehab@brturbo.com.br) | 6 | * Copyright (c) 2005 Mauro Carvalho Chehab (mchehab@brturbo.com.br) |
8 | * This code is placed under the terms of the GNU General Public License | 7 | * This code is placed under the terms of the GNU General Public License |
@@ -205,11 +204,6 @@ static void set_radio_freq(struct i2c_client *c, unsigned int frq) | |||
205 | TEA5767_ST_NOISE_CTL | TEA5767_JAPAN_BAND; | 204 | TEA5767_ST_NOISE_CTL | TEA5767_JAPAN_BAND; |
206 | buffer[4] = 0; | 205 | buffer[4] = 0; |
207 | 206 | ||
208 | if (t->mode == T_STANDBY) { | ||
209 | tuner_dbg("TEA5767 set to standby mode\n"); | ||
210 | buffer[3] |= TEA5767_STDBY; | ||
211 | } | ||
212 | |||
213 | if (t->audmode == V4L2_TUNER_MODE_MONO) { | 207 | if (t->audmode == V4L2_TUNER_MODE_MONO) { |
214 | tuner_dbg("TEA5767 set to mono\n"); | 208 | tuner_dbg("TEA5767 set to mono\n"); |
215 | buffer[2] |= TEA5767_MONO; | 209 | buffer[2] |= TEA5767_MONO; |
@@ -290,13 +284,31 @@ static int tea5767_stereo(struct i2c_client *c) | |||
290 | return ((buffer[2] & TEA5767_STEREO_MASK) ? V4L2_TUNER_SUB_STEREO : 0); | 284 | return ((buffer[2] & TEA5767_STEREO_MASK) ? V4L2_TUNER_SUB_STEREO : 0); |
291 | } | 285 | } |
292 | 286 | ||
287 | static void tea5767_standby(struct i2c_client *c) | ||
288 | { | ||
289 | unsigned char buffer[5]; | ||
290 | struct tuner *t = i2c_get_clientdata(c); | ||
291 | unsigned div, rc; | ||
292 | |||
293 | div = (87500 * 4 + 700 + 225 + 25) / 50; /* Set frequency to 87.5 MHz */ | ||
294 | buffer[0] = (div >> 8) & 0x3f; | ||
295 | buffer[1] = div & 0xff; | ||
296 | buffer[2] = TEA5767_PORT1_HIGH; | ||
297 | buffer[3] = TEA5767_PORT2_HIGH | TEA5767_HIGH_CUT_CTRL | | ||
298 | TEA5767_ST_NOISE_CTL | TEA5767_JAPAN_BAND | TEA5767_STDBY; | ||
299 | buffer[4] = 0; | ||
300 | |||
301 | if (5 != (rc = i2c_master_send(c, buffer, 5))) | ||
302 | tuner_warn("i2c i/o error: rc == %d (should be 5)\n", rc); | ||
303 | } | ||
304 | |||
293 | int tea5767_autodetection(struct i2c_client *c) | 305 | int tea5767_autodetection(struct i2c_client *c) |
294 | { | 306 | { |
295 | unsigned char buffer[7] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; | 307 | unsigned char buffer[7] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; |
296 | int rc; | 308 | int rc; |
297 | struct tuner *t = i2c_get_clientdata(c); | 309 | struct tuner *t = i2c_get_clientdata(c); |
298 | 310 | ||
299 | if (7 != (rc = i2c_master_recv(c, buffer, 7))) { | 311 | if ((rc = i2c_master_recv(c, buffer, 7))< 5) { |
300 | tuner_warn("It is not a TEA5767. Received %i bytes.\n", rc); | 312 | tuner_warn("It is not a TEA5767. Received %i bytes.\n", rc); |
301 | return EINVAL; | 313 | return EINVAL; |
302 | } | 314 | } |
@@ -313,15 +325,10 @@ int tea5767_autodetection(struct i2c_client *c) | |||
313 | * bit 0 : internally set to 0 | 325 | * bit 0 : internally set to 0 |
314 | * Byte 5: bit 7:0 : == 0 | 326 | * Byte 5: bit 7:0 : == 0 |
315 | */ | 327 | */ |
316 | if (!((buffer[3] & 0x0f) == 0x00) && (buffer[4] == 0x00)) { | 328 | if (((buffer[3] & 0x0f) != 0x00) || (buffer[4] != 0x00)) { |
317 | tuner_warn("Chip ID is not zero. It is not a TEA5767\n"); | 329 | tuner_warn("Chip ID is not zero. It is not a TEA5767\n"); |
318 | return EINVAL; | 330 | return EINVAL; |
319 | } | 331 | } |
320 | /* It seems that tea5767 returns 0xff after the 5th byte */ | ||
321 | if ((buffer[5] != 0xff) || (buffer[6] != 0xff)) { | ||
322 | tuner_warn("Returned more than 5 bytes. It is not a TEA5767\n"); | ||
323 | return EINVAL; | ||
324 | } | ||
325 | 332 | ||
326 | /* It seems that tea5767 returns 0xff after the 5th byte */ | 333 | /* It seems that tea5767 returns 0xff after the 5th byte */ |
327 | if ((buffer[5] != 0xff) || (buffer[6] != 0xff)) { | 334 | if ((buffer[5] != 0xff) || (buffer[6] != 0xff)) { |
@@ -337,14 +344,14 @@ int tea5767_tuner_init(struct i2c_client *c) | |||
337 | { | 344 | { |
338 | struct tuner *t = i2c_get_clientdata(c); | 345 | struct tuner *t = i2c_get_clientdata(c); |
339 | 346 | ||
340 | tuner_info("type set to %d (%s)\n", t->type, | 347 | tuner_info("type set to %d (%s)\n", t->type, "Philips TEA5767HN FM Radio"); |
341 | "Philips TEA5767HN FM Radio"); | ||
342 | strlcpy(c->name, "tea5767", sizeof(c->name)); | 348 | strlcpy(c->name, "tea5767", sizeof(c->name)); |
343 | 349 | ||
344 | t->tv_freq = set_tv_freq; | 350 | t->tv_freq = set_tv_freq; |
345 | t->radio_freq = set_radio_freq; | 351 | t->radio_freq = set_radio_freq; |
346 | t->has_signal = tea5767_signal; | 352 | t->has_signal = tea5767_signal; |
347 | t->is_stereo = tea5767_stereo; | 353 | t->is_stereo = tea5767_stereo; |
354 | t->standby = tea5767_standby; | ||
348 | 355 | ||
349 | return (0); | 356 | return (0); |
350 | } | 357 | } |
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 3b1893c2ae3b..05572020af4d 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: tuner-core.c,v 1.63 2005/07/28 18:19:55 mchehab Exp $ | ||
3 | * | 2 | * |
4 | * i2c tv tuner chip device driver | 3 | * i2c tv tuner chip device driver |
5 | * core core, i.e. kernel interfaces, registering and so on | 4 | * core core, i.e. kernel interfaces, registering and so on |
@@ -182,6 +181,14 @@ static void set_type(struct i2c_client *c, unsigned int type, | |||
182 | i2c_master_send(c, buffer, 4); | 181 | i2c_master_send(c, buffer, 4); |
183 | default_tuner_init(c); | 182 | default_tuner_init(c); |
184 | break; | 183 | break; |
184 | case TUNER_LG_TDVS_H062F: | ||
185 | /* Set the Auxiliary Byte. */ | ||
186 | buffer[2] &= ~0x20; | ||
187 | buffer[2] |= 0x18; | ||
188 | buffer[3] = 0x20; | ||
189 | i2c_master_send(c, buffer, 4); | ||
190 | default_tuner_init(c); | ||
191 | break; | ||
185 | default: | 192 | default: |
186 | default_tuner_init(c); | 193 | default_tuner_init(c); |
187 | break; | 194 | break; |
@@ -208,31 +215,31 @@ static void set_addr(struct i2c_client *c, struct tuner_setup *tun_setup) | |||
208 | { | 215 | { |
209 | struct tuner *t = i2c_get_clientdata(c); | 216 | struct tuner *t = i2c_get_clientdata(c); |
210 | 217 | ||
211 | if (tun_setup->addr == ADDR_UNSET) { | 218 | if ((tun_setup->addr == ADDR_UNSET && |
212 | if (t->mode_mask & tun_setup->mode_mask) | 219 | (t->mode_mask & tun_setup->mode_mask)) || |
220 | tun_setup->addr == c->addr) { | ||
213 | set_type(c, tun_setup->type, tun_setup->mode_mask); | 221 | set_type(c, tun_setup->type, tun_setup->mode_mask); |
214 | } else if (tun_setup->addr == c->addr) { | ||
215 | set_type(c, tun_setup->type, tun_setup->mode_mask); | ||
216 | } | 222 | } |
217 | } | 223 | } |
218 | 224 | ||
219 | static inline int check_mode(struct tuner *t, char *cmd) | 225 | static inline int check_mode(struct tuner *t, char *cmd) |
220 | { | 226 | { |
221 | if (1 << t->mode & t->mode_mask) { | 227 | if ((1 << t->mode & t->mode_mask) == 0) { |
222 | switch (t->mode) { | 228 | return EINVAL; |
223 | case V4L2_TUNER_RADIO: | 229 | } |
224 | tuner_dbg("Cmd %s accepted for radio\n", cmd); | 230 | |
225 | break; | 231 | switch (t->mode) { |
226 | case V4L2_TUNER_ANALOG_TV: | 232 | case V4L2_TUNER_RADIO: |
227 | tuner_dbg("Cmd %s accepted for analog TV\n", cmd); | 233 | tuner_dbg("Cmd %s accepted for radio\n", cmd); |
228 | break; | 234 | break; |
229 | case V4L2_TUNER_DIGITAL_TV: | 235 | case V4L2_TUNER_ANALOG_TV: |
230 | tuner_dbg("Cmd %s accepted for digital TV\n", cmd); | 236 | tuner_dbg("Cmd %s accepted for analog TV\n", cmd); |
231 | break; | 237 | break; |
232 | } | 238 | case V4L2_TUNER_DIGITAL_TV: |
233 | return 0; | 239 | tuner_dbg("Cmd %s accepted for digital TV\n", cmd); |
240 | break; | ||
234 | } | 241 | } |
235 | return EINVAL; | 242 | return 0; |
236 | } | 243 | } |
237 | 244 | ||
238 | static char pal[] = "-"; | 245 | static char pal[] = "-"; |
@@ -274,6 +281,12 @@ static int tuner_fixup_std(struct tuner *t) | |||
274 | tuner_dbg ("insmod fixup: PAL => PAL-N\n"); | 281 | tuner_dbg ("insmod fixup: PAL => PAL-N\n"); |
275 | t->std = V4L2_STD_PAL_N; | 282 | t->std = V4L2_STD_PAL_N; |
276 | break; | 283 | break; |
284 | case '-': | ||
285 | /* default parameter, do nothing */ | ||
286 | break; | ||
287 | default: | ||
288 | tuner_warn ("pal= argument not recognised\n"); | ||
289 | break; | ||
277 | } | 290 | } |
278 | } | 291 | } |
279 | if ((t->std & V4L2_STD_SECAM) == V4L2_STD_SECAM) { | 292 | if ((t->std & V4L2_STD_SECAM) == V4L2_STD_SECAM) { |
@@ -290,6 +303,12 @@ static int tuner_fixup_std(struct tuner *t) | |||
290 | tuner_dbg ("insmod fixup: SECAM => SECAM-L\n"); | 303 | tuner_dbg ("insmod fixup: SECAM => SECAM-L\n"); |
291 | t->std = V4L2_STD_SECAM_L; | 304 | t->std = V4L2_STD_SECAM_L; |
292 | break; | 305 | break; |
306 | case '-': | ||
307 | /* default parameter, do nothing */ | ||
308 | break; | ||
309 | default: | ||
310 | tuner_warn ("secam= argument not recognised\n"); | ||
311 | break; | ||
293 | } | 312 | } |
294 | } | 313 | } |
295 | 314 | ||
@@ -406,20 +425,18 @@ static int tuner_detach(struct i2c_client *client) | |||
406 | 425 | ||
407 | static inline int set_mode(struct i2c_client *client, struct tuner *t, int mode, char *cmd) | 426 | static inline int set_mode(struct i2c_client *client, struct tuner *t, int mode, char *cmd) |
408 | { | 427 | { |
409 | if (mode != t->mode) { | 428 | if (mode == t->mode) |
410 | 429 | return 0; | |
411 | t->mode = mode; | 430 | |
412 | if (check_mode(t, cmd) == EINVAL) { | 431 | t->mode = mode; |
413 | t->mode = T_STANDBY; | 432 | |
414 | if (V4L2_TUNER_RADIO == mode) { | 433 | if (check_mode(t, cmd) == EINVAL) { |
415 | set_tv_freq(client, 400 * 16); | 434 | t->mode = T_STANDBY; |
416 | } else { | 435 | if (t->standby) |
417 | set_radio_freq(client, 87.5 * 16000); | 436 | t->standby (client); |
418 | } | 437 | return EINVAL; |
419 | return EINVAL; | 438 | } |
420 | } | 439 | return 0; |
421 | } | ||
422 | return 0; | ||
423 | } | 440 | } |
424 | 441 | ||
425 | #define switch_v4l2() if (!t->using_v4l2) \ | 442 | #define switch_v4l2() if (!t->using_v4l2) \ |
@@ -453,6 +470,14 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
453 | case AUDC_SET_RADIO: | 470 | case AUDC_SET_RADIO: |
454 | set_mode(client,t,V4L2_TUNER_RADIO, "AUDC_SET_RADIO"); | 471 | set_mode(client,t,V4L2_TUNER_RADIO, "AUDC_SET_RADIO"); |
455 | break; | 472 | break; |
473 | case TUNER_SET_STANDBY: | ||
474 | { | ||
475 | if (check_mode(t, "TUNER_SET_STANDBY") == EINVAL) | ||
476 | return 0; | ||
477 | if (t->standby) | ||
478 | t->standby (client); | ||
479 | break; | ||
480 | } | ||
456 | case AUDC_CONFIG_PINNACLE: | 481 | case AUDC_CONFIG_PINNACLE: |
457 | if (check_mode(t, "AUDC_CONFIG_PINNACLE") == EINVAL) | 482 | if (check_mode(t, "AUDC_CONFIG_PINNACLE") == EINVAL) |
458 | return 0; | 483 | return 0; |
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c index de0c93aeb75d..8edd73abe1d8 100644 --- a/drivers/media/video/tuner-simple.c +++ b/drivers/media/video/tuner-simple.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: tuner-simple.c,v 1.43 2005/07/28 18:41:21 mchehab Exp $ | ||
3 | * | 2 | * |
4 | * i2c tv tuner chip device driver | 3 | * i2c tv tuner chip device driver |
5 | * controls all those simple 4-control-bytes style tuners. | 4 | * controls all those simple 4-control-bytes style tuners. |
@@ -102,6 +101,7 @@ struct tunertype | |||
102 | * "no float in kernel" rule. | 101 | * "no float in kernel" rule. |
103 | */ | 102 | */ |
104 | static struct tunertype tuners[] = { | 103 | static struct tunertype tuners[] = { |
104 | /* 0-9 */ | ||
105 | { "Temic PAL (4002 FH5)", TEMIC, PAL, | 105 | { "Temic PAL (4002 FH5)", TEMIC, PAL, |
106 | 16*140.25,16*463.25,0x02,0x04,0x01,0x8e,623}, | 106 | 16*140.25,16*463.25,0x02,0x04,0x01,0x8e,623}, |
107 | { "Philips PAL_I (FI1246 and compatibles)", Philips, PAL_I, | 107 | { "Philips PAL_I (FI1246 and compatibles)", Philips, PAL_I, |
@@ -110,7 +110,6 @@ static struct tunertype tuners[] = { | |||
110 | 16*157.25,16*451.25,0xA0,0x90,0x30,0x8e,732}, | 110 | 16*157.25,16*451.25,0xA0,0x90,0x30,0x8e,732}, |
111 | { "Philips (SECAM+PAL_BG) (FI1216MF, FM1216MF, FR1216MF)", Philips, SECAM, | 111 | { "Philips (SECAM+PAL_BG) (FI1216MF, FM1216MF, FR1216MF)", Philips, SECAM, |
112 | 16*168.25,16*447.25,0xA7,0x97,0x37,0x8e,623}, | 112 | 16*168.25,16*447.25,0xA7,0x97,0x37,0x8e,623}, |
113 | |||
114 | { "NoTuner", NoTuner, NOTUNER, | 113 | { "NoTuner", NoTuner, NOTUNER, |
115 | 0,0,0x00,0x00,0x00,0x00,0x00}, | 114 | 0,0,0x00,0x00,0x00,0x00,0x00}, |
116 | { "Philips PAL_BG (FI1216 and compatibles)", Philips, PAL, | 115 | { "Philips PAL_BG (FI1216 and compatibles)", Philips, PAL, |
@@ -119,34 +118,34 @@ static struct tunertype tuners[] = { | |||
119 | 16*157.25,16*463.25,0x02,0x04,0x01,0x8e,732}, | 118 | 16*157.25,16*463.25,0x02,0x04,0x01,0x8e,732}, |
120 | { "Temic PAL_I (4062 FY5)", TEMIC, PAL_I, | 119 | { "Temic PAL_I (4062 FY5)", TEMIC, PAL_I, |
121 | 16*170.00,16*450.00,0x02,0x04,0x01,0x8e,623}, | 120 | 16*170.00,16*450.00,0x02,0x04,0x01,0x8e,623}, |
122 | |||
123 | { "Temic NTSC (4036 FY5)", TEMIC, NTSC, | 121 | { "Temic NTSC (4036 FY5)", TEMIC, NTSC, |
124 | 16*157.25,16*463.25,0xa0,0x90,0x30,0x8e,732}, | 122 | 16*157.25,16*463.25,0xa0,0x90,0x30,0x8e,732}, |
125 | { "Alps HSBH1", TEMIC, NTSC, | 123 | { "Alps HSBH1", TEMIC, NTSC, |
126 | 16*137.25,16*385.25,0x01,0x02,0x08,0x8e,732}, | 124 | 16*137.25,16*385.25,0x01,0x02,0x08,0x8e,732}, |
127 | { "Alps TSBE1",TEMIC,PAL, | 125 | |
126 | /* 10-19 */ | ||
127 | { "Alps TSBE1", TEMIC, PAL, | ||
128 | 16*137.25,16*385.25,0x01,0x02,0x08,0x8e,732}, | 128 | 16*137.25,16*385.25,0x01,0x02,0x08,0x8e,732}, |
129 | { "Alps TSBB5", Alps, PAL_I, /* tested (UK UHF) with Modulartech MM205 */ | 129 | { "Alps TSBB5", Alps, PAL_I, /* tested (UK UHF) with Modulartech MM205 */ |
130 | 16*133.25,16*351.25,0x01,0x02,0x08,0x8e,632}, | 130 | 16*133.25,16*351.25,0x01,0x02,0x08,0x8e,632}, |
131 | |||
132 | { "Alps TSBE5", Alps, PAL, /* untested - data sheet guess. Only IF differs. */ | 131 | { "Alps TSBE5", Alps, PAL, /* untested - data sheet guess. Only IF differs. */ |
133 | 16*133.25,16*351.25,0x01,0x02,0x08,0x8e,622}, | 132 | 16*133.25,16*351.25,0x01,0x02,0x08,0x8e,622}, |
134 | { "Alps TSBC5", Alps, PAL, /* untested - data sheet guess. Only IF differs. */ | 133 | { "Alps TSBC5", Alps, PAL, /* untested - data sheet guess. Only IF differs. */ |
135 | 16*133.25,16*351.25,0x01,0x02,0x08,0x8e,608}, | 134 | 16*133.25,16*351.25,0x01,0x02,0x08,0x8e,608}, |
136 | { "Temic PAL_BG (4006FH5)", TEMIC, PAL, | 135 | { "Temic PAL_BG (4006FH5)", TEMIC, PAL, |
137 | 16*170.00,16*450.00,0xa0,0x90,0x30,0x8e,623}, | 136 | 16*170.00,16*450.00,0xa0,0x90,0x30,0x8e,623}, |
138 | { "Alps TSCH6",Alps,NTSC, | 137 | { "Alps TSCH6", Alps, NTSC, |
139 | 16*137.25,16*385.25,0x14,0x12,0x11,0x8e,732}, | 138 | 16*137.25,16*385.25,0x14,0x12,0x11,0x8e,732}, |
140 | 139 | { "Temic PAL_DK (4016 FY5)", TEMIC, PAL, | |
141 | { "Temic PAL_DK (4016 FY5)",TEMIC,PAL, | ||
142 | 16*168.25,16*456.25,0xa0,0x90,0x30,0x8e,623}, | 140 | 16*168.25,16*456.25,0xa0,0x90,0x30,0x8e,623}, |
143 | { "Philips NTSC_M (MK2)",Philips,NTSC, | 141 | { "Philips NTSC_M (MK2)", Philips, NTSC, |
144 | 16*160.00,16*454.00,0xa0,0x90,0x30,0x8e,732}, | 142 | 16*160.00,16*454.00,0xa0,0x90,0x30,0x8e,732}, |
145 | { "Temic PAL_I (4066 FY5)", TEMIC, PAL_I, | 143 | { "Temic PAL_I (4066 FY5)", TEMIC, PAL_I, |
146 | 16*169.00, 16*454.00, 0xa0,0x90,0x30,0x8e,623}, | 144 | 16*169.00, 16*454.00, 0xa0,0x90,0x30,0x8e,623}, |
147 | { "Temic PAL* auto (4006 FN5)", TEMIC, PAL, | 145 | { "Temic PAL* auto (4006 FN5)", TEMIC, PAL, |
148 | 16*169.00, 16*454.00, 0xa0,0x90,0x30,0x8e,623}, | 146 | 16*169.00, 16*454.00, 0xa0,0x90,0x30,0x8e,623}, |
149 | 147 | ||
148 | /* 20-29 */ | ||
150 | { "Temic PAL_BG (4009 FR5) or PAL_I (4069 FR5)", TEMIC, PAL, | 149 | { "Temic PAL_BG (4009 FR5) or PAL_I (4069 FR5)", TEMIC, PAL, |
151 | 16*141.00, 16*464.00, 0xa0,0x90,0x30,0x8e,623}, | 150 | 16*141.00, 16*464.00, 0xa0,0x90,0x30,0x8e,623}, |
152 | { "Temic NTSC (4039 FR5)", TEMIC, NTSC, | 151 | { "Temic NTSC (4039 FR5)", TEMIC, NTSC, |
@@ -155,7 +154,6 @@ static struct tunertype tuners[] = { | |||
155 | 16*169.00, 16*454.00, 0xa0,0x90,0x30,0x8e,623}, | 154 | 16*169.00, 16*454.00, 0xa0,0x90,0x30,0x8e,623}, |
156 | { "Philips PAL_DK (FI1256 and compatibles)", Philips, PAL, | 155 | { "Philips PAL_DK (FI1256 and compatibles)", Philips, PAL, |
157 | 16*170.00,16*450.00,0xa0,0x90,0x30,0x8e,623}, | 156 | 16*170.00,16*450.00,0xa0,0x90,0x30,0x8e,623}, |
158 | |||
159 | { "Philips PAL/SECAM multi (FQ1216ME)", Philips, PAL, | 157 | { "Philips PAL/SECAM multi (FQ1216ME)", Philips, PAL, |
160 | 16*170.00,16*450.00,0xa0,0x90,0x30,0x8e,623}, | 158 | 16*170.00,16*450.00,0xa0,0x90,0x30,0x8e,623}, |
161 | { "LG PAL_I+FM (TAPC-I001D)", LGINNOTEK, PAL_I, | 159 | { "LG PAL_I+FM (TAPC-I001D)", LGINNOTEK, PAL_I, |
@@ -164,25 +162,24 @@ static struct tunertype tuners[] = { | |||
164 | 16*170.00,16*450.00,0xa0,0x90,0x30,0x8e,623}, | 162 | 16*170.00,16*450.00,0xa0,0x90,0x30,0x8e,623}, |
165 | { "LG NTSC+FM (TPI8NSR01F)", LGINNOTEK, NTSC, | 163 | { "LG NTSC+FM (TPI8NSR01F)", LGINNOTEK, NTSC, |
166 | 16*210.00,16*497.00,0xa0,0x90,0x30,0x8e,732}, | 164 | 16*210.00,16*497.00,0xa0,0x90,0x30,0x8e,732}, |
167 | |||
168 | { "LG PAL_BG+FM (TPI8PSB01D)", LGINNOTEK, PAL, | 165 | { "LG PAL_BG+FM (TPI8PSB01D)", LGINNOTEK, PAL, |
169 | 16*170.00,16*450.00,0xa0,0x90,0x30,0x8e,623}, | 166 | 16*170.00,16*450.00,0xa0,0x90,0x30,0x8e,623}, |
170 | { "LG PAL_BG (TPI8PSB11D)", LGINNOTEK, PAL, | 167 | { "LG PAL_BG (TPI8PSB11D)", LGINNOTEK, PAL, |
171 | 16*170.00,16*450.00,0xa0,0x90,0x30,0x8e,623}, | 168 | 16*170.00,16*450.00,0xa0,0x90,0x30,0x8e,623}, |
169 | |||
170 | /* 30-39 */ | ||
172 | { "Temic PAL* auto + FM (4009 FN5)", TEMIC, PAL, | 171 | { "Temic PAL* auto + FM (4009 FN5)", TEMIC, PAL, |
173 | 16*141.00, 16*464.00, 0xa0,0x90,0x30,0x8e,623}, | 172 | 16*141.00, 16*464.00, 0xa0,0x90,0x30,0x8e,623}, |
174 | { "SHARP NTSC_JP (2U5JF5540)", SHARP, NTSC, /* 940=16*58.75 NTSC@Japan */ | 173 | { "SHARP NTSC_JP (2U5JF5540)", SHARP, NTSC, /* 940=16*58.75 NTSC@Japan */ |
175 | 16*137.25,16*317.25,0x01,0x02,0x08,0x8e,940 }, | 174 | 16*137.25,16*317.25,0x01,0x02,0x08,0x8e,940 }, |
176 | 175 | { "Samsung PAL TCPM9091PD27", Samsung, PAL, /* from sourceforge v3tv */ | |
177 | { "Samsung PAL TCPM9091PD27", Samsung, PAL, /* from sourceforge v3tv */ | ||
178 | 16*169,16*464,0xA0,0x90,0x30,0x8e,623}, | 176 | 16*169,16*464,0xA0,0x90,0x30,0x8e,623}, |
179 | { "MT20xx universal", Microtune,PAL|NTSC, | 177 | { "MT20xx universal", Microtune, PAL|NTSC, |
180 | /* see mt20xx.c for details */ }, | 178 | /* see mt20xx.c for details */ }, |
181 | { "Temic PAL_BG (4106 FH5)", TEMIC, PAL, | 179 | { "Temic PAL_BG (4106 FH5)", TEMIC, PAL, |
182 | 16*141.00, 16*464.00, 0xa0,0x90,0x30,0x8e,623}, | 180 | 16*141.00, 16*464.00, 0xa0,0x90,0x30,0x8e,623}, |
183 | { "Temic PAL_DK/SECAM_L (4012 FY5)", TEMIC, PAL, | 181 | { "Temic PAL_DK/SECAM_L (4012 FY5)", TEMIC, PAL, |
184 | 16*140.25, 16*463.25, 0x02,0x04,0x01,0x8e,623}, | 182 | 16*140.25, 16*463.25, 0x02,0x04,0x01,0x8e,623}, |
185 | |||
186 | { "Temic NTSC (4136 FY5)", TEMIC, NTSC, | 183 | { "Temic NTSC (4136 FY5)", TEMIC, NTSC, |
187 | 16*158.00, 16*453.00, 0xa0,0x90,0x30,0x8e,732}, | 184 | 16*158.00, 16*453.00, 0xa0,0x90,0x30,0x8e,732}, |
188 | { "LG PAL (newer TAPC series)", LGINNOTEK, PAL, | 185 | { "LG PAL (newer TAPC series)", LGINNOTEK, PAL, |
@@ -192,42 +189,41 @@ static struct tunertype tuners[] = { | |||
192 | { "LG NTSC (newer TAPC series)", LGINNOTEK, NTSC, | 189 | { "LG NTSC (newer TAPC series)", LGINNOTEK, NTSC, |
193 | 16*170.00, 16*450.00, 0x01,0x02,0x08,0x8e,732}, | 190 | 16*170.00, 16*450.00, 0x01,0x02,0x08,0x8e,732}, |
194 | 191 | ||
192 | /* 40-49 */ | ||
195 | { "HITACHI V7-J180AT", HITACHI, NTSC, | 193 | { "HITACHI V7-J180AT", HITACHI, NTSC, |
196 | 16*170.00, 16*450.00, 0x01,0x02,0x08,0x8e,940 }, | 194 | 16*170.00, 16*450.00, 0x01,0x02,0x08,0x8e,940 }, |
197 | { "Philips PAL_MK (FI1216 MK)", Philips, PAL, | 195 | { "Philips PAL_MK (FI1216 MK)", Philips, PAL, |
198 | 16*140.25,16*463.25,0x01,0xc2,0xcf,0x8e,623}, | 196 | 16*140.25,16*463.25,0x01,0xc2,0xcf,0x8e,623}, |
199 | { "Philips 1236D ATSC/NTSC daul in",Philips,ATSC, | 197 | { "Philips 1236D ATSC/NTSC daul in", Philips, ATSC, |
200 | 16*157.25,16*454.00,0xa0,0x90,0x30,0x8e,732}, | 198 | 16*157.25,16*454.00,0xa0,0x90,0x30,0x8e,732}, |
201 | { "Philips NTSC MK3 (FM1236MK3 or FM1236/F)", Philips, NTSC, | 199 | { "Philips NTSC MK3 (FM1236MK3 or FM1236/F)", Philips, NTSC, |
202 | 16*160.00,16*442.00,0x01,0x02,0x04,0x8e,732}, | 200 | 16*160.00,16*442.00,0x01,0x02,0x04,0x8e,732}, |
203 | |||
204 | { "Philips 4 in 1 (ATI TV Wonder Pro/Conexant)", Philips, NTSC, | 201 | { "Philips 4 in 1 (ATI TV Wonder Pro/Conexant)", Philips, NTSC, |
205 | 16*160.00,16*442.00,0x01,0x02,0x04,0x8e,732}, | 202 | 16*160.00,16*442.00,0x01,0x02,0x04,0x8e,732}, |
206 | { "Microtune 4049 FM5",Microtune,PAL, | 203 | { "Microtune 4049 FM5", Microtune, PAL, |
207 | 16*141.00,16*464.00,0xa0,0x90,0x30,0x8e,623}, | 204 | 16*141.00,16*464.00,0xa0,0x90,0x30,0x8e,623}, |
208 | { "Panasonic VP27s/ENGE4324D", Panasonic, NTSC, | 205 | { "Panasonic VP27s/ENGE4324D", Panasonic, NTSC, |
209 | 16*160.00,16*454.00,0x01,0x02,0x08,0xce,940}, | 206 | 16*160.00,16*454.00,0x01,0x02,0x08,0xce,940}, |
210 | { "LG NTSC (TAPE series)", LGINNOTEK, NTSC, | 207 | { "LG NTSC (TAPE series)", LGINNOTEK, NTSC, |
211 | 16*160.00,16*442.00,0x01,0x02,0x04,0x8e,732 }, | 208 | 16*160.00,16*442.00,0x01,0x02,0x04,0x8e,732 }, |
212 | |||
213 | { "Tenna TNF 8831 BGFF)", Philips, PAL, | 209 | { "Tenna TNF 8831 BGFF)", Philips, PAL, |
214 | 16*161.25,16*463.25,0xa0,0x90,0x30,0x8e,623}, | 210 | 16*161.25,16*463.25,0xa0,0x90,0x30,0x8e,623}, |
215 | { "Microtune 4042 FI5 ATSC/NTSC dual in", Microtune, NTSC, | 211 | { "Microtune 4042 FI5 ATSC/NTSC dual in", Microtune, NTSC, |
216 | 16*162.00,16*457.00,0xa2,0x94,0x31,0x8e,732}, | 212 | 16*162.00,16*457.00,0xa2,0x94,0x31,0x8e,732}, |
213 | |||
214 | /* 50-59 */ | ||
217 | { "TCL 2002N", TCL, NTSC, | 215 | { "TCL 2002N", TCL, NTSC, |
218 | 16*172.00,16*448.00,0x01,0x02,0x08,0x8e,732}, | 216 | 16*172.00,16*448.00,0x01,0x02,0x08,0x8e,732}, |
219 | { "Philips PAL/SECAM_D (FM 1256 I-H3)", Philips, PAL, | 217 | { "Philips PAL/SECAM_D (FM 1256 I-H3)", Philips, PAL, |
220 | 16*160.00,16*442.00,0x01,0x02,0x04,0x8e,623 }, | 218 | 16*160.00,16*442.00,0x01,0x02,0x04,0x8e,623 }, |
221 | |||
222 | { "Thomson DDT 7610 (ATSC/NTSC)", THOMSON, ATSC, | 219 | { "Thomson DDT 7610 (ATSC/NTSC)", THOMSON, ATSC, |
223 | 16*157.25,16*454.00,0x39,0x3a,0x3c,0x8e,732}, | 220 | 16*157.25,16*454.00,0x39,0x3a,0x3c,0x8e,732}, |
224 | { "Philips FQ1286", Philips, NTSC, | 221 | { "Philips FQ1286", Philips, NTSC, |
225 | 16*160.00,16*454.00,0x41,0x42,0x04,0x8e,940}, // UHF band untested | 222 | 16*160.00,16*454.00,0x41,0x42,0x04,0x8e,940}, /* UHF band untested */ |
226 | { "tda8290+75", Philips,PAL|NTSC, | 223 | { "tda8290+75", Philips, PAL|NTSC, |
227 | /* see tda8290.c for details */ }, | 224 | /* see tda8290.c for details */ }, |
228 | { "LG PAL (TAPE series)", LGINNOTEK, PAL, | 225 | { "LG PAL (TAPE series)", LGINNOTEK, PAL, |
229 | 16*170.00, 16*450.00, 0x01,0x02,0x08,0xce,623}, | 226 | 16*170.00, 16*450.00, 0x01,0x02,0x08,0xce,623}, |
230 | |||
231 | { "Philips PAL/SECAM multi (FQ1216AME MK4)", Philips, PAL, | 227 | { "Philips PAL/SECAM multi (FQ1216AME MK4)", Philips, PAL, |
232 | 16*160.00,16*442.00,0x01,0x02,0x04,0xce,623 }, | 228 | 16*160.00,16*442.00,0x01,0x02,0x04,0xce,623 }, |
233 | { "Philips FQ1236A MK4", Philips, NTSC, | 229 | { "Philips FQ1236A MK4", Philips, NTSC, |
@@ -237,6 +233,7 @@ static struct tunertype tuners[] = { | |||
237 | { "Ymec TVision TVF-5533MF", Philips, NTSC, | 233 | { "Ymec TVision TVF-5533MF", Philips, NTSC, |
238 | 16*160.00,16*454.00,0x01,0x02,0x04,0x8e,732}, | 234 | 16*160.00,16*454.00,0x01,0x02,0x04,0x8e,732}, |
239 | 235 | ||
236 | /* 60-66 */ | ||
240 | { "Thomson DDT 7611 (ATSC/NTSC)", THOMSON, ATSC, | 237 | { "Thomson DDT 7611 (ATSC/NTSC)", THOMSON, ATSC, |
241 | 16*157.25,16*454.00,0x39,0x3a,0x3c,0x8e,732}, | 238 | 16*157.25,16*454.00,0x39,0x3a,0x3c,0x8e,732}, |
242 | { "Tena TNF9533-D/IF/TNF9533-B/DF", Philips, PAL, | 239 | { "Tena TNF9533-D/IF/TNF9533-B/DF", Philips, PAL, |
@@ -245,12 +242,12 @@ static struct tunertype tuners[] = { | |||
245 | /* see tea5767.c for details */}, | 242 | /* see tea5767.c for details */}, |
246 | { "Philips FMD1216ME MK3 Hybrid Tuner", Philips, PAL, | 243 | { "Philips FMD1216ME MK3 Hybrid Tuner", Philips, PAL, |
247 | 16*160.00,16*442.00,0x51,0x52,0x54,0x86,623 }, | 244 | 16*160.00,16*442.00,0x51,0x52,0x54,0x86,623 }, |
248 | 245 | { "LG TDVS-H062F/TUA6034", LGINNOTEK, ATSC, | |
249 | { "LG TDVS-H062F/TUA6034", LGINNOTEK, NTSC, | ||
250 | 16*160.00,16*455.00,0x01,0x02,0x04,0x8e,732}, | 246 | 16*160.00,16*455.00,0x01,0x02,0x04,0x8e,732}, |
251 | |||
252 | { "Ymec TVF66T5-B/DFF", Philips, PAL, | 247 | { "Ymec TVF66T5-B/DFF", Philips, PAL, |
253 | 16*160.25,16*464.25,0x01,0x02,0x08,0x8e,623}, | 248 | 16*160.25,16*464.25,0x01,0x02,0x08,0x8e,623}, |
249 | { "LG NTSC (TALN mini series)", LGINNOTEK, NTSC, | ||
250 | 16*137.25,16*373.25,0x01,0x02,0x08,0x8e,732 }, | ||
254 | }; | 251 | }; |
255 | 252 | ||
256 | unsigned const int tuner_count = ARRAY_SIZE(tuners); | 253 | unsigned const int tuner_count = ARRAY_SIZE(tuners); |
@@ -471,6 +468,10 @@ static void default_set_radio_freq(struct i2c_client *c, unsigned int freq) | |||
471 | case TUNER_LG_PAL_FM: | 468 | case TUNER_LG_PAL_FM: |
472 | buffer[3] = 0xa5; | 469 | buffer[3] = 0xa5; |
473 | break; | 470 | break; |
471 | case TUNER_MICROTUNE_4049FM5: | ||
472 | div = (20 * freq) / 16000 + (int)(33.3 * 20); /* IF 33.3 MHz */ | ||
473 | buffer[3] = 0xa4; | ||
474 | break; | ||
474 | default: | 475 | default: |
475 | buffer[3] = 0xa4; | 476 | buffer[3] = 0xa4; |
476 | break; | 477 | break; |
@@ -497,6 +498,7 @@ int default_tuner_init(struct i2c_client *c) | |||
497 | t->radio_freq = default_set_radio_freq; | 498 | t->radio_freq = default_set_radio_freq; |
498 | t->has_signal = tuner_signal; | 499 | t->has_signal = tuner_signal; |
499 | t->is_stereo = tuner_stereo; | 500 | t->is_stereo = tuner_stereo; |
501 | t->standby = NULL; | ||
500 | 502 | ||
501 | return 0; | 503 | return 0; |
502 | } | 504 | } |
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c index 258724b2d6d2..1c31ef52f863 100644 --- a/drivers/media/video/tvaudio.c +++ b/drivers/media/video/tvaudio.c | |||
@@ -46,7 +46,17 @@ MODULE_AUTHOR("Eric Sandeen, Steve VanDeBogart, Greg Alexander, Gerd Knorr"); | |||
46 | MODULE_LICENSE("GPL"); | 46 | MODULE_LICENSE("GPL"); |
47 | 47 | ||
48 | #define UNSET (-1U) | 48 | #define UNSET (-1U) |
49 | #define dprintk if (debug) printk | 49 | |
50 | #define tvaudio_info(fmt, arg...) do {\ | ||
51 | printk(KERN_INFO "tvaudio %d-%04x: " fmt, \ | ||
52 | chip->c.adapter->nr, chip->c.addr , ##arg); } while (0) | ||
53 | #define tvaudio_warn(fmt, arg...) do {\ | ||
54 | printk(KERN_WARNING "tvaudio %d-%04x: " fmt, \ | ||
55 | chip->c.adapter->nr, chip->c.addr , ##arg); } while (0) | ||
56 | #define tvaudio_dbg(fmt, arg...) do {\ | ||
57 | if (debug) \ | ||
58 | printk(KERN_INFO "tvaudio %d-%04x: " fmt, \ | ||
59 | chip->c.adapter->nr, chip->c.addr , ##arg); } while (0) | ||
50 | 60 | ||
51 | /* ---------------------------------------------------------------------- */ | 61 | /* ---------------------------------------------------------------------- */ |
52 | /* our structs */ | 62 | /* our structs */ |
@@ -162,23 +172,24 @@ static int chip_write(struct CHIPSTATE *chip, int subaddr, int val) | |||
162 | unsigned char buffer[2]; | 172 | unsigned char buffer[2]; |
163 | 173 | ||
164 | if (-1 == subaddr) { | 174 | if (-1 == subaddr) { |
165 | dprintk("%s: chip_write: 0x%x\n", chip->c.name, val); | 175 | tvaudio_dbg("%s: chip_write: 0x%x\n", |
176 | chip->c.name, val); | ||
166 | chip->shadow.bytes[1] = val; | 177 | chip->shadow.bytes[1] = val; |
167 | buffer[0] = val; | 178 | buffer[0] = val; |
168 | if (1 != i2c_master_send(&chip->c,buffer,1)) { | 179 | if (1 != i2c_master_send(&chip->c,buffer,1)) { |
169 | printk(KERN_WARNING "%s: I/O error (write 0x%x)\n", | 180 | tvaudio_warn("%s: I/O error (write 0x%x)\n", |
170 | chip->c.name, val); | 181 | chip->c.name, val); |
171 | return -1; | 182 | return -1; |
172 | } | 183 | } |
173 | } else { | 184 | } else { |
174 | dprintk("%s: chip_write: reg%d=0x%x\n", | 185 | tvaudio_dbg("%s: chip_write: reg%d=0x%x\n", |
175 | chip->c.name, subaddr, val); | 186 | chip->c.name, subaddr, val); |
176 | chip->shadow.bytes[subaddr+1] = val; | 187 | chip->shadow.bytes[subaddr+1] = val; |
177 | buffer[0] = subaddr; | 188 | buffer[0] = subaddr; |
178 | buffer[1] = val; | 189 | buffer[1] = val; |
179 | if (2 != i2c_master_send(&chip->c,buffer,2)) { | 190 | if (2 != i2c_master_send(&chip->c,buffer,2)) { |
180 | printk(KERN_WARNING "%s: I/O error (write reg%d=0x%x)\n", | 191 | tvaudio_warn("%s: I/O error (write reg%d=0x%x)\n", |
181 | chip->c.name, subaddr, val); | 192 | chip->c.name, subaddr, val); |
182 | return -1; | 193 | return -1; |
183 | } | 194 | } |
184 | } | 195 | } |
@@ -202,29 +213,30 @@ static int chip_read(struct CHIPSTATE *chip) | |||
202 | unsigned char buffer; | 213 | unsigned char buffer; |
203 | 214 | ||
204 | if (1 != i2c_master_recv(&chip->c,&buffer,1)) { | 215 | if (1 != i2c_master_recv(&chip->c,&buffer,1)) { |
205 | printk(KERN_WARNING "%s: I/O error (read)\n", chip->c.name); | 216 | tvaudio_warn("%s: I/O error (read)\n", |
217 | chip->c.name); | ||
206 | return -1; | 218 | return -1; |
207 | } | 219 | } |
208 | dprintk("%s: chip_read: 0x%x\n", chip->c.name, buffer); | 220 | tvaudio_dbg("%s: chip_read: 0x%x\n",chip->c.name,buffer); |
209 | return buffer; | 221 | return buffer; |
210 | } | 222 | } |
211 | 223 | ||
212 | static int chip_read2(struct CHIPSTATE *chip, int subaddr) | 224 | static int chip_read2(struct CHIPSTATE *chip, int subaddr) |
213 | { | 225 | { |
214 | unsigned char write[1]; | 226 | unsigned char write[1]; |
215 | unsigned char read[1]; | 227 | unsigned char read[1]; |
216 | struct i2c_msg msgs[2] = { | 228 | struct i2c_msg msgs[2] = { |
217 | { chip->c.addr, 0, 1, write }, | 229 | { chip->c.addr, 0, 1, write }, |
218 | { chip->c.addr, I2C_M_RD, 1, read } | 230 | { chip->c.addr, I2C_M_RD, 1, read } |
219 | }; | 231 | }; |
220 | write[0] = subaddr; | 232 | write[0] = subaddr; |
221 | 233 | ||
222 | if (2 != i2c_transfer(chip->c.adapter,msgs,2)) { | 234 | if (2 != i2c_transfer(chip->c.adapter,msgs,2)) { |
223 | printk(KERN_WARNING "%s: I/O error (read2)\n", chip->c.name); | 235 | tvaudio_warn("%s: I/O error (read2)\n", chip->c.name); |
224 | return -1; | 236 | return -1; |
225 | } | 237 | } |
226 | dprintk("%s: chip_read2: reg%d=0x%x\n", | 238 | tvaudio_dbg("%s: chip_read2: reg%d=0x%x\n", |
227 | chip->c.name, subaddr, read[0]); | 239 | chip->c.name,subaddr,read[0]); |
228 | return read[0]; | 240 | return read[0]; |
229 | } | 241 | } |
230 | 242 | ||
@@ -236,17 +248,19 @@ static int chip_cmd(struct CHIPSTATE *chip, char *name, audiocmd *cmd) | |||
236 | return 0; | 248 | return 0; |
237 | 249 | ||
238 | /* update our shadow register set; print bytes if (debug > 0) */ | 250 | /* update our shadow register set; print bytes if (debug > 0) */ |
239 | dprintk("%s: chip_cmd(%s): reg=%d, data:", | 251 | tvaudio_dbg("%s: chip_cmd(%s): reg=%d, data:", |
240 | chip->c.name, name, cmd->bytes[0]); | 252 | chip->c.name,name,cmd->bytes[0]); |
241 | for (i = 1; i < cmd->count; i++) { | 253 | for (i = 1; i < cmd->count; i++) { |
242 | dprintk(" 0x%x",cmd->bytes[i]); | 254 | if (debug) |
255 | printk(" 0x%x",cmd->bytes[i]); | ||
243 | chip->shadow.bytes[i+cmd->bytes[0]] = cmd->bytes[i]; | 256 | chip->shadow.bytes[i+cmd->bytes[0]] = cmd->bytes[i]; |
244 | } | 257 | } |
245 | dprintk("\n"); | 258 | if (debug) |
259 | printk("\n"); | ||
246 | 260 | ||
247 | /* send data to the chip */ | 261 | /* send data to the chip */ |
248 | if (cmd->count != i2c_master_send(&chip->c,cmd->bytes,cmd->count)) { | 262 | if (cmd->count != i2c_master_send(&chip->c,cmd->bytes,cmd->count)) { |
249 | printk(KERN_WARNING "%s: I/O error (%s)\n", chip->c.name, name); | 263 | tvaudio_warn("%s: I/O error (%s)\n", chip->c.name, name); |
250 | return -1; | 264 | return -1; |
251 | } | 265 | } |
252 | return 0; | 266 | return 0; |
@@ -261,19 +275,19 @@ static int chip_cmd(struct CHIPSTATE *chip, char *name, audiocmd *cmd) | |||
261 | 275 | ||
262 | static void chip_thread_wake(unsigned long data) | 276 | static void chip_thread_wake(unsigned long data) |
263 | { | 277 | { |
264 | struct CHIPSTATE *chip = (struct CHIPSTATE*)data; | 278 | struct CHIPSTATE *chip = (struct CHIPSTATE*)data; |
265 | wake_up_interruptible(&chip->wq); | 279 | wake_up_interruptible(&chip->wq); |
266 | } | 280 | } |
267 | 281 | ||
268 | static int chip_thread(void *data) | 282 | static int chip_thread(void *data) |
269 | { | 283 | { |
270 | DECLARE_WAITQUEUE(wait, current); | 284 | DECLARE_WAITQUEUE(wait, current); |
271 | struct CHIPSTATE *chip = data; | 285 | struct CHIPSTATE *chip = data; |
272 | struct CHIPDESC *desc = chiplist + chip->type; | 286 | struct CHIPDESC *desc = chiplist + chip->type; |
273 | 287 | ||
274 | daemonize("%s", chip->c.name); | 288 | daemonize("%s", chip->c.name); |
275 | allow_signal(SIGTERM); | 289 | allow_signal(SIGTERM); |
276 | dprintk("%s: thread started\n", chip->c.name); | 290 | tvaudio_dbg("%s: thread started\n", chip->c.name); |
277 | 291 | ||
278 | for (;;) { | 292 | for (;;) { |
279 | add_wait_queue(&chip->wq, &wait); | 293 | add_wait_queue(&chip->wq, &wait); |
@@ -285,7 +299,7 @@ static int chip_thread(void *data) | |||
285 | try_to_freeze(); | 299 | try_to_freeze(); |
286 | if (chip->done || signal_pending(current)) | 300 | if (chip->done || signal_pending(current)) |
287 | break; | 301 | break; |
288 | dprintk("%s: thread wakeup\n", chip->c.name); | 302 | tvaudio_dbg("%s: thread wakeup\n", chip->c.name); |
289 | 303 | ||
290 | /* don't do anything for radio or if mode != auto */ | 304 | /* don't do anything for radio or if mode != auto */ |
291 | if (chip->norm == VIDEO_MODE_RADIO || chip->mode != 0) | 305 | if (chip->norm == VIDEO_MODE_RADIO || chip->mode != 0) |
@@ -298,8 +312,8 @@ static int chip_thread(void *data) | |||
298 | mod_timer(&chip->wt, jiffies+2*HZ); | 312 | mod_timer(&chip->wt, jiffies+2*HZ); |
299 | } | 313 | } |
300 | 314 | ||
301 | dprintk("%s: thread exiting\n", chip->c.name); | 315 | tvaudio_dbg("%s: thread exiting\n", chip->c.name); |
302 | complete_and_exit(&chip->texit, 0); | 316 | complete_and_exit(&chip->texit, 0); |
303 | return 0; | 317 | return 0; |
304 | } | 318 | } |
305 | 319 | ||
@@ -309,9 +323,9 @@ static void generic_checkmode(struct CHIPSTATE *chip) | |||
309 | int mode = desc->getmode(chip); | 323 | int mode = desc->getmode(chip); |
310 | 324 | ||
311 | if (mode == chip->prevmode) | 325 | if (mode == chip->prevmode) |
312 | return; | 326 | return; |
313 | 327 | ||
314 | dprintk("%s: thread checkmode\n", chip->c.name); | 328 | tvaudio_dbg("%s: thread checkmode\n", chip->c.name); |
315 | chip->prevmode = mode; | 329 | chip->prevmode = mode; |
316 | 330 | ||
317 | if (mode & VIDEO_SOUND_STEREO) | 331 | if (mode & VIDEO_SOUND_STEREO) |
@@ -358,8 +372,8 @@ static int tda9840_getmode(struct CHIPSTATE *chip) | |||
358 | if (val & TDA9840_ST_STEREO) | 372 | if (val & TDA9840_ST_STEREO) |
359 | mode |= VIDEO_SOUND_STEREO; | 373 | mode |= VIDEO_SOUND_STEREO; |
360 | 374 | ||
361 | dprintk ("tda9840_getmode(): raw chip read: %d, return: %d\n", | 375 | tvaudio_dbg ("tda9840_getmode(): raw chip read: %d, return: %d\n", |
362 | val, mode); | 376 | val, mode); |
363 | return mode; | 377 | return mode; |
364 | } | 378 | } |
365 | 379 | ||
@@ -654,8 +668,8 @@ static int tda9873_getmode(struct CHIPSTATE *chip) | |||
654 | mode |= VIDEO_SOUND_STEREO; | 668 | mode |= VIDEO_SOUND_STEREO; |
655 | if (val & TDA9873_DUAL) | 669 | if (val & TDA9873_DUAL) |
656 | mode |= VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; | 670 | mode |= VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; |
657 | dprintk ("tda9873_getmode(): raw chip read: %d, return: %d\n", | 671 | tvaudio_dbg ("tda9873_getmode(): raw chip read: %d, return: %d\n", |
658 | val, mode); | 672 | val, mode); |
659 | return mode; | 673 | return mode; |
660 | } | 674 | } |
661 | 675 | ||
@@ -665,12 +679,12 @@ static void tda9873_setmode(struct CHIPSTATE *chip, int mode) | |||
665 | /* int adj_data = chip->shadow.bytes[TDA9873_AD+1] ; */ | 679 | /* int adj_data = chip->shadow.bytes[TDA9873_AD+1] ; */ |
666 | 680 | ||
667 | if ((sw_data & TDA9873_INP_MASK) != TDA9873_INTERNAL) { | 681 | if ((sw_data & TDA9873_INP_MASK) != TDA9873_INTERNAL) { |
668 | dprintk("tda9873_setmode(): external input\n"); | 682 | tvaudio_dbg("tda9873_setmode(): external input\n"); |
669 | return; | 683 | return; |
670 | } | 684 | } |
671 | 685 | ||
672 | dprintk("tda9873_setmode(): chip->shadow.bytes[%d] = %d\n", TDA9873_SW+1, chip->shadow.bytes[TDA9873_SW+1]); | 686 | tvaudio_dbg("tda9873_setmode(): chip->shadow.bytes[%d] = %d\n", TDA9873_SW+1, chip->shadow.bytes[TDA9873_SW+1]); |
673 | dprintk("tda9873_setmode(): sw_data = %d\n", sw_data); | 687 | tvaudio_dbg("tda9873_setmode(): sw_data = %d\n", sw_data); |
674 | 688 | ||
675 | switch (mode) { | 689 | switch (mode) { |
676 | case VIDEO_SOUND_MONO: | 690 | case VIDEO_SOUND_MONO: |
@@ -691,7 +705,7 @@ static void tda9873_setmode(struct CHIPSTATE *chip, int mode) | |||
691 | } | 705 | } |
692 | 706 | ||
693 | chip_write(chip, TDA9873_SW, sw_data); | 707 | chip_write(chip, TDA9873_SW, sw_data); |
694 | dprintk("tda9873_setmode(): req. mode %d; chip_write: %d\n", | 708 | tvaudio_dbg("tda9873_setmode(): req. mode %d; chip_write: %d\n", |
695 | mode, sw_data); | 709 | mode, sw_data); |
696 | } | 710 | } |
697 | 711 | ||
@@ -828,9 +842,9 @@ static int tda9874a_setup(struct CHIPSTATE *chip) | |||
828 | } else { /* dic == 0x07 */ | 842 | } else { /* dic == 0x07 */ |
829 | chip_write(chip, TDA9874A_AMCONR, 0xfb); | 843 | chip_write(chip, TDA9874A_AMCONR, 0xfb); |
830 | chip_write(chip, TDA9874A_SDACOSR, (tda9874a_mode) ? 0x81:0x80); | 844 | chip_write(chip, TDA9874A_SDACOSR, (tda9874a_mode) ? 0x81:0x80); |
831 | chip_write(chip, TDA9874A_AOSR, 0x00); // or 0x10 | 845 | chip_write(chip, TDA9874A_AOSR, 0x00); /* or 0x10 */ |
832 | } | 846 | } |
833 | dprintk("tda9874a_setup(): %s [0x%02X].\n", | 847 | tvaudio_dbg("tda9874a_setup(): %s [0x%02X].\n", |
834 | tda9874a_modelist[tda9874a_STD].name,tda9874a_STD); | 848 | tda9874a_modelist[tda9874a_STD].name,tda9874a_STD); |
835 | return 1; | 849 | return 1; |
836 | } | 850 | } |
@@ -873,7 +887,7 @@ static int tda9874a_getmode(struct CHIPSTATE *chip) | |||
873 | mode |= VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; | 887 | mode |= VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; |
874 | } | 888 | } |
875 | 889 | ||
876 | dprintk("tda9874a_getmode(): DSR=0x%X, NSR=0x%X, NECR=0x%X, return: %d.\n", | 890 | tvaudio_dbg("tda9874a_getmode(): DSR=0x%X, NSR=0x%X, NECR=0x%X, return: %d.\n", |
877 | dsr, nsr, necr, mode); | 891 | dsr, nsr, necr, mode); |
878 | return mode; | 892 | return mode; |
879 | } | 893 | } |
@@ -919,7 +933,7 @@ static void tda9874a_setmode(struct CHIPSTATE *chip, int mode) | |||
919 | chip_write(chip, TDA9874A_AOSR, aosr); | 933 | chip_write(chip, TDA9874A_AOSR, aosr); |
920 | chip_write(chip, TDA9874A_MDACOSR, mdacosr); | 934 | chip_write(chip, TDA9874A_MDACOSR, mdacosr); |
921 | 935 | ||
922 | dprintk("tda9874a_setmode(): req. mode %d; AOSR=0x%X, MDACOSR=0x%X.\n", | 936 | tvaudio_dbg("tda9874a_setmode(): req. mode %d; AOSR=0x%X, MDACOSR=0x%X.\n", |
923 | mode, aosr, mdacosr); | 937 | mode, aosr, mdacosr); |
924 | 938 | ||
925 | } else { /* dic == 0x07 */ | 939 | } else { /* dic == 0x07 */ |
@@ -954,7 +968,7 @@ static void tda9874a_setmode(struct CHIPSTATE *chip, int mode) | |||
954 | chip_write(chip, TDA9874A_FMMR, fmmr); | 968 | chip_write(chip, TDA9874A_FMMR, fmmr); |
955 | chip_write(chip, TDA9874A_AOSR, aosr); | 969 | chip_write(chip, TDA9874A_AOSR, aosr); |
956 | 970 | ||
957 | dprintk("tda9874a_setmode(): req. mode %d; FMMR=0x%X, AOSR=0x%X.\n", | 971 | tvaudio_dbg("tda9874a_setmode(): req. mode %d; FMMR=0x%X, AOSR=0x%X.\n", |
958 | mode, fmmr, aosr); | 972 | mode, fmmr, aosr); |
959 | } | 973 | } |
960 | } | 974 | } |
@@ -968,10 +982,10 @@ static int tda9874a_checkit(struct CHIPSTATE *chip) | |||
968 | if(-1 == (sic = chip_read2(chip,TDA9874A_SIC))) | 982 | if(-1 == (sic = chip_read2(chip,TDA9874A_SIC))) |
969 | return 0; | 983 | return 0; |
970 | 984 | ||
971 | dprintk("tda9874a_checkit(): DIC=0x%X, SIC=0x%X.\n", dic, sic); | 985 | tvaudio_dbg("tda9874a_checkit(): DIC=0x%X, SIC=0x%X.\n", dic, sic); |
972 | 986 | ||
973 | if((dic == 0x11)||(dic == 0x07)) { | 987 | if((dic == 0x11)||(dic == 0x07)) { |
974 | printk("tvaudio: found tda9874%s.\n", (dic == 0x11) ? "a":"h"); | 988 | tvaudio_info("found tda9874%s.\n", (dic == 0x11) ? "a":"h"); |
975 | tda9874a_dic = dic; /* remember device id. */ | 989 | tda9874a_dic = dic; /* remember device id. */ |
976 | return 1; | 990 | return 1; |
977 | } | 991 | } |
@@ -1146,7 +1160,7 @@ static void tda8425_setmode(struct CHIPSTATE *chip, int mode) | |||
1146 | /* ---------------------------------------------------------------------- */ | 1160 | /* ---------------------------------------------------------------------- */ |
1147 | /* audio chip descriptions - defines+functions for TA8874Z */ | 1161 | /* audio chip descriptions - defines+functions for TA8874Z */ |
1148 | 1162 | ||
1149 | // write 1st byte | 1163 | /* write 1st byte */ |
1150 | #define TA8874Z_LED_STE 0x80 | 1164 | #define TA8874Z_LED_STE 0x80 |
1151 | #define TA8874Z_LED_BIL 0x40 | 1165 | #define TA8874Z_LED_BIL 0x40 |
1152 | #define TA8874Z_LED_EXT 0x20 | 1166 | #define TA8874Z_LED_EXT 0x20 |
@@ -1156,21 +1170,22 @@ static void tda8425_setmode(struct CHIPSTATE *chip, int mode) | |||
1156 | #define TA8874Z_MODE_SUB 0x02 | 1170 | #define TA8874Z_MODE_SUB 0x02 |
1157 | #define TA8874Z_MODE_MAIN 0x01 | 1171 | #define TA8874Z_MODE_MAIN 0x01 |
1158 | 1172 | ||
1159 | // write 2nd byte | 1173 | /* write 2nd byte */ |
1160 | //#define TA8874Z_TI 0x80 // test mode | 1174 | /*#define TA8874Z_TI 0x80 */ /* test mode */ |
1161 | #define TA8874Z_SEPARATION 0x3f | 1175 | #define TA8874Z_SEPARATION 0x3f |
1162 | #define TA8874Z_SEPARATION_DEFAULT 0x10 | 1176 | #define TA8874Z_SEPARATION_DEFAULT 0x10 |
1163 | 1177 | ||
1164 | // read | 1178 | /* read */ |
1165 | #define TA8874Z_B1 0x80 | 1179 | #define TA8874Z_B1 0x80 |
1166 | #define TA8874Z_B0 0x40 | 1180 | #define TA8874Z_B0 0x40 |
1167 | #define TA8874Z_CHAG_FLAG 0x20 | 1181 | #define TA8874Z_CHAG_FLAG 0x20 |
1168 | 1182 | ||
1169 | // B1 B0 | 1183 | /* |
1170 | // mono L H | 1184 | * B1 B0 |
1171 | // stereo L L | 1185 | * mono L H |
1172 | // BIL H L | 1186 | * stereo L L |
1173 | 1187 | * BIL H L | |
1188 | */ | ||
1174 | static int ta8874z_getmode(struct CHIPSTATE *chip) | 1189 | static int ta8874z_getmode(struct CHIPSTATE *chip) |
1175 | { | 1190 | { |
1176 | int val, mode; | 1191 | int val, mode; |
@@ -1182,7 +1197,7 @@ static int ta8874z_getmode(struct CHIPSTATE *chip) | |||
1182 | }else if (!(val & TA8874Z_B0)){ | 1197 | }else if (!(val & TA8874Z_B0)){ |
1183 | mode |= VIDEO_SOUND_STEREO; | 1198 | mode |= VIDEO_SOUND_STEREO; |
1184 | } | 1199 | } |
1185 | //dprintk ("ta8874z_getmode(): raw chip read: 0x%02x, return: 0x%02x\n", val, mode); | 1200 | /* tvaudio_dbg ("ta8874z_getmode(): raw chip read: 0x%02x, return: 0x%02x\n", val, mode); */ |
1186 | return mode; | 1201 | return mode; |
1187 | } | 1202 | } |
1188 | 1203 | ||
@@ -1195,7 +1210,7 @@ static void ta8874z_setmode(struct CHIPSTATE *chip, int mode) | |||
1195 | { | 1210 | { |
1196 | int update = 1; | 1211 | int update = 1; |
1197 | audiocmd *t = NULL; | 1212 | audiocmd *t = NULL; |
1198 | dprintk("ta8874z_setmode(): mode: 0x%02x\n", mode); | 1213 | tvaudio_dbg("ta8874z_setmode(): mode: 0x%02x\n", mode); |
1199 | 1214 | ||
1200 | switch(mode){ | 1215 | switch(mode){ |
1201 | case VIDEO_SOUND_MONO: | 1216 | case VIDEO_SOUND_MONO: |
@@ -1235,11 +1250,11 @@ static int tda9850 = 1; | |||
1235 | static int tda9855 = 1; | 1250 | static int tda9855 = 1; |
1236 | static int tda9873 = 1; | 1251 | static int tda9873 = 1; |
1237 | static int tda9874a = 1; | 1252 | static int tda9874a = 1; |
1238 | static int tea6300 = 0; // address clash with msp34xx | 1253 | static int tea6300 = 0; /* address clash with msp34xx */ |
1239 | static int tea6320 = 0; // address clash with msp34xx | 1254 | static int tea6320 = 0; /* address clash with msp34xx */ |
1240 | static int tea6420 = 1; | 1255 | static int tea6420 = 1; |
1241 | static int pic16c54 = 1; | 1256 | static int pic16c54 = 1; |
1242 | static int ta8874z = 0; // address clash with tda9840 | 1257 | static int ta8874z = 0; /* address clash with tda9840 */ |
1243 | 1258 | ||
1244 | module_param(tda8425, int, 0444); | 1259 | module_param(tda8425, int, 0444); |
1245 | module_param(tda9840, int, 0444); | 1260 | module_param(tda9840, int, 0444); |
@@ -1441,7 +1456,7 @@ static struct CHIPDESC chiplist[] = { | |||
1441 | { | 1456 | { |
1442 | .name = "ta8874z", | 1457 | .name = "ta8874z", |
1443 | .id = -1, | 1458 | .id = -1, |
1444 | //.id = I2C_DRIVERID_TA8874Z, | 1459 | /*.id = I2C_DRIVERID_TA8874Z, */ |
1445 | .checkit = ta8874z_checkit, | 1460 | .checkit = ta8874z_checkit, |
1446 | .insmodopt = &ta8874z, | 1461 | .insmodopt = &ta8874z, |
1447 | .addr_lo = I2C_TDA9840 >> 1, | 1462 | .addr_lo = I2C_TDA9840 >> 1, |
@@ -1476,7 +1491,7 @@ static int chip_attach(struct i2c_adapter *adap, int addr, int kind) | |||
1476 | i2c_set_clientdata(&chip->c, chip); | 1491 | i2c_set_clientdata(&chip->c, chip); |
1477 | 1492 | ||
1478 | /* find description for the chip */ | 1493 | /* find description for the chip */ |
1479 | dprintk("tvaudio: chip found @ i2c-addr=0x%x\n", addr<<1); | 1494 | tvaudio_dbg("chip found @ 0x%x\n", addr<<1); |
1480 | for (desc = chiplist; desc->name != NULL; desc++) { | 1495 | for (desc = chiplist; desc->name != NULL; desc++) { |
1481 | if (0 == *(desc->insmodopt)) | 1496 | if (0 == *(desc->insmodopt)) |
1482 | continue; | 1497 | continue; |
@@ -1488,17 +1503,19 @@ static int chip_attach(struct i2c_adapter *adap, int addr, int kind) | |||
1488 | break; | 1503 | break; |
1489 | } | 1504 | } |
1490 | if (desc->name == NULL) { | 1505 | if (desc->name == NULL) { |
1491 | dprintk("tvaudio: no matching chip description found\n"); | 1506 | tvaudio_dbg("no matching chip description found\n"); |
1492 | return -EIO; | 1507 | return -EIO; |
1493 | } | 1508 | } |
1494 | printk("tvaudio: found %s @ 0x%x\n", desc->name, addr<<1); | 1509 | tvaudio_info("%s found @ 0x%x (%s)\n", desc->name, addr<<1, adap->name); |
1495 | dprintk("tvaudio: matches:%s%s%s.\n", | 1510 | if (desc->flags) { |
1496 | (desc->flags & CHIP_HAS_VOLUME) ? " volume" : "", | 1511 | tvaudio_dbg("matches:%s%s%s.\n", |
1497 | (desc->flags & CHIP_HAS_BASSTREBLE) ? " bass/treble" : "", | 1512 | (desc->flags & CHIP_HAS_VOLUME) ? " volume" : "", |
1498 | (desc->flags & CHIP_HAS_INPUTSEL) ? " audiomux" : ""); | 1513 | (desc->flags & CHIP_HAS_BASSTREBLE) ? " bass/treble" : "", |
1514 | (desc->flags & CHIP_HAS_INPUTSEL) ? " audiomux" : ""); | ||
1515 | } | ||
1499 | 1516 | ||
1500 | /* fill required data structures */ | 1517 | /* fill required data structures */ |
1501 | strcpy(chip->c.name, desc->name); | 1518 | strcpy(chip->c.name,desc->name); |
1502 | chip->type = desc-chiplist; | 1519 | chip->type = desc-chiplist; |
1503 | chip->shadow.count = desc->registers+1; | 1520 | chip->shadow.count = desc->registers+1; |
1504 | chip->prevmode = -1; | 1521 | chip->prevmode = -1; |
@@ -1534,7 +1551,7 @@ static int chip_attach(struct i2c_adapter *adap, int addr, int kind) | |||
1534 | init_completion(&chip->texit); | 1551 | init_completion(&chip->texit); |
1535 | chip->tpid = kernel_thread(chip_thread,(void *)chip,0); | 1552 | chip->tpid = kernel_thread(chip_thread,(void *)chip,0); |
1536 | if (chip->tpid < 0) | 1553 | if (chip->tpid < 0) |
1537 | printk(KERN_WARNING "%s: kernel_thread() failed\n", | 1554 | tvaudio_warn("%s: kernel_thread() failed\n", |
1538 | chip->c.name); | 1555 | chip->c.name); |
1539 | wake_up_interruptible(&chip->wq); | 1556 | wake_up_interruptible(&chip->wq); |
1540 | } | 1557 | } |
@@ -1545,7 +1562,7 @@ static int chip_probe(struct i2c_adapter *adap) | |||
1545 | { | 1562 | { |
1546 | /* don't attach on saa7146 based cards, | 1563 | /* don't attach on saa7146 based cards, |
1547 | because dedicated drivers are used */ | 1564 | because dedicated drivers are used */ |
1548 | if (adap->id == I2C_HW_SAA7146) | 1565 | if ((adap->id == I2C_HW_SAA7146)) |
1549 | return 0; | 1566 | return 0; |
1550 | #ifdef I2C_CLASS_TV_ANALOG | 1567 | #ifdef I2C_CLASS_TV_ANALOG |
1551 | if (adap->class & I2C_CLASS_TV_ANALOG) | 1568 | if (adap->class & I2C_CLASS_TV_ANALOG) |
@@ -1584,11 +1601,11 @@ static int chip_detach(struct i2c_client *client) | |||
1584 | static int chip_command(struct i2c_client *client, | 1601 | static int chip_command(struct i2c_client *client, |
1585 | unsigned int cmd, void *arg) | 1602 | unsigned int cmd, void *arg) |
1586 | { | 1603 | { |
1587 | __u16 *sarg = arg; | 1604 | __u16 *sarg = arg; |
1588 | struct CHIPSTATE *chip = i2c_get_clientdata(client); | 1605 | struct CHIPSTATE *chip = i2c_get_clientdata(client); |
1589 | struct CHIPDESC *desc = chiplist + chip->type; | 1606 | struct CHIPDESC *desc = chiplist + chip->type; |
1590 | 1607 | ||
1591 | dprintk("%s: chip_command 0x%x\n", chip->c.name, cmd); | 1608 | tvaudio_dbg("%s: chip_command 0x%x\n",chip->c.name,cmd); |
1592 | 1609 | ||
1593 | switch (cmd) { | 1610 | switch (cmd) { |
1594 | case AUDC_SET_INPUT: | 1611 | case AUDC_SET_INPUT: |
@@ -1601,7 +1618,6 @@ static int chip_command(struct i2c_client *client, | |||
1601 | break; | 1618 | break; |
1602 | 1619 | ||
1603 | case AUDC_SET_RADIO: | 1620 | case AUDC_SET_RADIO: |
1604 | dprintk(KERN_DEBUG "tvaudio: AUDC_SET_RADIO\n"); | ||
1605 | chip->norm = VIDEO_MODE_RADIO; | 1621 | chip->norm = VIDEO_MODE_RADIO; |
1606 | chip->watch_stereo = 0; | 1622 | chip->watch_stereo = 0; |
1607 | /* del_timer(&chip->wt); */ | 1623 | /* del_timer(&chip->wt); */ |
@@ -1609,7 +1625,7 @@ static int chip_command(struct i2c_client *client, | |||
1609 | 1625 | ||
1610 | /* --- v4l ioctls --- */ | 1626 | /* --- v4l ioctls --- */ |
1611 | /* take care: bttv does userspace copying, we'll get a | 1627 | /* take care: bttv does userspace copying, we'll get a |
1612 | kernel pointer here... */ | 1628 | kernel pointer here... */ |
1613 | case VIDIOCGAUDIO: | 1629 | case VIDIOCGAUDIO: |
1614 | { | 1630 | { |
1615 | struct video_audio *va = arg; | 1631 | struct video_audio *va = arg; |
@@ -1643,9 +1659,9 @@ static int chip_command(struct i2c_client *client, | |||
1643 | 1659 | ||
1644 | if (desc->flags & CHIP_HAS_VOLUME) { | 1660 | if (desc->flags & CHIP_HAS_VOLUME) { |
1645 | chip->left = (min(65536 - va->balance,32768) * | 1661 | chip->left = (min(65536 - va->balance,32768) * |
1646 | va->volume) / 32768; | 1662 | va->volume) / 32768; |
1647 | chip->right = (min(va->balance,(__u16)32768) * | 1663 | chip->right = (min(va->balance,(__u16)32768) * |
1648 | va->volume) / 32768; | 1664 | va->volume) / 32768; |
1649 | chip_write(chip,desc->leftreg,desc->volfunc(chip->left)); | 1665 | chip_write(chip,desc->leftreg,desc->volfunc(chip->left)); |
1650 | chip_write(chip,desc->rightreg,desc->volfunc(chip->right)); | 1666 | chip_write(chip,desc->rightreg,desc->volfunc(chip->right)); |
1651 | } | 1667 | } |
@@ -1667,17 +1683,16 @@ static int chip_command(struct i2c_client *client, | |||
1667 | { | 1683 | { |
1668 | struct video_channel *vc = arg; | 1684 | struct video_channel *vc = arg; |
1669 | 1685 | ||
1670 | dprintk(KERN_DEBUG "tvaudio: VIDIOCSCHAN\n"); | ||
1671 | chip->norm = vc->norm; | 1686 | chip->norm = vc->norm; |
1672 | break; | 1687 | break; |
1673 | } | 1688 | } |
1674 | case VIDIOCSFREQ: | 1689 | case VIDIOCSFREQ: |
1675 | { | 1690 | { |
1676 | chip->mode = 0; /* automatic */ | 1691 | chip->mode = 0; /* automatic */ |
1677 | if (desc->checkmode) { | 1692 | if (desc->checkmode) { |
1678 | desc->setmode(chip,VIDEO_SOUND_MONO); | 1693 | desc->setmode(chip,VIDEO_SOUND_MONO); |
1679 | if (chip->prevmode != VIDEO_SOUND_MONO) | 1694 | if (chip->prevmode != VIDEO_SOUND_MONO) |
1680 | chip->prevmode = -1; /* reset previous mode */ | 1695 | chip->prevmode = -1; /* reset previous mode */ |
1681 | mod_timer(&chip->wt, jiffies+2*HZ); | 1696 | mod_timer(&chip->wt, jiffies+2*HZ); |
1682 | /* the thread will call checkmode() later */ | 1697 | /* the thread will call checkmode() later */ |
1683 | } | 1698 | } |
@@ -1689,29 +1704,32 @@ static int chip_command(struct i2c_client *client, | |||
1689 | 1704 | ||
1690 | static struct i2c_driver driver = { | 1705 | static struct i2c_driver driver = { |
1691 | .owner = THIS_MODULE, | 1706 | .owner = THIS_MODULE, |
1692 | .name = "generic i2c audio driver", | 1707 | .name = "generic i2c audio driver", |
1693 | .id = I2C_DRIVERID_TVAUDIO, | 1708 | .id = I2C_DRIVERID_TVAUDIO, |
1694 | .flags = I2C_DF_NOTIFY, | 1709 | .flags = I2C_DF_NOTIFY, |
1695 | .attach_adapter = chip_probe, | 1710 | .attach_adapter = chip_probe, |
1696 | .detach_client = chip_detach, | 1711 | .detach_client = chip_detach, |
1697 | .command = chip_command, | 1712 | .command = chip_command, |
1698 | }; | 1713 | }; |
1699 | 1714 | ||
1700 | static struct i2c_client client_template = | 1715 | static struct i2c_client client_template = |
1701 | { | 1716 | { |
1702 | .name = "(unset)", | 1717 | .name = "(unset)", |
1703 | .flags = I2C_CLIENT_ALLOW_USE, | 1718 | .flags = I2C_CLIENT_ALLOW_USE, |
1704 | .driver = &driver, | 1719 | .driver = &driver, |
1705 | }; | 1720 | }; |
1706 | 1721 | ||
1707 | static int __init audiochip_init_module(void) | 1722 | static int __init audiochip_init_module(void) |
1708 | { | 1723 | { |
1709 | struct CHIPDESC *desc; | 1724 | struct CHIPDESC *desc; |
1710 | printk(KERN_INFO "tvaudio: TV audio decoder + audio/video mux driver\n"); | 1725 | |
1711 | printk(KERN_INFO "tvaudio: known chips: "); | 1726 | if (debug) { |
1712 | for (desc = chiplist; desc->name != NULL; desc++) | 1727 | printk(KERN_INFO "tvaudio: TV audio decoder + audio/video mux driver\n"); |
1713 | printk("%s%s", (desc == chiplist) ? "" : ",",desc->name); | 1728 | printk(KERN_INFO "tvaudio: known chips: "); |
1714 | printk("\n"); | 1729 | for (desc = chiplist; desc->name != NULL; desc++) |
1730 | printk("%s%s", (desc == chiplist) ? "" : ", ", desc->name); | ||
1731 | printk("\n"); | ||
1732 | } | ||
1715 | 1733 | ||
1716 | return i2c_add_driver(&driver); | 1734 | return i2c_add_driver(&driver); |
1717 | } | 1735 | } |
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); |
diff --git a/drivers/media/video/tvmixer.c b/drivers/media/video/tvmixer.c index a43301a154af..d86e08ebddfc 100644 --- a/drivers/media/video/tvmixer.c +++ b/drivers/media/video/tvmixer.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: tvmixer.c,v 1.8 2005/06/12 04:19:19 mchehab Exp $ | ||
3 | */ | 2 | */ |
4 | 3 | ||
5 | #include <linux/module.h> | 4 | #include <linux/module.h> |
diff --git a/drivers/media/video/v4l1-compat.c b/drivers/media/video/v4l1-compat.c index 70ecbdb80277..59bb71381a1b 100644 --- a/drivers/media/video/v4l1-compat.c +++ b/drivers/media/video/v4l1-compat.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: v4l1-compat.c,v 1.9 2005/06/12 04:19:19 mchehab Exp $ | ||
3 | * | 2 | * |
4 | * Video for Linux Two | 3 | * Video for Linux Two |
5 | * Backward Compatibility Layer | 4 | * Backward Compatibility Layer |
@@ -604,9 +603,6 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
604 | dprintk("VIDIOCGPICT / VIDIOC_G_FMT: %d\n",err); | 603 | dprintk("VIDIOCGPICT / VIDIOC_G_FMT: %d\n",err); |
605 | break; | 604 | break; |
606 | } | 605 | } |
607 | #if 0 /* FIXME */ | ||
608 | pict->depth = fmt2->fmt.pix.depth; | ||
609 | #endif | ||
610 | pict->palette = pixelformat_to_palette( | 606 | pict->palette = pixelformat_to_palette( |
611 | fmt2->fmt.pix.pixelformat); | 607 | fmt2->fmt.pix.pixelformat); |
612 | break; | 608 | break; |
@@ -707,13 +703,7 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
707 | } | 703 | } |
708 | case VIDIOCSTUNER: /* select a tuner input */ | 704 | case VIDIOCSTUNER: /* select a tuner input */ |
709 | { | 705 | { |
710 | #if 0 /* FIXME */ | ||
711 | err = drv(inode, file, VIDIOC_S_INPUT, &i); | ||
712 | if (err < 0) | ||
713 | dprintk("VIDIOCSTUNER / VIDIOC_S_INPUT: %d\n",err); | ||
714 | #else | ||
715 | err = 0; | 706 | err = 0; |
716 | #endif | ||
717 | break; | 707 | break; |
718 | } | 708 | } |
719 | case VIDIOCGFREQ: /* get frequency */ | 709 | case VIDIOCGFREQ: /* get frequency */ |
@@ -852,12 +842,6 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
852 | err = 0; | 842 | err = 0; |
853 | break; | 843 | break; |
854 | } | 844 | } |
855 | #if 0 | ||
856 | case VIDIOCGMBUF: | ||
857 | /* v4l2 drivers must implement that themself. The | ||
858 | mmap() differences can't be translated fully | ||
859 | transparent, thus there is no point to try that */ | ||
860 | #endif | ||
861 | case VIDIOCMCAPTURE: /* capture a frame */ | 845 | case VIDIOCMCAPTURE: /* capture a frame */ |
862 | { | 846 | { |
863 | struct video_mmap *mm = arg; | 847 | struct video_mmap *mm = arg; |
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index b5e0cf3448f4..597b8db35a13 100644 --- a/drivers/media/video/v4l2-common.c +++ b/drivers/media/video/v4l2-common.c | |||
@@ -84,20 +84,6 @@ MODULE_LICENSE("GPL"); | |||
84 | * Video Standard Operations (contributed by Michael Schimek) | 84 | * Video Standard Operations (contributed by Michael Schimek) |
85 | */ | 85 | */ |
86 | 86 | ||
87 | #if 0 /* seems to have no users */ | ||
88 | /* This is the recommended method to deal with the framerate fields. More | ||
89 | sophisticated drivers will access the fields directly. */ | ||
90 | unsigned int | ||
91 | v4l2_video_std_fps(struct v4l2_standard *vs) | ||
92 | { | ||
93 | if (vs->frameperiod.numerator > 0) | ||
94 | return (((vs->frameperiod.denominator << 8) / | ||
95 | vs->frameperiod.numerator) + | ||
96 | (1 << 7)) / (1 << 8); | ||
97 | return 0; | ||
98 | } | ||
99 | EXPORT_SYMBOL(v4l2_video_std_fps); | ||
100 | #endif | ||
101 | 87 | ||
102 | /* Fill in the fields of a v4l2_standard structure according to the | 88 | /* Fill in the fields of a v4l2_standard structure according to the |
103 | 'id' and 'transmission' parameters. Returns negative on error. */ | 89 | 'id' and 'transmission' parameters. Returns negative on error. */ |
@@ -213,10 +199,6 @@ char *v4l2_ioctl_names[256] = { | |||
213 | [_IOC_NR(VIDIOC_ENUM_FMT)] = "VIDIOC_ENUM_FMT", | 199 | [_IOC_NR(VIDIOC_ENUM_FMT)] = "VIDIOC_ENUM_FMT", |
214 | [_IOC_NR(VIDIOC_G_FMT)] = "VIDIOC_G_FMT", | 200 | [_IOC_NR(VIDIOC_G_FMT)] = "VIDIOC_G_FMT", |
215 | [_IOC_NR(VIDIOC_S_FMT)] = "VIDIOC_S_FMT", | 201 | [_IOC_NR(VIDIOC_S_FMT)] = "VIDIOC_S_FMT", |
216 | #if 0 | ||
217 | [_IOC_NR(VIDIOC_G_COMP)] = "VIDIOC_G_COMP", | ||
218 | [_IOC_NR(VIDIOC_S_COMP)] = "VIDIOC_S_COMP", | ||
219 | #endif | ||
220 | [_IOC_NR(VIDIOC_REQBUFS)] = "VIDIOC_REQBUFS", | 202 | [_IOC_NR(VIDIOC_REQBUFS)] = "VIDIOC_REQBUFS", |
221 | [_IOC_NR(VIDIOC_QUERYBUF)] = "VIDIOC_QUERYBUF", | 203 | [_IOC_NR(VIDIOC_QUERYBUF)] = "VIDIOC_QUERYBUF", |
222 | [_IOC_NR(VIDIOC_G_FBUF)] = "VIDIOC_G_FBUF", | 204 | [_IOC_NR(VIDIOC_G_FBUF)] = "VIDIOC_G_FBUF", |
diff --git a/drivers/media/video/video-buf-dvb.c b/drivers/media/video/video-buf-dvb.c index 15f5bb486963..55f129e964eb 100644 --- a/drivers/media/video/video-buf-dvb.c +++ b/drivers/media/video/video-buf-dvb.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: video-buf-dvb.c,v 1.7 2004/12/09 12:51:35 kraxel Exp $ | ||
3 | * | 2 | * |
4 | * some helper function for simple DVB cards which simply DMA the | 3 | * some helper function for simple DVB cards which simply DMA the |
5 | * complete transport stream and let the computer sort everything else | 4 | * complete transport stream and let the computer sort everything else |
diff --git a/drivers/media/video/video-buf.c b/drivers/media/video/video-buf.c index 5afdc7852610..574b8e36f3c6 100644 --- a/drivers/media/video/video-buf.c +++ b/drivers/media/video/video-buf.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: video-buf.c,v 1.18 2005/02/24 13:32:30 kraxel Exp $ | ||
3 | * | 2 | * |
4 | * generic helper functions for video4linux capture buffers, to handle | 3 | * generic helper functions for video4linux capture buffers, to handle |
5 | * memory management and PCI DMA. Right now bttv + saa7134 use it. | 4 | * memory management and PCI DMA. Right now bttv + saa7134 use it. |
@@ -268,10 +267,10 @@ int videobuf_dma_free(struct videobuf_dmabuf *dma) | |||
268 | kfree(dma->pages); | 267 | kfree(dma->pages); |
269 | dma->pages = NULL; | 268 | dma->pages = NULL; |
270 | } | 269 | } |
271 | if (dma->vmalloc) { | 270 | |
272 | vfree(dma->vmalloc); | 271 | vfree(dma->vmalloc); |
273 | dma->vmalloc = NULL; | 272 | dma->vmalloc = NULL; |
274 | } | 273 | |
275 | if (dma->bus_addr) { | 274 | if (dma->bus_addr) { |
276 | dma->bus_addr = 0; | 275 | dma->bus_addr = 0; |
277 | } | 276 | } |
diff --git a/drivers/media/video/zoran_driver.c b/drivers/media/video/zoran_driver.c index ba838a42ec80..53adeb70f2ca 100644 --- a/drivers/media/video/zoran_driver.c +++ b/drivers/media/video/zoran_driver.c | |||
@@ -650,7 +650,7 @@ jpg_fbuffer_free (struct file *file) | |||
650 | off += PAGE_SIZE) | 650 | off += PAGE_SIZE) |
651 | ClearPageReserved(MAP_NR | 651 | ClearPageReserved(MAP_NR |
652 | (mem + off)); | 652 | (mem + off)); |
653 | kfree((void *) mem); | 653 | kfree(mem); |
654 | fh->jpg_buffers.buffer[i].frag_tab[0] = 0; | 654 | fh->jpg_buffers.buffer[i].frag_tab[0] = 0; |
655 | fh->jpg_buffers.buffer[i].frag_tab[1] = 0; | 655 | fh->jpg_buffers.buffer[i].frag_tab[1] = 0; |
656 | } | 656 | } |
diff --git a/drivers/media/video/zr36120.c b/drivers/media/video/zr36120.c index c33533155cc7..07286816d7df 100644 --- a/drivers/media/video/zr36120.c +++ b/drivers/media/video/zr36120.c | |||
@@ -820,11 +820,9 @@ void zoran_close(struct video_device* dev) | |||
820 | msleep(100); /* Wait 1/10th of a second */ | 820 | msleep(100); /* Wait 1/10th of a second */ |
821 | 821 | ||
822 | /* free the allocated framebuffer */ | 822 | /* free the allocated framebuffer */ |
823 | if (ztv->fbuffer) | 823 | bfree(ztv->fbuffer, ZORAN_MAX_FBUFSIZE); |
824 | bfree( ztv->fbuffer, ZORAN_MAX_FBUFSIZE ); | ||
825 | ztv->fbuffer = 0; | 824 | ztv->fbuffer = 0; |
826 | if (ztv->overinfo.overlay) | 825 | kfree(ztv->overinfo.overlay); |
827 | kfree( ztv->overinfo.overlay ); | ||
828 | ztv->overinfo.overlay = 0; | 826 | ztv->overinfo.overlay = 0; |
829 | 827 | ||
830 | } | 828 | } |