diff options
Diffstat (limited to 'drivers/media/video/cx88/cx88-dvb.c')
-rw-r--r-- | drivers/media/video/cx88/cx88-dvb.c | 550 |
1 files changed, 398 insertions, 152 deletions
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index d96173ff1dba..cf6c30d4e545 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c | |||
@@ -48,6 +48,11 @@ | |||
48 | #include "tuner-simple.h" | 48 | #include "tuner-simple.h" |
49 | #include "tda9887.h" | 49 | #include "tda9887.h" |
50 | #include "s5h1411.h" | 50 | #include "s5h1411.h" |
51 | #include "stv0299.h" | ||
52 | #include "z0194a.h" | ||
53 | #include "stv0288.h" | ||
54 | #include "stb6000.h" | ||
55 | #include "cx24116.h" | ||
51 | 56 | ||
52 | MODULE_DESCRIPTION("driver for cx2388x based DVB cards"); | 57 | MODULE_DESCRIPTION("driver for cx2388x based DVB cards"); |
53 | MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>"); | 58 | MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>"); |
@@ -111,13 +116,23 @@ static int cx88_dvb_bus_ctrl(struct dvb_frontend* fe, int acquire) | |||
111 | struct cx8802_dev *dev= fe->dvb->priv; | 116 | struct cx8802_dev *dev= fe->dvb->priv; |
112 | struct cx8802_driver *drv = NULL; | 117 | struct cx8802_driver *drv = NULL; |
113 | 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", __func__); | ||
124 | return -EINVAL; | ||
125 | } | ||
114 | 126 | ||
115 | drv = cx8802_get_driver(dev, CX88_MPEG_DVB); | 127 | drv = cx8802_get_driver(dev, CX88_MPEG_DVB); |
116 | if (drv) { | 128 | if (drv) { |
117 | if (acquire) | 129 | if (acquire){ |
130 | dev->frontends.active_fe_id = fe_id; | ||
118 | ret = drv->request_acquire(drv); | 131 | ret = drv->request_acquire(drv); |
119 | else | 132 | } else { |
120 | ret = drv->request_release(drv); | 133 | ret = drv->request_release(drv); |
134 | dev->frontends.active_fe_id = 0; | ||
135 | } | ||
121 | } | 136 | } |
122 | 137 | ||
123 | return ret; | 138 | return ret; |
@@ -375,37 +390,28 @@ static int geniatech_dvbs_set_voltage(struct dvb_frontend *fe, | |||
375 | return 0; | 390 | return 0; |
376 | } | 391 | } |
377 | 392 | ||
378 | static int cx88_pci_nano_callback(void *ptr, int command, int arg) | 393 | static int tevii_dvbs_set_voltage(struct dvb_frontend *fe, |
394 | fe_sec_voltage_t voltage) | ||
379 | { | 395 | { |
380 | struct cx88_core *core = ptr; | 396 | struct cx8802_dev *dev= fe->dvb->priv; |
381 | 397 | struct cx88_core *core = dev->core; | |
382 | switch (command) { | ||
383 | case XC2028_TUNER_RESET: | ||
384 | /* Send the tuner in then out of reset */ | ||
385 | dprintk(1, "%s: XC2028_TUNER_RESET %d\n", __func__, arg); | ||
386 | |||
387 | switch (core->boardnr) { | ||
388 | case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO: | ||
389 | /* GPIO-4 xc3028 tuner */ | ||
390 | |||
391 | cx_set(MO_GP0_IO, 0x00001000); | ||
392 | cx_clear(MO_GP0_IO, 0x00000010); | ||
393 | msleep(100); | ||
394 | cx_set(MO_GP0_IO, 0x00000010); | ||
395 | msleep(100); | ||
396 | break; | ||
397 | } | ||
398 | 398 | ||
399 | break; | 399 | switch (voltage) { |
400 | case XC2028_RESET_CLK: | 400 | case SEC_VOLTAGE_13: |
401 | dprintk(1, "%s: XC2028_RESET_CLK %d\n", __func__, arg); | 401 | printk("LNB Voltage SEC_VOLTAGE_13\n"); |
402 | break; | 402 | cx_write(MO_GP0_IO, 0x00006040); |
403 | default: | 403 | break; |
404 | dprintk(1, "%s: unknown command %d, arg %d\n", __func__, | 404 | case SEC_VOLTAGE_18: |
405 | command, arg); | 405 | printk("LNB Voltage SEC_VOLTAGE_18\n"); |
406 | return -EINVAL; | 406 | cx_write(MO_GP0_IO, 0x00006060); |
407 | break; | ||
408 | case SEC_VOLTAGE_OFF: | ||
409 | printk("LNB Voltage SEC_VOLTAGE_off\n"); | ||
410 | break; | ||
407 | } | 411 | } |
408 | 412 | ||
413 | if (core->prev_set_voltage) | ||
414 | return core->prev_set_voltage(fe, voltage); | ||
409 | return 0; | 415 | return 0; |
410 | } | 416 | } |
411 | 417 | ||
@@ -456,7 +462,12 @@ static struct s5h1409_config kworld_atsc_120_config = { | |||
456 | static struct xc5000_config pinnacle_pctv_hd_800i_tuner_config = { | 462 | static struct xc5000_config pinnacle_pctv_hd_800i_tuner_config = { |
457 | .i2c_address = 0x64, | 463 | .i2c_address = 0x64, |
458 | .if_khz = 5380, | 464 | .if_khz = 5380, |
459 | .tuner_callback = cx88_tuner_callback, | 465 | }; |
466 | |||
467 | static struct zl10353_config cx88_pinnacle_hybrid_pctv = { | ||
468 | .demod_address = (0x1e >> 1), | ||
469 | .no_tuner = 1, | ||
470 | .if2 = 45600, | ||
460 | }; | 471 | }; |
461 | 472 | ||
462 | static struct zl10353_config cx88_geniatech_x8000_mt = { | 473 | static struct zl10353_config cx88_geniatech_x8000_mt = { |
@@ -477,21 +488,25 @@ static struct s5h1411_config dvico_fusionhdtv7_config = { | |||
477 | static struct xc5000_config dvico_fusionhdtv7_tuner_config = { | 488 | static struct xc5000_config dvico_fusionhdtv7_tuner_config = { |
478 | .i2c_address = 0xc2 >> 1, | 489 | .i2c_address = 0xc2 >> 1, |
479 | .if_khz = 5380, | 490 | .if_khz = 5380, |
480 | .tuner_callback = cx88_tuner_callback, | ||
481 | }; | 491 | }; |
482 | 492 | ||
483 | static int attach_xc3028(u8 addr, struct cx8802_dev *dev) | 493 | static int attach_xc3028(u8 addr, struct cx8802_dev *dev) |
484 | { | 494 | { |
485 | struct dvb_frontend *fe; | 495 | struct dvb_frontend *fe; |
496 | struct videobuf_dvb_frontend *fe0 = NULL; | ||
486 | struct xc2028_ctrl ctl; | 497 | struct xc2028_ctrl ctl; |
487 | struct xc2028_config cfg = { | 498 | struct xc2028_config cfg = { |
488 | .i2c_adap = &dev->core->i2c_adap, | 499 | .i2c_adap = &dev->core->i2c_adap, |
489 | .i2c_addr = addr, | 500 | .i2c_addr = addr, |
490 | .ctrl = &ctl, | 501 | .ctrl = &ctl, |
491 | .callback = cx88_tuner_callback, | ||
492 | }; | 502 | }; |
493 | 503 | ||
494 | if (!dev->dvb.frontend) { | 504 | /* Get the first frontend */ |
505 | fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1); | ||
506 | if (!fe0) | ||
507 | return -EINVAL; | ||
508 | |||
509 | if (!fe0->dvb.frontend) { | ||
495 | printk(KERN_ERR "%s/2: dvb frontend not attached. " | 510 | printk(KERN_ERR "%s/2: dvb frontend not attached. " |
496 | "Can't attach xc3028\n", | 511 | "Can't attach xc3028\n", |
497 | dev->core->name); | 512 | dev->core->name); |
@@ -505,10 +520,13 @@ static int attach_xc3028(u8 addr, struct cx8802_dev *dev) | |||
505 | */ | 520 | */ |
506 | cx88_setup_xc3028(dev->core, &ctl); | 521 | cx88_setup_xc3028(dev->core, &ctl); |
507 | 522 | ||
508 | fe = dvb_attach(xc2028_attach, dev->dvb.frontend, &cfg); | 523 | fe = dvb_attach(xc2028_attach, fe0->dvb.frontend, &cfg); |
509 | if (!fe) { | 524 | if (!fe) { |
510 | printk(KERN_ERR "%s/2: xc3028 attach failed\n", | 525 | printk(KERN_ERR "%s/2: xc3028 attach failed\n", |
511 | dev->core->name); | 526 | dev->core->name); |
527 | dvb_frontend_detach(fe0->dvb.frontend); | ||
528 | dvb_unregister_frontend(fe0->dvb.frontend); | ||
529 | fe0->dvb.frontend = NULL; | ||
512 | return -EINVAL; | 530 | return -EINVAL; |
513 | } | 531 | } |
514 | 532 | ||
@@ -518,22 +536,84 @@ static int attach_xc3028(u8 addr, struct cx8802_dev *dev) | |||
518 | return 0; | 536 | return 0; |
519 | } | 537 | } |
520 | 538 | ||
539 | static int cx24116_set_ts_param(struct dvb_frontend *fe, | ||
540 | int is_punctured) | ||
541 | { | ||
542 | struct cx8802_dev *dev = fe->dvb->priv; | ||
543 | dev->ts_gen_cntrl = 0x2; | ||
544 | |||
545 | return 0; | ||
546 | } | ||
547 | |||
548 | static int cx24116_reset_device(struct dvb_frontend *fe) | ||
549 | { | ||
550 | struct cx8802_dev *dev = fe->dvb->priv; | ||
551 | struct cx88_core *core = dev->core; | ||
552 | |||
553 | /* Reset the part */ | ||
554 | /* Put the cx24116 into reset */ | ||
555 | cx_write(MO_SRST_IO, 0); | ||
556 | msleep(10); | ||
557 | /* Take the cx24116 out of reset */ | ||
558 | cx_write(MO_SRST_IO, 1); | ||
559 | msleep(10); | ||
560 | |||
561 | return 0; | ||
562 | } | ||
563 | |||
564 | static struct cx24116_config hauppauge_hvr4000_config = { | ||
565 | .demod_address = 0x05, | ||
566 | .set_ts_params = cx24116_set_ts_param, | ||
567 | .reset_device = cx24116_reset_device, | ||
568 | }; | ||
569 | |||
570 | static struct cx24116_config tevii_s460_config = { | ||
571 | .demod_address = 0x55, | ||
572 | .set_ts_params = cx24116_set_ts_param, | ||
573 | .reset_device = cx24116_reset_device, | ||
574 | }; | ||
575 | |||
576 | static struct stv0299_config tevii_tuner_sharp_config = { | ||
577 | .demod_address = 0x68, | ||
578 | .inittab = sharp_z0194a_inittab, | ||
579 | .mclk = 88000000UL, | ||
580 | .invert = 1, | ||
581 | .skip_reinit = 0, | ||
582 | .lock_output = 1, | ||
583 | .volt13_op0_op1 = STV0299_VOLT13_OP1, | ||
584 | .min_delay_ms = 100, | ||
585 | .set_symbol_rate = sharp_z0194a_set_symbol_rate, | ||
586 | .set_ts_params = cx24116_set_ts_param, | ||
587 | }; | ||
588 | |||
589 | static struct stv0288_config tevii_tuner_earda_config = { | ||
590 | .demod_address = 0x68, | ||
591 | .min_delay_ms = 100, | ||
592 | .set_ts_params = cx24116_set_ts_param, | ||
593 | }; | ||
594 | |||
521 | static int dvb_register(struct cx8802_dev *dev) | 595 | static int dvb_register(struct cx8802_dev *dev) |
522 | { | 596 | { |
523 | struct cx88_core *core = dev->core; | 597 | struct cx88_core *core = dev->core; |
598 | struct videobuf_dvb_frontend *fe0, *fe1 = NULL; | ||
599 | int mfe_shared = 0; /* bus not shared by default */ | ||
524 | 600 | ||
525 | /* init struct videobuf_dvb */ | 601 | /* Get the first frontend */ |
526 | dev->dvb.name = core->name; | 602 | fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1); |
527 | dev->ts_gen_cntrl = 0x0c; | 603 | if (!fe0) |
604 | return -EINVAL; | ||
605 | |||
606 | /* multi-frontend gate control is undefined or defaults to fe0 */ | ||
607 | dev->frontends.gate = 0; | ||
528 | 608 | ||
529 | /* init frontend */ | 609 | /* init frontend(s) */ |
530 | switch (core->boardnr) { | 610 | switch (core->boardnr) { |
531 | case CX88_BOARD_HAUPPAUGE_DVB_T1: | 611 | case CX88_BOARD_HAUPPAUGE_DVB_T1: |
532 | dev->dvb.frontend = dvb_attach(cx22702_attach, | 612 | fe0->dvb.frontend = dvb_attach(cx22702_attach, |
533 | &connexant_refboard_config, | 613 | &connexant_refboard_config, |
534 | &core->i2c_adap); | 614 | &core->i2c_adap); |
535 | if (dev->dvb.frontend != NULL) { | 615 | if (fe0->dvb.frontend != NULL) { |
536 | if (!dvb_attach(dvb_pll_attach, dev->dvb.frontend, | 616 | if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend, |
537 | 0x61, &core->i2c_adap, | 617 | 0x61, &core->i2c_adap, |
538 | DVB_PLL_THOMSON_DTT759X)) | 618 | DVB_PLL_THOMSON_DTT759X)) |
539 | goto frontend_detach; | 619 | goto frontend_detach; |
@@ -543,11 +623,11 @@ static int dvb_register(struct cx8802_dev *dev) | |||
543 | case CX88_BOARD_CONEXANT_DVB_T1: | 623 | case CX88_BOARD_CONEXANT_DVB_T1: |
544 | case CX88_BOARD_KWORLD_DVB_T_CX22702: | 624 | case CX88_BOARD_KWORLD_DVB_T_CX22702: |
545 | case CX88_BOARD_WINFAST_DTV1000: | 625 | case CX88_BOARD_WINFAST_DTV1000: |
546 | dev->dvb.frontend = dvb_attach(cx22702_attach, | 626 | fe0->dvb.frontend = dvb_attach(cx22702_attach, |
547 | &connexant_refboard_config, | 627 | &connexant_refboard_config, |
548 | &core->i2c_adap); | 628 | &core->i2c_adap); |
549 | if (dev->dvb.frontend != NULL) { | 629 | if (fe0->dvb.frontend != NULL) { |
550 | if (!dvb_attach(dvb_pll_attach, dev->dvb.frontend, | 630 | if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend, |
551 | 0x60, &core->i2c_adap, | 631 | 0x60, &core->i2c_adap, |
552 | DVB_PLL_THOMSON_DTT7579)) | 632 | DVB_PLL_THOMSON_DTT7579)) |
553 | goto frontend_detach; | 633 | goto frontend_detach; |
@@ -557,33 +637,67 @@ static int dvb_register(struct cx8802_dev *dev) | |||
557 | case CX88_BOARD_HAUPPAUGE_HVR1100: | 637 | case CX88_BOARD_HAUPPAUGE_HVR1100: |
558 | case CX88_BOARD_HAUPPAUGE_HVR1100LP: | 638 | case CX88_BOARD_HAUPPAUGE_HVR1100LP: |
559 | case CX88_BOARD_HAUPPAUGE_HVR1300: | 639 | case CX88_BOARD_HAUPPAUGE_HVR1300: |
560 | case CX88_BOARD_HAUPPAUGE_HVR3000: | 640 | fe0->dvb.frontend = dvb_attach(cx22702_attach, |
561 | dev->dvb.frontend = dvb_attach(cx22702_attach, | ||
562 | &hauppauge_hvr_config, | 641 | &hauppauge_hvr_config, |
563 | &core->i2c_adap); | 642 | &core->i2c_adap); |
564 | if (dev->dvb.frontend != NULL) { | 643 | if (fe0->dvb.frontend != NULL) { |
565 | if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend, | 644 | if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
566 | &core->i2c_adap, 0x61, | 645 | &core->i2c_adap, 0x61, |
567 | TUNER_PHILIPS_FMD1216ME_MK3)) | 646 | TUNER_PHILIPS_FMD1216ME_MK3)) |
568 | goto frontend_detach; | 647 | goto frontend_detach; |
569 | } | 648 | } |
570 | break; | 649 | break; |
650 | case CX88_BOARD_HAUPPAUGE_HVR3000: | ||
651 | /* DVB-S init */ | ||
652 | fe0->dvb.frontend = dvb_attach(cx24123_attach, | ||
653 | &hauppauge_novas_config, | ||
654 | &dev->core->i2c_adap); | ||
655 | if (fe0->dvb.frontend) { | ||
656 | if (!dvb_attach(isl6421_attach, fe0->dvb.frontend, | ||
657 | &dev->core->i2c_adap, 0x08, ISL6421_DCL, 0x00)) { | ||
658 | dprintk( 1, "%s(): HVR3000 - DVB-S LNB Init: failed\n", __func__); | ||
659 | } | ||
660 | } else { | ||
661 | dprintk( 1, "%s(): HVR3000 - DVB-S Init: failed\n", __func__); | ||
662 | } | ||
663 | /* DVB-T init */ | ||
664 | fe1 = videobuf_dvb_get_frontend(&dev->frontends, 2); | ||
665 | if (fe1) { | ||
666 | dev->frontends.gate = 2; | ||
667 | mfe_shared = 1; | ||
668 | fe1->dvb.frontend = dvb_attach(cx22702_attach, | ||
669 | &hauppauge_hvr_config, | ||
670 | &dev->core->i2c_adap); | ||
671 | if (fe1->dvb.frontend) { | ||
672 | fe1->dvb.frontend->id = 1; | ||
673 | if(!dvb_attach(simple_tuner_attach, fe1->dvb.frontend, | ||
674 | &dev->core->i2c_adap, 0x61, | ||
675 | TUNER_PHILIPS_FMD1216ME_MK3)) { | ||
676 | dprintk( 1, "%s(): HVR3000 - DVB-T misc Init: failed\n", __func__); | ||
677 | } | ||
678 | } else { | ||
679 | dprintk( 1, "%s(): HVR3000 - DVB-T Init: failed\n", __func__); | ||
680 | } | ||
681 | } else { | ||
682 | dprintk( 1, "%s(): HVR3000 - DVB-T Init: can't find frontend 2.\n", __func__); | ||
683 | } | ||
684 | break; | ||
571 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS: | 685 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS: |
572 | dev->dvb.frontend = dvb_attach(mt352_attach, | 686 | fe0->dvb.frontend = dvb_attach(mt352_attach, |
573 | &dvico_fusionhdtv, | 687 | &dvico_fusionhdtv, |
574 | &core->i2c_adap); | 688 | &core->i2c_adap); |
575 | if (dev->dvb.frontend != NULL) { | 689 | if (fe0->dvb.frontend != NULL) { |
576 | if (!dvb_attach(dvb_pll_attach, dev->dvb.frontend, | 690 | if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend, |
577 | 0x60, NULL, DVB_PLL_THOMSON_DTT7579)) | 691 | 0x60, NULL, DVB_PLL_THOMSON_DTT7579)) |
578 | goto frontend_detach; | 692 | goto frontend_detach; |
579 | break; | 693 | break; |
580 | } | 694 | } |
581 | /* ZL10353 replaces MT352 on later cards */ | 695 | /* ZL10353 replaces MT352 on later cards */ |
582 | dev->dvb.frontend = dvb_attach(zl10353_attach, | 696 | fe0->dvb.frontend = dvb_attach(zl10353_attach, |
583 | &dvico_fusionhdtv_plus_v1_1, | 697 | &dvico_fusionhdtv_plus_v1_1, |
584 | &core->i2c_adap); | 698 | &core->i2c_adap); |
585 | if (dev->dvb.frontend != NULL) { | 699 | if (fe0->dvb.frontend != NULL) { |
586 | if (!dvb_attach(dvb_pll_attach, dev->dvb.frontend, | 700 | if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend, |
587 | 0x60, NULL, DVB_PLL_THOMSON_DTT7579)) | 701 | 0x60, NULL, DVB_PLL_THOMSON_DTT7579)) |
588 | goto frontend_detach; | 702 | goto frontend_detach; |
589 | } | 703 | } |
@@ -591,31 +705,31 @@ static int dvb_register(struct cx8802_dev *dev) | |||
591 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL: | 705 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL: |
592 | /* The tin box says DEE1601, but it seems to be DTT7579 | 706 | /* The tin box says DEE1601, but it seems to be DTT7579 |
593 | * compatible, with a slightly different MT352 AGC gain. */ | 707 | * compatible, with a slightly different MT352 AGC gain. */ |
594 | dev->dvb.frontend = dvb_attach(mt352_attach, | 708 | fe0->dvb.frontend = dvb_attach(mt352_attach, |
595 | &dvico_fusionhdtv_dual, | 709 | &dvico_fusionhdtv_dual, |
596 | &core->i2c_adap); | 710 | &core->i2c_adap); |
597 | if (dev->dvb.frontend != NULL) { | 711 | if (fe0->dvb.frontend != NULL) { |
598 | if (!dvb_attach(dvb_pll_attach, dev->dvb.frontend, | 712 | if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend, |
599 | 0x61, NULL, DVB_PLL_THOMSON_DTT7579)) | 713 | 0x61, NULL, DVB_PLL_THOMSON_DTT7579)) |
600 | goto frontend_detach; | 714 | goto frontend_detach; |
601 | break; | 715 | break; |
602 | } | 716 | } |
603 | /* ZL10353 replaces MT352 on later cards */ | 717 | /* ZL10353 replaces MT352 on later cards */ |
604 | dev->dvb.frontend = dvb_attach(zl10353_attach, | 718 | fe0->dvb.frontend = dvb_attach(zl10353_attach, |
605 | &dvico_fusionhdtv_plus_v1_1, | 719 | &dvico_fusionhdtv_plus_v1_1, |
606 | &core->i2c_adap); | 720 | &core->i2c_adap); |
607 | if (dev->dvb.frontend != NULL) { | 721 | if (fe0->dvb.frontend != NULL) { |
608 | if (!dvb_attach(dvb_pll_attach, dev->dvb.frontend, | 722 | if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend, |
609 | 0x61, NULL, DVB_PLL_THOMSON_DTT7579)) | 723 | 0x61, NULL, DVB_PLL_THOMSON_DTT7579)) |
610 | goto frontend_detach; | 724 | goto frontend_detach; |
611 | } | 725 | } |
612 | break; | 726 | break; |
613 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1: | 727 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1: |
614 | dev->dvb.frontend = dvb_attach(mt352_attach, | 728 | fe0->dvb.frontend = dvb_attach(mt352_attach, |
615 | &dvico_fusionhdtv, | 729 | &dvico_fusionhdtv, |
616 | &core->i2c_adap); | 730 | &core->i2c_adap); |
617 | if (dev->dvb.frontend != NULL) { | 731 | if (fe0->dvb.frontend != NULL) { |
618 | if (!dvb_attach(dvb_pll_attach, dev->dvb.frontend, | 732 | if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend, |
619 | 0x61, NULL, DVB_PLL_LG_Z201)) | 733 | 0x61, NULL, DVB_PLL_LG_Z201)) |
620 | goto frontend_detach; | 734 | goto frontend_detach; |
621 | } | 735 | } |
@@ -623,11 +737,11 @@ static int dvb_register(struct cx8802_dev *dev) | |||
623 | case CX88_BOARD_KWORLD_DVB_T: | 737 | case CX88_BOARD_KWORLD_DVB_T: |
624 | case CX88_BOARD_DNTV_LIVE_DVB_T: | 738 | case CX88_BOARD_DNTV_LIVE_DVB_T: |
625 | case CX88_BOARD_ADSTECH_DVB_T_PCI: | 739 | case CX88_BOARD_ADSTECH_DVB_T_PCI: |
626 | dev->dvb.frontend = dvb_attach(mt352_attach, | 740 | fe0->dvb.frontend = dvb_attach(mt352_attach, |
627 | &dntv_live_dvbt_config, | 741 | &dntv_live_dvbt_config, |
628 | &core->i2c_adap); | 742 | &core->i2c_adap); |
629 | if (dev->dvb.frontend != NULL) { | 743 | if (fe0->dvb.frontend != NULL) { |
630 | if (!dvb_attach(dvb_pll_attach, dev->dvb.frontend, | 744 | if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend, |
631 | 0x61, NULL, DVB_PLL_UNKNOWN_1)) | 745 | 0x61, NULL, DVB_PLL_UNKNOWN_1)) |
632 | goto frontend_detach; | 746 | goto frontend_detach; |
633 | } | 747 | } |
@@ -635,10 +749,10 @@ static int dvb_register(struct cx8802_dev *dev) | |||
635 | case CX88_BOARD_DNTV_LIVE_DVB_T_PRO: | 749 | case CX88_BOARD_DNTV_LIVE_DVB_T_PRO: |
636 | #if defined(CONFIG_VIDEO_CX88_VP3054) || (defined(CONFIG_VIDEO_CX88_VP3054_MODULE) && defined(MODULE)) | 750 | #if defined(CONFIG_VIDEO_CX88_VP3054) || (defined(CONFIG_VIDEO_CX88_VP3054_MODULE) && defined(MODULE)) |
637 | /* MT352 is on a secondary I2C bus made from some GPIO lines */ | 751 | /* MT352 is on a secondary I2C bus made from some GPIO lines */ |
638 | dev->dvb.frontend = dvb_attach(mt352_attach, &dntv_live_dvbt_pro_config, | 752 | fe0->dvb.frontend = dvb_attach(mt352_attach, &dntv_live_dvbt_pro_config, |
639 | &dev->vp3054->adap); | 753 | &dev->vp3054->adap); |
640 | if (dev->dvb.frontend != NULL) { | 754 | if (fe0->dvb.frontend != NULL) { |
641 | if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend, | 755 | if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
642 | &core->i2c_adap, 0x61, | 756 | &core->i2c_adap, 0x61, |
643 | TUNER_PHILIPS_FMD1216ME_MK3)) | 757 | TUNER_PHILIPS_FMD1216ME_MK3)) |
644 | goto frontend_detach; | 758 | goto frontend_detach; |
@@ -649,22 +763,22 @@ static int dvb_register(struct cx8802_dev *dev) | |||
649 | #endif | 763 | #endif |
650 | break; | 764 | break; |
651 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID: | 765 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID: |
652 | dev->dvb.frontend = dvb_attach(zl10353_attach, | 766 | fe0->dvb.frontend = dvb_attach(zl10353_attach, |
653 | &dvico_fusionhdtv_hybrid, | 767 | &dvico_fusionhdtv_hybrid, |
654 | &core->i2c_adap); | 768 | &core->i2c_adap); |
655 | if (dev->dvb.frontend != NULL) { | 769 | if (fe0->dvb.frontend != NULL) { |
656 | if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend, | 770 | if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
657 | &core->i2c_adap, 0x61, | 771 | &core->i2c_adap, 0x61, |
658 | TUNER_THOMSON_FE6600)) | 772 | TUNER_THOMSON_FE6600)) |
659 | goto frontend_detach; | 773 | goto frontend_detach; |
660 | } | 774 | } |
661 | break; | 775 | break; |
662 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO: | 776 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO: |
663 | dev->dvb.frontend = dvb_attach(zl10353_attach, | 777 | fe0->dvb.frontend = dvb_attach(zl10353_attach, |
664 | &dvico_fusionhdtv_xc3028, | 778 | &dvico_fusionhdtv_xc3028, |
665 | &core->i2c_adap); | 779 | &core->i2c_adap); |
666 | if (dev->dvb.frontend == NULL) | 780 | if (fe0->dvb.frontend == NULL) |
667 | dev->dvb.frontend = dvb_attach(mt352_attach, | 781 | fe0->dvb.frontend = dvb_attach(mt352_attach, |
668 | &dvico_fusionhdtv_mt352_xc3028, | 782 | &dvico_fusionhdtv_mt352_xc3028, |
669 | &core->i2c_adap); | 783 | &core->i2c_adap); |
670 | /* | 784 | /* |
@@ -672,16 +786,16 @@ static int dvb_register(struct cx8802_dev *dev) | |||
672 | * We must not permit gate_ctrl to be performed, or | 786 | * We must not permit gate_ctrl to be performed, or |
673 | * the xc3028 cannot communicate on the bus. | 787 | * the xc3028 cannot communicate on the bus. |
674 | */ | 788 | */ |
675 | if (dev->dvb.frontend) | 789 | if (fe0->dvb.frontend) |
676 | dev->dvb.frontend->ops.i2c_gate_ctrl = NULL; | 790 | fe0->dvb.frontend->ops.i2c_gate_ctrl = NULL; |
677 | if (attach_xc3028(0x61, dev) < 0) | 791 | if (attach_xc3028(0x61, dev) < 0) |
678 | return -EINVAL; | 792 | goto frontend_detach; |
679 | break; | 793 | break; |
680 | case CX88_BOARD_PCHDTV_HD3000: | 794 | case CX88_BOARD_PCHDTV_HD3000: |
681 | dev->dvb.frontend = dvb_attach(or51132_attach, &pchdtv_hd3000, | 795 | fe0->dvb.frontend = dvb_attach(or51132_attach, &pchdtv_hd3000, |
682 | &core->i2c_adap); | 796 | &core->i2c_adap); |
683 | if (dev->dvb.frontend != NULL) { | 797 | if (fe0->dvb.frontend != NULL) { |
684 | if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend, | 798 | if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
685 | &core->i2c_adap, 0x61, | 799 | &core->i2c_adap, 0x61, |
686 | TUNER_THOMSON_DTT761X)) | 800 | TUNER_THOMSON_DTT761X)) |
687 | goto frontend_detach; | 801 | goto frontend_detach; |
@@ -698,11 +812,11 @@ static int dvb_register(struct cx8802_dev *dev) | |||
698 | 812 | ||
699 | /* Select RF connector callback */ | 813 | /* Select RF connector callback */ |
700 | fusionhdtv_3_gold.pll_rf_set = lgdt330x_pll_rf_set; | 814 | fusionhdtv_3_gold.pll_rf_set = lgdt330x_pll_rf_set; |
701 | dev->dvb.frontend = dvb_attach(lgdt330x_attach, | 815 | fe0->dvb.frontend = dvb_attach(lgdt330x_attach, |
702 | &fusionhdtv_3_gold, | 816 | &fusionhdtv_3_gold, |
703 | &core->i2c_adap); | 817 | &core->i2c_adap); |
704 | if (dev->dvb.frontend != NULL) { | 818 | if (fe0->dvb.frontend != NULL) { |
705 | if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend, | 819 | if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
706 | &core->i2c_adap, 0x61, | 820 | &core->i2c_adap, 0x61, |
707 | TUNER_MICROTUNE_4042FI5)) | 821 | TUNER_MICROTUNE_4042FI5)) |
708 | goto frontend_detach; | 822 | goto frontend_detach; |
@@ -716,11 +830,11 @@ static int dvb_register(struct cx8802_dev *dev) | |||
716 | mdelay(100); | 830 | mdelay(100); |
717 | cx_set(MO_GP0_IO, 9); | 831 | cx_set(MO_GP0_IO, 9); |
718 | mdelay(200); | 832 | mdelay(200); |
719 | dev->dvb.frontend = dvb_attach(lgdt330x_attach, | 833 | fe0->dvb.frontend = dvb_attach(lgdt330x_attach, |
720 | &fusionhdtv_3_gold, | 834 | &fusionhdtv_3_gold, |
721 | &core->i2c_adap); | 835 | &core->i2c_adap); |
722 | if (dev->dvb.frontend != NULL) { | 836 | if (fe0->dvb.frontend != NULL) { |
723 | if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend, | 837 | if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
724 | &core->i2c_adap, 0x61, | 838 | &core->i2c_adap, 0x61, |
725 | TUNER_THOMSON_DTT761X)) | 839 | TUNER_THOMSON_DTT761X)) |
726 | goto frontend_detach; | 840 | goto frontend_detach; |
@@ -734,15 +848,15 @@ static int dvb_register(struct cx8802_dev *dev) | |||
734 | mdelay(100); | 848 | mdelay(100); |
735 | cx_set(MO_GP0_IO, 1); | 849 | cx_set(MO_GP0_IO, 1); |
736 | mdelay(200); | 850 | mdelay(200); |
737 | dev->dvb.frontend = dvb_attach(lgdt330x_attach, | 851 | fe0->dvb.frontend = dvb_attach(lgdt330x_attach, |
738 | &fusionhdtv_5_gold, | 852 | &fusionhdtv_5_gold, |
739 | &core->i2c_adap); | 853 | &core->i2c_adap); |
740 | if (dev->dvb.frontend != NULL) { | 854 | if (fe0->dvb.frontend != NULL) { |
741 | if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend, | 855 | if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
742 | &core->i2c_adap, 0x61, | 856 | &core->i2c_adap, 0x61, |
743 | TUNER_LG_TDVS_H06XF)) | 857 | TUNER_LG_TDVS_H06XF)) |
744 | goto frontend_detach; | 858 | goto frontend_detach; |
745 | if (!dvb_attach(tda9887_attach, dev->dvb.frontend, | 859 | if (!dvb_attach(tda9887_attach, fe0->dvb.frontend, |
746 | &core->i2c_adap, 0x43)) | 860 | &core->i2c_adap, 0x43)) |
747 | goto frontend_detach; | 861 | goto frontend_detach; |
748 | } | 862 | } |
@@ -755,25 +869,25 @@ static int dvb_register(struct cx8802_dev *dev) | |||
755 | mdelay(100); | 869 | mdelay(100); |
756 | cx_set(MO_GP0_IO, 1); | 870 | cx_set(MO_GP0_IO, 1); |
757 | mdelay(200); | 871 | mdelay(200); |
758 | dev->dvb.frontend = dvb_attach(lgdt330x_attach, | 872 | fe0->dvb.frontend = dvb_attach(lgdt330x_attach, |
759 | &pchdtv_hd5500, | 873 | &pchdtv_hd5500, |
760 | &core->i2c_adap); | 874 | &core->i2c_adap); |
761 | if (dev->dvb.frontend != NULL) { | 875 | if (fe0->dvb.frontend != NULL) { |
762 | if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend, | 876 | if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
763 | &core->i2c_adap, 0x61, | 877 | &core->i2c_adap, 0x61, |
764 | TUNER_LG_TDVS_H06XF)) | 878 | TUNER_LG_TDVS_H06XF)) |
765 | goto frontend_detach; | 879 | goto frontend_detach; |
766 | if (!dvb_attach(tda9887_attach, dev->dvb.frontend, | 880 | if (!dvb_attach(tda9887_attach, fe0->dvb.frontend, |
767 | &core->i2c_adap, 0x43)) | 881 | &core->i2c_adap, 0x43)) |
768 | goto frontend_detach; | 882 | goto frontend_detach; |
769 | } | 883 | } |
770 | break; | 884 | break; |
771 | case CX88_BOARD_ATI_HDTVWONDER: | 885 | case CX88_BOARD_ATI_HDTVWONDER: |
772 | dev->dvb.frontend = dvb_attach(nxt200x_attach, | 886 | fe0->dvb.frontend = dvb_attach(nxt200x_attach, |
773 | &ati_hdtvwonder, | 887 | &ati_hdtvwonder, |
774 | &core->i2c_adap); | 888 | &core->i2c_adap); |
775 | if (dev->dvb.frontend != NULL) { | 889 | if (fe0->dvb.frontend != NULL) { |
776 | if (!dvb_attach(simple_tuner_attach, dev->dvb.frontend, | 890 | if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
777 | &core->i2c_adap, 0x61, | 891 | &core->i2c_adap, 0x61, |
778 | TUNER_PHILIPS_TUV1236D)) | 892 | TUNER_PHILIPS_TUV1236D)) |
779 | goto frontend_detach; | 893 | goto frontend_detach; |
@@ -781,107 +895,190 @@ static int dvb_register(struct cx8802_dev *dev) | |||
781 | break; | 895 | break; |
782 | case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1: | 896 | case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1: |
783 | case CX88_BOARD_HAUPPAUGE_NOVASE2_S1: | 897 | case CX88_BOARD_HAUPPAUGE_NOVASE2_S1: |
784 | dev->dvb.frontend = dvb_attach(cx24123_attach, | 898 | fe0->dvb.frontend = dvb_attach(cx24123_attach, |
785 | &hauppauge_novas_config, | 899 | &hauppauge_novas_config, |
786 | &core->i2c_adap); | 900 | &core->i2c_adap); |
787 | if (dev->dvb.frontend) { | 901 | if (fe0->dvb.frontend) { |
788 | if (!dvb_attach(isl6421_attach, dev->dvb.frontend, | 902 | if (!dvb_attach(isl6421_attach, fe0->dvb.frontend, |
789 | &core->i2c_adap, 0x08, 0x00, 0x00)) | 903 | &core->i2c_adap, 0x08, ISL6421_DCL, 0x00)) |
790 | goto frontend_detach; | 904 | goto frontend_detach; |
791 | } | 905 | } |
792 | break; | 906 | break; |
793 | case CX88_BOARD_KWORLD_DVBS_100: | 907 | case CX88_BOARD_KWORLD_DVBS_100: |
794 | dev->dvb.frontend = dvb_attach(cx24123_attach, | 908 | fe0->dvb.frontend = dvb_attach(cx24123_attach, |
795 | &kworld_dvbs_100_config, | 909 | &kworld_dvbs_100_config, |
796 | &core->i2c_adap); | 910 | &core->i2c_adap); |
797 | if (dev->dvb.frontend) { | 911 | if (fe0->dvb.frontend) { |
798 | core->prev_set_voltage = dev->dvb.frontend->ops.set_voltage; | 912 | core->prev_set_voltage = fe0->dvb.frontend->ops.set_voltage; |
799 | dev->dvb.frontend->ops.set_voltage = kworld_dvbs_100_set_voltage; | 913 | fe0->dvb.frontend->ops.set_voltage = kworld_dvbs_100_set_voltage; |
800 | } | 914 | } |
801 | break; | 915 | break; |
802 | case CX88_BOARD_GENIATECH_DVBS: | 916 | case CX88_BOARD_GENIATECH_DVBS: |
803 | dev->dvb.frontend = dvb_attach(cx24123_attach, | 917 | fe0->dvb.frontend = dvb_attach(cx24123_attach, |
804 | &geniatech_dvbs_config, | 918 | &geniatech_dvbs_config, |
805 | &core->i2c_adap); | 919 | &core->i2c_adap); |
806 | if (dev->dvb.frontend) { | 920 | if (fe0->dvb.frontend) { |
807 | core->prev_set_voltage = dev->dvb.frontend->ops.set_voltage; | 921 | core->prev_set_voltage = fe0->dvb.frontend->ops.set_voltage; |
808 | dev->dvb.frontend->ops.set_voltage = geniatech_dvbs_set_voltage; | 922 | fe0->dvb.frontend->ops.set_voltage = geniatech_dvbs_set_voltage; |
809 | } | 923 | } |
810 | break; | 924 | break; |
811 | case CX88_BOARD_PINNACLE_PCTV_HD_800i: | 925 | case CX88_BOARD_PINNACLE_PCTV_HD_800i: |
812 | dev->dvb.frontend = dvb_attach(s5h1409_attach, | 926 | fe0->dvb.frontend = dvb_attach(s5h1409_attach, |
813 | &pinnacle_pctv_hd_800i_config, | 927 | &pinnacle_pctv_hd_800i_config, |
814 | &core->i2c_adap); | 928 | &core->i2c_adap); |
815 | if (dev->dvb.frontend != NULL) { | 929 | if (fe0->dvb.frontend != NULL) { |
816 | /* tuner_config.video_dev must point to | 930 | if (!dvb_attach(xc5000_attach, fe0->dvb.frontend, |
817 | * i2c_adap.algo_data | ||
818 | */ | ||
819 | if (!dvb_attach(xc5000_attach, dev->dvb.frontend, | ||
820 | &core->i2c_adap, | 931 | &core->i2c_adap, |
821 | &pinnacle_pctv_hd_800i_tuner_config, | 932 | &pinnacle_pctv_hd_800i_tuner_config)) |
822 | core->i2c_adap.algo_data)) | ||
823 | goto frontend_detach; | 933 | goto frontend_detach; |
824 | } | 934 | } |
825 | break; | 935 | break; |
826 | case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO: | 936 | case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO: |
827 | dev->dvb.frontend = dvb_attach(s5h1409_attach, | 937 | fe0->dvb.frontend = dvb_attach(s5h1409_attach, |
828 | &dvico_hdtv5_pci_nano_config, | 938 | &dvico_hdtv5_pci_nano_config, |
829 | &core->i2c_adap); | 939 | &core->i2c_adap); |
830 | if (dev->dvb.frontend != NULL) { | 940 | if (fe0->dvb.frontend != NULL) { |
831 | struct dvb_frontend *fe; | 941 | struct dvb_frontend *fe; |
832 | struct xc2028_config cfg = { | 942 | struct xc2028_config cfg = { |
833 | .i2c_adap = &core->i2c_adap, | 943 | .i2c_adap = &core->i2c_adap, |
834 | .i2c_addr = 0x61, | 944 | .i2c_addr = 0x61, |
835 | .callback = cx88_pci_nano_callback, | ||
836 | }; | 945 | }; |
837 | static struct xc2028_ctrl ctl = { | 946 | static struct xc2028_ctrl ctl = { |
838 | .fname = "xc3028-v27.fw", | 947 | .fname = XC2028_DEFAULT_FIRMWARE, |
839 | .max_len = 64, | 948 | .max_len = 64, |
840 | .scode_table = XC3028_FE_OREN538, | 949 | .scode_table = XC3028_FE_OREN538, |
841 | }; | 950 | }; |
842 | 951 | ||
843 | fe = dvb_attach(xc2028_attach, | 952 | fe = dvb_attach(xc2028_attach, |
844 | dev->dvb.frontend, &cfg); | 953 | fe0->dvb.frontend, &cfg); |
845 | if (fe != NULL && fe->ops.tuner_ops.set_config != NULL) | 954 | if (fe != NULL && fe->ops.tuner_ops.set_config != NULL) |
846 | fe->ops.tuner_ops.set_config(fe, &ctl); | 955 | fe->ops.tuner_ops.set_config(fe, &ctl); |
847 | } | 956 | } |
848 | break; | 957 | break; |
849 | case CX88_BOARD_PINNACLE_HYBRID_PCTV: | 958 | case CX88_BOARD_PINNACLE_HYBRID_PCTV: |
850 | dev->dvb.frontend = dvb_attach(zl10353_attach, | 959 | fe0->dvb.frontend = dvb_attach(zl10353_attach, |
851 | &cx88_geniatech_x8000_mt, | 960 | &cx88_pinnacle_hybrid_pctv, |
852 | &core->i2c_adap); | 961 | &core->i2c_adap); |
853 | if (attach_xc3028(0x61, dev) < 0) | 962 | if (fe0->dvb.frontend) { |
854 | goto frontend_detach; | 963 | fe0->dvb.frontend->ops.i2c_gate_ctrl = NULL; |
964 | if (attach_xc3028(0x61, dev) < 0) | ||
965 | goto frontend_detach; | ||
966 | } | ||
855 | break; | 967 | break; |
856 | case CX88_BOARD_GENIATECH_X8000_MT: | 968 | case CX88_BOARD_GENIATECH_X8000_MT: |
857 | dev->ts_gen_cntrl = 0x00; | 969 | dev->ts_gen_cntrl = 0x00; |
858 | 970 | ||
859 | dev->dvb.frontend = dvb_attach(zl10353_attach, | 971 | fe0->dvb.frontend = dvb_attach(zl10353_attach, |
860 | &cx88_geniatech_x8000_mt, | 972 | &cx88_geniatech_x8000_mt, |
861 | &core->i2c_adap); | 973 | &core->i2c_adap); |
862 | if (attach_xc3028(0x61, dev) < 0) | 974 | if (attach_xc3028(0x61, dev) < 0) |
863 | goto frontend_detach; | 975 | goto frontend_detach; |
864 | break; | 976 | break; |
865 | case CX88_BOARD_KWORLD_ATSC_120: | 977 | case CX88_BOARD_KWORLD_ATSC_120: |
866 | dev->dvb.frontend = dvb_attach(s5h1409_attach, | 978 | fe0->dvb.frontend = dvb_attach(s5h1409_attach, |
867 | &kworld_atsc_120_config, | 979 | &kworld_atsc_120_config, |
868 | &core->i2c_adap); | 980 | &core->i2c_adap); |
869 | if (attach_xc3028(0x61, dev) < 0) | 981 | if (attach_xc3028(0x61, dev) < 0) |
870 | goto frontend_detach; | 982 | goto frontend_detach; |
871 | break; | 983 | break; |
872 | case CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD: | 984 | case CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD: |
873 | dev->dvb.frontend = dvb_attach(s5h1411_attach, | 985 | fe0->dvb.frontend = dvb_attach(s5h1411_attach, |
874 | &dvico_fusionhdtv7_config, | 986 | &dvico_fusionhdtv7_config, |
875 | &core->i2c_adap); | 987 | &core->i2c_adap); |
876 | if (dev->dvb.frontend != NULL) { | 988 | if (fe0->dvb.frontend != NULL) { |
877 | /* tuner_config.video_dev must point to | 989 | if (!dvb_attach(xc5000_attach, fe0->dvb.frontend, |
878 | * i2c_adap.algo_data | ||
879 | */ | ||
880 | if (!dvb_attach(xc5000_attach, dev->dvb.frontend, | ||
881 | &core->i2c_adap, | 990 | &core->i2c_adap, |
882 | &dvico_fusionhdtv7_tuner_config, | 991 | &dvico_fusionhdtv7_tuner_config)) |
883 | core->i2c_adap.algo_data)) | 992 | goto frontend_detach; |
993 | } | ||
994 | break; | ||
995 | case CX88_BOARD_HAUPPAUGE_HVR4000: | ||
996 | /* DVB-S/S2 Init */ | ||
997 | fe0->dvb.frontend = dvb_attach(cx24116_attach, | ||
998 | &hauppauge_hvr4000_config, | ||
999 | &dev->core->i2c_adap); | ||
1000 | if (fe0->dvb.frontend) { | ||
1001 | if(!dvb_attach(isl6421_attach, fe0->dvb.frontend, | ||
1002 | &dev->core->i2c_adap, 0x08, ISL6421_DCL, 0x00)) { | ||
1003 | dprintk( 1, "%s(): HVR4000 - DVB-S LNB Init: failed\n", __func__); | ||
1004 | } | ||
1005 | } else { | ||
1006 | dprintk( 1, "%s(): HVR4000 - DVB-S Init: failed\n", __func__); | ||
1007 | } | ||
1008 | /* DVB-T Init */ | ||
1009 | fe1 = videobuf_dvb_get_frontend(&dev->frontends, 2); | ||
1010 | if (fe1) { | ||
1011 | dev->frontends.gate = 2; | ||
1012 | mfe_shared = 1; | ||
1013 | fe1->dvb.frontend = dvb_attach(cx22702_attach, | ||
1014 | &hauppauge_hvr_config, | ||
1015 | &dev->core->i2c_adap); | ||
1016 | if (fe1->dvb.frontend) { | ||
1017 | fe1->dvb.frontend->id = 1; | ||
1018 | if(!dvb_attach(simple_tuner_attach, fe1->dvb.frontend, | ||
1019 | &dev->core->i2c_adap, 0x61, | ||
1020 | TUNER_PHILIPS_FMD1216ME_MK3)) { | ||
1021 | dprintk( 1, "%s(): HVR4000 - DVB-T misc Init: failed\n", __func__); | ||
1022 | } | ||
1023 | } else { | ||
1024 | dprintk( 1, "%s(): HVR4000 - DVB-T Init: failed\n", __func__); | ||
1025 | } | ||
1026 | } else { | ||
1027 | dprintk( 1, "%s(): HVR4000 - DVB-T Init: can't find frontend 2.\n", __func__); | ||
1028 | } | ||
1029 | break; | ||
1030 | case CX88_BOARD_HAUPPAUGE_HVR4000LITE: | ||
1031 | fe0->dvb.frontend = dvb_attach(cx24116_attach, | ||
1032 | &hauppauge_hvr4000_config, | ||
1033 | &dev->core->i2c_adap); | ||
1034 | if (fe0->dvb.frontend) { | ||
1035 | dvb_attach(isl6421_attach, fe0->dvb.frontend, | ||
1036 | &dev->core->i2c_adap, | ||
1037 | 0x08, ISL6421_DCL, 0x00); | ||
1038 | } | ||
1039 | break; | ||
1040 | case CX88_BOARD_TEVII_S420: | ||
1041 | fe0->dvb.frontend = dvb_attach(stv0299_attach, | ||
1042 | &tevii_tuner_sharp_config, | ||
1043 | &core->i2c_adap); | ||
1044 | if (fe0->dvb.frontend != NULL) { | ||
1045 | if (!dvb_attach(dvb_pll_attach, fe0->dvb.frontend, 0x60, | ||
1046 | &core->i2c_adap, DVB_PLL_OPERA1)) | ||
884 | goto frontend_detach; | 1047 | goto frontend_detach; |
1048 | core->prev_set_voltage = fe0->dvb.frontend->ops.set_voltage; | ||
1049 | fe0->dvb.frontend->ops.set_voltage = tevii_dvbs_set_voltage; | ||
1050 | |||
1051 | } else { | ||
1052 | fe0->dvb.frontend = dvb_attach(stv0288_attach, | ||
1053 | &tevii_tuner_earda_config, | ||
1054 | &core->i2c_adap); | ||
1055 | if (fe0->dvb.frontend != NULL) { | ||
1056 | if (!dvb_attach(stb6000_attach, fe0->dvb.frontend, 0x61, | ||
1057 | &core->i2c_adap)) | ||
1058 | goto frontend_detach; | ||
1059 | core->prev_set_voltage = fe0->dvb.frontend->ops.set_voltage; | ||
1060 | fe0->dvb.frontend->ops.set_voltage = tevii_dvbs_set_voltage; | ||
1061 | } | ||
1062 | } | ||
1063 | break; | ||
1064 | case CX88_BOARD_TEVII_S460: | ||
1065 | fe0->dvb.frontend = dvb_attach(cx24116_attach, | ||
1066 | &tevii_s460_config, | ||
1067 | &core->i2c_adap); | ||
1068 | if (fe0->dvb.frontend != NULL) { | ||
1069 | core->prev_set_voltage = fe0->dvb.frontend->ops.set_voltage; | ||
1070 | fe0->dvb.frontend->ops.set_voltage = tevii_dvbs_set_voltage; | ||
1071 | } | ||
1072 | break; | ||
1073 | case CX88_BOARD_OMICOM_SS4_PCI: | ||
1074 | case CX88_BOARD_TBS_8920: | ||
1075 | case CX88_BOARD_PROF_7300: | ||
1076 | fe0->dvb.frontend = dvb_attach(cx24116_attach, | ||
1077 | &hauppauge_hvr4000_config, | ||
1078 | &core->i2c_adap); | ||
1079 | if (fe0->dvb.frontend != NULL) { | ||
1080 | core->prev_set_voltage = fe0->dvb.frontend->ops.set_voltage; | ||
1081 | fe0->dvb.frontend->ops.set_voltage = tevii_dvbs_set_voltage; | ||
885 | } | 1082 | } |
886 | break; | 1083 | break; |
887 | default: | 1084 | default: |
@@ -889,28 +1086,30 @@ static int dvb_register(struct cx8802_dev *dev) | |||
889 | core->name); | 1086 | core->name); |
890 | break; | 1087 | break; |
891 | } | 1088 | } |
892 | if (NULL == dev->dvb.frontend) { | 1089 | |
1090 | if ( (NULL == fe0->dvb.frontend) || (fe1 && NULL == fe1->dvb.frontend) ) { | ||
893 | printk(KERN_ERR | 1091 | printk(KERN_ERR |
894 | "%s/2: frontend initialization failed\n", | 1092 | "%s/2: frontend initialization failed\n", |
895 | core->name); | 1093 | core->name); |
896 | return -EINVAL; | 1094 | return -EINVAL; |
897 | } | 1095 | } |
1096 | /* define general-purpose callback pointer */ | ||
1097 | fe0->dvb.frontend->callback = cx88_tuner_callback; | ||
898 | 1098 | ||
899 | /* Ensure all frontends negotiate bus access */ | 1099 | /* Ensure all frontends negotiate bus access */ |
900 | 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; | ||
901 | 1103 | ||
902 | /* Put the analog decoder in standby to keep it quiet */ | 1104 | /* Put the analog decoder in standby to keep it quiet */ |
903 | cx88_call_i2c_clients(core, TUNER_SET_STANDBY, NULL); | 1105 | cx88_call_i2c_clients(core, TUNER_SET_STANDBY, NULL); |
904 | 1106 | ||
905 | /* register everything */ | 1107 | /* register everything */ |
906 | return videobuf_dvb_register(&dev->dvb, THIS_MODULE, dev, | 1108 | return videobuf_dvb_register_bus(&dev->frontends, THIS_MODULE, dev, |
907 | &dev->pci->dev, adapter_nr); | 1109 | &dev->pci->dev, adapter_nr, mfe_shared); |
908 | 1110 | ||
909 | frontend_detach: | 1111 | frontend_detach: |
910 | if (dev->dvb.frontend) { | 1112 | videobuf_dvb_dealloc_frontends(&dev->frontends); |
911 | dvb_frontend_detach(dev->dvb.frontend); | ||
912 | dev->dvb.frontend = NULL; | ||
913 | } | ||
914 | return -EINVAL; | 1113 | return -EINVAL; |
915 | } | 1114 | } |
916 | 1115 | ||
@@ -933,6 +1132,38 @@ static int cx8802_dvb_advise_acquire(struct cx8802_driver *drv) | |||
933 | cx_clear(MO_GP0_IO, 0x00000004); | 1132 | cx_clear(MO_GP0_IO, 0x00000004); |
934 | udelay(1000); | 1133 | udelay(1000); |
935 | break; | 1134 | break; |
1135 | |||
1136 | case CX88_BOARD_HAUPPAUGE_HVR3000: | ||
1137 | case CX88_BOARD_HAUPPAUGE_HVR4000: | ||
1138 | if(core->dvbdev->frontends.active_fe_id == 1) { | ||
1139 | /* DVB-S/S2 Enabled */ | ||
1140 | |||
1141 | /* Toggle reset on cx22702 leaving i2c active */ | ||
1142 | cx_write(MO_GP0_IO, (core->board.input[0].gpio0 & 0x0000ff00) | 0x00000080); | ||
1143 | udelay(1000); | ||
1144 | cx_clear(MO_GP0_IO, 0x00000080); | ||
1145 | udelay(50); | ||
1146 | cx_set(MO_GP0_IO, 0x00000080); /* cx22702 out of reset */ | ||
1147 | cx_set(MO_GP0_IO, 0x00000004); /* tri-state the cx22702 pins */ | ||
1148 | udelay(1000); | ||
1149 | |||
1150 | cx_write(MO_SRST_IO, 1); /* Take the cx24116/cx24123 out of reset */ | ||
1151 | core->dvbdev->ts_gen_cntrl = 0x02; /* Parallel IO */ | ||
1152 | } else | ||
1153 | if (core->dvbdev->frontends.active_fe_id == 2) { | ||
1154 | /* DVB-T Enabled */ | ||
1155 | |||
1156 | /* Put the cx24116/cx24123 into reset */ | ||
1157 | cx_write(MO_SRST_IO, 0); | ||
1158 | |||
1159 | /* cx22702 out of reset and enable it */ | ||
1160 | cx_set(MO_GP0_IO, 0x00000080); | ||
1161 | cx_clear(MO_GP0_IO, 0x00000004); | ||
1162 | core->dvbdev->ts_gen_cntrl = 0x0c; /* Serial IO */ | ||
1163 | udelay(1000); | ||
1164 | } | ||
1165 | break; | ||
1166 | |||
936 | default: | 1167 | default: |
937 | err = -ENODEV; | 1168 | err = -ENODEV; |
938 | } | 1169 | } |
@@ -950,6 +1181,9 @@ static int cx8802_dvb_advise_release(struct cx8802_driver *drv) | |||
950 | case CX88_BOARD_HAUPPAUGE_HVR1300: | 1181 | case CX88_BOARD_HAUPPAUGE_HVR1300: |
951 | /* Do Nothing, leave the cx22702 on the bus. */ | 1182 | /* Do Nothing, leave the cx22702 on the bus. */ |
952 | break; | 1183 | break; |
1184 | case CX88_BOARD_HAUPPAUGE_HVR3000: | ||
1185 | case CX88_BOARD_HAUPPAUGE_HVR4000: | ||
1186 | break; | ||
953 | default: | 1187 | default: |
954 | err = -ENODEV; | 1188 | err = -ENODEV; |
955 | } | 1189 | } |
@@ -960,7 +1194,8 @@ static int cx8802_dvb_probe(struct cx8802_driver *drv) | |||
960 | { | 1194 | { |
961 | struct cx88_core *core = drv->core; | 1195 | struct cx88_core *core = drv->core; |
962 | struct cx8802_dev *dev = drv->core->dvbdev; | 1196 | struct cx8802_dev *dev = drv->core->dvbdev; |
963 | int err; | 1197 | int err, i; |
1198 | struct videobuf_dvb_frontend *fe; | ||
964 | 1199 | ||
965 | dprintk( 1, "%s\n", __func__); | 1200 | dprintk( 1, "%s\n", __func__); |
966 | dprintk( 1, " ->being probed by Card=%d Name=%s, PCI %02x:%02x\n", | 1201 | dprintk( 1, " ->being probed by Card=%d Name=%s, PCI %02x:%02x\n", |
@@ -980,28 +1215,39 @@ static int cx8802_dvb_probe(struct cx8802_driver *drv) | |||
980 | 1215 | ||
981 | /* dvb stuff */ | 1216 | /* dvb stuff */ |
982 | printk(KERN_INFO "%s/2: cx2388x based DVB/ATSC card\n", core->name); | 1217 | printk(KERN_INFO "%s/2: cx2388x based DVB/ATSC card\n", core->name); |
983 | videobuf_queue_sg_init(&dev->dvb.dvbq, &dvb_qops, | 1218 | dev->ts_gen_cntrl = 0x0c; |
1219 | |||
1220 | for (i = 1; i <= core->board.num_frontends; i++) { | ||
1221 | fe = videobuf_dvb_get_frontend(&core->dvbdev->frontends, i); | ||
1222 | if (!fe) { | ||
1223 | printk(KERN_ERR "%s() failed to get frontend(%d)\n", __func__, i); | ||
1224 | continue; | ||
1225 | } | ||
1226 | videobuf_queue_sg_init(&fe->dvb.dvbq, &dvb_qops, | ||
984 | &dev->pci->dev, &dev->slock, | 1227 | &dev->pci->dev, &dev->slock, |
985 | V4L2_BUF_TYPE_VIDEO_CAPTURE, | 1228 | V4L2_BUF_TYPE_VIDEO_CAPTURE, |
986 | V4L2_FIELD_TOP, | 1229 | V4L2_FIELD_TOP, |
987 | sizeof(struct cx88_buffer), | 1230 | sizeof(struct cx88_buffer), |
988 | dev); | 1231 | dev); |
1232 | /* init struct videobuf_dvb */ | ||
1233 | fe->dvb.name = dev->core->name; | ||
1234 | } | ||
989 | err = dvb_register(dev); | 1235 | err = dvb_register(dev); |
990 | if (err != 0) | 1236 | if (err != 0) |
991 | printk(KERN_ERR "%s/2: dvb_register failed (err = %d)\n", | 1237 | printk(KERN_ERR "%s/2: dvb_register failed (err = %d)\n", |
992 | core->name, err); | 1238 | core->name, err); |
993 | 1239 | fail_core: | |
994 | fail_core: | ||
995 | return err; | 1240 | return err; |
996 | } | 1241 | } |
997 | 1242 | ||
998 | static int cx8802_dvb_remove(struct cx8802_driver *drv) | 1243 | static int cx8802_dvb_remove(struct cx8802_driver *drv) |
999 | { | 1244 | { |
1245 | struct cx88_core *core = drv->core; | ||
1000 | struct cx8802_dev *dev = drv->core->dvbdev; | 1246 | struct cx8802_dev *dev = drv->core->dvbdev; |
1001 | 1247 | ||
1002 | /* dvb */ | 1248 | dprintk( 1, "%s\n", __func__); |
1003 | if (dev->dvb.frontend) | 1249 | |
1004 | videobuf_dvb_unregister(&dev->dvb); | 1250 | videobuf_dvb_unregister_bus(&dev->frontends); |
1005 | 1251 | ||
1006 | vp3054_i2c_remove(dev); | 1252 | vp3054_i2c_remove(dev); |
1007 | 1253 | ||