diff options
author | Steven Toth <stoth@linuxtv.org> | 2008-10-11 10:05:50 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-10-17 16:23:10 -0400 |
commit | 363c35fc448943c3d6121332d28bcda2d2fbf87c (patch) | |
tree | 739864d237b7fa60bef51bc510fe55c888b606ca /drivers/media/video/cx88 | |
parent | 548da7625c825eccc31b4b3865ae5389c3660486 (diff) |
V4L/DVB (9222): S2API: Add Multiple-frontend on a single adapter support.
A detailed description from the original patches 2 years ago:
"The WinTV-HVR3000 has a single transport bus which is shared between
a DVB-T and DVB-S modulator. These patches build on the bus acquisition
cx88 work from a few weeks ago to add support for this.
So to applications the HVR3000 looks like this:
/dev/dvb/adapter0/fe0 (cx24123 DVB-S demod)
/dev/dvb/adapter0/fe1 (cx22702 DVB-T demod)
Additional boards continue as before, eg:
/dev/dvb/adapter1/fe0 (lgdt3302 ATSC demod)
The basic change is removing the single instance of the videobuf_dvb in
cx8802_dev and saa7134_dev(?) and replacing it with a list and some
supporting functions.
*NOTE* This branch was taken before v4l-dvb was closed for 2.6.19 so
two or three current cx88 patches appear to be reversed by this tree,
this will be cleaned up in the near future. The patches missing change
the mutex handing to core->lock, fix an enumeration problem."
It should be recognised that a number of people have been maintaining
this patchset. Significant levels of Kudos to everyone one involved,
including but not limited to:
Darron Broad
Fabio M. Di Nitto
Carlo Scarfoglio
Hans Werner
Without the work of these people, and countless others, my two year old
patches would of died on the Mercurial linuxtv.org vine a long time
ago.
TODO: Revise these patches a little further so that the need for
demux1 and dvr0 is optional, not mandatory on the HVR3000.
HISTORY (darron):
This is the last update to MFE prepared by Hans which is based
upon the `scratchpad' diff created by Carlo.
All MFE work prior to that point must be attributed to Fabio
who ported and maintained Steve's original patch up to that
time.
Signed-off-by: Steven Toth <stoth@linuxtv.org>
Signed-off-by: Darron Broad <darron@kewl.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx88')
-rw-r--r-- | drivers/media/video/cx88/cx88-cards.c | 11 | ||||
-rw-r--r-- | drivers/media/video/cx88/cx88-dvb.c | 423 | ||||
-rw-r--r-- | drivers/media/video/cx88/cx88-i2c.c | 15 | ||||
-rw-r--r-- | drivers/media/video/cx88/cx88-input.c | 1 | ||||
-rw-r--r-- | drivers/media/video/cx88/cx88-mpeg.c | 22 | ||||
-rw-r--r-- | drivers/media/video/cx88/cx88.h | 4 |
6 files changed, 340 insertions, 136 deletions
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index 5da04e811ca2..638d9ec38d7f 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c | |||
@@ -1291,6 +1291,7 @@ static const struct cx88_board cx88_boards[] = { | |||
1291 | .gpio0 = 0x84bf, | 1291 | .gpio0 = 0x84bf, |
1292 | }}, | 1292 | }}, |
1293 | .mpeg = CX88_MPEG_DVB, | 1293 | .mpeg = CX88_MPEG_DVB, |
1294 | .num_frontends = 2, | ||
1294 | }, | 1295 | }, |
1295 | [CX88_BOARD_NORWOOD_MICRO] = { | 1296 | [CX88_BOARD_NORWOOD_MICRO] = { |
1296 | .name = "Norwood Micro TV Tuner", | 1297 | .name = "Norwood Micro TV Tuner", |
@@ -1761,6 +1762,7 @@ static const struct cx88_board cx88_boards[] = { | |||
1761 | } }, | 1762 | } }, |
1762 | /* fixme: Add radio support */ | 1763 | /* fixme: Add radio support */ |
1763 | .mpeg = CX88_MPEG_DVB, | 1764 | .mpeg = CX88_MPEG_DVB, |
1765 | .num_frontends = 2, | ||
1764 | }, | 1766 | }, |
1765 | [CX88_BOARD_HAUPPAUGE_HVR4000LITE] = { | 1767 | [CX88_BOARD_HAUPPAUGE_HVR4000LITE] = { |
1766 | .name = "Hauppauge WinTV-HVR4000(Lite) DVB-S/S2", | 1768 | .name = "Hauppauge WinTV-HVR4000(Lite) DVB-S/S2", |
@@ -3002,12 +3004,17 @@ struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr) | |||
3002 | cx88_card_list(core, pci); | 3004 | cx88_card_list(core, pci); |
3003 | } | 3005 | } |
3004 | 3006 | ||
3007 | memset(&core->board, 0, sizeof(core->board)); | ||
3005 | memcpy(&core->board, &cx88_boards[core->boardnr], sizeof(core->board)); | 3008 | memcpy(&core->board, &cx88_boards[core->boardnr], sizeof(core->board)); |
3006 | 3009 | ||
3007 | info_printk(core, "subsystem: %04x:%04x, board: %s [card=%d,%s]\n", | 3010 | if (!core->board.num_frontends) |
3011 | core->board.num_frontends=1; | ||
3012 | |||
3013 | info_printk(core, "subsystem: %04x:%04x, board: %s [card=%d,%s], frontend(s): %d\n", | ||
3008 | pci->subsystem_vendor, pci->subsystem_device, core->board.name, | 3014 | pci->subsystem_vendor, pci->subsystem_device, core->board.name, |
3009 | core->boardnr, card[core->nr] == core->boardnr ? | 3015 | core->boardnr, card[core->nr] == core->boardnr ? |
3010 | "insmod option" : "autodetected"); | 3016 | "insmod option" : "autodetected", |
3017 | core->board.num_frontends); | ||
3011 | 3018 | ||
3012 | if (tuner[core->nr] != UNSET) | 3019 | if (tuner[core->nr] != UNSET) |
3013 | core->board.tuner_type = tuner[core->nr]; | 3020 | core->board.tuner_type = tuner[core->nr]; |
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index 344ed2626e59..099de66c72c4 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c | |||
@@ -116,13 +116,24 @@ static int cx88_dvb_bus_ctrl(struct dvb_frontend* fe, int acquire) | |||
116 | struct cx8802_dev *dev= fe->dvb->priv; | 116 | struct cx8802_dev *dev= fe->dvb->priv; |
117 | struct cx8802_driver *drv = NULL; | 117 | struct cx8802_driver *drv = NULL; |
118 | int ret = 0; | 118 | int ret = 0; |
119 | int fe_id; | ||
120 | |||
121 | fe_id = videobuf_dvb_find_frontend(&dev->frontends, fe); | ||
122 | if (!fe_id) { | ||
123 | printk(KERN_ERR "%s() No frontend found\n", __FUNCTION__); | ||
124 | return -EINVAL; | ||
125 | } | ||
126 | |||
119 | 127 | ||
120 | drv = cx8802_get_driver(dev, CX88_MPEG_DVB); | 128 | drv = cx8802_get_driver(dev, CX88_MPEG_DVB); |
121 | if (drv) { | 129 | if (drv) { |
122 | if (acquire) | 130 | if (acquire){ |
131 | dev->frontends.active_fe_id = fe_id; | ||
123 | ret = drv->request_acquire(drv); | 132 | ret = drv->request_acquire(drv); |
124 | else | 133 | } else { |
125 | ret = drv->request_release(drv); | 134 | ret = drv->request_release(drv); |
135 | dev->frontends.active_fe_id = 0; | ||
136 | } | ||
126 | } | 137 | } |
127 | 138 | ||
128 | return ret; | 139 | return ret; |
@@ -396,7 +407,7 @@ static int tevii_dvbs_set_voltage(struct dvb_frontend *fe, | |||
396 | cx_write(MO_GP0_IO, 0x00006060); | 407 | cx_write(MO_GP0_IO, 0x00006060); |
397 | break; | 408 | break; |
398 | case SEC_VOLTAGE_OFF: | 409 | case SEC_VOLTAGE_OFF: |
399 | printk("LNB Voltage SEC_VOLTAGE_off\n"); | 410 | printk("LNB Voltage SEC_VOLTAGE_off\n"); |
400 | break; | 411 | break; |
401 | } | 412 | } |
402 | 413 | ||
@@ -483,6 +494,7 @@ static struct xc5000_config dvico_fusionhdtv7_tuner_config = { | |||
483 | static int attach_xc3028(u8 addr, struct cx8802_dev *dev) | 494 | static int attach_xc3028(u8 addr, struct cx8802_dev *dev) |
484 | { | 495 | { |
485 | struct dvb_frontend *fe; | 496 | struct dvb_frontend *fe; |
497 | struct videobuf_dvb_frontend *fe0 = NULL; | ||
486 | struct xc2028_ctrl ctl; | 498 | struct xc2028_ctrl ctl; |
487 | struct xc2028_config cfg = { | 499 | struct xc2028_config cfg = { |
488 | .i2c_adap = &dev->core->i2c_adap, | 500 | .i2c_adap = &dev->core->i2c_adap, |
@@ -490,7 +502,12 @@ static int attach_xc3028(u8 addr, struct cx8802_dev *dev) | |||
490 | .ctrl = &ctl, | 502 | .ctrl = &ctl, |
491 | }; | 503 | }; |
492 | 504 | ||
493 | if (!dev->dvb.frontend) { | 505 | /* Get the first frontend */ |
506 | fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1); | ||
507 | if (!fe0) | ||
508 | return -EINVAL; | ||
509 | |||
510 | if (!fe0->dvb.frontend) { | ||
494 | printk(KERN_ERR "%s/2: dvb frontend not attached. " | 511 | printk(KERN_ERR "%s/2: dvb frontend not attached. " |
495 | "Can't attach xc3028\n", | 512 | "Can't attach xc3028\n", |
496 | dev->core->name); | 513 | dev->core->name); |
@@ -504,10 +521,13 @@ static int attach_xc3028(u8 addr, struct cx8802_dev *dev) | |||
504 | */ | 521 | */ |
505 | cx88_setup_xc3028(dev->core, &ctl); | 522 | cx88_setup_xc3028(dev->core, &ctl); |
506 | 523 | ||
507 | fe = dvb_attach(xc2028_attach, dev->dvb.frontend, &cfg); | 524 | fe = dvb_attach(xc2028_attach, fe0->dvb.frontend, &cfg); |
508 | if (!fe) { | 525 | if (!fe) { |
509 | printk(KERN_ERR "%s/2: xc3028 attach failed\n", | 526 | printk(KERN_ERR "%s/2: xc3028 attach failed\n", |
510 | dev->core->name); | 527 | dev->core->name); |
528 | dvb_frontend_detach(fe0->dvb.frontend); | ||
529 | dvb_unregister_frontend(fe0->dvb.frontend); | ||
530 | fe0->dvb.frontend = NULL; | ||
511 | return -EINVAL; | 531 | return -EINVAL; |
512 | } | 532 | } |
513 | 533 | ||
@@ -532,8 +552,10 @@ static int cx24116_reset_device(struct dvb_frontend *fe) | |||
532 | struct cx88_core *core = dev->core; | 552 | struct cx88_core *core = dev->core; |
533 | 553 | ||
534 | /* Reset the part */ | 554 | /* Reset the part */ |
555 | /* Put the cx24116 into reset */ | ||
535 | cx_write(MO_SRST_IO, 0); | 556 | cx_write(MO_SRST_IO, 0); |
536 | msleep(10); | 557 | msleep(10); |
558 | /* Take the cx24116 out of reset */ | ||
537 | cx_write(MO_SRST_IO, 1); | 559 | cx_write(MO_SRST_IO, 1); |
538 | msleep(10); | 560 | msleep(10); |
539 | 561 | ||
@@ -573,20 +595,28 @@ static struct stv0288_config tevii_tuner_earda_config = { | |||
573 | 595 | ||
574 | static int dvb_register(struct cx8802_dev *dev) | 596 | static int dvb_register(struct cx8802_dev *dev) |
575 | { | 597 | { |
598 | //struct cx88_core *core = dev->core; | ||
599 | |||
600 | ///* init struct videobuf_dvb */ | ||
601 | //fe->dvb.name = core->name; | ||
602 | //dev->ts_gen_cntrl = 0x0c; | ||
603 | |||
576 | struct cx88_core *core = dev->core; | 604 | struct cx88_core *core = dev->core; |
605 | struct videobuf_dvb_frontend *fe0, *fe1 = NULL; | ||
577 | 606 | ||
578 | /* init struct videobuf_dvb */ | 607 | /* Get the first frontend */ |
579 | dev->dvb.name = core->name; | 608 | fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1); |
580 | dev->ts_gen_cntrl = 0x0c; | 609 | if (!fe0) |
610 | return -EINVAL; | ||
581 | 611 | ||
582 | /* init frontend */ | 612 | /* init frontend */ |
583 | switch (core->boardnr) { | 613 | switch (core->boardnr) { |
584 | case CX88_BOARD_HAUPPAUGE_DVB_T1: | 614 | case CX88_BOARD_HAUPPAUGE_DVB_T1: |
585 | dev->dvb.frontend = dvb_attach(cx22702_attach, | 615 | fe0->dvb.frontend = dvb_attach(cx22702_attach, |
586 | &connexant_refboard_config, | 616 | &connexant_refboard_config, |
587 | &core->i2c_adap); | 617 | &core->i2c_adap); |
588 | if (dev->dvb.frontend != NULL) { | 618 | if (fe0->dvb.frontend != NULL) { |
589 | if (!dvb_attach(dvb_pll_attach, dev->dvb.frontend, | 619 | if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend, |
590 | 0x61, &core->i2c_adap, | 620 | 0x61, &core->i2c_adap, |
591 | DVB_PLL_THOMSON_DTT759X)) | 621 | DVB_PLL_THOMSON_DTT759X)) |
592 | goto frontend_detach; | 622 | goto frontend_detach; |
@@ -596,11 +626,11 @@ static int dvb_register(struct cx8802_dev *dev) | |||
596 | case CX88_BOARD_CONEXANT_DVB_T1: | 626 | case CX88_BOARD_CONEXANT_DVB_T1: |
597 | case CX88_BOARD_KWORLD_DVB_T_CX22702: | 627 | case CX88_BOARD_KWORLD_DVB_T_CX22702: |
598 | case CX88_BOARD_WINFAST_DTV1000: | 628 | case CX88_BOARD_WINFAST_DTV1000: |
599 | dev->dvb.frontend = dvb_attach(cx22702_attach, | 629 | fe0->dvb.frontend = dvb_attach(cx22702_attach, |
600 | &connexant_refboard_config, | 630 | &connexant_refboard_config, |
601 | &core->i2c_adap); | 631 | &core->i2c_adap); |
602 | if (dev->dvb.frontend != NULL) { | 632 | if (fe0->dvb.frontend != NULL) { |
603 | if (!dvb_attach(dvb_pll_attach, dev->dvb.frontend, | 633 | if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend, |
604 | 0x60, &core->i2c_adap, | 634 | 0x60, &core->i2c_adap, |
605 | DVB_PLL_THOMSON_DTT7579)) | 635 | DVB_PLL_THOMSON_DTT7579)) |
606 | goto frontend_detach; | 636 | goto frontend_detach; |
@@ -610,33 +640,65 @@ static int dvb_register(struct cx8802_dev *dev) | |||
610 | case CX88_BOARD_HAUPPAUGE_HVR1100: | 640 | case CX88_BOARD_HAUPPAUGE_HVR1100: |
611 | case CX88_BOARD_HAUPPAUGE_HVR1100LP: | 641 | case CX88_BOARD_HAUPPAUGE_HVR1100LP: |
612 | case CX88_BOARD_HAUPPAUGE_HVR1300: | 642 | case CX88_BOARD_HAUPPAUGE_HVR1300: |
613 | case CX88_BOARD_HAUPPAUGE_HVR3000: | 643 | fe0->dvb.frontend = dvb_attach(cx22702_attach, |
614 | dev->dvb.frontend = dvb_attach(cx22702_attach, | ||
615 | &hauppauge_hvr_config, | 644 | &hauppauge_hvr_config, |
616 | &core->i2c_adap); | 645 | &core->i2c_adap); |
617 | if (dev->dvb.frontend != NULL) { | 646 | if (fe0->dvb.frontend != NULL) { |
618 | if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend, | 647 | if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
619 | &core->i2c_adap, 0x61, | 648 | &core->i2c_adap, 0x61, |
620 | TUNER_PHILIPS_FMD1216ME_MK3)) | 649 | TUNER_PHILIPS_FMD1216ME_MK3)) |
621 | goto frontend_detach; | 650 | goto frontend_detach; |
622 | } | 651 | } |
623 | break; | 652 | break; |
653 | case CX88_BOARD_HAUPPAUGE_HVR3000: | ||
654 | /* DVB-S init */ | ||
655 | fe0->dvb.frontend = dvb_attach(cx24123_attach, | ||
656 | &hauppauge_novas_config, | ||
657 | &dev->core->i2c_adap); | ||
658 | if (fe0->dvb.frontend) { | ||
659 | if (!dvb_attach(isl6421_attach, fe0->dvb.frontend, | ||
660 | &dev->core->i2c_adap, 0x08, ISL6421_DCL, 0x00)) { | ||
661 | dprintk( 1, "%s(): HVR3000 - DVB-S LNB Init: failed\n", __FUNCTION__); | ||
662 | } | ||
663 | } else { | ||
664 | dprintk( 1, "%s(): HVR3000 - DVB-S Init: failed\n", __FUNCTION__); | ||
665 | } | ||
666 | /* DVB-T init */ | ||
667 | fe1 = videobuf_dvb_get_frontend(&dev->frontends, 2); | ||
668 | if (fe1) { | ||
669 | fe1->dvb.frontend = dvb_attach(cx22702_attach, | ||
670 | &hauppauge_hvr_config, | ||
671 | &dev->core->i2c_adap); | ||
672 | if (fe1->dvb.frontend) { | ||
673 | fe1->dvb.frontend->id = 1; | ||
674 | if(!dvb_attach(simple_tuner_attach, fe1->dvb.frontend, | ||
675 | &dev->core->i2c_adap, 0x61, | ||
676 | TUNER_PHILIPS_FMD1216ME_MK3)) { | ||
677 | dprintk( 1, "%s(): HVR3000 - DVB-T misc Init: failed\n", __FUNCTION__); | ||
678 | } | ||
679 | } else { | ||
680 | dprintk( 1, "%s(): HVR3000 - DVB-T Init: failed\n", __FUNCTION__); | ||
681 | } | ||
682 | } else { | ||
683 | dprintk( 1, "%s(): HVR3000 - DVB-T Init: can't find frontend 2.\n", __FUNCTION__); | ||
684 | } | ||
685 | break; | ||
624 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS: | 686 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS: |
625 | dev->dvb.frontend = dvb_attach(mt352_attach, | 687 | fe0->dvb.frontend = dvb_attach(mt352_attach, |
626 | &dvico_fusionhdtv, | 688 | &dvico_fusionhdtv, |
627 | &core->i2c_adap); | 689 | &core->i2c_adap); |
628 | if (dev->dvb.frontend != NULL) { | 690 | if (fe0->dvb.frontend != NULL) { |
629 | if (!dvb_attach(dvb_pll_attach, dev->dvb.frontend, | 691 | if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend, |
630 | 0x60, NULL, DVB_PLL_THOMSON_DTT7579)) | 692 | 0x60, NULL, DVB_PLL_THOMSON_DTT7579)) |
631 | goto frontend_detach; | 693 | goto frontend_detach; |
632 | break; | 694 | break; |
633 | } | 695 | } |
634 | /* ZL10353 replaces MT352 on later cards */ | 696 | /* ZL10353 replaces MT352 on later cards */ |
635 | dev->dvb.frontend = dvb_attach(zl10353_attach, | 697 | fe0->dvb.frontend = dvb_attach(zl10353_attach, |
636 | &dvico_fusionhdtv_plus_v1_1, | 698 | &dvico_fusionhdtv_plus_v1_1, |
637 | &core->i2c_adap); | 699 | &core->i2c_adap); |
638 | if (dev->dvb.frontend != NULL) { | 700 | if (fe0->dvb.frontend != NULL) { |
639 | if (!dvb_attach(dvb_pll_attach, dev->dvb.frontend, | 701 | if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend, |
640 | 0x60, NULL, DVB_PLL_THOMSON_DTT7579)) | 702 | 0x60, NULL, DVB_PLL_THOMSON_DTT7579)) |
641 | goto frontend_detach; | 703 | goto frontend_detach; |
642 | } | 704 | } |
@@ -644,31 +706,31 @@ static int dvb_register(struct cx8802_dev *dev) | |||
644 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL: | 706 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL: |
645 | /* The tin box says DEE1601, but it seems to be DTT7579 | 707 | /* The tin box says DEE1601, but it seems to be DTT7579 |
646 | * compatible, with a slightly different MT352 AGC gain. */ | 708 | * compatible, with a slightly different MT352 AGC gain. */ |
647 | dev->dvb.frontend = dvb_attach(mt352_attach, | 709 | fe0->dvb.frontend = dvb_attach(mt352_attach, |
648 | &dvico_fusionhdtv_dual, | 710 | &dvico_fusionhdtv_dual, |
649 | &core->i2c_adap); | 711 | &core->i2c_adap); |
650 | if (dev->dvb.frontend != NULL) { | 712 | if (fe0->dvb.frontend != NULL) { |
651 | if (!dvb_attach(dvb_pll_attach, dev->dvb.frontend, | 713 | if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend, |
652 | 0x61, NULL, DVB_PLL_THOMSON_DTT7579)) | 714 | 0x61, NULL, DVB_PLL_THOMSON_DTT7579)) |
653 | goto frontend_detach; | 715 | goto frontend_detach; |
654 | break; | 716 | break; |
655 | } | 717 | } |
656 | /* ZL10353 replaces MT352 on later cards */ | 718 | /* ZL10353 replaces MT352 on later cards */ |
657 | dev->dvb.frontend = dvb_attach(zl10353_attach, | 719 | fe0->dvb.frontend = dvb_attach(zl10353_attach, |
658 | &dvico_fusionhdtv_plus_v1_1, | 720 | &dvico_fusionhdtv_plus_v1_1, |
659 | &core->i2c_adap); | 721 | &core->i2c_adap); |
660 | if (dev->dvb.frontend != NULL) { | 722 | if (fe0->dvb.frontend != NULL) { |
661 | if (!dvb_attach(dvb_pll_attach, dev->dvb.frontend, | 723 | if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend, |
662 | 0x61, NULL, DVB_PLL_THOMSON_DTT7579)) | 724 | 0x61, NULL, DVB_PLL_THOMSON_DTT7579)) |
663 | goto frontend_detach; | 725 | goto frontend_detach; |
664 | } | 726 | } |
665 | break; | 727 | break; |
666 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1: | 728 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1: |
667 | dev->dvb.frontend = dvb_attach(mt352_attach, | 729 | fe0->dvb.frontend = dvb_attach(mt352_attach, |
668 | &dvico_fusionhdtv, | 730 | &dvico_fusionhdtv, |
669 | &core->i2c_adap); | 731 | &core->i2c_adap); |
670 | if (dev->dvb.frontend != NULL) { | 732 | if (fe0->dvb.frontend != NULL) { |
671 | if (!dvb_attach(dvb_pll_attach, dev->dvb.frontend, | 733 | if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend, |
672 | 0x61, NULL, DVB_PLL_LG_Z201)) | 734 | 0x61, NULL, DVB_PLL_LG_Z201)) |
673 | goto frontend_detach; | 735 | goto frontend_detach; |
674 | } | 736 | } |
@@ -676,11 +738,11 @@ static int dvb_register(struct cx8802_dev *dev) | |||
676 | case CX88_BOARD_KWORLD_DVB_T: | 738 | case CX88_BOARD_KWORLD_DVB_T: |
677 | case CX88_BOARD_DNTV_LIVE_DVB_T: | 739 | case CX88_BOARD_DNTV_LIVE_DVB_T: |
678 | case CX88_BOARD_ADSTECH_DVB_T_PCI: | 740 | case CX88_BOARD_ADSTECH_DVB_T_PCI: |
679 | dev->dvb.frontend = dvb_attach(mt352_attach, | 741 | fe0->dvb.frontend = dvb_attach(mt352_attach, |
680 | &dntv_live_dvbt_config, | 742 | &dntv_live_dvbt_config, |
681 | &core->i2c_adap); | 743 | &core->i2c_adap); |
682 | if (dev->dvb.frontend != NULL) { | 744 | if (fe0->dvb.frontend != NULL) { |
683 | if (!dvb_attach(dvb_pll_attach, dev->dvb.frontend, | 745 | if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend, |
684 | 0x61, NULL, DVB_PLL_UNKNOWN_1)) | 746 | 0x61, NULL, DVB_PLL_UNKNOWN_1)) |
685 | goto frontend_detach; | 747 | goto frontend_detach; |
686 | } | 748 | } |
@@ -688,10 +750,10 @@ static int dvb_register(struct cx8802_dev *dev) | |||
688 | case CX88_BOARD_DNTV_LIVE_DVB_T_PRO: | 750 | case CX88_BOARD_DNTV_LIVE_DVB_T_PRO: |
689 | #if defined(CONFIG_VIDEO_CX88_VP3054) || (defined(CONFIG_VIDEO_CX88_VP3054_MODULE) && defined(MODULE)) | 751 | #if defined(CONFIG_VIDEO_CX88_VP3054) || (defined(CONFIG_VIDEO_CX88_VP3054_MODULE) && defined(MODULE)) |
690 | /* MT352 is on a secondary I2C bus made from some GPIO lines */ | 752 | /* MT352 is on a secondary I2C bus made from some GPIO lines */ |
691 | dev->dvb.frontend = dvb_attach(mt352_attach, &dntv_live_dvbt_pro_config, | 753 | fe0->dvb.frontend = dvb_attach(mt352_attach, &dntv_live_dvbt_pro_config, |
692 | &dev->vp3054->adap); | 754 | &dev->vp3054->adap); |
693 | if (dev->dvb.frontend != NULL) { | 755 | if (fe0->dvb.frontend != NULL) { |
694 | if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend, | 756 | if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
695 | &core->i2c_adap, 0x61, | 757 | &core->i2c_adap, 0x61, |
696 | TUNER_PHILIPS_FMD1216ME_MK3)) | 758 | TUNER_PHILIPS_FMD1216ME_MK3)) |
697 | goto frontend_detach; | 759 | goto frontend_detach; |
@@ -702,22 +764,22 @@ static int dvb_register(struct cx8802_dev *dev) | |||
702 | #endif | 764 | #endif |
703 | break; | 765 | break; |
704 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID: | 766 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID: |
705 | dev->dvb.frontend = dvb_attach(zl10353_attach, | 767 | fe0->dvb.frontend = dvb_attach(zl10353_attach, |
706 | &dvico_fusionhdtv_hybrid, | 768 | &dvico_fusionhdtv_hybrid, |
707 | &core->i2c_adap); | 769 | &core->i2c_adap); |
708 | if (dev->dvb.frontend != NULL) { | 770 | if (fe0->dvb.frontend != NULL) { |
709 | if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend, | 771 | if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
710 | &core->i2c_adap, 0x61, | 772 | &core->i2c_adap, 0x61, |
711 | TUNER_THOMSON_FE6600)) | 773 | TUNER_THOMSON_FE6600)) |
712 | goto frontend_detach; | 774 | goto frontend_detach; |
713 | } | 775 | } |
714 | break; | 776 | break; |
715 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO: | 777 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO: |
716 | dev->dvb.frontend = dvb_attach(zl10353_attach, | 778 | fe0->dvb.frontend = dvb_attach(zl10353_attach, |
717 | &dvico_fusionhdtv_xc3028, | 779 | &dvico_fusionhdtv_xc3028, |
718 | &core->i2c_adap); | 780 | &core->i2c_adap); |
719 | if (dev->dvb.frontend == NULL) | 781 | if (fe0->dvb.frontend == NULL) |
720 | dev->dvb.frontend = dvb_attach(mt352_attach, | 782 | fe0->dvb.frontend = dvb_attach(mt352_attach, |
721 | &dvico_fusionhdtv_mt352_xc3028, | 783 | &dvico_fusionhdtv_mt352_xc3028, |
722 | &core->i2c_adap); | 784 | &core->i2c_adap); |
723 | /* | 785 | /* |
@@ -725,16 +787,16 @@ static int dvb_register(struct cx8802_dev *dev) | |||
725 | * We must not permit gate_ctrl to be performed, or | 787 | * We must not permit gate_ctrl to be performed, or |
726 | * the xc3028 cannot communicate on the bus. | 788 | * the xc3028 cannot communicate on the bus. |
727 | */ | 789 | */ |
728 | if (dev->dvb.frontend) | 790 | if (fe0->dvb.frontend) |
729 | dev->dvb.frontend->ops.i2c_gate_ctrl = NULL; | 791 | fe0->dvb.frontend->ops.i2c_gate_ctrl = NULL; |
730 | if (attach_xc3028(0x61, dev) < 0) | 792 | if (attach_xc3028(0x61, dev) < 0) |
731 | return -EINVAL; | 793 | return -EINVAL; |
732 | break; | 794 | break; |
733 | case CX88_BOARD_PCHDTV_HD3000: | 795 | case CX88_BOARD_PCHDTV_HD3000: |
734 | dev->dvb.frontend = dvb_attach(or51132_attach, &pchdtv_hd3000, | 796 | fe0->dvb.frontend = dvb_attach(or51132_attach, &pchdtv_hd3000, |
735 | &core->i2c_adap); | 797 | &core->i2c_adap); |
736 | if (dev->dvb.frontend != NULL) { | 798 | if (fe0->dvb.frontend != NULL) { |
737 | if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend, | 799 | if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
738 | &core->i2c_adap, 0x61, | 800 | &core->i2c_adap, 0x61, |
739 | TUNER_THOMSON_DTT761X)) | 801 | TUNER_THOMSON_DTT761X)) |
740 | goto frontend_detach; | 802 | goto frontend_detach; |
@@ -751,11 +813,11 @@ static int dvb_register(struct cx8802_dev *dev) | |||
751 | 813 | ||
752 | /* Select RF connector callback */ | 814 | /* Select RF connector callback */ |
753 | fusionhdtv_3_gold.pll_rf_set = lgdt330x_pll_rf_set; | 815 | fusionhdtv_3_gold.pll_rf_set = lgdt330x_pll_rf_set; |
754 | dev->dvb.frontend = dvb_attach(lgdt330x_attach, | 816 | fe0->dvb.frontend = dvb_attach(lgdt330x_attach, |
755 | &fusionhdtv_3_gold, | 817 | &fusionhdtv_3_gold, |
756 | &core->i2c_adap); | 818 | &core->i2c_adap); |
757 | if (dev->dvb.frontend != NULL) { | 819 | if (fe0->dvb.frontend != NULL) { |
758 | if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend, | 820 | if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
759 | &core->i2c_adap, 0x61, | 821 | &core->i2c_adap, 0x61, |
760 | TUNER_MICROTUNE_4042FI5)) | 822 | TUNER_MICROTUNE_4042FI5)) |
761 | goto frontend_detach; | 823 | goto frontend_detach; |
@@ -769,11 +831,11 @@ static int dvb_register(struct cx8802_dev *dev) | |||
769 | mdelay(100); | 831 | mdelay(100); |
770 | cx_set(MO_GP0_IO, 9); | 832 | cx_set(MO_GP0_IO, 9); |
771 | mdelay(200); | 833 | mdelay(200); |
772 | dev->dvb.frontend = dvb_attach(lgdt330x_attach, | 834 | fe0->dvb.frontend = dvb_attach(lgdt330x_attach, |
773 | &fusionhdtv_3_gold, | 835 | &fusionhdtv_3_gold, |
774 | &core->i2c_adap); | 836 | &core->i2c_adap); |
775 | if (dev->dvb.frontend != NULL) { | 837 | if (fe0->dvb.frontend != NULL) { |
776 | if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend, | 838 | if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
777 | &core->i2c_adap, 0x61, | 839 | &core->i2c_adap, 0x61, |
778 | TUNER_THOMSON_DTT761X)) | 840 | TUNER_THOMSON_DTT761X)) |
779 | goto frontend_detach; | 841 | goto frontend_detach; |
@@ -787,15 +849,15 @@ static int dvb_register(struct cx8802_dev *dev) | |||
787 | mdelay(100); | 849 | mdelay(100); |
788 | cx_set(MO_GP0_IO, 1); | 850 | cx_set(MO_GP0_IO, 1); |
789 | mdelay(200); | 851 | mdelay(200); |
790 | dev->dvb.frontend = dvb_attach(lgdt330x_attach, | 852 | fe0->dvb.frontend = dvb_attach(lgdt330x_attach, |
791 | &fusionhdtv_5_gold, | 853 | &fusionhdtv_5_gold, |
792 | &core->i2c_adap); | 854 | &core->i2c_adap); |
793 | if (dev->dvb.frontend != NULL) { | 855 | if (fe0->dvb.frontend != NULL) { |
794 | if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend, | 856 | if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
795 | &core->i2c_adap, 0x61, | 857 | &core->i2c_adap, 0x61, |
796 | TUNER_LG_TDVS_H06XF)) | 858 | TUNER_LG_TDVS_H06XF)) |
797 | goto frontend_detach; | 859 | goto frontend_detach; |
798 | if (!dvb_attach(tda9887_attach, dev->dvb.frontend, | 860 | if (!dvb_attach(tda9887_attach, fe0->dvb.frontend, |
799 | &core->i2c_adap, 0x43)) | 861 | &core->i2c_adap, 0x43)) |
800 | goto frontend_detach; | 862 | goto frontend_detach; |
801 | } | 863 | } |
@@ -808,25 +870,25 @@ static int dvb_register(struct cx8802_dev *dev) | |||
808 | mdelay(100); | 870 | mdelay(100); |
809 | cx_set(MO_GP0_IO, 1); | 871 | cx_set(MO_GP0_IO, 1); |
810 | mdelay(200); | 872 | mdelay(200); |
811 | dev->dvb.frontend = dvb_attach(lgdt330x_attach, | 873 | fe0->dvb.frontend = dvb_attach(lgdt330x_attach, |
812 | &pchdtv_hd5500, | 874 | &pchdtv_hd5500, |
813 | &core->i2c_adap); | 875 | &core->i2c_adap); |
814 | if (dev->dvb.frontend != NULL) { | 876 | if (fe0->dvb.frontend != NULL) { |
815 | if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend, | 877 | if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
816 | &core->i2c_adap, 0x61, | 878 | &core->i2c_adap, 0x61, |
817 | TUNER_LG_TDVS_H06XF)) | 879 | TUNER_LG_TDVS_H06XF)) |
818 | goto frontend_detach; | 880 | goto frontend_detach; |
819 | if (!dvb_attach(tda9887_attach, dev->dvb.frontend, | 881 | if (!dvb_attach(tda9887_attach, fe0->dvb.frontend, |
820 | &core->i2c_adap, 0x43)) | 882 | &core->i2c_adap, 0x43)) |
821 | goto frontend_detach; | 883 | goto frontend_detach; |
822 | } | 884 | } |
823 | break; | 885 | break; |
824 | case CX88_BOARD_ATI_HDTVWONDER: | 886 | case CX88_BOARD_ATI_HDTVWONDER: |
825 | dev->dvb.frontend = dvb_attach(nxt200x_attach, | 887 | fe0->dvb.frontend = dvb_attach(nxt200x_attach, |
826 | &ati_hdtvwonder, | 888 | &ati_hdtvwonder, |
827 | &core->i2c_adap); | 889 | &core->i2c_adap); |
828 | if (dev->dvb.frontend != NULL) { | 890 | if (fe0->dvb.frontend != NULL) { |
829 | if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend, | 891 | if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
830 | &core->i2c_adap, 0x61, | 892 | &core->i2c_adap, 0x61, |
831 | TUNER_PHILIPS_TUV1236D)) | 893 | TUNER_PHILIPS_TUV1236D)) |
832 | goto frontend_detach; | 894 | goto frontend_detach; |
@@ -834,49 +896,49 @@ static int dvb_register(struct cx8802_dev *dev) | |||
834 | break; | 896 | break; |
835 | case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1: | 897 | case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1: |
836 | case CX88_BOARD_HAUPPAUGE_NOVASE2_S1: | 898 | case CX88_BOARD_HAUPPAUGE_NOVASE2_S1: |
837 | dev->dvb.frontend = dvb_attach(cx24123_attach, | 899 | fe0->dvb.frontend = dvb_attach(cx24123_attach, |
838 | &hauppauge_novas_config, | 900 | &hauppauge_novas_config, |
839 | &core->i2c_adap); | 901 | &core->i2c_adap); |
840 | if (dev->dvb.frontend) { | 902 | if (fe0->dvb.frontend) { |
841 | if (!dvb_attach(isl6421_attach, dev->dvb.frontend, | 903 | if (!dvb_attach(isl6421_attach, fe0->dvb.frontend, |
842 | &core->i2c_adap, 0x08, ISL6421_DCL, 0x00)) | 904 | &core->i2c_adap, 0x08, ISL6421_DCL, 0x00)) |
843 | goto frontend_detach; | 905 | goto frontend_detach; |
844 | } | 906 | } |
845 | break; | 907 | break; |
846 | case CX88_BOARD_KWORLD_DVBS_100: | 908 | case CX88_BOARD_KWORLD_DVBS_100: |
847 | dev->dvb.frontend = dvb_attach(cx24123_attach, | 909 | fe0->dvb.frontend = dvb_attach(cx24123_attach, |
848 | &kworld_dvbs_100_config, | 910 | &kworld_dvbs_100_config, |
849 | &core->i2c_adap); | 911 | &core->i2c_adap); |
850 | if (dev->dvb.frontend) { | 912 | if (fe0->dvb.frontend) { |
851 | core->prev_set_voltage = dev->dvb.frontend->ops.set_voltage; | 913 | core->prev_set_voltage = fe0->dvb.frontend->ops.set_voltage; |
852 | dev->dvb.frontend->ops.set_voltage = kworld_dvbs_100_set_voltage; | 914 | fe0->dvb.frontend->ops.set_voltage = kworld_dvbs_100_set_voltage; |
853 | } | 915 | } |
854 | break; | 916 | break; |
855 | case CX88_BOARD_GENIATECH_DVBS: | 917 | case CX88_BOARD_GENIATECH_DVBS: |
856 | dev->dvb.frontend = dvb_attach(cx24123_attach, | 918 | fe0->dvb.frontend = dvb_attach(cx24123_attach, |
857 | &geniatech_dvbs_config, | 919 | &geniatech_dvbs_config, |
858 | &core->i2c_adap); | 920 | &core->i2c_adap); |
859 | if (dev->dvb.frontend) { | 921 | if (fe0->dvb.frontend) { |
860 | core->prev_set_voltage = dev->dvb.frontend->ops.set_voltage; | 922 | core->prev_set_voltage = fe0->dvb.frontend->ops.set_voltage; |
861 | dev->dvb.frontend->ops.set_voltage = geniatech_dvbs_set_voltage; | 923 | fe0->dvb.frontend->ops.set_voltage = geniatech_dvbs_set_voltage; |
862 | } | 924 | } |
863 | break; | 925 | break; |
864 | case CX88_BOARD_PINNACLE_PCTV_HD_800i: | 926 | case CX88_BOARD_PINNACLE_PCTV_HD_800i: |
865 | dev->dvb.frontend = dvb_attach(s5h1409_attach, | 927 | fe0->dvb.frontend = dvb_attach(s5h1409_attach, |
866 | &pinnacle_pctv_hd_800i_config, | 928 | &pinnacle_pctv_hd_800i_config, |
867 | &core->i2c_adap); | 929 | &core->i2c_adap); |
868 | if (dev->dvb.frontend != NULL) { | 930 | if (fe0->dvb.frontend != NULL) { |
869 | if (!dvb_attach(xc5000_attach, dev->dvb.frontend, | 931 | if (!dvb_attach(xc5000_attach, fe0->dvb.frontend, |
870 | &core->i2c_adap, | 932 | &core->i2c_adap, |
871 | &pinnacle_pctv_hd_800i_tuner_config)) | 933 | &pinnacle_pctv_hd_800i_tuner_config)) |
872 | goto frontend_detach; | 934 | goto frontend_detach; |
873 | } | 935 | } |
874 | break; | 936 | break; |
875 | case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO: | 937 | case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO: |
876 | dev->dvb.frontend = dvb_attach(s5h1409_attach, | 938 | fe0->dvb.frontend = dvb_attach(s5h1409_attach, |
877 | &dvico_hdtv5_pci_nano_config, | 939 | &dvico_hdtv5_pci_nano_config, |
878 | &core->i2c_adap); | 940 | &core->i2c_adap); |
879 | if (dev->dvb.frontend != NULL) { | 941 | if (fe0->dvb.frontend != NULL) { |
880 | struct dvb_frontend *fe; | 942 | struct dvb_frontend *fe; |
881 | struct xc2028_config cfg = { | 943 | struct xc2028_config cfg = { |
882 | .i2c_adap = &core->i2c_adap, | 944 | .i2c_adap = &core->i2c_adap, |
@@ -889,17 +951,17 @@ static int dvb_register(struct cx8802_dev *dev) | |||
889 | }; | 951 | }; |
890 | 952 | ||
891 | fe = dvb_attach(xc2028_attach, | 953 | fe = dvb_attach(xc2028_attach, |
892 | dev->dvb.frontend, &cfg); | 954 | fe0->dvb.frontend, &cfg); |
893 | if (fe != NULL && fe->ops.tuner_ops.set_config != NULL) | 955 | if (fe != NULL && fe->ops.tuner_ops.set_config != NULL) |
894 | fe->ops.tuner_ops.set_config(fe, &ctl); | 956 | fe->ops.tuner_ops.set_config(fe, &ctl); |
895 | } | 957 | } |
896 | break; | 958 | break; |
897 | case CX88_BOARD_PINNACLE_HYBRID_PCTV: | 959 | case CX88_BOARD_PINNACLE_HYBRID_PCTV: |
898 | dev->dvb.frontend = dvb_attach(zl10353_attach, | 960 | fe0->dvb.frontend = dvb_attach(zl10353_attach, |
899 | &cx88_pinnacle_hybrid_pctv, | 961 | &cx88_pinnacle_hybrid_pctv, |
900 | &core->i2c_adap); | 962 | &core->i2c_adap); |
901 | if (dev->dvb.frontend) { | 963 | if (fe0->dvb.frontend) { |
902 | dev->dvb.frontend->ops.i2c_gate_ctrl = NULL; | 964 | fe0->dvb.frontend->ops.i2c_gate_ctrl = NULL; |
903 | if (attach_xc3028(0x61, dev) < 0) | 965 | if (attach_xc3028(0x61, dev) < 0) |
904 | goto frontend_detach; | 966 | goto frontend_detach; |
905 | } | 967 | } |
@@ -907,85 +969,116 @@ static int dvb_register(struct cx8802_dev *dev) | |||
907 | case CX88_BOARD_GENIATECH_X8000_MT: | 969 | case CX88_BOARD_GENIATECH_X8000_MT: |
908 | dev->ts_gen_cntrl = 0x00; | 970 | dev->ts_gen_cntrl = 0x00; |
909 | 971 | ||
910 | dev->dvb.frontend = dvb_attach(zl10353_attach, | 972 | fe0->dvb.frontend = dvb_attach(zl10353_attach, |
911 | &cx88_geniatech_x8000_mt, | 973 | &cx88_geniatech_x8000_mt, |
912 | &core->i2c_adap); | 974 | &core->i2c_adap); |
913 | if (attach_xc3028(0x61, dev) < 0) | 975 | if (attach_xc3028(0x61, dev) < 0) |
914 | goto frontend_detach; | 976 | goto frontend_detach; |
915 | break; | 977 | break; |
916 | case CX88_BOARD_KWORLD_ATSC_120: | 978 | case CX88_BOARD_KWORLD_ATSC_120: |
917 | dev->dvb.frontend = dvb_attach(s5h1409_attach, | 979 | fe0->dvb.frontend = dvb_attach(s5h1409_attach, |
918 | &kworld_atsc_120_config, | 980 | &kworld_atsc_120_config, |
919 | &core->i2c_adap); | 981 | &core->i2c_adap); |
920 | if (attach_xc3028(0x61, dev) < 0) | 982 | if (attach_xc3028(0x61, dev) < 0) |
921 | goto frontend_detach; | 983 | goto frontend_detach; |
922 | break; | 984 | break; |
923 | case CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD: | 985 | case CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD: |
924 | dev->dvb.frontend = dvb_attach(s5h1411_attach, | 986 | fe0->dvb.frontend = dvb_attach(s5h1411_attach, |
925 | &dvico_fusionhdtv7_config, | 987 | &dvico_fusionhdtv7_config, |
926 | &core->i2c_adap); | 988 | &core->i2c_adap); |
927 | if (dev->dvb.frontend != NULL) { | 989 | if (fe0->dvb.frontend != NULL) { |
928 | if (!dvb_attach(xc5000_attach, dev->dvb.frontend, | 990 | if (!dvb_attach(xc5000_attach, fe0->dvb.frontend, |
929 | &core->i2c_adap, | 991 | &core->i2c_adap, |
930 | &dvico_fusionhdtv7_tuner_config)) | 992 | &dvico_fusionhdtv7_tuner_config)) |
931 | goto frontend_detach; | 993 | goto frontend_detach; |
932 | } | 994 | } |
933 | break; | 995 | break; |
934 | case CX88_BOARD_HAUPPAUGE_HVR4000: | 996 | case CX88_BOARD_HAUPPAUGE_HVR4000: |
997 | /* DVB-S/S2 Init */ | ||
998 | fe0->dvb.frontend = dvb_attach(cx24116_attach, | ||
999 | &hauppauge_hvr4000_config, | ||
1000 | &dev->core->i2c_adap); | ||
1001 | if (fe0->dvb.frontend) { | ||
1002 | if(!dvb_attach(isl6421_attach, fe0->dvb.frontend, | ||
1003 | &dev->core->i2c_adap, 0x08, ISL6421_DCL, 0x00)) { | ||
1004 | dprintk( 1, "%s(): HVR4000 - DVB-S LNB Init: failed\n", __FUNCTION__); | ||
1005 | } | ||
1006 | } else { | ||
1007 | dprintk( 1, "%s(): HVR4000 - DVB-S Init: failed\n", __FUNCTION__); | ||
1008 | } | ||
1009 | /* DVB-T Init */ | ||
1010 | fe1 = videobuf_dvb_get_frontend(&dev->frontends, 2); | ||
1011 | if (fe1) { | ||
1012 | fe1->dvb.frontend = dvb_attach(cx22702_attach, | ||
1013 | &hauppauge_hvr_config, | ||
1014 | &dev->core->i2c_adap); | ||
1015 | if (fe1->dvb.frontend) { | ||
1016 | fe1->dvb.frontend->id = 1; | ||
1017 | if(!dvb_attach(simple_tuner_attach, fe1->dvb.frontend, | ||
1018 | &dev->core->i2c_adap, 0x61, | ||
1019 | TUNER_PHILIPS_FMD1216ME_MK3)) { | ||
1020 | dprintk( 1, "%s(): HVR4000 - DVB-T misc Init: failed\n", __FUNCTION__); | ||
1021 | } | ||
1022 | } else { | ||
1023 | dprintk( 1, "%s(): HVR4000 - DVB-T Init: failed\n", __FUNCTION__); | ||
1024 | } | ||
1025 | } else { | ||
1026 | dprintk( 1, "%s(): HVR4000 - DVB-T Init: can't find frontend 2.\n", __FUNCTION__); | ||
1027 | } | ||
1028 | break; | ||
935 | case CX88_BOARD_HAUPPAUGE_HVR4000LITE: | 1029 | case CX88_BOARD_HAUPPAUGE_HVR4000LITE: |
936 | /* Support for DVB-S only, not DVB-T support */ | 1030 | fe0->dvb.frontend = dvb_attach(cx24116_attach, |
937 | dev->dvb.frontend = dvb_attach(cx24116_attach, | ||
938 | &hauppauge_hvr4000_config, | 1031 | &hauppauge_hvr4000_config, |
939 | &dev->core->i2c_adap); | 1032 | &dev->core->i2c_adap); |
940 | if (dev->dvb.frontend) { | 1033 | if (fe0->dvb.frontend) { |
941 | dvb_attach(isl6421_attach, dev->dvb.frontend, | 1034 | dvb_attach(isl6421_attach, fe0->dvb.frontend, |
942 | &dev->core->i2c_adap, | 1035 | &dev->core->i2c_adap, |
943 | 0x08, ISL6421_DCL, 0x00); | 1036 | 0x08, ISL6421_DCL, 0x00); |
944 | } | 1037 | } |
945 | break; | 1038 | break; |
946 | case CX88_BOARD_TEVII_S420: | 1039 | case CX88_BOARD_TEVII_S420: |
947 | dev->dvb.frontend = dvb_attach(stv0299_attach, | 1040 | fe0->dvb.frontend = dvb_attach(stv0299_attach, |
948 | &tevii_tuner_sharp_config, | 1041 | &tevii_tuner_sharp_config, |
949 | &core->i2c_adap); | 1042 | &core->i2c_adap); |
950 | if (dev->dvb.frontend != NULL) { | 1043 | if (fe0->dvb.frontend != NULL) { |
951 | if (!dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60, | 1044 | if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend, 0x60, |
952 | &core->i2c_adap, DVB_PLL_OPERA1)) | 1045 | &core->i2c_adap, DVB_PLL_OPERA1)) |
953 | goto frontend_detach; | 1046 | goto frontend_detach; |
954 | core->prev_set_voltage = dev->dvb.frontend->ops.set_voltage; | 1047 | core->prev_set_voltage = fe0->dvb.frontend->ops.set_voltage; |
955 | dev->dvb.frontend->ops.set_voltage = tevii_dvbs_set_voltage; | 1048 | fe0->dvb.frontend->ops.set_voltage = tevii_dvbs_set_voltage; |
956 | 1049 | ||
957 | } else { | 1050 | } else { |
958 | dev->dvb.frontend = dvb_attach(stv0288_attach, | 1051 | fe0->dvb.frontend = dvb_attach(stv0288_attach, |
959 | &tevii_tuner_earda_config, | 1052 | &tevii_tuner_earda_config, |
960 | &core->i2c_adap); | 1053 | &core->i2c_adap); |
961 | if (dev->dvb.frontend != NULL) { | 1054 | if (fe0->dvb.frontend != NULL) { |
962 | if (!dvb_attach(stb6000_attach, dev->dvb.frontend, 0x61, | 1055 | if (!dvb_attach(stb6000_attach, fe0->dvb.frontend, 0x61, |
963 | &core->i2c_adap)) | 1056 | &core->i2c_adap)) |
964 | goto frontend_detach; | 1057 | goto frontend_detach; |
965 | core->prev_set_voltage = dev->dvb.frontend->ops.set_voltage; | 1058 | core->prev_set_voltage = fe0->dvb.frontend->ops.set_voltage; |
966 | dev->dvb.frontend->ops.set_voltage = tevii_dvbs_set_voltage; | 1059 | fe0->dvb.frontend->ops.set_voltage = tevii_dvbs_set_voltage; |
967 | 1060 | ||
968 | } | 1061 | } |
969 | } | 1062 | } |
970 | break; | 1063 | break; |
971 | case CX88_BOARD_TEVII_S460: | 1064 | case CX88_BOARD_TEVII_S460: |
972 | dev->dvb.frontend = dvb_attach(cx24116_attach, | 1065 | fe0->dvb.frontend = dvb_attach(cx24116_attach, |
973 | &tevii_s460_config, | 1066 | &tevii_s460_config, |
974 | &core->i2c_adap); | 1067 | &core->i2c_adap); |
975 | if (dev->dvb.frontend != NULL) { | 1068 | if (fe0->dvb.frontend != NULL) { |
976 | core->prev_set_voltage = dev->dvb.frontend->ops.set_voltage; | 1069 | core->prev_set_voltage = fe0->dvb.frontend->ops.set_voltage; |
977 | dev->dvb.frontend->ops.set_voltage = tevii_dvbs_set_voltage; | 1070 | fe0->dvb.frontend->ops.set_voltage = tevii_dvbs_set_voltage; |
978 | } | 1071 | } |
979 | break; | 1072 | break; |
980 | case CX88_BOARD_OMICOM_SS4_PCI: | 1073 | case CX88_BOARD_OMICOM_SS4_PCI: |
981 | case CX88_BOARD_TBS_8920: | 1074 | case CX88_BOARD_TBS_8920: |
982 | case CX88_BOARD_PROF_7300: | 1075 | case CX88_BOARD_PROF_7300: |
983 | dev->dvb.frontend = dvb_attach(cx24116_attach, | 1076 | fe0->dvb.frontend = dvb_attach(cx24116_attach, |
984 | &hauppauge_hvr4000_config, | 1077 | &hauppauge_hvr4000_config, |
985 | &core->i2c_adap); | 1078 | &core->i2c_adap); |
986 | if (dev->dvb.frontend != NULL) { | 1079 | if (fe0->dvb.frontend != NULL) { |
987 | core->prev_set_voltage = dev->dvb.frontend->ops.set_voltage; | 1080 | core->prev_set_voltage = fe0->dvb.frontend->ops.set_voltage; |
988 | dev->dvb.frontend->ops.set_voltage = tevii_dvbs_set_voltage; | 1081 | fe0->dvb.frontend->ops.set_voltage = tevii_dvbs_set_voltage; |
989 | } | 1082 | } |
990 | break; | 1083 | break; |
991 | default: | 1084 | default: |
@@ -993,29 +1086,32 @@ static int dvb_register(struct cx8802_dev *dev) | |||
993 | core->name); | 1086 | core->name); |
994 | break; | 1087 | break; |
995 | } | 1088 | } |
996 | if (NULL == dev->dvb.frontend) { | 1089 | |
1090 | if ( (NULL == fe0->dvb.frontend) || (fe1 && NULL == fe1->dvb.frontend) ) { | ||
997 | printk(KERN_ERR | 1091 | printk(KERN_ERR |
998 | "%s/2: frontend initialization failed\n", | 1092 | "%s/2: frontend initialization failed\n", |
999 | core->name); | 1093 | core->name); |
1000 | return -EINVAL; | 1094 | return -EINVAL; |
1001 | } | 1095 | } |
1002 | /* define general-purpose callback pointer */ | 1096 | /* define general-purpose callback pointer */ |
1003 | dev->dvb.frontend->callback = cx88_tuner_callback; | 1097 | fe0->dvb.frontend->callback = cx88_tuner_callback; |
1004 | 1098 | ||
1005 | /* Ensure all frontends negotiate bus access */ | 1099 | /* Ensure all frontends negotiate bus access */ |
1006 | dev->dvb.frontend->ops.ts_bus_ctrl = cx88_dvb_bus_ctrl; | 1100 | fe0->dvb.frontend->ops.ts_bus_ctrl = cx88_dvb_bus_ctrl; |
1101 | if (fe1) | ||
1102 | fe1->dvb.frontend->ops.ts_bus_ctrl = cx88_dvb_bus_ctrl; | ||
1007 | 1103 | ||
1008 | /* Put the analog decoder in standby to keep it quiet */ | 1104 | /* Put the analog decoder in standby to keep it quiet */ |
1009 | cx88_call_i2c_clients(core, TUNER_SET_STANDBY, NULL); | 1105 | cx88_call_i2c_clients(core, TUNER_SET_STANDBY, NULL); |
1010 | 1106 | ||
1011 | /* register everything */ | 1107 | /* register everything */ |
1012 | return videobuf_dvb_register(&dev->dvb, THIS_MODULE, dev, | 1108 | return videobuf_dvb_register_bus(&dev->frontends, THIS_MODULE, dev, |
1013 | &dev->pci->dev, adapter_nr); | 1109 | &dev->pci->dev, adapter_nr); |
1014 | 1110 | ||
1015 | frontend_detach: | 1111 | frontend_detach: |
1016 | if (dev->dvb.frontend) { | 1112 | if (fe0->dvb.frontend) { |
1017 | dvb_frontend_detach(dev->dvb.frontend); | 1113 | dvb_frontend_detach(fe0->dvb.frontend); |
1018 | dev->dvb.frontend = NULL; | 1114 | fe0->dvb.frontend = NULL; |
1019 | } | 1115 | } |
1020 | return -EINVAL; | 1116 | return -EINVAL; |
1021 | } | 1117 | } |
@@ -1039,6 +1135,66 @@ static int cx8802_dvb_advise_acquire(struct cx8802_driver *drv) | |||
1039 | cx_clear(MO_GP0_IO, 0x00000004); | 1135 | cx_clear(MO_GP0_IO, 0x00000004); |
1040 | udelay(1000); | 1136 | udelay(1000); |
1041 | break; | 1137 | break; |
1138 | |||
1139 | case CX88_BOARD_HAUPPAUGE_HVR3000: /* ? */ | ||
1140 | if(core->dvbdev->frontends.active_fe_id == 1) { | ||
1141 | /* DVB-S/S2 Enabled */ | ||
1142 | |||
1143 | /* Toggle reset on cx22702 leaving i2c active */ | ||
1144 | cx_write(MO_GP0_IO, core->board.input[0].gpio0); | ||
1145 | udelay(1000); | ||
1146 | cx_clear(MO_GP0_IO, 0x00000080); | ||
1147 | udelay(50); | ||
1148 | cx_set(MO_GP0_IO, 0x00000080); /* cx22702 out of reset */ | ||
1149 | cx_set(MO_GP0_IO, 0x00000004); /* tri-state the cx22702 pins */ | ||
1150 | udelay(1000); | ||
1151 | |||
1152 | cx_write(MO_SRST_IO, 1); /* Take the cx24116/cx24123 out of reset */ | ||
1153 | core->dvbdev->ts_gen_cntrl = 0x02; /* Parallel IO */ | ||
1154 | } else | ||
1155 | if (core->dvbdev->frontends.active_fe_id == 2) { | ||
1156 | /* DVB-T Enabled */ | ||
1157 | |||
1158 | /* Put the cx24116/cx24123 into reset */ | ||
1159 | cx_write(MO_SRST_IO, 0); | ||
1160 | |||
1161 | /* cx22702 out of reset and enable it */ | ||
1162 | cx_set(MO_GP0_IO, 0x00000080); | ||
1163 | cx_clear(MO_GP0_IO, 0x00000004); | ||
1164 | core->dvbdev->ts_gen_cntrl = 0x0c; /* Serial IO */ | ||
1165 | udelay(1000); | ||
1166 | } | ||
1167 | break; | ||
1168 | case CX88_BOARD_HAUPPAUGE_HVR4000: | ||
1169 | if(core->dvbdev->frontends.active_fe_id == 1) { | ||
1170 | /* DVB-S/S2 Enabled */ | ||
1171 | |||
1172 | /* Toggle reset on cx22702 leaving i2c active */ | ||
1173 | cx_write(MO_GP0_IO, (core->board.input[0].gpio0 & 0x0000ff00) | 0x00000080); | ||
1174 | udelay(1000); | ||
1175 | cx_clear(MO_GP0_IO, 0x00000080); | ||
1176 | udelay(50); | ||
1177 | cx_set(MO_GP0_IO, 0x00000080); /* cx22702 out of reset */ | ||
1178 | cx_set(MO_GP0_IO, 0x00000004); /* tri-state the cx22702 pins */ | ||
1179 | udelay(1000); | ||
1180 | |||
1181 | cx_write(MO_SRST_IO, 1); /* Take the cx24116/cx24123 out of reset */ | ||
1182 | core->dvbdev->ts_gen_cntrl = 0x02; /* Parallel IO */ | ||
1183 | } else | ||
1184 | if (core->dvbdev->frontends.active_fe_id == 2) { | ||
1185 | /* DVB-T Enabled */ | ||
1186 | |||
1187 | /* Put the cx24116/cx24123 into reset */ | ||
1188 | cx_write(MO_SRST_IO, 0); | ||
1189 | |||
1190 | /* cx22702 out of reset and enable it */ | ||
1191 | cx_set(MO_GP0_IO, 0x00000080); | ||
1192 | cx_clear(MO_GP0_IO, 0x00000004); | ||
1193 | core->dvbdev->ts_gen_cntrl = 0x0c; /* Serial IO */ | ||
1194 | udelay(1000); | ||
1195 | } | ||
1196 | break; | ||
1197 | |||
1042 | default: | 1198 | default: |
1043 | err = -ENODEV; | 1199 | err = -ENODEV; |
1044 | } | 1200 | } |
@@ -1056,6 +1212,9 @@ static int cx8802_dvb_advise_release(struct cx8802_driver *drv) | |||
1056 | case CX88_BOARD_HAUPPAUGE_HVR1300: | 1212 | case CX88_BOARD_HAUPPAUGE_HVR1300: |
1057 | /* Do Nothing, leave the cx22702 on the bus. */ | 1213 | /* Do Nothing, leave the cx22702 on the bus. */ |
1058 | break; | 1214 | break; |
1215 | case CX88_BOARD_HAUPPAUGE_HVR3000: | ||
1216 | case CX88_BOARD_HAUPPAUGE_HVR4000: | ||
1217 | break; | ||
1059 | default: | 1218 | default: |
1060 | err = -ENODEV; | 1219 | err = -ENODEV; |
1061 | } | 1220 | } |
@@ -1066,7 +1225,8 @@ static int cx8802_dvb_probe(struct cx8802_driver *drv) | |||
1066 | { | 1225 | { |
1067 | struct cx88_core *core = drv->core; | 1226 | struct cx88_core *core = drv->core; |
1068 | struct cx8802_dev *dev = drv->core->dvbdev; | 1227 | struct cx8802_dev *dev = drv->core->dvbdev; |
1069 | int err; | 1228 | int err,i; |
1229 | struct videobuf_dvb_frontend *fe; | ||
1070 | 1230 | ||
1071 | dprintk( 1, "%s\n", __func__); | 1231 | dprintk( 1, "%s\n", __func__); |
1072 | dprintk( 1, " ->being probed by Card=%d Name=%s, PCI %02x:%02x\n", | 1232 | dprintk( 1, " ->being probed by Card=%d Name=%s, PCI %02x:%02x\n", |
@@ -1086,12 +1246,23 @@ static int cx8802_dvb_probe(struct cx8802_driver *drv) | |||
1086 | 1246 | ||
1087 | /* dvb stuff */ | 1247 | /* dvb stuff */ |
1088 | printk(KERN_INFO "%s/2: cx2388x based DVB/ATSC card\n", core->name); | 1248 | printk(KERN_INFO "%s/2: cx2388x based DVB/ATSC card\n", core->name); |
1089 | videobuf_queue_sg_init(&dev->dvb.dvbq, &dvb_qops, | 1249 | dev->ts_gen_cntrl = 0x0c; |
1250 | |||
1251 | for (i = 1; i <= core->board.num_frontends; i++) { | ||
1252 | fe = videobuf_dvb_get_frontend(&core->dvbdev->frontends, i); | ||
1253 | if (!fe) { | ||
1254 | printk(KERN_ERR "%s() failed to get frontend(%d)\n", __FUNCTION__, i); | ||
1255 | continue; | ||
1256 | } | ||
1257 | videobuf_queue_sg_init(&fe->dvb.dvbq, &dvb_qops, | ||
1090 | &dev->pci->dev, &dev->slock, | 1258 | &dev->pci->dev, &dev->slock, |
1091 | V4L2_BUF_TYPE_VIDEO_CAPTURE, | 1259 | V4L2_BUF_TYPE_VIDEO_CAPTURE, |
1092 | V4L2_FIELD_TOP, | 1260 | V4L2_FIELD_TOP, |
1093 | sizeof(struct cx88_buffer), | 1261 | sizeof(struct cx88_buffer), |
1094 | dev); | 1262 | dev); |
1263 | /* init struct videobuf_dvb */ | ||
1264 | fe->dvb.name = dev->core->name; | ||
1265 | } | ||
1095 | err = dvb_register(dev); | 1266 | err = dvb_register(dev); |
1096 | if (err != 0) | 1267 | if (err != 0) |
1097 | printk(KERN_ERR "%s/2: dvb_register failed (err = %d)\n", | 1268 | printk(KERN_ERR "%s/2: dvb_register failed (err = %d)\n", |
@@ -1105,9 +1276,7 @@ static int cx8802_dvb_remove(struct cx8802_driver *drv) | |||
1105 | { | 1276 | { |
1106 | struct cx8802_dev *dev = drv->core->dvbdev; | 1277 | struct cx8802_dev *dev = drv->core->dvbdev; |
1107 | 1278 | ||
1108 | /* dvb */ | 1279 | videobuf_dvb_unregister_bus(&dev->frontends); |
1109 | if (dev->dvb.frontend) | ||
1110 | videobuf_dvb_unregister(&dev->dvb); | ||
1111 | 1280 | ||
1112 | vp3054_i2c_remove(dev); | 1281 | vp3054_i2c_remove(dev); |
1113 | 1282 | ||
diff --git a/drivers/media/video/cx88/cx88-i2c.c b/drivers/media/video/cx88/cx88-i2c.c index 8e74d64fdcd2..582769de26b5 100644 --- a/drivers/media/video/cx88/cx88-i2c.c +++ b/drivers/media/video/cx88/cx88-i2c.c | |||
@@ -116,18 +116,23 @@ static int detach_inform(struct i2c_client *client) | |||
116 | 116 | ||
117 | void cx88_call_i2c_clients(struct cx88_core *core, unsigned int cmd, void *arg) | 117 | void cx88_call_i2c_clients(struct cx88_core *core, unsigned int cmd, void *arg) |
118 | { | 118 | { |
119 | struct videobuf_dvb_frontend *fe0 = NULL; | ||
119 | if (0 != core->i2c_rc) | 120 | if (0 != core->i2c_rc) |
120 | return; | 121 | return; |
121 | 122 | ||
122 | #if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE) | 123 | #if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE) |
123 | if ( (core->dvbdev) && (core->dvbdev->dvb.frontend) ) { | 124 | if (core->dvbdev) { |
124 | if (core->dvbdev->dvb.frontend->ops.i2c_gate_ctrl) | 125 | /* Get the first frontend and assume that all I2C is routed through it */ |
125 | core->dvbdev->dvb.frontend->ops.i2c_gate_ctrl(core->dvbdev->dvb.frontend, 1); | 126 | /* TODO: Get _THIS_FE_ then find the right i2c_gate_ctrl for it */ |
127 | fe0 = videobuf_dvb_get_frontend(&core->dvbdev->frontends, 1); | ||
128 | |||
129 | if (fe0 && fe0->dvb.frontend && fe0->dvb.frontend->ops.i2c_gate_ctrl) | ||
130 | fe0->dvb.frontend->ops.i2c_gate_ctrl(fe0->dvb.frontend, 1); | ||
126 | 131 | ||
127 | i2c_clients_command(&core->i2c_adap, cmd, arg); | 132 | i2c_clients_command(&core->i2c_adap, cmd, arg); |
128 | 133 | ||
129 | if (core->dvbdev->dvb.frontend->ops.i2c_gate_ctrl) | 134 | if (fe0 && fe0->dvb.frontend && fe0->dvb.frontend->ops.i2c_gate_ctrl) |
130 | core->dvbdev->dvb.frontend->ops.i2c_gate_ctrl(core->dvbdev->dvb.frontend, 0); | 135 | fe0->dvb.frontend->ops.i2c_gate_ctrl(fe0->dvb.frontend, 0); |
131 | } else | 136 | } else |
132 | #endif | 137 | #endif |
133 | i2c_clients_command(&core->i2c_adap, cmd, arg); | 138 | i2c_clients_command(&core->i2c_adap, cmd, arg); |
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index 8683d104de72..17150cb88c80 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c | |||
@@ -495,6 +495,7 @@ void cx88_ir_irq(struct cx88_core *core) | |||
495 | case CX88_BOARD_PINNACLE_PCTV_HD_800i: | 495 | case CX88_BOARD_PINNACLE_PCTV_HD_800i: |
496 | ircode = ir_decode_biphase(ir->samples, ir->scount, 5, 7); | 496 | ircode = ir_decode_biphase(ir->samples, ir->scount, 5, 7); |
497 | ir_dprintk("biphase decoded: %x\n", ircode); | 497 | ir_dprintk("biphase decoded: %x\n", ircode); |
498 | //TODO Darron has other code here | ||
498 | if ((ircode & 0xfffff000) != 0x3000) | 499 | if ((ircode & 0xfffff000) != 0x3000) |
499 | break; | 500 | break; |
500 | ir_input_keydown(ir->input, &ir->ir, ircode & 0x3f, ircode); | 501 | ir_input_keydown(ir->input, &ir->ir, ircode & 0x3f, ircode); |
diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c index a6b061c2644a..22c2a88fbf1c 100644 --- a/drivers/media/video/cx88/cx88-mpeg.c +++ b/drivers/media/video/cx88/cx88-mpeg.c | |||
@@ -768,7 +768,8 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev, | |||
768 | { | 768 | { |
769 | struct cx8802_dev *dev; | 769 | struct cx8802_dev *dev; |
770 | struct cx88_core *core; | 770 | struct cx88_core *core; |
771 | int err; | 771 | struct videobuf_dvb_frontend *demod; |
772 | int err,i; | ||
772 | 773 | ||
773 | /* general setup */ | 774 | /* general setup */ |
774 | core = cx88_core_get(pci_dev); | 775 | core = cx88_core_get(pci_dev); |
@@ -781,6 +782,11 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev, | |||
781 | if (!core->board.mpeg) | 782 | if (!core->board.mpeg) |
782 | goto fail_core; | 783 | goto fail_core; |
783 | 784 | ||
785 | if (!core->board.num_frontends) { | ||
786 | printk(KERN_ERR "%s() .num_frontends should be non-zero, err = %d\n", __FUNCTION__, err); | ||
787 | goto fail_core; | ||
788 | } | ||
789 | |||
784 | err = -ENOMEM; | 790 | err = -ENOMEM; |
785 | dev = kzalloc(sizeof(*dev),GFP_KERNEL); | 791 | dev = kzalloc(sizeof(*dev),GFP_KERNEL); |
786 | if (NULL == dev) | 792 | if (NULL == dev) |
@@ -795,6 +801,20 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev, | |||
795 | INIT_LIST_HEAD(&dev->drvlist); | 801 | INIT_LIST_HEAD(&dev->drvlist); |
796 | list_add_tail(&dev->devlist,&cx8802_devlist); | 802 | list_add_tail(&dev->devlist,&cx8802_devlist); |
797 | 803 | ||
804 | mutex_init(&dev->frontends.lock); | ||
805 | INIT_LIST_HEAD(&dev->frontends.frontend.felist); | ||
806 | |||
807 | printk(KERN_INFO "%s() allocating %d frontend(s)\n", __FUNCTION__, core->board.num_frontends); | ||
808 | |||
809 | for (i = 1; i <= core->board.num_frontends; i++) { | ||
810 | demod = videobuf_dvb_alloc_frontend(dev, &dev->frontends, i); | ||
811 | if(demod == NULL) { | ||
812 | printk(KERN_ERR "%s() failed to alloc\n", __FUNCTION__); | ||
813 | err = -ENOMEM; | ||
814 | goto fail_free; | ||
815 | } | ||
816 | } | ||
817 | |||
798 | /* Maintain a reference so cx88-video can query the 8802 device. */ | 818 | /* Maintain a reference so cx88-video can query the 8802 device. */ |
799 | core->dvbdev = dev; | 819 | core->dvbdev = dev; |
800 | 820 | ||
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index dbf01b8b57a5..063f7b57e42a 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h | |||
@@ -261,6 +261,7 @@ struct cx88_board { | |||
261 | struct cx88_input radio; | 261 | struct cx88_input radio; |
262 | enum cx88_board_type mpeg; | 262 | enum cx88_board_type mpeg; |
263 | unsigned int audio_chip; | 263 | unsigned int audio_chip; |
264 | int num_frontends; | ||
264 | }; | 265 | }; |
265 | 266 | ||
266 | struct cx88_subid { | 267 | struct cx88_subid { |
@@ -356,6 +357,7 @@ struct cx88_core { | |||
356 | struct cx8802_dev *dvbdev; | 357 | struct cx8802_dev *dvbdev; |
357 | enum cx88_board_type active_type_id; | 358 | enum cx88_board_type active_type_id; |
358 | int active_ref; | 359 | int active_ref; |
360 | int active_fe_id; | ||
359 | }; | 361 | }; |
360 | 362 | ||
361 | struct cx8800_dev; | 363 | struct cx8800_dev; |
@@ -490,7 +492,7 @@ struct cx8802_dev { | |||
490 | 492 | ||
491 | #if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE) | 493 | #if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE) |
492 | /* for dvb only */ | 494 | /* for dvb only */ |
493 | struct videobuf_dvb dvb; | 495 | struct videobuf_dvb_frontends frontends; |
494 | #endif | 496 | #endif |
495 | 497 | ||
496 | #if defined(CONFIG_VIDEO_CX88_VP3054) || \ | 498 | #if defined(CONFIG_VIDEO_CX88_VP3054) || \ |