em28xx-dvb.c (0d4a42f6bd298e826620585e766a154ab460617a) em28xx-dvb.c (4159d01bea38ee82f6e49383b7e73e328c118755)
1/*
2 DVB device driver for em28xx
3
4 (c) 2008-2011 Mauro Carvalho Chehab <mchehab@infradead.org>
5
6 (c) 2008 Devin Heitmueller <devin.heitmueller@gmail.com>
7 - Fixes for the driver to properly work with HVR-950
8 - Fixes for the driver to properly work with Pinnacle PCTV HD Pro Stick

--- 36 unchanged lines hidden (view full) ---

45#include "s921.h"
46#include "drxd.h"
47#include "cxd2820r.h"
48#include "tda18271c2dd.h"
49#include "drxk.h"
50#include "tda10071.h"
51#include "a8293.h"
52#include "qt1010.h"
1/*
2 DVB device driver for em28xx
3
4 (c) 2008-2011 Mauro Carvalho Chehab <mchehab@infradead.org>
5
6 (c) 2008 Devin Heitmueller <devin.heitmueller@gmail.com>
7 - Fixes for the driver to properly work with HVR-950
8 - Fixes for the driver to properly work with Pinnacle PCTV HD Pro Stick

--- 36 unchanged lines hidden (view full) ---

45#include "s921.h"
46#include "drxd.h"
47#include "cxd2820r.h"
48#include "tda18271c2dd.h"
49#include "drxk.h"
50#include "tda10071.h"
51#include "a8293.h"
52#include "qt1010.h"
53#include "mb86a20s.h"
53
54MODULE_DESCRIPTION("driver for em28xx based DVB cards");
55MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@infradead.org>");
56MODULE_LICENSE("GPL");
57
58static unsigned int debug;
59module_param(debug, int, 0644);
60MODULE_PARM_DESC(debug, "enable debug messages [dvb]");

--- 154 unchanged lines hidden (view full) ---

215}
216
217static int em28xx_stop_streaming(struct em28xx_dvb *dvb)
218{
219 struct em28xx *dev = dvb->adapter.priv;
220
221 em28xx_stop_urbs(dev);
222
54
55MODULE_DESCRIPTION("driver for em28xx based DVB cards");
56MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@infradead.org>");
57MODULE_LICENSE("GPL");
58
59static unsigned int debug;
60module_param(debug, int, 0644);
61MODULE_PARM_DESC(debug, "enable debug messages [dvb]");

--- 154 unchanged lines hidden (view full) ---

216}
217
218static int em28xx_stop_streaming(struct em28xx_dvb *dvb)
219{
220 struct em28xx *dev = dvb->adapter.priv;
221
222 em28xx_stop_urbs(dev);
223
223 em28xx_set_mode(dev, EM28XX_SUSPEND);
224
225 return 0;
226}
227
228static int em28xx_start_feed(struct dvb_demux_feed *feed)
229{
230 struct dvb_demux *demux = feed->demux;
231 struct em28xx_dvb *dvb = demux->priv;
232 int rc, ret;

--- 227 unchanged lines hidden (view full) ---

460 };
461
462 em28xx_gpio_set(dev, hauppauge_hvr930c_init);
463 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40);
464 msleep(10);
465 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44);
466 msleep(10);
467
224 return 0;
225}
226
227static int em28xx_start_feed(struct dvb_demux_feed *feed)
228{
229 struct dvb_demux *demux = feed->demux;
230 struct em28xx_dvb *dvb = demux->priv;
231 int rc, ret;

--- 227 unchanged lines hidden (view full) ---

459 };
460
461 em28xx_gpio_set(dev, hauppauge_hvr930c_init);
462 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40);
463 msleep(10);
464 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44);
465 msleep(10);
466
468 dev->i2c_client.addr = 0x82 >> 1;
467 dev->i2c_client[dev->def_i2c_bus].addr = 0x82 >> 1;
469
470 for (i = 0; i < ARRAY_SIZE(regs); i++)
468
469 for (i = 0; i < ARRAY_SIZE(regs); i++)
471 i2c_master_send(&dev->i2c_client, regs[i].r, regs[i].len);
470 i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], regs[i].r, regs[i].len);
472 em28xx_gpio_set(dev, hauppauge_hvr930c_end);
473
474 msleep(100);
475
476 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44);
477 msleep(30);
478
479 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x45);

--- 37 unchanged lines hidden (view full) ---

517 };
518
519 em28xx_gpio_set(dev, terratec_h5_init);
520 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40);
521 msleep(10);
522 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x45);
523 msleep(10);
524
471 em28xx_gpio_set(dev, hauppauge_hvr930c_end);
472
473 msleep(100);
474
475 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44);
476 msleep(30);
477
478 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x45);

--- 37 unchanged lines hidden (view full) ---

516 };
517
518 em28xx_gpio_set(dev, terratec_h5_init);
519 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40);
520 msleep(10);
521 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x45);
522 msleep(10);
523
525 dev->i2c_client.addr = 0x82 >> 1;
524 dev->i2c_client[dev->def_i2c_bus].addr = 0x82 >> 1;
526
527 for (i = 0; i < ARRAY_SIZE(regs); i++)
525
526 for (i = 0; i < ARRAY_SIZE(regs); i++)
528 i2c_master_send(&dev->i2c_client, regs[i].r, regs[i].len);
527 i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], regs[i].r, regs[i].len);
529 em28xx_gpio_set(dev, terratec_h5_end);
530};
531
532static void terratec_htc_stick_init(struct em28xx *dev)
533{
534 int i;
535
536 /*

--- 33 unchanged lines hidden (view full) ---

570
571 em28xx_gpio_set(dev, terratec_htc_stick_init);
572
573 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40);
574 msleep(10);
575 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44);
576 msleep(10);
577
528 em28xx_gpio_set(dev, terratec_h5_end);
529};
530
531static void terratec_htc_stick_init(struct em28xx *dev)
532{
533 int i;
534
535 /*

--- 33 unchanged lines hidden (view full) ---

569
570 em28xx_gpio_set(dev, terratec_htc_stick_init);
571
572 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40);
573 msleep(10);
574 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44);
575 msleep(10);
576
578 dev->i2c_client.addr = 0x82 >> 1;
577 dev->i2c_client[dev->def_i2c_bus].addr = 0x82 >> 1;
579
580 for (i = 0; i < ARRAY_SIZE(regs); i++)
578
579 for (i = 0; i < ARRAY_SIZE(regs); i++)
581 i2c_master_send(&dev->i2c_client, regs[i].r, regs[i].len);
580 i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], regs[i].r, regs[i].len);
582
583 em28xx_gpio_set(dev, terratec_htc_stick_end);
584};
585
586static void terratec_htc_usb_xs_init(struct em28xx *dev)
587{
588 int i;
589

--- 38 unchanged lines hidden (view full) ---

628
629 em28xx_gpio_set(dev, terratec_htc_usb_xs_init);
630
631 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40);
632 msleep(10);
633 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44);
634 msleep(10);
635
581
582 em28xx_gpio_set(dev, terratec_htc_stick_end);
583};
584
585static void terratec_htc_usb_xs_init(struct em28xx *dev)
586{
587 int i;
588

--- 38 unchanged lines hidden (view full) ---

627
628 em28xx_gpio_set(dev, terratec_htc_usb_xs_init);
629
630 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40);
631 msleep(10);
632 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44);
633 msleep(10);
634
636 dev->i2c_client.addr = 0x82 >> 1;
635 dev->i2c_client[dev->def_i2c_bus].addr = 0x82 >> 1;
637
638 for (i = 0; i < ARRAY_SIZE(regs); i++)
636
637 for (i = 0; i < ARRAY_SIZE(regs); i++)
639 i2c_master_send(&dev->i2c_client, regs[i].r, regs[i].len);
638 i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], regs[i].r, regs[i].len);
640
641 em28xx_gpio_set(dev, terratec_htc_usb_xs_end);
642};
643
644static void pctv_520e_init(struct em28xx *dev)
645{
646 /*
647 * Init AVF4910B analog decoder. Looks like I2C traffic to

--- 9 unchanged lines hidden (view full) ---

657 {{ 0x01, 0x02, 0x00, 0xc6 }, 4},
658 {{ 0x01, 0x00 }, 2},
659 {{ 0x01, 0x00, 0xff, 0xaf }, 4},
660 {{ 0x01, 0x00, 0x03, 0xa0 }, 4},
661 {{ 0x01, 0x00 }, 2},
662 {{ 0x01, 0x00, 0x73, 0xaf }, 4},
663 };
664
639
640 em28xx_gpio_set(dev, terratec_htc_usb_xs_end);
641};
642
643static void pctv_520e_init(struct em28xx *dev)
644{
645 /*
646 * Init AVF4910B analog decoder. Looks like I2C traffic to

--- 9 unchanged lines hidden (view full) ---

656 {{ 0x01, 0x02, 0x00, 0xc6 }, 4},
657 {{ 0x01, 0x00 }, 2},
658 {{ 0x01, 0x00, 0xff, 0xaf }, 4},
659 {{ 0x01, 0x00, 0x03, 0xa0 }, 4},
660 {{ 0x01, 0x00 }, 2},
661 {{ 0x01, 0x00, 0x73, 0xaf }, 4},
662 };
663
665 dev->i2c_client.addr = 0x82 >> 1; /* 0x41 */
664 dev->i2c_client[dev->def_i2c_bus].addr = 0x82 >> 1; /* 0x41 */
666
667 for (i = 0; i < ARRAY_SIZE(regs); i++)
665
666 for (i = 0; i < ARRAY_SIZE(regs); i++)
668 i2c_master_send(&dev->i2c_client, regs[i].r, regs[i].len);
667 i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], regs[i].r, regs[i].len);
669};
670
671static int em28xx_pctv_290e_set_lna(struct dvb_frontend *fe)
672{
673 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
674 struct em28xx *dev = fe->dvb->priv;
675#ifdef CONFIG_GPIOLIB
676 struct em28xx_dvb *dvb = dev->dvb;

--- 86 unchanged lines hidden (view full) ---

763static struct zl10353_config em28xx_zl10353_no_i2c_gate_dev = {
764 .demod_address = (0x1e >> 1),
765 .disable_i2c_gate_ctrl = 1,
766 .no_tuner = 1,
767 .parallel_ts = 1,
768};
769static struct qt1010_config em28xx_qt1010_config = {
770 .i2c_address = 0x62
668};
669
670static int em28xx_pctv_290e_set_lna(struct dvb_frontend *fe)
671{
672 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
673 struct em28xx *dev = fe->dvb->priv;
674#ifdef CONFIG_GPIOLIB
675 struct em28xx_dvb *dvb = dev->dvb;

--- 86 unchanged lines hidden (view full) ---

762static struct zl10353_config em28xx_zl10353_no_i2c_gate_dev = {
763 .demod_address = (0x1e >> 1),
764 .disable_i2c_gate_ctrl = 1,
765 .no_tuner = 1,
766 .parallel_ts = 1,
767};
768static struct qt1010_config em28xx_qt1010_config = {
769 .i2c_address = 0x62
770};
771
771
772static const struct mb86a20s_config c3tech_duo_mb86a20s_config = {
773 .demod_address = 0x10,
774 .is_serial = true,
772};
773
775};
776
777static struct tda18271_std_map mb86a20s_tda18271_config = {
778 .dvbt_6 = { .if_freq = 4000, .agc_mode = 3, .std = 4,
779 .if_lvl = 1, .rfagc_top = 0x37, },
780};
781
782static struct tda18271_config c3tech_duo_tda18271_config = {
783 .std_map = &mb86a20s_tda18271_config,
784 .gate = TDA18271_GATE_DIGITAL,
785 .small_i2c = TDA18271_03_BYTE_CHUNK_INIT,
786};
787
788
774/* ------------------------------------------------------------------ */
775
776static int em28xx_attach_xc3028(u8 addr, struct em28xx *dev)
777{
778 struct dvb_frontend *fe;
779 struct xc2028_config cfg;
780
781 memset(&cfg, 0, sizeof(cfg));
789/* ------------------------------------------------------------------ */
790
791static int em28xx_attach_xc3028(u8 addr, struct em28xx *dev)
792{
793 struct dvb_frontend *fe;
794 struct xc2028_config cfg;
795
796 memset(&cfg, 0, sizeof(cfg));
782 cfg.i2c_adap = &dev->i2c_adap;
797 cfg.i2c_adap = &dev->i2c_adap[dev->def_i2c_bus];
783 cfg.i2c_addr = addr;
784
785 if (!dev->dvb->fe[0]) {
786 em28xx_errdev("/2: dvb frontend not attached. "
787 "Can't attach xc3028\n");
788 return -EINVAL;
789 }
790

--- 166 unchanged lines hidden (view full) ---

957 dvb->fe[0] = dvb->fe[1] = NULL;
958
959 mutex_lock(&dev->lock);
960 em28xx_set_mode(dev, EM28XX_DIGITAL_MODE);
961 /* init frontend */
962 switch (dev->model) {
963 case EM2874_BOARD_LEADERSHIP_ISDBT:
964 dvb->fe[0] = dvb_attach(s921_attach,
798 cfg.i2c_addr = addr;
799
800 if (!dev->dvb->fe[0]) {
801 em28xx_errdev("/2: dvb frontend not attached. "
802 "Can't attach xc3028\n");
803 return -EINVAL;
804 }
805

--- 166 unchanged lines hidden (view full) ---

972 dvb->fe[0] = dvb->fe[1] = NULL;
973
974 mutex_lock(&dev->lock);
975 em28xx_set_mode(dev, EM28XX_DIGITAL_MODE);
976 /* init frontend */
977 switch (dev->model) {
978 case EM2874_BOARD_LEADERSHIP_ISDBT:
979 dvb->fe[0] = dvb_attach(s921_attach,
965 &sharp_isdbt, &dev->i2c_adap);
980 &sharp_isdbt, &dev->i2c_adap[dev->def_i2c_bus]);
966
967 if (!dvb->fe[0]) {
968 result = -EINVAL;
969 goto out_free;
970 }
971
972 break;
973 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850:
974 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
975 case EM2880_BOARD_PINNACLE_PCTV_HD_PRO:
976 case EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600:
977 dvb->fe[0] = dvb_attach(lgdt330x_attach,
978 &em2880_lgdt3303_dev,
981
982 if (!dvb->fe[0]) {
983 result = -EINVAL;
984 goto out_free;
985 }
986
987 break;
988 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850:
989 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
990 case EM2880_BOARD_PINNACLE_PCTV_HD_PRO:
991 case EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600:
992 dvb->fe[0] = dvb_attach(lgdt330x_attach,
993 &em2880_lgdt3303_dev,
979 &dev->i2c_adap);
994 &dev->i2c_adap[dev->def_i2c_bus]);
980 if (em28xx_attach_xc3028(0x61, dev) < 0) {
981 result = -EINVAL;
982 goto out_free;
983 }
984 break;
985 case EM2880_BOARD_KWORLD_DVB_310U:
986 dvb->fe[0] = dvb_attach(zl10353_attach,
987 &em28xx_zl10353_with_xc3028,
995 if (em28xx_attach_xc3028(0x61, dev) < 0) {
996 result = -EINVAL;
997 goto out_free;
998 }
999 break;
1000 case EM2880_BOARD_KWORLD_DVB_310U:
1001 dvb->fe[0] = dvb_attach(zl10353_attach,
1002 &em28xx_zl10353_with_xc3028,
988 &dev->i2c_adap);
1003 &dev->i2c_adap[dev->def_i2c_bus]);
989 if (em28xx_attach_xc3028(0x61, dev) < 0) {
990 result = -EINVAL;
991 goto out_free;
992 }
993 break;
994 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
995 case EM2882_BOARD_TERRATEC_HYBRID_XS:
996 case EM2880_BOARD_EMPIRE_DUAL_TV:
997 dvb->fe[0] = dvb_attach(zl10353_attach,
998 &em28xx_zl10353_xc3028_no_i2c_gate,
1004 if (em28xx_attach_xc3028(0x61, dev) < 0) {
1005 result = -EINVAL;
1006 goto out_free;
1007 }
1008 break;
1009 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
1010 case EM2882_BOARD_TERRATEC_HYBRID_XS:
1011 case EM2880_BOARD_EMPIRE_DUAL_TV:
1012 dvb->fe[0] = dvb_attach(zl10353_attach,
1013 &em28xx_zl10353_xc3028_no_i2c_gate,
999 &dev->i2c_adap);
1014 &dev->i2c_adap[dev->def_i2c_bus]);
1000 if (em28xx_attach_xc3028(0x61, dev) < 0) {
1001 result = -EINVAL;
1002 goto out_free;
1003 }
1004 break;
1005 case EM2880_BOARD_TERRATEC_HYBRID_XS:
1006 case EM2880_BOARD_TERRATEC_HYBRID_XS_FR:
1007 case EM2881_BOARD_PINNACLE_HYBRID_PRO:
1008 case EM2882_BOARD_DIKOM_DK300:
1009 case EM2882_BOARD_KWORLD_VS_DVBT:
1010 dvb->fe[0] = dvb_attach(zl10353_attach,
1011 &em28xx_zl10353_xc3028_no_i2c_gate,
1015 if (em28xx_attach_xc3028(0x61, dev) < 0) {
1016 result = -EINVAL;
1017 goto out_free;
1018 }
1019 break;
1020 case EM2880_BOARD_TERRATEC_HYBRID_XS:
1021 case EM2880_BOARD_TERRATEC_HYBRID_XS_FR:
1022 case EM2881_BOARD_PINNACLE_HYBRID_PRO:
1023 case EM2882_BOARD_DIKOM_DK300:
1024 case EM2882_BOARD_KWORLD_VS_DVBT:
1025 dvb->fe[0] = dvb_attach(zl10353_attach,
1026 &em28xx_zl10353_xc3028_no_i2c_gate,
1012 &dev->i2c_adap);
1027 &dev->i2c_adap[dev->def_i2c_bus]);
1013 if (dvb->fe[0] == NULL) {
1014 /* This board could have either a zl10353 or a mt352.
1015 If the chip id isn't for zl10353, try mt352 */
1016 dvb->fe[0] = dvb_attach(mt352_attach,
1017 &terratec_xs_mt352_cfg,
1028 if (dvb->fe[0] == NULL) {
1029 /* This board could have either a zl10353 or a mt352.
1030 If the chip id isn't for zl10353, try mt352 */
1031 dvb->fe[0] = dvb_attach(mt352_attach,
1032 &terratec_xs_mt352_cfg,
1018 &dev->i2c_adap);
1033 &dev->i2c_adap[dev->def_i2c_bus]);
1019 }
1020
1021 if (em28xx_attach_xc3028(0x61, dev) < 0) {
1022 result = -EINVAL;
1023 goto out_free;
1024 }
1025 break;
1026 case EM2870_BOARD_KWORLD_355U:
1027 dvb->fe[0] = dvb_attach(zl10353_attach,
1028 &em28xx_zl10353_no_i2c_gate_dev,
1034 }
1035
1036 if (em28xx_attach_xc3028(0x61, dev) < 0) {
1037 result = -EINVAL;
1038 goto out_free;
1039 }
1040 break;
1041 case EM2870_BOARD_KWORLD_355U:
1042 dvb->fe[0] = dvb_attach(zl10353_attach,
1043 &em28xx_zl10353_no_i2c_gate_dev,
1029 &dev->i2c_adap);
1044 &dev->i2c_adap[dev->def_i2c_bus]);
1030 if (dvb->fe[0] != NULL)
1031 dvb_attach(qt1010_attach, dvb->fe[0],
1045 if (dvb->fe[0] != NULL)
1046 dvb_attach(qt1010_attach, dvb->fe[0],
1032 &dev->i2c_adap, &em28xx_qt1010_config);
1047 &dev->i2c_adap[dev->def_i2c_bus], &em28xx_qt1010_config);
1033 break;
1034 case EM2883_BOARD_KWORLD_HYBRID_330U:
1035 case EM2882_BOARD_EVGA_INDTUBE:
1036 dvb->fe[0] = dvb_attach(s5h1409_attach,
1037 &em28xx_s5h1409_with_xc3028,
1048 break;
1049 case EM2883_BOARD_KWORLD_HYBRID_330U:
1050 case EM2882_BOARD_EVGA_INDTUBE:
1051 dvb->fe[0] = dvb_attach(s5h1409_attach,
1052 &em28xx_s5h1409_with_xc3028,
1038 &dev->i2c_adap);
1053 &dev->i2c_adap[dev->def_i2c_bus]);
1039 if (em28xx_attach_xc3028(0x61, dev) < 0) {
1040 result = -EINVAL;
1041 goto out_free;
1042 }
1043 break;
1044 case EM2882_BOARD_KWORLD_ATSC_315U:
1045 dvb->fe[0] = dvb_attach(lgdt330x_attach,
1046 &em2880_lgdt3303_dev,
1054 if (em28xx_attach_xc3028(0x61, dev) < 0) {
1055 result = -EINVAL;
1056 goto out_free;
1057 }
1058 break;
1059 case EM2882_BOARD_KWORLD_ATSC_315U:
1060 dvb->fe[0] = dvb_attach(lgdt330x_attach,
1061 &em2880_lgdt3303_dev,
1047 &dev->i2c_adap);
1062 &dev->i2c_adap[dev->def_i2c_bus]);
1048 if (dvb->fe[0] != NULL) {
1049 if (!dvb_attach(simple_tuner_attach, dvb->fe[0],
1063 if (dvb->fe[0] != NULL) {
1064 if (!dvb_attach(simple_tuner_attach, dvb->fe[0],
1050 &dev->i2c_adap, 0x61, TUNER_THOMSON_DTT761X)) {
1065 &dev->i2c_adap[dev->def_i2c_bus], 0x61, TUNER_THOMSON_DTT761X)) {
1051 result = -EINVAL;
1052 goto out_free;
1053 }
1054 }
1055 break;
1056 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2:
1057 case EM2882_BOARD_PINNACLE_HYBRID_PRO_330E:
1058 dvb->fe[0] = dvb_attach(drxd_attach, &em28xx_drxd, NULL,
1066 result = -EINVAL;
1067 goto out_free;
1068 }
1069 }
1070 break;
1071 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2:
1072 case EM2882_BOARD_PINNACLE_HYBRID_PRO_330E:
1073 dvb->fe[0] = dvb_attach(drxd_attach, &em28xx_drxd, NULL,
1059 &dev->i2c_adap, &dev->udev->dev);
1074 &dev->i2c_adap[dev->def_i2c_bus], &dev->udev->dev);
1060 if (em28xx_attach_xc3028(0x61, dev) < 0) {
1061 result = -EINVAL;
1062 goto out_free;
1063 }
1064 break;
1065 case EM2870_BOARD_REDDO_DVB_C_USB_BOX:
1066 /* Philips CU1216L NIM (Philips TDA10023 + Infineon TUA6034) */
1067 dvb->fe[0] = dvb_attach(tda10023_attach,
1068 &em28xx_tda10023_config,
1075 if (em28xx_attach_xc3028(0x61, dev) < 0) {
1076 result = -EINVAL;
1077 goto out_free;
1078 }
1079 break;
1080 case EM2870_BOARD_REDDO_DVB_C_USB_BOX:
1081 /* Philips CU1216L NIM (Philips TDA10023 + Infineon TUA6034) */
1082 dvb->fe[0] = dvb_attach(tda10023_attach,
1083 &em28xx_tda10023_config,
1069 &dev->i2c_adap, 0x48);
1084 &dev->i2c_adap[dev->def_i2c_bus], 0x48);
1070 if (dvb->fe[0]) {
1071 if (!dvb_attach(simple_tuner_attach, dvb->fe[0],
1085 if (dvb->fe[0]) {
1086 if (!dvb_attach(simple_tuner_attach, dvb->fe[0],
1072 &dev->i2c_adap, 0x60, TUNER_PHILIPS_CU1216L)) {
1087 &dev->i2c_adap[dev->def_i2c_bus], 0x60, TUNER_PHILIPS_CU1216L)) {
1073 result = -EINVAL;
1074 goto out_free;
1075 }
1076 }
1077 break;
1078 case EM2870_BOARD_KWORLD_A340:
1079 dvb->fe[0] = dvb_attach(lgdt3305_attach,
1080 &em2870_lgdt3304_dev,
1088 result = -EINVAL;
1089 goto out_free;
1090 }
1091 }
1092 break;
1093 case EM2870_BOARD_KWORLD_A340:
1094 dvb->fe[0] = dvb_attach(lgdt3305_attach,
1095 &em2870_lgdt3304_dev,
1081 &dev->i2c_adap);
1096 &dev->i2c_adap[dev->def_i2c_bus]);
1082 if (dvb->fe[0] != NULL)
1083 dvb_attach(tda18271_attach, dvb->fe[0], 0x60,
1097 if (dvb->fe[0] != NULL)
1098 dvb_attach(tda18271_attach, dvb->fe[0], 0x60,
1084 &dev->i2c_adap, &kworld_a340_config);
1099 &dev->i2c_adap[dev->def_i2c_bus], &kworld_a340_config);
1085 break;
1086 case EM28174_BOARD_PCTV_290E:
1087 /* set default GPIO0 for LNA, used if GPIOLIB is undefined */
1088 dvb->lna_gpio = CXD2820R_GPIO_E | CXD2820R_GPIO_O |
1089 CXD2820R_GPIO_L;
1090 dvb->fe[0] = dvb_attach(cxd2820r_attach,
1091 &em28xx_cxd2820r_config,
1100 break;
1101 case EM28174_BOARD_PCTV_290E:
1102 /* set default GPIO0 for LNA, used if GPIOLIB is undefined */
1103 dvb->lna_gpio = CXD2820R_GPIO_E | CXD2820R_GPIO_O |
1104 CXD2820R_GPIO_L;
1105 dvb->fe[0] = dvb_attach(cxd2820r_attach,
1106 &em28xx_cxd2820r_config,
1092 &dev->i2c_adap,
1107 &dev->i2c_adap[dev->def_i2c_bus],
1093 &dvb->lna_gpio);
1094 if (dvb->fe[0]) {
1095 /* FE 0 attach tuner */
1096 if (!dvb_attach(tda18271_attach,
1097 dvb->fe[0],
1098 0x60,
1108 &dvb->lna_gpio);
1109 if (dvb->fe[0]) {
1110 /* FE 0 attach tuner */
1111 if (!dvb_attach(tda18271_attach,
1112 dvb->fe[0],
1113 0x60,
1099 &dev->i2c_adap,
1114 &dev->i2c_adap[dev->def_i2c_bus],
1100 &em28xx_cxd2820r_tda18271_config)) {
1101
1102 dvb_frontend_detach(dvb->fe[0]);
1103 result = -EINVAL;
1104 goto out_free;
1105 }
1106
1107#ifdef CONFIG_GPIOLIB

--- 13 unchanged lines hidden (view full) ---

1121
1122 break;
1123 case EM2884_BOARD_HAUPPAUGE_WINTV_HVR_930C:
1124 {
1125 struct xc5000_config cfg;
1126 hauppauge_hvr930c_init(dev);
1127
1128 dvb->fe[0] = dvb_attach(drxk_attach,
1115 &em28xx_cxd2820r_tda18271_config)) {
1116
1117 dvb_frontend_detach(dvb->fe[0]);
1118 result = -EINVAL;
1119 goto out_free;
1120 }
1121
1122#ifdef CONFIG_GPIOLIB

--- 13 unchanged lines hidden (view full) ---

1136
1137 break;
1138 case EM2884_BOARD_HAUPPAUGE_WINTV_HVR_930C:
1139 {
1140 struct xc5000_config cfg;
1141 hauppauge_hvr930c_init(dev);
1142
1143 dvb->fe[0] = dvb_attach(drxk_attach,
1129 &hauppauge_930c_drxk, &dev->i2c_adap);
1144 &hauppauge_930c_drxk, &dev->i2c_adap[dev->def_i2c_bus]);
1130 if (!dvb->fe[0]) {
1131 result = -EINVAL;
1132 goto out_free;
1133 }
1134 /* FIXME: do we need a pll semaphore? */
1135 dvb->fe[0]->sec_priv = dvb;
1136 sema_init(&dvb->pll_mutex, 1);
1137 dvb->gate_ctrl = dvb->fe[0]->ops.i2c_gate_ctrl;
1138 dvb->fe[0]->ops.i2c_gate_ctrl = drxk_gate_ctrl;
1139
1140 /* Attach xc5000 */
1141 memset(&cfg, 0, sizeof(cfg));
1142 cfg.i2c_address = 0x61;
1143 cfg.if_khz = 4000;
1144
1145 if (dvb->fe[0]->ops.i2c_gate_ctrl)
1146 dvb->fe[0]->ops.i2c_gate_ctrl(dvb->fe[0], 1);
1145 if (!dvb->fe[0]) {
1146 result = -EINVAL;
1147 goto out_free;
1148 }
1149 /* FIXME: do we need a pll semaphore? */
1150 dvb->fe[0]->sec_priv = dvb;
1151 sema_init(&dvb->pll_mutex, 1);
1152 dvb->gate_ctrl = dvb->fe[0]->ops.i2c_gate_ctrl;
1153 dvb->fe[0]->ops.i2c_gate_ctrl = drxk_gate_ctrl;
1154
1155 /* Attach xc5000 */
1156 memset(&cfg, 0, sizeof(cfg));
1157 cfg.i2c_address = 0x61;
1158 cfg.if_khz = 4000;
1159
1160 if (dvb->fe[0]->ops.i2c_gate_ctrl)
1161 dvb->fe[0]->ops.i2c_gate_ctrl(dvb->fe[0], 1);
1147 if (!dvb_attach(xc5000_attach, dvb->fe[0], &dev->i2c_adap,
1162 if (!dvb_attach(xc5000_attach, dvb->fe[0], &dev->i2c_adap[dev->def_i2c_bus],
1148 &cfg)) {
1149 result = -EINVAL;
1150 goto out_free;
1151 }
1152 if (dvb->fe[0]->ops.i2c_gate_ctrl)
1153 dvb->fe[0]->ops.i2c_gate_ctrl(dvb->fe[0], 0);
1154
1155 break;
1156 }
1157 case EM2884_BOARD_TERRATEC_H5:
1158 terratec_h5_init(dev);
1159
1163 &cfg)) {
1164 result = -EINVAL;
1165 goto out_free;
1166 }
1167 if (dvb->fe[0]->ops.i2c_gate_ctrl)
1168 dvb->fe[0]->ops.i2c_gate_ctrl(dvb->fe[0], 0);
1169
1170 break;
1171 }
1172 case EM2884_BOARD_TERRATEC_H5:
1173 terratec_h5_init(dev);
1174
1160 dvb->fe[0] = dvb_attach(drxk_attach, &terratec_h5_drxk, &dev->i2c_adap);
1175 dvb->fe[0] = dvb_attach(drxk_attach, &terratec_h5_drxk, &dev->i2c_adap[dev->def_i2c_bus]);
1161 if (!dvb->fe[0]) {
1162 result = -EINVAL;
1163 goto out_free;
1164 }
1165 /* FIXME: do we need a pll semaphore? */
1166 dvb->fe[0]->sec_priv = dvb;
1167 sema_init(&dvb->pll_mutex, 1);
1168 dvb->gate_ctrl = dvb->fe[0]->ops.i2c_gate_ctrl;
1169 dvb->fe[0]->ops.i2c_gate_ctrl = drxk_gate_ctrl;
1170
1171 /* Attach tda18271 to DVB-C frontend */
1172 if (dvb->fe[0]->ops.i2c_gate_ctrl)
1173 dvb->fe[0]->ops.i2c_gate_ctrl(dvb->fe[0], 1);
1176 if (!dvb->fe[0]) {
1177 result = -EINVAL;
1178 goto out_free;
1179 }
1180 /* FIXME: do we need a pll semaphore? */
1181 dvb->fe[0]->sec_priv = dvb;
1182 sema_init(&dvb->pll_mutex, 1);
1183 dvb->gate_ctrl = dvb->fe[0]->ops.i2c_gate_ctrl;
1184 dvb->fe[0]->ops.i2c_gate_ctrl = drxk_gate_ctrl;
1185
1186 /* Attach tda18271 to DVB-C frontend */
1187 if (dvb->fe[0]->ops.i2c_gate_ctrl)
1188 dvb->fe[0]->ops.i2c_gate_ctrl(dvb->fe[0], 1);
1174 if (!dvb_attach(tda18271c2dd_attach, dvb->fe[0], &dev->i2c_adap, 0x60)) {
1189 if (!dvb_attach(tda18271c2dd_attach, dvb->fe[0], &dev->i2c_adap[dev->def_i2c_bus], 0x60)) {
1175 result = -EINVAL;
1176 goto out_free;
1177 }
1178 if (dvb->fe[0]->ops.i2c_gate_ctrl)
1179 dvb->fe[0]->ops.i2c_gate_ctrl(dvb->fe[0], 0);
1180
1181 break;
1190 result = -EINVAL;
1191 goto out_free;
1192 }
1193 if (dvb->fe[0]->ops.i2c_gate_ctrl)
1194 dvb->fe[0]->ops.i2c_gate_ctrl(dvb->fe[0], 0);
1195
1196 break;
1197 case EM2884_BOARD_C3TECH_DIGITAL_DUO:
1198 dvb->fe[0] = dvb_attach(mb86a20s_attach,
1199 &c3tech_duo_mb86a20s_config,
1200 &dev->i2c_adap[dev->def_i2c_bus]);
1201 if (dvb->fe[0] != NULL)
1202 dvb_attach(tda18271_attach, dvb->fe[0], 0x60,
1203 &dev->i2c_adap[dev->def_i2c_bus],
1204 &c3tech_duo_tda18271_config);
1205 break;
1182 case EM28174_BOARD_PCTV_460E:
1183 /* attach demod */
1184 dvb->fe[0] = dvb_attach(tda10071_attach,
1206 case EM28174_BOARD_PCTV_460E:
1207 /* attach demod */
1208 dvb->fe[0] = dvb_attach(tda10071_attach,
1185 &em28xx_tda10071_config, &dev->i2c_adap);
1209 &em28xx_tda10071_config, &dev->i2c_adap[dev->def_i2c_bus]);
1186
1187 /* attach SEC */
1188 if (dvb->fe[0])
1210
1211 /* attach SEC */
1212 if (dvb->fe[0])
1189 dvb_attach(a8293_attach, dvb->fe[0], &dev->i2c_adap,
1213 dvb_attach(a8293_attach, dvb->fe[0], &dev->i2c_adap[dev->def_i2c_bus],
1190 &em28xx_a8293_config);
1191 break;
1192 case EM2874_BOARD_MAXMEDIA_UB425_TC:
1193 /* attach demodulator */
1194 dvb->fe[0] = dvb_attach(drxk_attach, &maxmedia_ub425_tc_drxk,
1214 &em28xx_a8293_config);
1215 break;
1216 case EM2874_BOARD_MAXMEDIA_UB425_TC:
1217 /* attach demodulator */
1218 dvb->fe[0] = dvb_attach(drxk_attach, &maxmedia_ub425_tc_drxk,
1195 &dev->i2c_adap);
1219 &dev->i2c_adap[dev->def_i2c_bus]);
1196
1197 if (dvb->fe[0]) {
1198 /* disable I2C-gate */
1199 dvb->fe[0]->ops.i2c_gate_ctrl = NULL;
1200
1201 /* attach tuner */
1202 if (!dvb_attach(tda18271c2dd_attach, dvb->fe[0],
1220
1221 if (dvb->fe[0]) {
1222 /* disable I2C-gate */
1223 dvb->fe[0]->ops.i2c_gate_ctrl = NULL;
1224
1225 /* attach tuner */
1226 if (!dvb_attach(tda18271c2dd_attach, dvb->fe[0],
1203 &dev->i2c_adap, 0x60)) {
1227 &dev->i2c_adap[dev->def_i2c_bus], 0x60)) {
1204 dvb_frontend_detach(dvb->fe[0]);
1205 result = -EINVAL;
1206 goto out_free;
1207 }
1208 }
1209
1210 /* TODO: we need drx-3913k firmware in order to support DVB-T */
1211 em28xx_info("MaxMedia UB425-TC: only DVB-C supported by that " \
1212 "driver version\n");
1213
1214 break;
1215 case EM2884_BOARD_PCTV_510E:
1216 case EM2884_BOARD_PCTV_520E:
1217 pctv_520e_init(dev);
1218
1219 /* attach demodulator */
1220 dvb->fe[0] = dvb_attach(drxk_attach, &pctv_520e_drxk,
1228 dvb_frontend_detach(dvb->fe[0]);
1229 result = -EINVAL;
1230 goto out_free;
1231 }
1232 }
1233
1234 /* TODO: we need drx-3913k firmware in order to support DVB-T */
1235 em28xx_info("MaxMedia UB425-TC: only DVB-C supported by that " \
1236 "driver version\n");
1237
1238 break;
1239 case EM2884_BOARD_PCTV_510E:
1240 case EM2884_BOARD_PCTV_520E:
1241 pctv_520e_init(dev);
1242
1243 /* attach demodulator */
1244 dvb->fe[0] = dvb_attach(drxk_attach, &pctv_520e_drxk,
1221 &dev->i2c_adap);
1245 &dev->i2c_adap[dev->def_i2c_bus]);
1222
1223 if (dvb->fe[0]) {
1224 /* attach tuner */
1225 if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60,
1246
1247 if (dvb->fe[0]) {
1248 /* attach tuner */
1249 if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60,
1226 &dev->i2c_adap,
1250 &dev->i2c_adap[dev->def_i2c_bus],
1227 &em28xx_cxd2820r_tda18271_config)) {
1228 dvb_frontend_detach(dvb->fe[0]);
1229 result = -EINVAL;
1230 goto out_free;
1231 }
1232 }
1233 break;
1234 case EM2884_BOARD_CINERGY_HTC_STICK:
1235 terratec_htc_stick_init(dev);
1236
1237 /* attach demodulator */
1238 dvb->fe[0] = dvb_attach(drxk_attach, &terratec_htc_stick_drxk,
1251 &em28xx_cxd2820r_tda18271_config)) {
1252 dvb_frontend_detach(dvb->fe[0]);
1253 result = -EINVAL;
1254 goto out_free;
1255 }
1256 }
1257 break;
1258 case EM2884_BOARD_CINERGY_HTC_STICK:
1259 terratec_htc_stick_init(dev);
1260
1261 /* attach demodulator */
1262 dvb->fe[0] = dvb_attach(drxk_attach, &terratec_htc_stick_drxk,
1239 &dev->i2c_adap);
1263 &dev->i2c_adap[dev->def_i2c_bus]);
1240 if (!dvb->fe[0]) {
1241 result = -EINVAL;
1242 goto out_free;
1243 }
1244
1245 /* Attach the demodulator. */
1246 if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60,
1264 if (!dvb->fe[0]) {
1265 result = -EINVAL;
1266 goto out_free;
1267 }
1268
1269 /* Attach the demodulator. */
1270 if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60,
1247 &dev->i2c_adap,
1271 &dev->i2c_adap[dev->def_i2c_bus],
1248 &em28xx_cxd2820r_tda18271_config)) {
1249 result = -EINVAL;
1250 goto out_free;
1251 }
1252 break;
1253 case EM2884_BOARD_TERRATEC_HTC_USB_XS:
1254 terratec_htc_usb_xs_init(dev);
1255
1256 /* attach demodulator */
1257 dvb->fe[0] = dvb_attach(drxk_attach, &terratec_htc_stick_drxk,
1272 &em28xx_cxd2820r_tda18271_config)) {
1273 result = -EINVAL;
1274 goto out_free;
1275 }
1276 break;
1277 case EM2884_BOARD_TERRATEC_HTC_USB_XS:
1278 terratec_htc_usb_xs_init(dev);
1279
1280 /* attach demodulator */
1281 dvb->fe[0] = dvb_attach(drxk_attach, &terratec_htc_stick_drxk,
1258 &dev->i2c_adap);
1282 &dev->i2c_adap[dev->def_i2c_bus]);
1259 if (!dvb->fe[0]) {
1260 result = -EINVAL;
1261 goto out_free;
1262 }
1263
1264 /* Attach the demodulator. */
1265 if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60,
1283 if (!dvb->fe[0]) {
1284 result = -EINVAL;
1285 goto out_free;
1286 }
1287
1288 /* Attach the demodulator. */
1289 if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60,
1266 &dev->i2c_adap,
1290 &dev->i2c_adap[dev->def_i2c_bus],
1267 &em28xx_cxd2820r_tda18271_config)) {
1268 result = -EINVAL;
1269 goto out_free;
1270 }
1271 break;
1272 default:
1273 em28xx_errdev("/2: The frontend of your DVB/ATSC card"
1274 " isn't supported yet\n");

--- 86 unchanged lines hidden ---
1291 &em28xx_cxd2820r_tda18271_config)) {
1292 result = -EINVAL;
1293 goto out_free;
1294 }
1295 break;
1296 default:
1297 em28xx_errdev("/2: The frontend of your DVB/ATSC card"
1298 " isn't supported yet\n");

--- 86 unchanged lines hidden ---