aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx88
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-24 14:21:08 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-24 14:21:08 -0400
commitc328d54cd4ad120d76284e46dcca6c6cf996154a (patch)
tree104c023be66faa5fce6e0a56c0a6d13c62fd21e5 /drivers/media/video/cx88
parent346ad4b7fe392571f19314f153db9151dbc1d82b (diff)
parentb0166ab3a6ae6d7af8d9a21a7836154963c69a11 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb
* git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb: (452 commits) V4L/DVB (7731): tuner-xc2028: fix signal strength calculus V4L/DVB (7730): tuner-xc2028: Fix SCODE load for MTS firmwares V4L/DVB (7729): Fix VIDIOCGAP corruption in ivtv V4L/DVB (7728): tea5761: bugzilla #10462: tea5761 autodetection code were broken V4L/DVB (7726): cx23885: Enable cx23417 support on the HVR1800 V4L/DVB (7725): cx23885: Add generic cx23417 hardware encoder support V4L/DVB (7723): pvrusb2: Clean up input selection list generation in V4L interface V4L/DVB (7722): pvrusb2: Implement FM radio support for Gotview USB2.0 DVD 2 V4L/DVB (7721): pvrusb2: Restructure cx23416 firmware loading to have a common exit point V4L/DVB (7720): pvrusb2: Fix bad error code on cx23416 firmware load failure V4L/DVB (7719): pvrusb2: Implement input selection enforcement V4L/DVB (7718): pvrusb2-dvb: update Kbuild selections V4L/DVB (7717): pvrusb2-dvb: add DVB-T support for Hauppauge pvrusb2 model 73xxx V4L/DVB (7716): pvrusb2: clean up global functions V4L/DVB (7715): pvrusb2: Clean out all use of __FUNCTION__ V4L/DVB (7714): pvrusb2: Fix hang on module removal V4L/DVB (7713): pvrusb2: Implement cleaner DVB kernel thread shutdown V4L/DVB (7712): pvrusb2: Close connect/disconnect race V4L/DVB (7711): pvrusb2: Fix race on module unload V4L/DVB (7710): pvrusb2: Implement critical digital streaming quirk for onair devices ...
Diffstat (limited to 'drivers/media/video/cx88')
-rw-r--r--drivers/media/video/cx88/Kconfig1
-rw-r--r--drivers/media/video/cx88/cx88-alsa.c10
-rw-r--r--drivers/media/video/cx88/cx88-blackbird.c18
-rw-r--r--drivers/media/video/cx88/cx88-cards.c585
-rw-r--r--drivers/media/video/cx88/cx88-core.c17
-rw-r--r--drivers/media/video/cx88/cx88-dvb.c260
-rw-r--r--drivers/media/video/cx88/cx88-i2c.c4
-rw-r--r--drivers/media/video/cx88/cx88-input.c15
-rw-r--r--drivers/media/video/cx88/cx88-mpeg.c20
-rw-r--r--drivers/media/video/cx88/cx88-tvaudio.c30
-rw-r--r--drivers/media/video/cx88/cx88-vbi.c2
-rw-r--r--drivers/media/video/cx88/cx88-video.c63
-rw-r--r--drivers/media/video/cx88/cx88.h14
13 files changed, 902 insertions, 137 deletions
diff --git a/drivers/media/video/cx88/Kconfig b/drivers/media/video/cx88/Kconfig
index 49d3813a9b48..bcf6d9ba063d 100644
--- a/drivers/media/video/cx88/Kconfig
+++ b/drivers/media/video/cx88/Kconfig
@@ -57,6 +57,7 @@ config VIDEO_CX88_DVB
57 select DVB_NXT200X if !DVB_FE_CUSTOMISE 57 select DVB_NXT200X if !DVB_FE_CUSTOMISE
58 select DVB_CX24123 if !DVB_FE_CUSTOMISE 58 select DVB_CX24123 if !DVB_FE_CUSTOMISE
59 select DVB_ISL6421 if !DVB_FE_CUSTOMISE 59 select DVB_ISL6421 if !DVB_FE_CUSTOMISE
60 select TUNER_SIMPLE if !DVB_FE_CUSTOMISE
60 ---help--- 61 ---help---
61 This adds support for DVB/ATSC cards based on the 62 This adds support for DVB/ATSC cards based on the
62 Conexant 2388x chip. 63 Conexant 2388x chip.
diff --git a/drivers/media/video/cx88/cx88-alsa.c b/drivers/media/video/cx88/cx88-alsa.c
index 03feb5b49e1b..e976fc6bef7c 100644
--- a/drivers/media/video/cx88/cx88-alsa.c
+++ b/drivers/media/video/cx88/cx88-alsa.c
@@ -283,7 +283,7 @@ static int dsp_buffer_free(snd_cx88_card_t *chip)
283 BUG_ON(!chip->dma_size); 283 BUG_ON(!chip->dma_size);
284 284
285 dprintk(2,"Freeing buffer\n"); 285 dprintk(2,"Freeing buffer\n");
286 videobuf_pci_dma_unmap(chip->pci, chip->dma_risc); 286 videobuf_sg_dma_unmap(&chip->pci->dev, chip->dma_risc);
287 videobuf_dma_free(chip->dma_risc); 287 videobuf_dma_free(chip->dma_risc);
288 btcx_riscmem_free(chip->pci,&chip->buf->risc); 288 btcx_riscmem_free(chip->pci,&chip->buf->risc);
289 kfree(chip->buf); 289 kfree(chip->buf);
@@ -385,7 +385,7 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream,
385 BUG_ON(!chip->dma_size); 385 BUG_ON(!chip->dma_size);
386 BUG_ON(chip->num_periods & (chip->num_periods-1)); 386 BUG_ON(chip->num_periods & (chip->num_periods-1));
387 387
388 buf = videobuf_pci_alloc(sizeof(*buf)); 388 buf = videobuf_sg_alloc(sizeof(*buf));
389 if (NULL == buf) 389 if (NULL == buf)
390 return -ENOMEM; 390 return -ENOMEM;
391 391
@@ -396,14 +396,14 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream,
396 buf->vb.height = chip->num_periods; 396 buf->vb.height = chip->num_periods;
397 buf->vb.size = chip->dma_size; 397 buf->vb.size = chip->dma_size;
398 398
399 dma=videobuf_to_dma(&buf->vb); 399 dma = videobuf_to_dma(&buf->vb);
400 videobuf_dma_init(dma); 400 videobuf_dma_init(dma);
401 ret = videobuf_dma_init_kernel(dma, PCI_DMA_FROMDEVICE, 401 ret = videobuf_dma_init_kernel(dma, PCI_DMA_FROMDEVICE,
402 (PAGE_ALIGN(buf->vb.size) >> PAGE_SHIFT)); 402 (PAGE_ALIGN(buf->vb.size) >> PAGE_SHIFT));
403 if (ret < 0) 403 if (ret < 0)
404 goto error; 404 goto error;
405 405
406 ret = videobuf_pci_dma_map(chip->pci,dma); 406 ret = videobuf_sg_dma_map(&chip->pci->dev, dma);
407 if (ret < 0) 407 if (ret < 0)
408 goto error; 408 goto error;
409 409
@@ -494,7 +494,7 @@ static snd_pcm_uframes_t snd_cx88_pointer(struct snd_pcm_substream *substream)
494 494
495 count = atomic_read(&chip->count); 495 count = atomic_read(&chip->count);
496 496
497// dprintk(2, "%s - count %d (+%u), period %d, frame %lu\n", __FUNCTION__, 497// dprintk(2, "%s - count %d (+%u), period %d, frame %lu\n", __func__,
498// count, new, count & (runtime->periods-1), 498// count, new, count & (runtime->periods-1),
499// runtime->period_size * (count & (runtime->periods-1))); 499// runtime->period_size * (count & (runtime->periods-1)));
500 return runtime->period_size * (count & (runtime->periods-1)); 500 return runtime->period_size * (count & (runtime->periods-1));
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c
index a99e9d5950aa..61c4f72644b8 100644
--- a/drivers/media/video/cx88/cx88-blackbird.c
+++ b/drivers/media/video/cx88/cx88-blackbird.c
@@ -45,7 +45,7 @@ static unsigned int mpegbufs = 32;
45module_param(mpegbufs,int,0644); 45module_param(mpegbufs,int,0644);
46MODULE_PARM_DESC(mpegbufs,"number of mpeg buffers, range 2-32"); 46MODULE_PARM_DESC(mpegbufs,"number of mpeg buffers, range 2-32");
47 47
48static unsigned int debug = 0; 48static unsigned int debug;
49module_param(debug,int,0644); 49module_param(debug,int,0644);
50MODULE_PARM_DESC(debug,"enable debug messages [blackbird]"); 50MODULE_PARM_DESC(debug,"enable debug messages [blackbird]");
51 51
@@ -314,7 +314,7 @@ static int blackbird_mbox_func(void *priv, u32 command, int in, int out, u32 dat
314 u32 value, flag, retval; 314 u32 value, flag, retval;
315 int i; 315 int i;
316 316
317 dprintk(1,"%s: 0x%X\n", __FUNCTION__, command); 317 dprintk(1,"%s: 0x%X\n", __func__, command);
318 318
319 /* this may not be 100% safe if we can't read any memory location 319 /* this may not be 100% safe if we can't read any memory location
320 without side effects */ 320 without side effects */
@@ -693,7 +693,7 @@ static int blackbird_queryctrl(struct cx8802_dev *dev, struct v4l2_queryctrl *qc
693 return -EINVAL; 693 return -EINVAL;
694 694
695 /* Standard V4L2 controls */ 695 /* Standard V4L2 controls */
696 if (cx8800_ctrl_query(qctrl) == 0) 696 if (cx8800_ctrl_query(dev->core, qctrl) == 0)
697 return 0; 697 return 0;
698 698
699 /* MPEG V4L2 controls */ 699 /* MPEG V4L2 controls */
@@ -933,7 +933,7 @@ static int vidioc_queryctrl (struct file *file, void *priv,
933 qctrl->id = v4l2_ctrl_next(ctrl_classes, qctrl->id); 933 qctrl->id = v4l2_ctrl_next(ctrl_classes, qctrl->id);
934 if (unlikely(qctrl->id == 0)) 934 if (unlikely(qctrl->id == 0))
935 return -EINVAL; 935 return -EINVAL;
936 return cx8800_ctrl_query(qctrl); 936 return cx8800_ctrl_query(dev->core, qctrl);
937} 937}
938 938
939static int vidioc_enum_input (struct file *file, void *priv, 939static int vidioc_enum_input (struct file *file, void *priv,
@@ -1055,7 +1055,7 @@ static int mpeg_open(struct inode *inode, struct file *file)
1055 1055
1056 dev = cx8802_get_device(inode); 1056 dev = cx8802_get_device(inode);
1057 1057
1058 dprintk( 1, "%s\n", __FUNCTION__); 1058 dprintk( 1, "%s\n", __func__);
1059 1059
1060 if (dev == NULL) 1060 if (dev == NULL)
1061 return -ENODEV; 1061 return -ENODEV;
@@ -1065,7 +1065,7 @@ static int mpeg_open(struct inode *inode, struct file *file)
1065 if (drv) { 1065 if (drv) {
1066 err = drv->request_acquire(drv); 1066 err = drv->request_acquire(drv);
1067 if(err != 0) { 1067 if(err != 0) {
1068 dprintk(1,"%s: Unable to acquire hardware, %d\n", __FUNCTION__, err); 1068 dprintk(1,"%s: Unable to acquire hardware, %d\n", __func__, err);
1069 return err; 1069 return err;
1070 } 1070 }
1071 } 1071 }
@@ -1087,8 +1087,8 @@ static int mpeg_open(struct inode *inode, struct file *file)
1087 file->private_data = fh; 1087 file->private_data = fh;
1088 fh->dev = dev; 1088 fh->dev = dev;
1089 1089
1090 videobuf_queue_pci_init(&fh->mpegq, &blackbird_qops, 1090 videobuf_queue_sg_init(&fh->mpegq, &blackbird_qops,
1091 dev->pci, &dev->slock, 1091 &dev->pci->dev, &dev->slock,
1092 V4L2_BUF_TYPE_VIDEO_CAPTURE, 1092 V4L2_BUF_TYPE_VIDEO_CAPTURE,
1093 V4L2_FIELD_INTERLACED, 1093 V4L2_FIELD_INTERLACED,
1094 sizeof(struct cx88_buffer), 1094 sizeof(struct cx88_buffer),
@@ -1284,7 +1284,7 @@ static int cx8802_blackbird_probe(struct cx8802_driver *drv)
1284 struct cx8802_dev *dev = core->dvbdev; 1284 struct cx8802_dev *dev = core->dvbdev;
1285 int err; 1285 int err;
1286 1286
1287 dprintk( 1, "%s\n", __FUNCTION__); 1287 dprintk( 1, "%s\n", __func__);
1288 dprintk( 1, " ->being probed by Card=%d Name=%s, PCI %02x:%02x\n", 1288 dprintk( 1, " ->being probed by Card=%d Name=%s, PCI %02x:%02x\n",
1289 core->boardnr, 1289 core->boardnr,
1290 core->name, 1290 core->name,
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c
index 8c9a8adf52de..620159d05506 100644
--- a/drivers/media/video/cx88/cx88-cards.c
+++ b/drivers/media/video/cx88/cx88-cards.c
@@ -44,6 +44,16 @@ static unsigned int latency = UNSET;
44module_param(latency,int,0444); 44module_param(latency,int,0444);
45MODULE_PARM_DESC(latency,"pci latency timer"); 45MODULE_PARM_DESC(latency,"pci latency timer");
46 46
47#define info_printk(core, fmt, arg...) \
48 printk(KERN_INFO "%s: " fmt, core->name , ## arg)
49
50#define warn_printk(core, fmt, arg...) \
51 printk(KERN_WARNING "%s: " fmt, core->name , ## arg)
52
53#define err_printk(core, fmt, arg...) \
54 printk(KERN_ERR "%s: " fmt, core->name , ## arg)
55
56
47/* ------------------------------------------------------------------ */ 57/* ------------------------------------------------------------------ */
48/* board config info */ 58/* board config info */
49 59
@@ -1354,6 +1364,10 @@ static const struct cx88_board cx88_boards[] = {
1354 }}, 1364 }},
1355 /* fixme: Add radio support */ 1365 /* fixme: Add radio support */
1356 .mpeg = CX88_MPEG_DVB | CX88_MPEG_BLACKBIRD, 1366 .mpeg = CX88_MPEG_DVB | CX88_MPEG_BLACKBIRD,
1367 .radio = {
1368 .type = CX88_RADIO,
1369 .gpio0 = 0xe780,
1370 },
1357 }, 1371 },
1358 [CX88_BOARD_ADSTECH_PTV_390] = { 1372 [CX88_BOARD_ADSTECH_PTV_390] = {
1359 .name = "ADS Tech Instant Video PCI", 1373 .name = "ADS Tech Instant Video PCI",
@@ -1401,6 +1415,245 @@ static const struct cx88_board cx88_boards[] = {
1401 }}, 1415 }},
1402 .mpeg = CX88_MPEG_DVB, 1416 .mpeg = CX88_MPEG_DVB,
1403 }, 1417 },
1418 [CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO] = {
1419 .name = "DViCO FusionHDTV 5 PCI nano",
1420 /* xc3008 tuner, digital only for now */
1421 .tuner_type = TUNER_ABSENT,
1422 .radio_type = UNSET,
1423 .tuner_addr = ADDR_UNSET,
1424 .radio_addr = ADDR_UNSET,
1425 .input = {{
1426 .type = CX88_VMUX_TELEVISION,
1427 .vmux = 0,
1428 .gpio0 = 0x000027df, /* Unconfirmed */
1429 }, {
1430 .type = CX88_VMUX_COMPOSITE1,
1431 .vmux = 1,
1432 .gpio0 = 0x000027df, /* Unconfirmed */
1433 .audioroute = 1,
1434 }, {
1435 .type = CX88_VMUX_SVIDEO,
1436 .vmux = 2,
1437 .gpio0 = 0x000027df, /* Unconfirmed */
1438 .audioroute = 1,
1439 } },
1440 .mpeg = CX88_MPEG_DVB,
1441 },
1442 [CX88_BOARD_PINNACLE_HYBRID_PCTV] = {
1443 .name = "Pinnacle Hybrid PCTV",
1444 .tuner_type = TUNER_XC2028,
1445 .tuner_addr = 0x61,
1446 .input = { {
1447 .type = CX88_VMUX_TELEVISION,
1448 .vmux = 0,
1449 }, {
1450 .type = CX88_VMUX_COMPOSITE1,
1451 .vmux = 1,
1452 }, {
1453 .type = CX88_VMUX_SVIDEO,
1454 .vmux = 2,
1455 } },
1456 .radio = {
1457 .type = CX88_RADIO,
1458 .gpio0 = 0x004ff,
1459 .gpio1 = 0x010ff,
1460 .gpio2 = 0x0ff,
1461 },
1462 },
1463 [CX88_BOARD_WINFAST_TV2000_XP_GLOBAL] = {
1464 .name = "Winfast TV2000 XP Global",
1465 .tuner_type = TUNER_XC2028,
1466 .tuner_addr = 0x61,
1467 .input = { {
1468 .type = CX88_VMUX_TELEVISION,
1469 .vmux = 0,
1470 .gpio0 = 0x0400, /* pin 2:mute = 0 (off?) */
1471 .gpio1 = 0x0000,
1472 .gpio2 = 0x0800, /* pin 19:audio = 0 (tv) */
1473
1474 }, {
1475 .type = CX88_VMUX_COMPOSITE1,
1476 .vmux = 1,
1477 .gpio0 = 0x0400, /* probably? or 0x0404 to turn mute on */
1478 .gpio1 = 0x0000,
1479 .gpio2 = 0x0808, /* pin 19:audio = 1 (line) */
1480
1481 }, {
1482 .type = CX88_VMUX_SVIDEO,
1483 .vmux = 2,
1484 } },
1485 .radio = {
1486 .type = CX88_RADIO,
1487 .gpio0 = 0x004ff,
1488 .gpio1 = 0x010ff,
1489 .gpio2 = 0x0ff,
1490 },
1491 },
1492 [CX88_BOARD_POWERCOLOR_REAL_ANGEL] = {
1493 .name = "PowerColor Real Angel 330",
1494 .tuner_type = TUNER_XC2028,
1495 .tuner_addr = 0x61,
1496 .input = { {
1497 .type = CX88_VMUX_TELEVISION,
1498 .vmux = 0,
1499 .gpio0 = 0x00ff,
1500 .gpio1 = 0xf35d,
1501 .gpio3 = 0x0000,
1502 }, {
1503 .type = CX88_VMUX_COMPOSITE1,
1504 .vmux = 1,
1505 .gpio0 = 0x00ff,
1506 .gpio1 = 0xf37d,
1507 .gpio3 = 0x0000,
1508 }, {
1509 .type = CX88_VMUX_SVIDEO,
1510 .vmux = 2,
1511 .gpio0 = 0x000ff,
1512 .gpio1 = 0x0f37d,
1513 .gpio3 = 0x00000,
1514 } },
1515 .radio = {
1516 .type = CX88_RADIO,
1517 .gpio0 = 0x000ff,
1518 .gpio1 = 0x0f35d,
1519 .gpio3 = 0x00000,
1520 },
1521 },
1522 [CX88_BOARD_GENIATECH_X8000_MT] = {
1523 /* Also PowerColor Real Angel 330 and Geniatech X800 OEM */
1524 .name = "Geniatech X8000-MT DVBT",
1525 .tuner_type = TUNER_XC2028,
1526 .tuner_addr = 0x61,
1527 .input = { {
1528 .type = CX88_VMUX_TELEVISION,
1529 .vmux = 0,
1530 .gpio0 = 0x00000000,
1531 .gpio1 = 0x00e3e341,
1532 .gpio2 = 0x00000000,
1533 .gpio3 = 0x00000000,
1534 }, {
1535 .type = CX88_VMUX_COMPOSITE1,
1536 .vmux = 1,
1537 .gpio0 = 0x00000000,
1538 .gpio1 = 0x00e3e361,
1539 .gpio2 = 0x00000000,
1540 .gpio3 = 0x00000000,
1541 }, {
1542 .type = CX88_VMUX_SVIDEO,
1543 .vmux = 2,
1544 .gpio0 = 0x00000000,
1545 .gpio1 = 0x00e3e361,
1546 .gpio2 = 0x00000000,
1547 .gpio3 = 0x00000000,
1548 } },
1549 .radio = {
1550 .type = CX88_RADIO,
1551 .gpio0 = 0x00000000,
1552 .gpio1 = 0x00e3e341,
1553 .gpio2 = 0x00000000,
1554 .gpio3 = 0x00000000,
1555 },
1556 .mpeg = CX88_MPEG_DVB,
1557 },
1558 [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO] = {
1559 .name = "DViCO FusionHDTV DVB-T PRO",
1560 .tuner_type = TUNER_ABSENT, /* XXX: Has XC3028 */
1561 .radio_type = UNSET,
1562 .tuner_addr = ADDR_UNSET,
1563 .radio_addr = ADDR_UNSET,
1564 .input = { {
1565 .type = CX88_VMUX_COMPOSITE1,
1566 .vmux = 1,
1567 .gpio0 = 0x000067df,
1568 }, {
1569 .type = CX88_VMUX_SVIDEO,
1570 .vmux = 2,
1571 .gpio0 = 0x000067df,
1572 } },
1573 .mpeg = CX88_MPEG_DVB,
1574 },
1575 [CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD] = {
1576 .name = "DViCO FusionHDTV 7 Gold",
1577 .tuner_type = TUNER_XC5000,
1578 .radio_type = UNSET,
1579 .tuner_addr = ADDR_UNSET,
1580 .radio_addr = ADDR_UNSET,
1581 .input = {{
1582 .type = CX88_VMUX_TELEVISION,
1583 .vmux = 0,
1584 .gpio0 = 0x10df,
1585 },{
1586 .type = CX88_VMUX_COMPOSITE1,
1587 .vmux = 1,
1588 .gpio0 = 0x16d9,
1589 },{
1590 .type = CX88_VMUX_SVIDEO,
1591 .vmux = 2,
1592 .gpio0 = 0x16d9,
1593 }},
1594 },
1595 [CX88_BOARD_PROLINK_PV_8000GT] = {
1596 .name = "Prolink Pixelview MPEG 8000GT",
1597 .tuner_type = TUNER_XC2028,
1598 .tuner_addr = 0x61,
1599 .input = { {
1600 .type = CX88_VMUX_TELEVISION,
1601 .vmux = 0,
1602 .gpio0 = 0x0ff,
1603 .gpio2 = 0x0cfb,
1604 }, {
1605 .type = CX88_VMUX_COMPOSITE1,
1606 .vmux = 1,
1607 .gpio2 = 0x0cfb,
1608 }, {
1609 .type = CX88_VMUX_SVIDEO,
1610 .vmux = 2,
1611 .gpio2 = 0x0cfb,
1612 } },
1613 .radio = {
1614 .type = CX88_RADIO,
1615 .gpio2 = 0x0cfb,
1616 },
1617 },
1618 /* Both radio, analog and ATSC work with this board.
1619 However, for analog to work, s5h1409 gate should be open,
1620 otherwise, tuner-xc3028 won't be detected.
1621 A proper fix require using the newer i2c methods to add
1622 tuner-xc3028 without doing an i2c probe.
1623 */
1624 [CX88_BOARD_KWORLD_ATSC_120] = {
1625 .name = "Kworld PlusTV HD PCI 120 (ATSC 120)",
1626 .tuner_type = TUNER_XC2028,
1627 .radio_type = UNSET,
1628 .tuner_addr = ADDR_UNSET,
1629 .radio_addr = ADDR_UNSET,
1630 .input = { {
1631 .type = CX88_VMUX_TELEVISION,
1632 .vmux = 0,
1633 .gpio0 = 0x000000ff,
1634 .gpio1 = 0x0000f35d,
1635 .gpio2 = 0x00000000,
1636 }, {
1637 .type = CX88_VMUX_COMPOSITE1,
1638 .vmux = 1,
1639 .gpio0 = 0x000000ff,
1640 .gpio1 = 0x0000f37e,
1641 .gpio2 = 0x00000000,
1642 }, {
1643 .type = CX88_VMUX_SVIDEO,
1644 .vmux = 2,
1645 .gpio0 = 0x000000ff,
1646 .gpio1 = 0x0000f37e,
1647 .gpio2 = 0x00000000,
1648 } },
1649 .radio = {
1650 .type = CX88_RADIO,
1651 .gpio0 = 0x000000ff,
1652 .gpio1 = 0x0000f35d,
1653 .gpio2 = 0x00000000,
1654 },
1655 .mpeg = CX88_MPEG_DVB,
1656 },
1404}; 1657};
1405 1658
1406/* ------------------------------------------------------------------ */ 1659/* ------------------------------------------------------------------ */
@@ -1605,7 +1858,11 @@ static const struct cx88_subid cx88_subids[] = {
1605 .subdevice = 0xdb11, 1858 .subdevice = 0xdb11,
1606 .card = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS, 1859 .card = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS,
1607 /* Re-branded DViCO: UltraView DVB-T Plus */ 1860 /* Re-branded DViCO: UltraView DVB-T Plus */
1608 },{ 1861 }, {
1862 .subvendor = 0x18ac,
1863 .subdevice = 0xdb30,
1864 .card = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO,
1865 }, {
1609 .subvendor = 0x17de, 1866 .subvendor = 0x17de,
1610 .subdevice = 0x0840, 1867 .subdevice = 0x0840,
1611 .card = CX88_BOARD_KWORLD_HARDWARE_MPEG_TV_XPERT, 1868 .card = CX88_BOARD_KWORLD_HARDWARE_MPEG_TV_XPERT,
@@ -1714,6 +1971,38 @@ static const struct cx88_subid cx88_subids[] = {
1714 .subvendor = 0x11bd, 1971 .subvendor = 0x11bd,
1715 .subdevice = 0x0051, 1972 .subdevice = 0x0051,
1716 .card = CX88_BOARD_PINNACLE_PCTV_HD_800i, 1973 .card = CX88_BOARD_PINNACLE_PCTV_HD_800i,
1974 }, {
1975 .subvendor = 0x18ac,
1976 .subdevice = 0xd530,
1977 .card = CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO,
1978 }, {
1979 .subvendor = 0x12ab,
1980 .subdevice = 0x1788,
1981 .card = CX88_BOARD_PINNACLE_HYBRID_PCTV,
1982 }, {
1983 .subvendor = 0x14f1,
1984 .subdevice = 0xea3d,
1985 .card = CX88_BOARD_POWERCOLOR_REAL_ANGEL,
1986 }, {
1987 .subvendor = 0x107d,
1988 .subdevice = 0x6f18,
1989 .card = CX88_BOARD_WINFAST_TV2000_XP_GLOBAL,
1990 }, {
1991 .subvendor = 0x14f1,
1992 .subdevice = 0x8852,
1993 .card = CX88_BOARD_GENIATECH_X8000_MT,
1994 }, {
1995 .subvendor = 0x18ac,
1996 .subdevice = 0xd610,
1997 .card = CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD,
1998 }, {
1999 .subvendor = 0x1554,
2000 .subdevice = 0x4935,
2001 .card = CX88_BOARD_PROLINK_PV_8000GT,
2002 }, {
2003 .subvendor = 0x17de,
2004 .subdevice = 0x08c1,
2005 .card = CX88_BOARD_KWORLD_ATSC_120,
1717 }, 2006 },
1718}; 2007};
1719 2008
@@ -1731,17 +2020,16 @@ static void leadtek_eeprom(struct cx88_core *core, u8 *eeprom_data)
1731 if (eeprom_data[4] != 0x7d || 2020 if (eeprom_data[4] != 0x7d ||
1732 eeprom_data[5] != 0x10 || 2021 eeprom_data[5] != 0x10 ||
1733 eeprom_data[7] != 0x66) { 2022 eeprom_data[7] != 0x66) {
1734 printk(KERN_WARNING "%s: Leadtek eeprom invalid.\n", 2023 warn_printk(core, "Leadtek eeprom invalid.\n");
1735 core->name);
1736 return; 2024 return;
1737 } 2025 }
1738 2026
1739 core->board.tuner_type = (eeprom_data[6] == 0x13) ? 2027 core->board.tuner_type = (eeprom_data[6] == 0x13) ?
1740 TUNER_PHILIPS_FM1236_MK3 : TUNER_PHILIPS_FM1216ME_MK3; 2028 TUNER_PHILIPS_FM1236_MK3 : TUNER_PHILIPS_FM1216ME_MK3;
1741 2029
1742 printk(KERN_INFO "%s: Leadtek Winfast 2000XP Expert config: " 2030 info_printk(core, "Leadtek Winfast 2000XP Expert config: "
1743 "tuner=%d, eeprom[0]=0x%02x\n", 2031 "tuner=%d, eeprom[0]=0x%02x\n",
1744 core->name, core->board.tuner_type, eeprom_data[0]); 2032 core->board.tuner_type, eeprom_data[0]);
1745} 2033}
1746 2034
1747static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data) 2035static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data)
@@ -1785,13 +2073,12 @@ static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data)
1785 /* known */ 2073 /* known */
1786 break; 2074 break;
1787 default: 2075 default:
1788 printk("%s: warning: unknown hauppauge model #%d\n", 2076 warn_printk(core, "warning: unknown hauppauge model #%d\n",
1789 core->name, tv.model); 2077 tv.model);
1790 break; 2078 break;
1791 } 2079 }
1792 2080
1793 printk(KERN_INFO "%s: hauppauge eeprom: model=%d\n", 2081 info_printk(core, "hauppauge eeprom: model=%d\n", tv.model);
1794 core->name, tv.model);
1795} 2082}
1796 2083
1797/* ----------------------------------------------------------------------- */ 2084/* ----------------------------------------------------------------------- */
@@ -1837,8 +2124,7 @@ static void gdi_eeprom(struct cx88_core *core, u8 *eeprom_data)
1837 char *name = (eeprom_data[0x0d] < ARRAY_SIZE(gdi_tuner)) 2124 char *name = (eeprom_data[0x0d] < ARRAY_SIZE(gdi_tuner))
1838 ? gdi_tuner[eeprom_data[0x0d]].name : NULL; 2125 ? gdi_tuner[eeprom_data[0x0d]].name : NULL;
1839 2126
1840 printk(KERN_INFO "%s: GDI: tuner=%s\n", core->name, 2127 info_printk(core, "GDI: tuner=%s\n", name ? name : "unknown");
1841 name ? name : "unknown");
1842 if (NULL == name) 2128 if (NULL == name)
1843 return; 2129 return;
1844 core->board.tuner_type = gdi_tuner[eeprom_data[0x0d]].id; 2130 core->board.tuner_type = gdi_tuner[eeprom_data[0x0d]].id;
@@ -1846,6 +2132,75 @@ static void gdi_eeprom(struct cx88_core *core, u8 *eeprom_data)
1846 CX88_RADIO : 0; 2132 CX88_RADIO : 0;
1847} 2133}
1848 2134
2135/* ------------------------------------------------------------------- */
2136/* some Divco specific stuff */
2137static int cx88_dvico_xc2028_callback(struct cx88_core *core,
2138 int command, int arg)
2139{
2140 switch (command) {
2141 case XC2028_TUNER_RESET:
2142 cx_write(MO_GP0_IO, 0x101000);
2143 mdelay(5);
2144 cx_set(MO_GP0_IO, 0x101010);
2145 break;
2146 default:
2147 return -EINVAL;
2148 }
2149
2150 return 0;
2151}
2152
2153
2154/* ----------------------------------------------------------------------- */
2155/* some Geniatech specific stuff */
2156
2157static int cx88_xc3028_geniatech_tuner_callback(struct cx88_core *core,
2158 int command, int mode)
2159{
2160 switch (command) {
2161 case XC2028_TUNER_RESET:
2162 switch (INPUT(core->input).type) {
2163 case CX88_RADIO:
2164 break;
2165 case CX88_VMUX_DVB:
2166 cx_write(MO_GP1_IO, 0x030302);
2167 mdelay(50);
2168 break;
2169 default:
2170 cx_write(MO_GP1_IO, 0x030301);
2171 mdelay(50);
2172 }
2173 cx_write(MO_GP1_IO, 0x101010);
2174 mdelay(50);
2175 cx_write(MO_GP1_IO, 0x101000);
2176 mdelay(50);
2177 cx_write(MO_GP1_IO, 0x101010);
2178 mdelay(50);
2179 return 0;
2180 }
2181 return -EINVAL;
2182}
2183
2184/* ------------------------------------------------------------------- */
2185/* some Divco specific stuff */
2186static int cx88_pv_8000gt_callback(struct cx88_core *core,
2187 int command, int arg)
2188{
2189 switch (command) {
2190 case XC2028_TUNER_RESET:
2191 cx_write(MO_GP2_IO, 0xcf7);
2192 mdelay(50);
2193 cx_write(MO_GP2_IO, 0xef5);
2194 mdelay(50);
2195 cx_write(MO_GP2_IO, 0xcf7);
2196 break;
2197 default:
2198 return -EINVAL;
2199 }
2200
2201 return 0;
2202}
2203
1849/* ----------------------------------------------------------------------- */ 2204/* ----------------------------------------------------------------------- */
1850/* some DViCO specific stuff */ 2205/* some DViCO specific stuff */
1851 2206
@@ -1874,32 +2229,85 @@ static void dvico_fusionhdtv_hybrid_init(struct cx88_core *core)
1874 msg.len = (i != 12 ? 5 : 2); 2229 msg.len = (i != 12 ? 5 : 2);
1875 err = i2c_transfer(&core->i2c_adap, &msg, 1); 2230 err = i2c_transfer(&core->i2c_adap, &msg, 1);
1876 if (err != 1) { 2231 if (err != 1) {
1877 printk("dvico_fusionhdtv_hybrid_init buf %d failed (err = %d)!\n", i, err); 2232 warn_printk(core, "dvico_fusionhdtv_hybrid_init buf %d "
2233 "failed (err = %d)!\n", i, err);
1878 return; 2234 return;
1879 } 2235 }
1880 } 2236 }
1881} 2237}
1882 2238
2239static int cx88_xc2028_tuner_callback(struct cx88_core *core,
2240 int command, int arg)
2241{
2242 /* Board-specific callbacks */
2243 switch (core->boardnr) {
2244 case CX88_BOARD_WINFAST_TV2000_XP_GLOBAL:
2245 case CX88_BOARD_POWERCOLOR_REAL_ANGEL:
2246 case CX88_BOARD_GENIATECH_X8000_MT:
2247 case CX88_BOARD_KWORLD_ATSC_120:
2248 return cx88_xc3028_geniatech_tuner_callback(core,
2249 command, arg);
2250 case CX88_BOARD_PROLINK_PV_8000GT:
2251 return cx88_pv_8000gt_callback(core, command, arg);
2252 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO:
2253 return cx88_dvico_xc2028_callback(core, command, arg);
2254 }
2255
2256 switch (command) {
2257 case XC2028_TUNER_RESET:
2258 switch (INPUT(core->input).type) {
2259 case CX88_RADIO:
2260 info_printk(core, "setting GPIO to radio!\n");
2261 cx_write(MO_GP0_IO, 0x4ff);
2262 mdelay(250);
2263 cx_write(MO_GP2_IO, 0xff);
2264 mdelay(250);
2265 break;
2266 case CX88_VMUX_DVB: /* Digital TV*/
2267 default: /* Analog TV */
2268 info_printk(core, "setting GPIO to TV!\n");
2269 break;
2270 }
2271 cx_write(MO_GP1_IO, 0x101010);
2272 mdelay(250);
2273 cx_write(MO_GP1_IO, 0x101000);
2274 mdelay(250);
2275 cx_write(MO_GP1_IO, 0x101010);
2276 mdelay(250);
2277 return 0;
2278 }
2279 return -EINVAL;
2280}
2281
1883/* ----------------------------------------------------------------------- */ 2282/* ----------------------------------------------------------------------- */
1884/* Tuner callback function. Currently only needed for the Pinnacle * 2283/* Tuner callback function. Currently only needed for the Pinnacle *
1885 * PCTV HD 800i with an xc5000 sillicon tuner. This is used for both * 2284 * PCTV HD 800i with an xc5000 sillicon tuner. This is used for both *
1886 * analog tuner attach (tuner-core.c) and dvb tuner attach (cx88-dvb.c) */ 2285 * analog tuner attach (tuner-core.c) and dvb tuner attach (cx88-dvb.c) */
1887 2286
1888int cx88_tuner_callback(void *priv, int command, int arg) 2287static int cx88_xc5000_tuner_callback(struct cx88_core *core,
2288 int command, int arg)
1889{ 2289{
1890 struct i2c_algo_bit_data *i2c_algo = priv; 2290 switch (core->boardnr) {
1891 struct cx88_core *core = i2c_algo->data;
1892
1893 switch(core->boardnr) {
1894 case CX88_BOARD_PINNACLE_PCTV_HD_800i: 2291 case CX88_BOARD_PINNACLE_PCTV_HD_800i:
1895 if(command == 0) { /* This is the reset command from xc5000 */ 2292 if (command == 0) { /* This is the reset command from xc5000 */
1896 /* Reset XC5000 tuner via SYS_RSTO_pin */ 2293 /* Reset XC5000 tuner via SYS_RSTO_pin */
1897 cx_write(MO_SRST_IO, 0); 2294 cx_write(MO_SRST_IO, 0);
1898 msleep(10); 2295 msleep(10);
1899 cx_write(MO_SRST_IO, 1); 2296 cx_write(MO_SRST_IO, 1);
1900 return 0; 2297 return 0;
2298 } else {
2299 err_printk(core, "xc5000: unknown tuner "
2300 "callback command.\n");
2301 return -EINVAL;
1901 } 2302 }
1902 else { 2303 break;
2304 case CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD:
2305 if (command == 0) { /* This is the reset command from xc5000 */
2306 cx_clear(MO_GP0_IO, 0x00000010);
2307 msleep(10);
2308 cx_set(MO_GP0_IO, 0x00000010);
2309 return 0;
2310 } else {
1903 printk(KERN_ERR 2311 printk(KERN_ERR
1904 "xc5000: unknown tuner callback command.\n"); 2312 "xc5000: unknown tuner callback command.\n");
1905 return -EINVAL; 2313 return -EINVAL;
@@ -1908,6 +2316,36 @@ int cx88_tuner_callback(void *priv, int command, int arg)
1908 } 2316 }
1909 return 0; /* Should never be here */ 2317 return 0; /* Should never be here */
1910} 2318}
2319
2320int cx88_tuner_callback(void *priv, int command, int arg)
2321{
2322 struct i2c_algo_bit_data *i2c_algo = priv;
2323 struct cx88_core *core;
2324
2325 if (!i2c_algo) {
2326 printk(KERN_ERR "cx88: Error - i2c private data undefined.\n");
2327 return -EINVAL;
2328 }
2329
2330 core = i2c_algo->data;
2331
2332 if (!core) {
2333 printk(KERN_ERR "cx88: Error - device struct undefined.\n");
2334 return -EINVAL;
2335 }
2336
2337 switch (core->board.tuner_type) {
2338 case TUNER_XC2028:
2339 info_printk(core, "Calling XC2028/3028 callback\n");
2340 return cx88_xc2028_tuner_callback(core, command, arg);
2341 case TUNER_XC5000:
2342 info_printk(core, "Calling XC5000 callback\n");
2343 return cx88_xc5000_tuner_callback(core, command, arg);
2344 }
2345 err_printk(core, "Error: Calling callback for tuner %d\n",
2346 core->board.tuner_type);
2347 return -EINVAL;
2348}
1911EXPORT_SYMBOL(cx88_tuner_callback); 2349EXPORT_SYMBOL(cx88_tuner_callback);
1912 2350
1913/* ----------------------------------------------------------------------- */ 2351/* ----------------------------------------------------------------------- */
@@ -1918,23 +2356,25 @@ static void cx88_card_list(struct cx88_core *core, struct pci_dev *pci)
1918 2356
1919 if (0 == pci->subsystem_vendor && 2357 if (0 == pci->subsystem_vendor &&
1920 0 == pci->subsystem_device) { 2358 0 == pci->subsystem_device) {
1921 printk("%s: Your board has no valid PCI Subsystem ID and thus can't\n" 2359 printk(KERN_ERR
2360 "%s: Your board has no valid PCI Subsystem ID and thus can't\n"
1922 "%s: be autodetected. Please pass card=<n> insmod option to\n" 2361 "%s: be autodetected. Please pass card=<n> insmod option to\n"
1923 "%s: workaround that. Redirect complaints to the vendor of\n" 2362 "%s: workaround that. Redirect complaints to the vendor of\n"
1924 "%s: the TV card. Best regards,\n" 2363 "%s: the TV card. Best regards,\n"
1925 "%s: -- tux\n", 2364 "%s: -- tux\n",
1926 core->name,core->name,core->name,core->name,core->name); 2365 core->name,core->name,core->name,core->name,core->name);
1927 } else { 2366 } else {
1928 printk("%s: Your board isn't known (yet) to the driver. You can\n" 2367 printk(KERN_ERR
2368 "%s: Your board isn't known (yet) to the driver. You can\n"
1929 "%s: try to pick one of the existing card configs via\n" 2369 "%s: try to pick one of the existing card configs via\n"
1930 "%s: card=<n> insmod option. Updating to the latest\n" 2370 "%s: card=<n> insmod option. Updating to the latest\n"
1931 "%s: version might help as well.\n", 2371 "%s: version might help as well.\n",
1932 core->name,core->name,core->name,core->name); 2372 core->name,core->name,core->name,core->name);
1933 } 2373 }
1934 printk("%s: Here is a list of valid choices for the card=<n> insmod option:\n", 2374 err_printk(core, "Here is a list of valid choices for the card=<n> "
1935 core->name); 2375 "insmod option:\n");
1936 for (i = 0; i < ARRAY_SIZE(cx88_boards); i++) 2376 for (i = 0; i < ARRAY_SIZE(cx88_boards); i++)
1937 printk("%s: card=%d -> %s\n", 2377 printk(KERN_ERR "%s: card=%d -> %s\n",
1938 core->name, i, cx88_boards[i].name); 2378 core->name, i, cx88_boards[i].name);
1939} 2379}
1940 2380
@@ -1951,9 +2391,57 @@ static void cx88_card_setup_pre_i2c(struct cx88_core *core)
1951 cx_set(MO_GP0_IO, 0x00000080); /* 702 out of reset */ 2391 cx_set(MO_GP0_IO, 0x00000080); /* 702 out of reset */
1952 udelay(1000); 2392 udelay(1000);
1953 break; 2393 break;
2394
2395 case CX88_BOARD_PROLINK_PV_8000GT:
2396 cx_write(MO_GP2_IO, 0xcf7);
2397 mdelay(50);
2398 cx_write(MO_GP2_IO, 0xef5);
2399 mdelay(50);
2400 cx_write(MO_GP2_IO, 0xcf7);
2401 msleep(10);
2402 break;
2403
2404 case CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD:
2405 /* Enable the xc5000 tuner */
2406 cx_set(MO_GP0_IO, 0x00001010);
2407 break;
1954 } 2408 }
1955} 2409}
1956 2410
2411/*
2412 * Sets board-dependent xc3028 configuration
2413 */
2414void cx88_setup_xc3028(struct cx88_core *core, struct xc2028_ctrl *ctl)
2415{
2416 memset(ctl, 0, sizeof(*ctl));
2417
2418 ctl->fname = XC2028_DEFAULT_FIRMWARE;
2419 ctl->max_len = 64;
2420
2421 switch (core->boardnr) {
2422 case CX88_BOARD_POWERCOLOR_REAL_ANGEL:
2423 /* Doesn't work with firmware version 2.7 */
2424 ctl->fname = "xc3028-v25.fw";
2425 break;
2426 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO:
2427 ctl->scode_table = XC3028_FE_ZARLINK456;
2428 break;
2429 case CX88_BOARD_KWORLD_ATSC_120:
2430 case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO:
2431 ctl->demod = XC3028_FE_OREN538;
2432 break;
2433 case CX88_BOARD_PROLINK_PV_8000GT:
2434 /*
2435 * This board uses non-MTS firmware
2436 */
2437 break;
2438 default:
2439 ctl->demod = XC3028_FE_OREN538;
2440 ctl->mts = 1;
2441 }
2442}
2443EXPORT_SYMBOL_GPL(cx88_setup_xc3028);
2444
1957static void cx88_card_setup(struct cx88_core *core) 2445static void cx88_card_setup(struct cx88_core *core)
1958{ 2446{
1959 static u8 eeprom[256]; 2447 static u8 eeprom[256];
@@ -1991,6 +2479,13 @@ static void cx88_card_setup(struct cx88_core *core)
1991 cx_write(MO_GP0_IO, 0x000007f8); 2479 cx_write(MO_GP0_IO, 0x000007f8);
1992 cx_write(MO_GP1_IO, 0x00000001); 2480 cx_write(MO_GP1_IO, 0x00000001);
1993 break; 2481 break;
2482 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO:
2483 /* GPIO0:0 is hooked to demod reset */
2484 /* GPIO0:4 is hooked to xc3028 reset */
2485 cx_write(MO_GP0_IO, 0x00111100);
2486 msleep(1);
2487 cx_write(MO_GP0_IO, 0x00111111);
2488 break;
1994 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL: 2489 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL:
1995 /* GPIO0:6 is hooked to FX2 reset pin */ 2490 /* GPIO0:6 is hooked to FX2 reset pin */
1996 cx_set(MO_GP0_IO, 0x00004040); 2491 cx_set(MO_GP0_IO, 0x00004040);
@@ -2038,10 +2533,8 @@ static void cx88_card_setup(struct cx88_core *core)
2038 for (i = 0; i < ARRAY_SIZE(buffer); i++) 2533 for (i = 0; i < ARRAY_SIZE(buffer); i++)
2039 if (2 != i2c_master_send(&core->i2c_client, 2534 if (2 != i2c_master_send(&core->i2c_client,
2040 buffer[i],2)) 2535 buffer[i],2))
2041 printk(KERN_WARNING 2536 warn_printk(core, "Unable to enable "
2042 "%s: Unable to enable " 2537 "tuner(%i).\n", i);
2043 "tuner(%i).\n",
2044 core->name, i);
2045 } 2538 }
2046 break; 2539 break;
2047 case CX88_BOARD_MSI_TVANYWHERE_MASTER: 2540 case CX88_BOARD_MSI_TVANYWHERE_MASTER:
@@ -2062,6 +2555,22 @@ static void cx88_card_setup(struct cx88_core *core)
2062 cx88_call_i2c_clients(core, TUNER_SET_CONFIG, &tea5767_cfg); 2555 cx88_call_i2c_clients(core, TUNER_SET_CONFIG, &tea5767_cfg);
2063 } 2556 }
2064 } 2557 }
2558
2559 if (core->board.tuner_type == TUNER_XC2028) {
2560 struct v4l2_priv_tun_config xc2028_cfg;
2561 struct xc2028_ctrl ctl;
2562
2563 /* Fills device-dependent initialization parameters */
2564 cx88_setup_xc3028(core, &ctl);
2565
2566 /* Sends parameters to xc2028/3028 tuner */
2567 memset(&xc2028_cfg, 0, sizeof(xc2028_cfg));
2568 xc2028_cfg.tuner = TUNER_XC2028;
2569 xc2028_cfg.priv = &ctl;
2570 info_printk(core, "Asking xc2028/3028 to load firmware %s\n",
2571 ctl.fname);
2572 cx88_call_i2c_clients(core, TUNER_SET_CONFIG, &xc2028_cfg);
2573 }
2065} 2574}
2066 2575
2067/* ------------------------------------------------------------------ */ 2576/* ------------------------------------------------------------------ */
@@ -2178,9 +2687,8 @@ struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr)
2178 2687
2179 memcpy(&core->board, &cx88_boards[core->boardnr], sizeof(core->board)); 2688 memcpy(&core->board, &cx88_boards[core->boardnr], sizeof(core->board));
2180 2689
2181 printk(KERN_INFO "%s: subsystem: %04x:%04x, board: %s [card=%d,%s]\n", 2690 info_printk(core, "subsystem: %04x:%04x, board: %s [card=%d,%s]\n",
2182 core->name,pci->subsystem_vendor, 2691 pci->subsystem_vendor, pci->subsystem_device, core->board.name,
2183 pci->subsystem_device, core->board.name,
2184 core->boardnr, card[core->nr] == core->boardnr ? 2692 core->boardnr, card[core->nr] == core->boardnr ?
2185 "insmod option" : "autodetected"); 2693 "insmod option" : "autodetected");
2186 2694
@@ -2189,8 +2697,8 @@ struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr)
2189 if (radio[core->nr] != UNSET) 2697 if (radio[core->nr] != UNSET)
2190 core->board.radio_type = radio[core->nr]; 2698 core->board.radio_type = radio[core->nr];
2191 2699
2192 printk(KERN_INFO "%s: TV tuner type %d, Radio tuner type %d\n", 2700 info_printk(core, "TV tuner type %d, Radio tuner type %d\n",
2193 core->name, core->board.tuner_type, core->board.radio_type); 2701 core->board.tuner_type, core->board.radio_type);
2194 2702
2195 /* init hardware */ 2703 /* init hardware */
2196 cx88_reset(core); 2704 cx88_reset(core);
@@ -2207,12 +2715,3 @@ struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr)
2207 2715
2208 return core; 2716 return core;
2209} 2717}
2210
2211/* ------------------------------------------------------------------ */
2212
2213/*
2214 * Local variables:
2215 * c-basic-offset: 8
2216 * End:
2217 * 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
2218 */
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c
index 01e2ac98970b..c4d1aff1fdb4 100644
--- a/drivers/media/video/cx88/cx88-core.c
+++ b/drivers/media/video/cx88/cx88-core.c
@@ -47,15 +47,15 @@ MODULE_LICENSE("GPL");
47 47
48/* ------------------------------------------------------------------ */ 48/* ------------------------------------------------------------------ */
49 49
50static unsigned int core_debug = 0; 50static unsigned int core_debug;
51module_param(core_debug,int,0644); 51module_param(core_debug,int,0644);
52MODULE_PARM_DESC(core_debug,"enable debug messages [core]"); 52MODULE_PARM_DESC(core_debug,"enable debug messages [core]");
53 53
54static unsigned int nicam = 0; 54static unsigned int nicam;
55module_param(nicam,int,0644); 55module_param(nicam,int,0644);
56MODULE_PARM_DESC(nicam,"tv audio is nicam"); 56MODULE_PARM_DESC(nicam,"tv audio is nicam");
57 57
58static unsigned int nocomb = 0; 58static unsigned int nocomb;
59module_param(nocomb,int,0644); 59module_param(nocomb,int,0644);
60MODULE_PARM_DESC(nocomb,"disable comb filter"); 60MODULE_PARM_DESC(nocomb,"disable comb filter");
61 61
@@ -219,7 +219,7 @@ cx88_free_buffer(struct videobuf_queue *q, struct cx88_buffer *buf)
219 videobuf_waiton(&buf->vb,0,0); 219 videobuf_waiton(&buf->vb,0,0);
220 videobuf_dma_unmap(q, dma); 220 videobuf_dma_unmap(q, dma);
221 videobuf_dma_free(dma); 221 videobuf_dma_free(dma);
222 btcx_riscmem_free((struct pci_dev *)q->dev, &buf->risc); 222 btcx_riscmem_free(to_pci_dev(q->dev), &buf->risc);
223 buf->vb.state = VIDEOBUF_NEEDS_INIT; 223 buf->vb.state = VIDEOBUF_NEEDS_INIT;
224} 224}
225 225
@@ -548,7 +548,7 @@ void cx88_wakeup(struct cx88_core *core,
548 mod_timer(&q->timeout, jiffies+BUFFER_TIMEOUT); 548 mod_timer(&q->timeout, jiffies+BUFFER_TIMEOUT);
549 } 549 }
550 if (bc != 1) 550 if (bc != 1)
551 printk("%s: %d buffers handled (should be 1)\n",__FUNCTION__,bc); 551 printk("%s: %d buffers handled (should be 1)\n",__func__,bc);
552} 552}
553 553
554void cx88_shutdown(struct cx88_core *core) 554void cx88_shutdown(struct cx88_core *core)
@@ -577,7 +577,7 @@ void cx88_shutdown(struct cx88_core *core)
577 577
578int cx88_reset(struct cx88_core *core) 578int cx88_reset(struct cx88_core *core)
579{ 579{
580 dprintk(1,"%s\n",__FUNCTION__); 580 dprintk(1,"%s\n",__func__);
581 cx88_shutdown(core); 581 cx88_shutdown(core);
582 582
583 /* clear irq status */ 583 /* clear irq status */
@@ -929,7 +929,10 @@ int cx88_set_tvnorm(struct cx88_core *core, v4l2_std_id norm)
929 929
930 dprintk(1,"set_tvnorm: MO_INPUT_FORMAT 0x%08x [old=0x%08x]\n", 930 dprintk(1,"set_tvnorm: MO_INPUT_FORMAT 0x%08x [old=0x%08x]\n",
931 cxiformat, cx_read(MO_INPUT_FORMAT) & 0x0f); 931 cxiformat, cx_read(MO_INPUT_FORMAT) & 0x0f);
932 cx_andor(MO_INPUT_FORMAT, 0xf, cxiformat); 932 /* Chroma AGC must be disabled if SECAM is used, we enable it
933 by default on PAL and NTSC */
934 cx_andor(MO_INPUT_FORMAT, 0x40f,
935 norm & V4L2_STD_SECAM ? cxiformat : cxiformat | 0x400);
933 936
934 // FIXME: as-is from DScaler 937 // FIXME: as-is from DScaler
935 dprintk(1,"set_tvnorm: MO_OUTPUT_FORMAT 0x%08x [old=0x%08x]\n", 938 dprintk(1,"set_tvnorm: MO_OUTPUT_FORMAT 0x%08x [old=0x%08x]\n",
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c
index f7b41eb1bb5a..f1251b844e08 100644
--- a/drivers/media/video/cx88/cx88-dvb.c
+++ b/drivers/media/video/cx88/cx88-dvb.c
@@ -45,16 +45,20 @@
45#include "nxt200x.h" 45#include "nxt200x.h"
46#include "cx24123.h" 46#include "cx24123.h"
47#include "isl6421.h" 47#include "isl6421.h"
48#include "tuner-simple.h"
49#include "tda9887.h"
48 50
49MODULE_DESCRIPTION("driver for cx2388x based DVB cards"); 51MODULE_DESCRIPTION("driver for cx2388x based DVB cards");
50MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>"); 52MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>");
51MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); 53MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
52MODULE_LICENSE("GPL"); 54MODULE_LICENSE("GPL");
53 55
54static unsigned int debug = 0; 56static unsigned int debug;
55module_param(debug, int, 0644); 57module_param(debug, int, 0644);
56MODULE_PARM_DESC(debug,"enable debug messages [dvb]"); 58MODULE_PARM_DESC(debug,"enable debug messages [dvb]");
57 59
60DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
61
58#define dprintk(level,fmt, arg...) if (debug >= level) \ 62#define dprintk(level,fmt, arg...) if (debug >= level) \
59 printk(KERN_DEBUG "%s/2-dvb: " fmt, core->name, ## arg) 63 printk(KERN_DEBUG "%s/2-dvb: " fmt, core->name, ## arg)
60 64
@@ -235,6 +239,19 @@ static struct zl10353_config dvico_fusionhdtv_hybrid = {
235 .no_tuner = 1, 239 .no_tuner = 1,
236}; 240};
237 241
242static struct zl10353_config dvico_fusionhdtv_xc3028 = {
243 .demod_address = 0x0f,
244 .if2 = 45600,
245 .no_tuner = 1,
246};
247
248static struct mt352_config dvico_fusionhdtv_mt352_xc3028 = {
249 .demod_address = 0x0f,
250 .if2 = 4560,
251 .no_tuner = 1,
252 .demod_init = dvico_fusionhdtv_demod_init,
253};
254
238static struct zl10353_config dvico_fusionhdtv_plus_v1_1 = { 255static struct zl10353_config dvico_fusionhdtv_plus_v1_1 = {
239 .demod_address = 0x0f, 256 .demod_address = 0x0f,
240}; 257};
@@ -266,7 +283,7 @@ static int lgdt330x_pll_rf_set(struct dvb_frontend* fe, int index)
266 struct cx8802_dev *dev= fe->dvb->priv; 283 struct cx8802_dev *dev= fe->dvb->priv;
267 struct cx88_core *core = dev->core; 284 struct cx88_core *core = dev->core;
268 285
269 dprintk(1, "%s: index = %d\n", __FUNCTION__, index); 286 dprintk(1, "%s: index = %d\n", __func__, index);
270 if (index == 0) 287 if (index == 0)
271 cx_clear(MO_GP0_IO, 8); 288 cx_clear(MO_GP0_IO, 8);
272 else 289 else
@@ -357,6 +374,40 @@ static int geniatech_dvbs_set_voltage(struct dvb_frontend *fe,
357 return 0; 374 return 0;
358} 375}
359 376
377static int cx88_pci_nano_callback(void *ptr, int command, int arg)
378{
379 struct cx88_core *core = ptr;
380
381 switch (command) {
382 case XC2028_TUNER_RESET:
383 /* Send the tuner in then out of reset */
384 dprintk(1, "%s: XC2028_TUNER_RESET %d\n", __func__, arg);
385
386 switch (core->boardnr) {
387 case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO:
388 /* GPIO-4 xc3028 tuner */
389
390 cx_set(MO_GP0_IO, 0x00001000);
391 cx_clear(MO_GP0_IO, 0x00000010);
392 msleep(100);
393 cx_set(MO_GP0_IO, 0x00000010);
394 msleep(100);
395 break;
396 }
397
398 break;
399 case XC2028_RESET_CLK:
400 dprintk(1, "%s: XC2028_RESET_CLK %d\n", __func__, arg);
401 break;
402 default:
403 dprintk(1, "%s: unknown command %d, arg %d\n", __func__,
404 command, arg);
405 return -EINVAL;
406 }
407
408 return 0;
409}
410
360static struct cx24123_config geniatech_dvbs_config = { 411static struct cx24123_config geniatech_dvbs_config = {
361 .demod_address = 0x55, 412 .demod_address = 0x55,
362 .set_ts_params = cx24123_set_ts_param, 413 .set_ts_params = cx24123_set_ts_param,
@@ -383,12 +434,76 @@ static struct s5h1409_config pinnacle_pctv_hd_800i_config = {
383 .mpeg_timing = S5H1409_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK, 434 .mpeg_timing = S5H1409_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK,
384}; 435};
385 436
437static struct s5h1409_config dvico_hdtv5_pci_nano_config = {
438 .demod_address = 0x32 >> 1,
439 .output_mode = S5H1409_SERIAL_OUTPUT,
440 .gpio = S5H1409_GPIO_OFF,
441 .inversion = S5H1409_INVERSION_OFF,
442 .status_mode = S5H1409_DEMODLOCKING,
443 .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK,
444};
445
446static struct s5h1409_config kworld_atsc_120_config = {
447 .demod_address = 0x32 >> 1,
448 .output_mode = S5H1409_SERIAL_OUTPUT,
449 .gpio = S5H1409_GPIO_OFF,
450 .inversion = S5H1409_INVERSION_OFF,
451 .status_mode = S5H1409_DEMODLOCKING,
452 .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK,
453};
454
386static struct xc5000_config pinnacle_pctv_hd_800i_tuner_config = { 455static struct xc5000_config pinnacle_pctv_hd_800i_tuner_config = {
387 .i2c_address = 0x64, 456 .i2c_address = 0x64,
388 .if_khz = 5380, 457 .if_khz = 5380,
389 .tuner_callback = cx88_tuner_callback, 458 .tuner_callback = cx88_tuner_callback,
390}; 459};
391 460
461static struct zl10353_config cx88_geniatech_x8000_mt = {
462 .demod_address = (0x1e >> 1),
463 .no_tuner = 1,
464};
465
466static int attach_xc3028(u8 addr, struct cx8802_dev *dev)
467{
468 struct dvb_frontend *fe;
469 struct xc2028_ctrl ctl;
470 struct xc2028_config cfg = {
471 .i2c_adap = &dev->core->i2c_adap,
472 .i2c_addr = addr,
473 .ctrl = &ctl,
474 .callback = cx88_tuner_callback,
475 };
476
477 if (!dev->dvb.frontend) {
478 printk(KERN_ERR "%s/2: dvb frontend not attached. "
479 "Can't attach xc3028\n",
480 dev->core->name);
481 return -EINVAL;
482 }
483
484 /*
485 * Some xc3028 devices may be hidden by an I2C gate. This is known
486 * to happen with some s5h1409-based devices.
487 * Now that I2C gate is open, sets up xc3028 configuration
488 */
489 cx88_setup_xc3028(dev->core, &ctl);
490
491 fe = dvb_attach(xc2028_attach, dev->dvb.frontend, &cfg);
492 if (!fe) {
493 printk(KERN_ERR "%s/2: xc3028 attach failed\n",
494 dev->core->name);
495 dvb_frontend_detach(dev->dvb.frontend);
496 dvb_unregister_frontend(dev->dvb.frontend);
497 dev->dvb.frontend = NULL;
498 return -EINVAL;
499 }
500
501 printk(KERN_INFO "%s/2: xc3028 attached\n",
502 dev->core->name);
503
504 return 0;
505}
506
392static int dvb_register(struct cx8802_dev *dev) 507static int dvb_register(struct cx8802_dev *dev)
393{ 508{
394 /* init struct videobuf_dvb */ 509 /* init struct videobuf_dvb */
@@ -429,8 +544,9 @@ static int dvb_register(struct cx8802_dev *dev)
429 &hauppauge_hvr_config, 544 &hauppauge_hvr_config,
430 &dev->core->i2c_adap); 545 &dev->core->i2c_adap);
431 if (dev->dvb.frontend != NULL) { 546 if (dev->dvb.frontend != NULL) {
432 dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, 547 dvb_attach(simple_tuner_attach, dev->dvb.frontend,
433 &dev->core->i2c_adap, DVB_PLL_FMD1216ME); 548 &dev->core->i2c_adap, 0x61,
549 TUNER_PHILIPS_FMD1216ME_MK3);
434 } 550 }
435 break; 551 break;
436 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS: 552 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS:
@@ -497,8 +613,9 @@ static int dvb_register(struct cx8802_dev *dev)
497 dev->dvb.frontend = dvb_attach(mt352_attach, &dntv_live_dvbt_pro_config, 613 dev->dvb.frontend = dvb_attach(mt352_attach, &dntv_live_dvbt_pro_config,
498 &dev->vp3054->adap); 614 &dev->vp3054->adap);
499 if (dev->dvb.frontend != NULL) { 615 if (dev->dvb.frontend != NULL) {
500 dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, 616 dvb_attach(simple_tuner_attach, dev->dvb.frontend,
501 &dev->core->i2c_adap, DVB_PLL_FMD1216ME); 617 &dev->core->i2c_adap, 0x61,
618 TUNER_PHILIPS_FMD1216ME_MK3);
502 } 619 }
503#else 620#else
504 printk(KERN_ERR "%s/2: built without vp3054 support\n", dev->core->name); 621 printk(KERN_ERR "%s/2: built without vp3054 support\n", dev->core->name);
@@ -509,18 +626,36 @@ static int dvb_register(struct cx8802_dev *dev)
509 &dvico_fusionhdtv_hybrid, 626 &dvico_fusionhdtv_hybrid,
510 &dev->core->i2c_adap); 627 &dev->core->i2c_adap);
511 if (dev->dvb.frontend != NULL) { 628 if (dev->dvb.frontend != NULL) {
512 dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, 629 dvb_attach(simple_tuner_attach, dev->dvb.frontend,
513 &dev->core->i2c_adap, 630 &dev->core->i2c_adap, 0x61,
514 DVB_PLL_THOMSON_FE6600); 631 TUNER_THOMSON_FE6600);
515 } 632 }
516 break; 633 break;
634 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO:
635 dev->dvb.frontend = dvb_attach(zl10353_attach,
636 &dvico_fusionhdtv_xc3028,
637 &dev->core->i2c_adap);
638 if (dev->dvb.frontend == NULL)
639 dev->dvb.frontend = dvb_attach(mt352_attach,
640 &dvico_fusionhdtv_mt352_xc3028,
641 &dev->core->i2c_adap);
642 /*
643 * On this board, the demod provides the I2C bus pullup.
644 * We must not permit gate_ctrl to be performed, or
645 * the xc3028 cannot communicate on the bus.
646 */
647 if (dev->dvb.frontend)
648 dev->dvb.frontend->ops.i2c_gate_ctrl = NULL;
649 if (attach_xc3028(0x61, dev) < 0)
650 return -EINVAL;
651 break;
517 case CX88_BOARD_PCHDTV_HD3000: 652 case CX88_BOARD_PCHDTV_HD3000:
518 dev->dvb.frontend = dvb_attach(or51132_attach, &pchdtv_hd3000, 653 dev->dvb.frontend = dvb_attach(or51132_attach, &pchdtv_hd3000,
519 &dev->core->i2c_adap); 654 &dev->core->i2c_adap);
520 if (dev->dvb.frontend != NULL) { 655 if (dev->dvb.frontend != NULL) {
521 dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, 656 dvb_attach(simple_tuner_attach, dev->dvb.frontend,
522 &dev->core->i2c_adap, 657 &dev->core->i2c_adap, 0x61,
523 DVB_PLL_THOMSON_DTT761X); 658 TUNER_THOMSON_DTT761X);
524 } 659 }
525 break; 660 break;
526 case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q: 661 case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q:
@@ -540,9 +675,9 @@ static int dvb_register(struct cx8802_dev *dev)
540 &fusionhdtv_3_gold, 675 &fusionhdtv_3_gold,
541 &dev->core->i2c_adap); 676 &dev->core->i2c_adap);
542 if (dev->dvb.frontend != NULL) { 677 if (dev->dvb.frontend != NULL) {
543 dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, 678 dvb_attach(simple_tuner_attach, dev->dvb.frontend,
544 &dev->core->i2c_adap, 679 &dev->core->i2c_adap, 0x61,
545 DVB_PLL_MICROTUNE_4042); 680 TUNER_MICROTUNE_4042FI5);
546 } 681 }
547 } 682 }
548 break; 683 break;
@@ -560,9 +695,9 @@ static int dvb_register(struct cx8802_dev *dev)
560 &fusionhdtv_3_gold, 695 &fusionhdtv_3_gold,
561 &dev->core->i2c_adap); 696 &dev->core->i2c_adap);
562 if (dev->dvb.frontend != NULL) { 697 if (dev->dvb.frontend != NULL) {
563 dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, 698 dvb_attach(simple_tuner_attach, dev->dvb.frontend,
564 &dev->core->i2c_adap, 699 &dev->core->i2c_adap, 0x61,
565 DVB_PLL_THOMSON_DTT761X); 700 TUNER_THOMSON_DTT761X);
566 } 701 }
567 } 702 }
568 break; 703 break;
@@ -580,9 +715,11 @@ static int dvb_register(struct cx8802_dev *dev)
580 &fusionhdtv_5_gold, 715 &fusionhdtv_5_gold,
581 &dev->core->i2c_adap); 716 &dev->core->i2c_adap);
582 if (dev->dvb.frontend != NULL) { 717 if (dev->dvb.frontend != NULL) {
583 dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, 718 dvb_attach(simple_tuner_attach, dev->dvb.frontend,
584 &dev->core->i2c_adap, 719 &dev->core->i2c_adap, 0x61,
585 DVB_PLL_LG_TDVS_H06XF); 720 TUNER_LG_TDVS_H06XF);
721 dvb_attach(tda9887_attach, dev->dvb.frontend,
722 &dev->core->i2c_adap, 0x43);
586 } 723 }
587 } 724 }
588 break; 725 break;
@@ -600,9 +737,11 @@ static int dvb_register(struct cx8802_dev *dev)
600 &pchdtv_hd5500, 737 &pchdtv_hd5500,
601 &dev->core->i2c_adap); 738 &dev->core->i2c_adap);
602 if (dev->dvb.frontend != NULL) { 739 if (dev->dvb.frontend != NULL) {
603 dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, 740 dvb_attach(simple_tuner_attach, dev->dvb.frontend,
604 &dev->core->i2c_adap, 741 &dev->core->i2c_adap, 0x61,
605 DVB_PLL_LG_TDVS_H06XF); 742 TUNER_LG_TDVS_H06XF);
743 dvb_attach(tda9887_attach, dev->dvb.frontend,
744 &dev->core->i2c_adap, 0x43);
606 } 745 }
607 } 746 }
608 break; 747 break;
@@ -611,8 +750,9 @@ static int dvb_register(struct cx8802_dev *dev)
611 &ati_hdtvwonder, 750 &ati_hdtvwonder,
612 &dev->core->i2c_adap); 751 &dev->core->i2c_adap);
613 if (dev->dvb.frontend != NULL) { 752 if (dev->dvb.frontend != NULL) {
614 dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, 753 dvb_attach(simple_tuner_attach, dev->dvb.frontend,
615 NULL, DVB_PLL_TUV1236D); 754 &dev->core->i2c_adap, 0x61,
755 TUNER_PHILIPS_TUV1236D);
616 } 756 }
617 break; 757 break;
618 case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1: 758 case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1:
@@ -658,14 +798,62 @@ static int dvb_register(struct cx8802_dev *dev)
658 &pinnacle_pctv_hd_800i_tuner_config); 798 &pinnacle_pctv_hd_800i_tuner_config);
659 } 799 }
660 break; 800 break;
801 case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO:
802 dev->dvb.frontend = dvb_attach(s5h1409_attach,
803 &dvico_hdtv5_pci_nano_config,
804 &dev->core->i2c_adap);
805 if (dev->dvb.frontend != NULL) {
806 struct dvb_frontend *fe;
807 struct xc2028_config cfg = {
808 .i2c_adap = &dev->core->i2c_adap,
809 .i2c_addr = 0x61,
810 .callback = cx88_pci_nano_callback,
811 };
812 static struct xc2028_ctrl ctl = {
813 .fname = "xc3028-v27.fw",
814 .max_len = 64,
815 .scode_table = XC3028_FE_OREN538,
816 };
817
818 fe = dvb_attach(xc2028_attach,
819 dev->dvb.frontend, &cfg);
820 if (fe != NULL && fe->ops.tuner_ops.set_config != NULL)
821 fe->ops.tuner_ops.set_config(fe, &ctl);
822 }
823 break;
824 case CX88_BOARD_PINNACLE_HYBRID_PCTV:
825 dev->dvb.frontend = dvb_attach(zl10353_attach,
826 &cx88_geniatech_x8000_mt,
827 &dev->core->i2c_adap);
828 if (attach_xc3028(0x61, dev) < 0)
829 return -EINVAL;
830 break;
831 case CX88_BOARD_GENIATECH_X8000_MT:
832 dev->ts_gen_cntrl = 0x00;
833
834 dev->dvb.frontend = dvb_attach(zl10353_attach,
835 &cx88_geniatech_x8000_mt,
836 &dev->core->i2c_adap);
837 if (attach_xc3028(0x61, dev) < 0)
838 return -EINVAL;
839 break;
840 case CX88_BOARD_KWORLD_ATSC_120:
841 dev->dvb.frontend = dvb_attach(s5h1409_attach,
842 &kworld_atsc_120_config,
843 &dev->core->i2c_adap);
844 if (attach_xc3028(0x61, dev) < 0)
845 return -EINVAL;
846 break;
661 default: 847 default:
662 printk(KERN_ERR "%s/2: The frontend of your DVB/ATSC card isn't supported yet\n", 848 printk(KERN_ERR "%s/2: The frontend of your DVB/ATSC card isn't supported yet\n",
663 dev->core->name); 849 dev->core->name);
664 break; 850 break;
665 } 851 }
666 if (NULL == dev->dvb.frontend) { 852 if (NULL == dev->dvb.frontend) {
667 printk(KERN_ERR "%s/2: frontend initialization failed\n", dev->core->name); 853 printk(KERN_ERR
668 return -1; 854 "%s/2: frontend initialization failed\n",
855 dev->core->name);
856 return -EINVAL;
669 } 857 }
670 858
671 /* Ensure all frontends negotiate bus access */ 859 /* Ensure all frontends negotiate bus access */
@@ -675,7 +863,8 @@ static int dvb_register(struct cx8802_dev *dev)
675 cx88_call_i2c_clients (dev->core, TUNER_SET_STANDBY, NULL); 863 cx88_call_i2c_clients (dev->core, TUNER_SET_STANDBY, NULL);
676 864
677 /* register everything */ 865 /* register everything */
678 return videobuf_dvb_register(&dev->dvb, THIS_MODULE, dev, &dev->pci->dev); 866 return videobuf_dvb_register(&dev->dvb, THIS_MODULE, dev,
867 &dev->pci->dev, adapter_nr);
679} 868}
680 869
681/* ----------------------------------------------------------- */ 870/* ----------------------------------------------------------- */
@@ -685,7 +874,7 @@ static int cx8802_dvb_advise_acquire(struct cx8802_driver *drv)
685{ 874{
686 struct cx88_core *core = drv->core; 875 struct cx88_core *core = drv->core;
687 int err = 0; 876 int err = 0;
688 dprintk( 1, "%s\n", __FUNCTION__); 877 dprintk( 1, "%s\n", __func__);
689 878
690 switch (core->boardnr) { 879 switch (core->boardnr) {
691 case CX88_BOARD_HAUPPAUGE_HVR1300: 880 case CX88_BOARD_HAUPPAUGE_HVR1300:
@@ -708,7 +897,7 @@ static int cx8802_dvb_advise_release(struct cx8802_driver *drv)
708{ 897{
709 struct cx88_core *core = drv->core; 898 struct cx88_core *core = drv->core;
710 int err = 0; 899 int err = 0;
711 dprintk( 1, "%s\n", __FUNCTION__); 900 dprintk( 1, "%s\n", __func__);
712 901
713 switch (core->boardnr) { 902 switch (core->boardnr) {
714 case CX88_BOARD_HAUPPAUGE_HVR1300: 903 case CX88_BOARD_HAUPPAUGE_HVR1300:
@@ -726,7 +915,7 @@ static int cx8802_dvb_probe(struct cx8802_driver *drv)
726 struct cx8802_dev *dev = drv->core->dvbdev; 915 struct cx8802_dev *dev = drv->core->dvbdev;
727 int err; 916 int err;
728 917
729 dprintk( 1, "%s\n", __FUNCTION__); 918 dprintk( 1, "%s\n", __func__);
730 dprintk( 1, " ->being probed by Card=%d Name=%s, PCI %02x:%02x\n", 919 dprintk( 1, " ->being probed by Card=%d Name=%s, PCI %02x:%02x\n",
731 core->boardnr, 920 core->boardnr,
732 core->name, 921 core->name,
@@ -744,8 +933,8 @@ static int cx8802_dvb_probe(struct cx8802_driver *drv)
744 933
745 /* dvb stuff */ 934 /* dvb stuff */
746 printk(KERN_INFO "%s/2: cx2388x based DVB/ATSC card\n", core->name); 935 printk(KERN_INFO "%s/2: cx2388x based DVB/ATSC card\n", core->name);
747 videobuf_queue_pci_init(&dev->dvb.dvbq, &dvb_qops, 936 videobuf_queue_sg_init(&dev->dvb.dvbq, &dvb_qops,
748 dev->pci, &dev->slock, 937 &dev->pci->dev, &dev->slock,
749 V4L2_BUF_TYPE_VIDEO_CAPTURE, 938 V4L2_BUF_TYPE_VIDEO_CAPTURE,
750 V4L2_FIELD_TOP, 939 V4L2_FIELD_TOP,
751 sizeof(struct cx88_buffer), 940 sizeof(struct cx88_buffer),
@@ -764,7 +953,8 @@ static int cx8802_dvb_remove(struct cx8802_driver *drv)
764 struct cx8802_dev *dev = drv->core->dvbdev; 953 struct cx8802_dev *dev = drv->core->dvbdev;
765 954
766 /* dvb */ 955 /* dvb */
767 videobuf_dvb_unregister(&dev->dvb); 956 if (dev->dvb.frontend)
957 videobuf_dvb_unregister(&dev->dvb);
768 958
769 vp3054_i2c_remove(dev); 959 vp3054_i2c_remove(dev);
770 960
diff --git a/drivers/media/video/cx88/cx88-i2c.c b/drivers/media/video/cx88/cx88-i2c.c
index 566b26af523e..c6b44732a082 100644
--- a/drivers/media/video/cx88/cx88-i2c.c
+++ b/drivers/media/video/cx88/cx88-i2c.c
@@ -35,11 +35,11 @@
35#include "cx88.h" 35#include "cx88.h"
36#include <media/v4l2-common.h> 36#include <media/v4l2-common.h>
37 37
38static unsigned int i2c_debug = 0; 38static unsigned int i2c_debug;
39module_param(i2c_debug, int, 0644); 39module_param(i2c_debug, int, 0644);
40MODULE_PARM_DESC(i2c_debug,"enable debug messages [i2c]"); 40MODULE_PARM_DESC(i2c_debug,"enable debug messages [i2c]");
41 41
42static unsigned int i2c_scan = 0; 42static unsigned int i2c_scan;
43module_param(i2c_scan, int, 0444); 43module_param(i2c_scan, int, 0444);
44MODULE_PARM_DESC(i2c_scan,"scan i2c bus at insmod time"); 44MODULE_PARM_DESC(i2c_scan,"scan i2c bus at insmod time");
45 45
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c
index bb0911b4d2f6..53526d997a4e 100644
--- a/drivers/media/video/cx88/cx88-input.c
+++ b/drivers/media/video/cx88/cx88-input.c
@@ -57,7 +57,7 @@ struct cx88_IR {
57 u32 mask_keyup; 57 u32 mask_keyup;
58}; 58};
59 59
60static int ir_debug = 0; 60static int ir_debug;
61module_param(ir_debug, int, 0644); /* debug level [IR] */ 61module_param(ir_debug, int, 0644); /* debug level [IR] */
62MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]"); 62MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]");
63 63
@@ -258,6 +258,13 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
258 ir->mask_keyup = 0x80; 258 ir->mask_keyup = 0x80;
259 ir->polling = 1; /* ms */ 259 ir->polling = 1; /* ms */
260 break; 260 break;
261 case CX88_BOARD_PROLINK_PV_8000GT:
262 ir_codes = ir_codes_pixelview_new;
263 ir->gpio_addr = MO_GP1_IO;
264 ir->mask_keycode = 0x3f;
265 ir->mask_keyup = 0x80;
266 ir->polling = 1; /* ms */
267 break;
261 case CX88_BOARD_KWORLD_LTV883: 268 case CX88_BOARD_KWORLD_LTV883:
262 ir_codes = ir_codes_pixelview; 269 ir_codes = ir_codes_pixelview;
263 ir->gpio_addr = MO_GP1_IO; 270 ir->gpio_addr = MO_GP1_IO;
@@ -310,6 +317,12 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
310 ir_type = IR_TYPE_RC5; 317 ir_type = IR_TYPE_RC5;
311 ir->sampling = 1; 318 ir->sampling = 1;
312 break; 319 break;
320 case CX88_BOARD_POWERCOLOR_REAL_ANGEL:
321 ir_codes = ir_codes_powercolor_real_angel;
322 ir->gpio_addr = MO_GP2_IO;
323 ir->mask_keycode = 0x7e;
324 ir->polling = 100; /* ms */
325 break;
313 } 326 }
314 327
315 if (NULL == ir_codes) { 328 if (NULL == ir_codes) {
diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c
index e357f415db06..a6b061c2644a 100644
--- a/drivers/media/video/cx88/cx88-mpeg.c
+++ b/drivers/media/video/cx88/cx88-mpeg.c
@@ -39,7 +39,7 @@ MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>");
39MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); 39MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
40MODULE_LICENSE("GPL"); 40MODULE_LICENSE("GPL");
41 41
42static unsigned int debug = 0; 42static unsigned int debug;
43module_param(debug,int,0644); 43module_param(debug,int,0644);
44MODULE_PARM_DESC(debug,"enable debug messages [mpeg]"); 44MODULE_PARM_DESC(debug,"enable debug messages [mpeg]");
45 45
@@ -146,7 +146,7 @@ static int cx8802_start_dma(struct cx8802_dev *dev,
146 cx_write(TS_GEN_CNTRL, 0x06); /* punctured clock TS & posedge driven */ 146 cx_write(TS_GEN_CNTRL, 0x06); /* punctured clock TS & posedge driven */
147 udelay(100); 147 udelay(100);
148 } else { 148 } else {
149 printk( "%s() Failed. Unsupported value in .mpeg (0x%08x)\n", __FUNCTION__, 149 printk( "%s() Failed. Unsupported value in .mpeg (0x%08x)\n", __func__,
150 core->board.mpeg ); 150 core->board.mpeg );
151 return -EINVAL; 151 return -EINVAL;
152 } 152 }
@@ -247,7 +247,7 @@ int cx8802_buf_prepare(struct videobuf_queue *q, struct cx8802_dev *dev,
247 struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb); 247 struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb);
248 int rc; 248 int rc;
249 249
250 dprintk(1, "%s: %p\n", __FUNCTION__, buf); 250 dprintk(1, "%s: %p\n", __func__, buf);
251 if (0 != buf->vb.baddr && buf->vb.bsize < size) 251 if (0 != buf->vb.baddr && buf->vb.bsize < size)
252 return -EINVAL; 252 return -EINVAL;
253 253
@@ -289,7 +289,7 @@ void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf)
289 buf->count = cx88q->count++; 289 buf->count = cx88q->count++;
290 mod_timer(&cx88q->timeout, jiffies+BUFFER_TIMEOUT); 290 mod_timer(&cx88q->timeout, jiffies+BUFFER_TIMEOUT);
291 dprintk(1,"[%p/%d] %s - first active\n", 291 dprintk(1,"[%p/%d] %s - first active\n",
292 buf, buf->vb.i, __FUNCTION__); 292 buf, buf->vb.i, __func__);
293 293
294 } else { 294 } else {
295 dprintk( 1, "queue is not empty - append to active\n" ); 295 dprintk( 1, "queue is not empty - append to active\n" );
@@ -299,7 +299,7 @@ void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf)
299 buf->count = cx88q->count++; 299 buf->count = cx88q->count++;
300 prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); 300 prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
301 dprintk( 1, "[%p/%d] %s - append to active\n", 301 dprintk( 1, "[%p/%d] %s - append to active\n",
302 buf, buf->vb.i, __FUNCTION__); 302 buf, buf->vb.i, __func__);
303 } 303 }
304} 304}
305 305
@@ -342,7 +342,7 @@ static void cx8802_timeout(unsigned long data)
342{ 342{
343 struct cx8802_dev *dev = (struct cx8802_dev*)data; 343 struct cx8802_dev *dev = (struct cx8802_dev*)data;
344 344
345 dprintk(1, "%s\n",__FUNCTION__); 345 dprintk(1, "%s\n",__func__);
346 346
347 if (debug) 347 if (debug)
348 cx88_sram_channel_dump(dev->core, &cx88_sram_channels[SRAM_CH28]); 348 cx88_sram_channel_dump(dev->core, &cx88_sram_channels[SRAM_CH28]);
@@ -613,6 +613,8 @@ static int cx8802_request_acquire(struct cx8802_driver *drv)
613 core->active_type_id != drv->type_id) 613 core->active_type_id != drv->type_id)
614 return -EBUSY; 614 return -EBUSY;
615 615
616 core->input = CX88_VMUX_DVB;
617
616 if (drv->advise_acquire) 618 if (drv->advise_acquire)
617 { 619 {
618 mutex_lock(&drv->core->lock); 620 mutex_lock(&drv->core->lock);
@@ -623,7 +625,7 @@ static int cx8802_request_acquire(struct cx8802_driver *drv)
623 } 625 }
624 mutex_unlock(&drv->core->lock); 626 mutex_unlock(&drv->core->lock);
625 627
626 mpeg_dbg(1,"%s() Post acquire GPIO=%x\n", __FUNCTION__, cx_read(MO_GP0_IO)); 628 mpeg_dbg(1,"%s() Post acquire GPIO=%x\n", __func__, cx_read(MO_GP0_IO));
627 } 629 }
628 630
629 return 0; 631 return 0;
@@ -639,7 +641,7 @@ static int cx8802_request_release(struct cx8802_driver *drv)
639 { 641 {
640 drv->advise_release(drv); 642 drv->advise_release(drv);
641 core->active_type_id = CX88_BOARD_NONE; 643 core->active_type_id = CX88_BOARD_NONE;
642 mpeg_dbg(1,"%s() Post release GPIO=%x\n", __FUNCTION__, cx_read(MO_GP0_IO)); 644 mpeg_dbg(1,"%s() Post release GPIO=%x\n", __func__, cx_read(MO_GP0_IO));
643 } 645 }
644 mutex_unlock(&drv->core->lock); 646 mutex_unlock(&drv->core->lock);
645 647
@@ -813,7 +815,7 @@ static void __devexit cx8802_remove(struct pci_dev *pci_dev)
813 815
814 dev = pci_get_drvdata(pci_dev); 816 dev = pci_get_drvdata(pci_dev);
815 817
816 dprintk( 1, "%s\n", __FUNCTION__); 818 dprintk( 1, "%s\n", __func__);
817 819
818 if (!list_empty(&dev->drvlist)) { 820 if (!list_empty(&dev->drvlist)) {
819 struct cx8802_driver *drv, *tmp; 821 struct cx8802_driver *drv, *tmp;
diff --git a/drivers/media/video/cx88/cx88-tvaudio.c b/drivers/media/video/cx88/cx88-tvaudio.c
index 76e5c78d8ae4..3a1977f41e27 100644
--- a/drivers/media/video/cx88/cx88-tvaudio.c
+++ b/drivers/media/video/cx88/cx88-tvaudio.c
@@ -53,15 +53,15 @@
53 53
54#include "cx88.h" 54#include "cx88.h"
55 55
56static unsigned int audio_debug = 0; 56static unsigned int audio_debug;
57module_param(audio_debug, int, 0644); 57module_param(audio_debug, int, 0644);
58MODULE_PARM_DESC(audio_debug, "enable debug messages [audio]"); 58MODULE_PARM_DESC(audio_debug, "enable debug messages [audio]");
59 59
60static unsigned int always_analog = 0; 60static unsigned int always_analog;
61module_param(always_analog,int,0644); 61module_param(always_analog,int,0644);
62MODULE_PARM_DESC(always_analog,"force analog audio out"); 62MODULE_PARM_DESC(always_analog,"force analog audio out");
63 63
64static unsigned int radio_deemphasis = 0; 64static unsigned int radio_deemphasis;
65module_param(radio_deemphasis,int,0644); 65module_param(radio_deemphasis,int,0644);
66MODULE_PARM_DESC(radio_deemphasis, "Radio deemphasis time constant, " 66MODULE_PARM_DESC(radio_deemphasis, "Radio deemphasis time constant, "
67 "0=None, 1=50us (elsewhere), 2=75us (USA)"); 67 "0=None, 1=50us (elsewhere), 2=75us (USA)");
@@ -265,12 +265,12 @@ static void set_audio_standard_BTSC(struct cx88_core *core, unsigned int sap,
265 mode |= EN_FMRADIO_EN_RDS; 265 mode |= EN_FMRADIO_EN_RDS;
266 266
267 if (sap) { 267 if (sap) {
268 dprintk("%s SAP (status: unknown)\n", __FUNCTION__); 268 dprintk("%s SAP (status: unknown)\n", __func__);
269 set_audio_start(core, SEL_SAP); 269 set_audio_start(core, SEL_SAP);
270 set_audio_registers(core, btsc_sap); 270 set_audio_registers(core, btsc_sap);
271 set_audio_finish(core, mode); 271 set_audio_finish(core, mode);
272 } else { 272 } else {
273 dprintk("%s (status: known-good)\n", __FUNCTION__); 273 dprintk("%s (status: known-good)\n", __func__);
274 set_audio_start(core, SEL_BTSC); 274 set_audio_start(core, SEL_BTSC);
275 set_audio_registers(core, btsc); 275 set_audio_registers(core, btsc);
276 set_audio_finish(core, mode); 276 set_audio_finish(core, mode);
@@ -351,16 +351,16 @@ static void set_audio_standard_NICAM(struct cx88_core *core, u32 mode)
351 set_audio_start(core,SEL_NICAM); 351 set_audio_start(core,SEL_NICAM);
352 switch (core->tvaudio) { 352 switch (core->tvaudio) {
353 case WW_L: 353 case WW_L:
354 dprintk("%s SECAM-L NICAM (status: devel)\n", __FUNCTION__); 354 dprintk("%s SECAM-L NICAM (status: devel)\n", __func__);
355 set_audio_registers(core, nicam_l); 355 set_audio_registers(core, nicam_l);
356 break; 356 break;
357 case WW_I: 357 case WW_I:
358 dprintk("%s PAL-I NICAM (status: known-good)\n", __FUNCTION__); 358 dprintk("%s PAL-I NICAM (status: known-good)\n", __func__);
359 set_audio_registers(core, nicam_bgdki_common); 359 set_audio_registers(core, nicam_bgdki_common);
360 set_audio_registers(core, nicam_i); 360 set_audio_registers(core, nicam_i);
361 break; 361 break;
362 default: 362 default:
363 dprintk("%s PAL-BGDK NICAM (status: known-good)\n", __FUNCTION__); 363 dprintk("%s PAL-BGDK NICAM (status: known-good)\n", __func__);
364 set_audio_registers(core, nicam_bgdki_common); 364 set_audio_registers(core, nicam_bgdki_common);
365 set_audio_registers(core, nicam_default); 365 set_audio_registers(core, nicam_default);
366 break; 366 break;
@@ -600,28 +600,28 @@ static void set_audio_standard_A2(struct cx88_core *core, u32 mode)
600 set_audio_start(core, SEL_A2); 600 set_audio_start(core, SEL_A2);
601 switch (core->tvaudio) { 601 switch (core->tvaudio) {
602 case WW_BG: 602 case WW_BG:
603 dprintk("%s PAL-BG A1/2 (status: known-good)\n", __FUNCTION__); 603 dprintk("%s PAL-BG A1/2 (status: known-good)\n", __func__);
604 set_audio_registers(core, a2_bgdk_common); 604 set_audio_registers(core, a2_bgdk_common);
605 set_audio_registers(core, a2_bg); 605 set_audio_registers(core, a2_bg);
606 set_audio_registers(core, a2_deemph50); 606 set_audio_registers(core, a2_deemph50);
607 break; 607 break;
608 case WW_DK: 608 case WW_DK:
609 dprintk("%s PAL-DK A1/2 (status: known-good)\n", __FUNCTION__); 609 dprintk("%s PAL-DK A1/2 (status: known-good)\n", __func__);
610 set_audio_registers(core, a2_bgdk_common); 610 set_audio_registers(core, a2_bgdk_common);
611 set_audio_registers(core, a2_dk); 611 set_audio_registers(core, a2_dk);
612 set_audio_registers(core, a2_deemph50); 612 set_audio_registers(core, a2_deemph50);
613 break; 613 break;
614 case WW_I: 614 case WW_I:
615 dprintk("%s PAL-I A1 (status: known-good)\n", __FUNCTION__); 615 dprintk("%s PAL-I A1 (status: known-good)\n", __func__);
616 set_audio_registers(core, a1_i); 616 set_audio_registers(core, a1_i);
617 set_audio_registers(core, a2_deemph50); 617 set_audio_registers(core, a2_deemph50);
618 break; 618 break;
619 case WW_L: 619 case WW_L:
620 dprintk("%s AM-L (status: devel)\n", __FUNCTION__); 620 dprintk("%s AM-L (status: devel)\n", __func__);
621 set_audio_registers(core, am_l); 621 set_audio_registers(core, am_l);
622 break; 622 break;
623 default: 623 default:
624 dprintk("%s Warning: wrong value\n", __FUNCTION__); 624 dprintk("%s Warning: wrong value\n", __func__);
625 return; 625 return;
626 break; 626 break;
627 }; 627 };
@@ -637,7 +637,7 @@ static void set_audio_standard_EIAJ(struct cx88_core *core)
637 637
638 { /* end of list */ }, 638 { /* end of list */ },
639 }; 639 };
640 dprintk("%s (status: unknown)\n", __FUNCTION__); 640 dprintk("%s (status: unknown)\n", __func__);
641 641
642 set_audio_start(core, SEL_EIAJ); 642 set_audio_start(core, SEL_EIAJ);
643 set_audio_registers(core, eiaj); 643 set_audio_registers(core, eiaj);
@@ -691,7 +691,7 @@ static void set_audio_standard_FM(struct cx88_core *core,
691 { /* end of list */ }, 691 { /* end of list */ },
692 }; 692 };
693 693
694 dprintk("%s (status: unknown)\n", __FUNCTION__); 694 dprintk("%s (status: unknown)\n", __func__);
695 set_audio_start(core, SEL_FMRADIO); 695 set_audio_start(core, SEL_FMRADIO);
696 696
697 switch (deemph) { 697 switch (deemph) {
diff --git a/drivers/media/video/cx88/cx88-vbi.c b/drivers/media/video/cx88/cx88-vbi.c
index d96ecfcf393a..0943060682bc 100644
--- a/drivers/media/video/cx88/cx88-vbi.c
+++ b/drivers/media/video/cx88/cx88-vbi.c
@@ -11,7 +11,7 @@ static unsigned int vbibufs = 4;
11module_param(vbibufs,int,0644); 11module_param(vbibufs,int,0644);
12MODULE_PARM_DESC(vbibufs,"number of vbi buffers, range 2-32"); 12MODULE_PARM_DESC(vbibufs,"number of vbi buffers, range 2-32");
13 13
14static unsigned int vbi_debug = 0; 14static unsigned int vbi_debug;
15module_param(vbi_debug,int,0644); 15module_param(vbi_debug,int,0644);
16MODULE_PARM_DESC(vbi_debug,"enable debug messages [vbi]"); 16MODULE_PARM_DESC(vbi_debug,"enable debug messages [vbi]");
17 17
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index 227179620d13..eea23f95edb7 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -63,11 +63,11 @@ MODULE_PARM_DESC(video_nr,"video device numbers");
63MODULE_PARM_DESC(vbi_nr,"vbi device numbers"); 63MODULE_PARM_DESC(vbi_nr,"vbi device numbers");
64MODULE_PARM_DESC(radio_nr,"radio device numbers"); 64MODULE_PARM_DESC(radio_nr,"radio device numbers");
65 65
66static unsigned int video_debug = 0; 66static unsigned int video_debug;
67module_param(video_debug,int,0644); 67module_param(video_debug,int,0644);
68MODULE_PARM_DESC(video_debug,"enable debug messages [video]"); 68MODULE_PARM_DESC(video_debug,"enable debug messages [video]");
69 69
70static unsigned int irq_debug = 0; 70static unsigned int irq_debug;
71module_param(irq_debug,int,0644); 71module_param(irq_debug,int,0644);
72MODULE_PARM_DESC(irq_debug,"enable debug messages [IRQ handler]"); 72MODULE_PARM_DESC(irq_debug,"enable debug messages [IRQ handler]");
73 73
@@ -228,6 +228,30 @@ static struct cx88_ctrl cx8800_ctls[] = {
228 .mask = 0x00ff, 228 .mask = 0x00ff,
229 .shift = 0, 229 .shift = 0,
230 },{ 230 },{
231 .v = {
232 .id = V4L2_CID_CHROMA_AGC,
233 .name = "Chroma AGC",
234 .minimum = 0,
235 .maximum = 1,
236 .default_value = 0x1,
237 .type = V4L2_CTRL_TYPE_BOOLEAN,
238 },
239 .reg = MO_INPUT_FORMAT,
240 .mask = 1 << 10,
241 .shift = 10,
242 }, {
243 .v = {
244 .id = V4L2_CID_COLOR_KILLER,
245 .name = "Color killer",
246 .minimum = 0,
247 .maximum = 1,
248 .default_value = 0x1,
249 .type = V4L2_CTRL_TYPE_BOOLEAN,
250 },
251 .reg = MO_INPUT_FORMAT,
252 .mask = 1 << 9,
253 .shift = 9,
254 }, {
231 /* --- audio --- */ 255 /* --- audio --- */
232 .v = { 256 .v = {
233 .id = V4L2_CID_AUDIO_MUTE, 257 .id = V4L2_CID_AUDIO_MUTE,
@@ -282,6 +306,8 @@ const u32 cx88_user_ctrls[] = {
282 V4L2_CID_AUDIO_VOLUME, 306 V4L2_CID_AUDIO_VOLUME,
283 V4L2_CID_AUDIO_BALANCE, 307 V4L2_CID_AUDIO_BALANCE,
284 V4L2_CID_AUDIO_MUTE, 308 V4L2_CID_AUDIO_MUTE,
309 V4L2_CID_CHROMA_AGC,
310 V4L2_CID_COLOR_KILLER,
285 0 311 0
286}; 312};
287EXPORT_SYMBOL(cx88_user_ctrls); 313EXPORT_SYMBOL(cx88_user_ctrls);
@@ -291,7 +317,7 @@ static const u32 *ctrl_classes[] = {
291 NULL 317 NULL
292}; 318};
293 319
294int cx8800_ctrl_query(struct v4l2_queryctrl *qctrl) 320int cx8800_ctrl_query(struct cx88_core *core, struct v4l2_queryctrl *qctrl)
295{ 321{
296 int i; 322 int i;
297 323
@@ -306,6 +332,11 @@ int cx8800_ctrl_query(struct v4l2_queryctrl *qctrl)
306 return 0; 332 return 0;
307 } 333 }
308 *qctrl = cx8800_ctls[i].v; 334 *qctrl = cx8800_ctls[i].v;
335 /* Report chroma AGC as inactive when SECAM is selected */
336 if (cx8800_ctls[i].v.id == V4L2_CID_CHROMA_AGC &&
337 core->tvnorm & V4L2_STD_SECAM)
338 qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE;
339
309 return 0; 340 return 0;
310} 341}
311EXPORT_SYMBOL(cx8800_ctrl_query); 342EXPORT_SYMBOL(cx8800_ctrl_query);
@@ -776,14 +807,14 @@ static int video_open(struct inode *inode, struct file *file)
776 fh->height = 240; 807 fh->height = 240;
777 fh->fmt = format_by_fourcc(V4L2_PIX_FMT_BGR24); 808 fh->fmt = format_by_fourcc(V4L2_PIX_FMT_BGR24);
778 809
779 videobuf_queue_pci_init(&fh->vidq, &cx8800_video_qops, 810 videobuf_queue_sg_init(&fh->vidq, &cx8800_video_qops,
780 dev->pci, &dev->slock, 811 &dev->pci->dev, &dev->slock,
781 V4L2_BUF_TYPE_VIDEO_CAPTURE, 812 V4L2_BUF_TYPE_VIDEO_CAPTURE,
782 V4L2_FIELD_INTERLACED, 813 V4L2_FIELD_INTERLACED,
783 sizeof(struct cx88_buffer), 814 sizeof(struct cx88_buffer),
784 fh); 815 fh);
785 videobuf_queue_pci_init(&fh->vbiq, &cx8800_vbi_qops, 816 videobuf_queue_sg_init(&fh->vbiq, &cx8800_vbi_qops,
786 dev->pci, &dev->slock, 817 &dev->pci->dev, &dev->slock,
787 V4L2_BUF_TYPE_VBI_CAPTURE, 818 V4L2_BUF_TYPE_VBI_CAPTURE,
788 V4L2_FIELD_SEQ_TB, 819 V4L2_FIELD_SEQ_TB,
789 sizeof(struct cx88_buffer), 820 sizeof(struct cx88_buffer),
@@ -976,6 +1007,12 @@ int cx88_set_control(struct cx88_core *core, struct v4l2_control *ctl)
976 } 1007 }
977 mask=0xffff; 1008 mask=0xffff;
978 break; 1009 break;
1010 case V4L2_CID_CHROMA_AGC:
1011 /* Do not allow chroma AGC to be enabled for SECAM */
1012 value = ((ctl->value - c->off) << c->shift) & c->mask;
1013 if (core->tvnorm & V4L2_STD_SECAM && value)
1014 return -EINVAL;
1015 break;
979 default: 1016 default:
980 value = ((ctl->value - c->off) << c->shift) & c->mask; 1017 value = ((ctl->value - c->off) << c->shift) & c->mask;
981 break; 1018 break;
@@ -1268,10 +1305,12 @@ static int vidioc_s_input (struct file *file, void *priv, unsigned int i)
1268static int vidioc_queryctrl (struct file *file, void *priv, 1305static int vidioc_queryctrl (struct file *file, void *priv,
1269 struct v4l2_queryctrl *qctrl) 1306 struct v4l2_queryctrl *qctrl)
1270{ 1307{
1308 struct cx88_core *core = ((struct cx8800_fh *)priv)->dev->core;
1309
1271 qctrl->id = v4l2_ctrl_next(ctrl_classes, qctrl->id); 1310 qctrl->id = v4l2_ctrl_next(ctrl_classes, qctrl->id);
1272 if (unlikely(qctrl->id == 0)) 1311 if (unlikely(qctrl->id == 0))
1273 return -EINVAL; 1312 return -EINVAL;
1274 return cx8800_ctrl_query(qctrl); 1313 return cx8800_ctrl_query(core, qctrl);
1275} 1314}
1276 1315
1277static int vidioc_g_ctrl (struct file *file, void *priv, 1316static int vidioc_g_ctrl (struct file *file, void *priv,
@@ -1832,8 +1871,11 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
1832 1871
1833 switch (core->boardnr) { 1872 switch (core->boardnr) {
1834 case CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD: 1873 case CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD:
1835 request_module("ir-kbd-i2c"); 1874 case CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD:
1836 request_module("rtc-isl1208"); 1875 request_module("rtc-isl1208");
1876 /* break intentionally omitted */
1877 case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO:
1878 request_module("ir-kbd-i2c");
1837 } 1879 }
1838 1880
1839 /* register v4l devices */ 1881 /* register v4l devices */
@@ -1917,6 +1959,9 @@ static void __devexit cx8800_finidev(struct pci_dev *pci_dev)
1917 core->kthread = NULL; 1959 core->kthread = NULL;
1918 } 1960 }
1919 1961
1962 if (core->ir)
1963 cx88_ir_stop(core, core->ir);
1964
1920 cx88_shutdown(core); /* FIXME */ 1965 cx88_shutdown(core); /* FIXME */
1921 pci_disable_device(pci_dev); 1966 pci_disable_device(pci_dev);
1922 1967
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index 37e6d2e4002f..14ac173f4071 100644
--- a/drivers/media/video/cx88/cx88.h
+++ b/drivers/media/video/cx88/cx88.h
@@ -37,6 +37,7 @@
37 37
38#include "btcx-risc.h" 38#include "btcx-risc.h"
39#include "cx88-reg.h" 39#include "cx88-reg.h"
40#include "tuner-xc2028.h"
40 41
41#include <linux/version.h> 42#include <linux/version.h>
42#include <linux/mutex.h> 43#include <linux/mutex.h>
@@ -211,6 +212,15 @@ extern struct sram_channel cx88_sram_channels[];
211#define CX88_BOARD_HAUPPAUGE_HVR1300 56 212#define CX88_BOARD_HAUPPAUGE_HVR1300 56
212#define CX88_BOARD_ADSTECH_PTV_390 57 213#define CX88_BOARD_ADSTECH_PTV_390 57
213#define CX88_BOARD_PINNACLE_PCTV_HD_800i 58 214#define CX88_BOARD_PINNACLE_PCTV_HD_800i 58
215#define CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO 59
216#define CX88_BOARD_PINNACLE_HYBRID_PCTV 60
217#define CX88_BOARD_WINFAST_TV2000_XP_GLOBAL 61
218#define CX88_BOARD_POWERCOLOR_REAL_ANGEL 62
219#define CX88_BOARD_GENIATECH_X8000_MT 63
220#define CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO 64
221#define CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD 65
222#define CX88_BOARD_PROLINK_PV_8000GT 66
223#define CX88_BOARD_KWORLD_ATSC_120 67
214 224
215enum cx88_itype { 225enum cx88_itype {
216 CX88_VMUX_COMPOSITE1 = 1, 226 CX88_VMUX_COMPOSITE1 = 1,
@@ -595,6 +605,7 @@ extern int cx88_tuner_callback(void *dev, int command, int arg);
595extern int cx88_get_resources(const struct cx88_core *core, 605extern int cx88_get_resources(const struct cx88_core *core,
596 struct pci_dev *pci); 606 struct pci_dev *pci);
597extern struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr); 607extern struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr);
608extern void cx88_setup_xc3028(struct cx88_core *core, struct xc2028_ctrl *ctl);
598 609
599/* ----------------------------------------------------------- */ 610/* ----------------------------------------------------------- */
600/* cx88-tvaudio.c */ 611/* cx88-tvaudio.c */
@@ -640,7 +651,8 @@ void cx8802_cancel_buffers(struct cx8802_dev *dev);
640/* ----------------------------------------------------------- */ 651/* ----------------------------------------------------------- */
641/* cx88-video.c*/ 652/* cx88-video.c*/
642extern const u32 cx88_user_ctrls[]; 653extern const u32 cx88_user_ctrls[];
643extern int cx8800_ctrl_query(struct v4l2_queryctrl *qctrl); 654extern int cx8800_ctrl_query(struct cx88_core *core,
655 struct v4l2_queryctrl *qctrl);
644int cx88_enum_input (struct cx88_core *core,struct v4l2_input *i); 656int cx88_enum_input (struct cx88_core *core,struct v4l2_input *i);
645int cx88_set_freq (struct cx88_core *core,struct v4l2_frequency *f); 657int cx88_set_freq (struct cx88_core *core,struct v4l2_frequency *f);
646int cx88_get_control(struct cx88_core *core, struct v4l2_control *ctl); 658int cx88_get_control(struct cx88_core *core, struct v4l2_control *ctl);