aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/em28xx
diff options
context:
space:
mode:
authorMartin Blumenstingl <martin.blumenstingl@googlemail.com>2012-06-12 17:19:28 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-06-21 13:31:10 -0400
commitc8dce0088a645c21cfb7e554390a4603e0e2139f (patch)
tree9720e0dc3fc14f1a528f6fd7c2893f2c59015243 /drivers/media/video/em28xx
parent729841ed0f41cfae494ad5c50df86af427078442 (diff)
[media] em28xx: Improve support for the Terratec Cinergy HTC Stick HD
The windows driver used different values for the GPIOs and analog decoder configuration. The values from the windows driver are now used. It also seems that the windows driver has LNA always disabled. Thus we are doing the same (using the same flags as on windows). I (only) tested with DVB-T and it worked quite well. [mchehab@redhat.com: Fix merge conflicts and tested with DVB-C] Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Tested-by: Mauro Carvalho Chehab <mchehab@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/em28xx')
-rw-r--r--drivers/media/video/em28xx/em28xx-cards.c8
-rw-r--r--drivers/media/video/em28xx/em28xx-dvb.c83
2 files changed, 84 insertions, 7 deletions
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
index 20a7e24de6fb..12bc54af431e 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -974,12 +974,8 @@ struct em28xx_board em28xx_boards[] = {
974 [EM2884_BOARD_CINERGY_HTC_STICK] = { 974 [EM2884_BOARD_CINERGY_HTC_STICK] = {
975 .name = "Terratec Cinergy HTC Stick", 975 .name = "Terratec Cinergy HTC Stick",
976 .has_dvb = 1, 976 .has_dvb = 1,
977#if 0 977 .ir_codes = RC_MAP_NEC_TERRATEC_CINERGY_XS,
978 .tuner_type = TUNER_PHILIPS_TDA8290, 978 .tuner_type = TUNER_ABSENT,
979 .tuner_addr = 0x41,
980 .dvb_gpio = terratec_h5_digital, /* FIXME: probably wrong */
981 .tuner_gpio = terratec_h5_gpio,
982#endif
983 .i2c_speed = EM2874_I2C_SECONDARY_BUS_SELECT | 979 .i2c_speed = EM2874_I2C_SECONDARY_BUS_SELECT |
984 EM28XX_I2C_CLK_WAIT_ENABLE | 980 EM28XX_I2C_CLK_WAIT_ENABLE |
985 EM28XX_I2C_FREQ_400_KHZ, 981 EM28XX_I2C_FREQ_400_KHZ,
diff --git a/drivers/media/video/em28xx/em28xx-dvb.c b/drivers/media/video/em28xx/em28xx-dvb.c
index 241a71a76926..f8ffe102d295 100644
--- a/drivers/media/video/em28xx/em28xx-dvb.c
+++ b/drivers/media/video/em28xx/em28xx-dvb.c
@@ -325,6 +325,18 @@ static struct drxk_config hauppauge_930c_drxk = {
325 .chunk_size = 56, 325 .chunk_size = 56,
326}; 326};
327 327
328struct drxk_config terratec_htc_stick_drxk = {
329 .adr = 0x29,
330 .single_master = 1,
331 .no_i2c_bridge = 1,
332 .microcode_name = "dvb-usb-terratec-htc-stick-drxk.fw",
333 .chunk_size = 54,
334 /* Required for the antenna_gpio to disable LNA. */
335 .antenna_dvbt = true,
336 /* The windows driver uses the same. This will disable LNA. */
337 .antenna_gpio = 0x6,
338};
339
328static struct drxk_config maxmedia_ub425_tc_drxk = { 340static struct drxk_config maxmedia_ub425_tc_drxk = {
329 .adr = 0x29, 341 .adr = 0x29,
330 .single_master = 1, 342 .single_master = 1,
@@ -473,6 +485,57 @@ static void terratec_h5_init(struct em28xx *dev)
473 em28xx_gpio_set(dev, terratec_h5_end); 485 em28xx_gpio_set(dev, terratec_h5_end);
474}; 486};
475 487
488static void terratec_htc_stick_init(struct em28xx *dev)
489{
490 int i;
491
492 /*
493 * GPIO configuration:
494 * 0xff: unknown (does not affect DVB-T).
495 * 0xf6: DRX-K (demodulator).
496 * 0xe6: unknown (does not affect DVB-T).
497 * 0xb6: unknown (does not affect DVB-T).
498 */
499 struct em28xx_reg_seq terratec_htc_stick_init[] = {
500 {EM28XX_R08_GPIO, 0xff, 0xff, 10},
501 {EM2874_R80_GPIO, 0xf6, 0xff, 100},
502 {EM2874_R80_GPIO, 0xe6, 0xff, 50},
503 {EM2874_R80_GPIO, 0xf6, 0xff, 100},
504 { -1, -1, -1, -1},
505 };
506 struct em28xx_reg_seq terratec_htc_stick_end[] = {
507 {EM2874_R80_GPIO, 0xb6, 0xff, 100},
508 {EM2874_R80_GPIO, 0xf6, 0xff, 50},
509 { -1, -1, -1, -1},
510 };
511
512 /* Init the analog decoder? */
513 struct {
514 unsigned char r[4];
515 int len;
516 } regs[] = {
517 {{ 0x06, 0x02, 0x00, 0x31 }, 4},
518 {{ 0x01, 0x02 }, 2},
519 {{ 0x01, 0x02, 0x00, 0xc6 }, 4},
520 {{ 0x01, 0x00 }, 2},
521 {{ 0x01, 0x00, 0xff, 0xaf }, 4},
522 };
523
524 em28xx_gpio_set(dev, terratec_htc_stick_init);
525
526 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40);
527 msleep(10);
528 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44);
529 msleep(10);
530
531 dev->i2c_client.addr = 0x82 >> 1;
532
533 for (i = 0; i < ARRAY_SIZE(regs); i++)
534 i2c_master_send(&dev->i2c_client, regs[i].r, regs[i].len);
535
536 em28xx_gpio_set(dev, terratec_htc_stick_end);
537};
538
476static void pctv_520e_init(struct em28xx *dev) 539static void pctv_520e_init(struct em28xx *dev)
477{ 540{
478 /* 541 /*
@@ -944,7 +1007,6 @@ static int em28xx_dvb_init(struct em28xx *dev)
944 break; 1007 break;
945 } 1008 }
946 case EM2884_BOARD_TERRATEC_H5: 1009 case EM2884_BOARD_TERRATEC_H5:
947 case EM2884_BOARD_CINERGY_HTC_STICK:
948 terratec_h5_init(dev); 1010 terratec_h5_init(dev);
949 1011
950 dvb->fe[0] = dvb_attach(drxk_attach, &terratec_h5_drxk, &dev->i2c_adap); 1012 dvb->fe[0] = dvb_attach(drxk_attach, &terratec_h5_drxk, &dev->i2c_adap);
@@ -1021,6 +1083,25 @@ static int em28xx_dvb_init(struct em28xx *dev)
1021 } 1083 }
1022 } 1084 }
1023 break; 1085 break;
1086 case EM2884_BOARD_CINERGY_HTC_STICK:
1087 terratec_htc_stick_init(dev);
1088
1089 /* attach demodulator */
1090 dvb->fe[0] = dvb_attach(drxk_attach, &terratec_htc_stick_drxk,
1091 &dev->i2c_adap);
1092 if (!dvb->fe[0]) {
1093 result = -EINVAL;
1094 goto out_free;
1095 }
1096
1097 /* Attach the demodulator. */
1098 if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60,
1099 &dev->i2c_adap,
1100 &em28xx_cxd2820r_tda18271_config)) {
1101 result = -EINVAL;
1102 goto out_free;
1103 }
1104 break;
1024 default: 1105 default:
1025 em28xx_errdev("/2: The frontend of your DVB/ATSC card" 1106 em28xx_errdev("/2: The frontend of your DVB/ATSC card"
1026 " isn't supported yet\n"); 1107 " isn't supported yet\n");