aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/usb/em28xx/em28xx-dvb.c
diff options
context:
space:
mode:
authorMartin Blumenstingl <martin.blumenstingl@googlemail.com>2012-10-04 13:22:54 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-10-25 09:25:16 -0400
commit890401364db1c521b0708ffb2468ec75e24de207 (patch)
tree43b26726d2ff0dcc5be2f4f14d30abe0f55c7526 /drivers/media/usb/em28xx/em28xx-dvb.c
parent74df06daf632ce2d321d01cb046004768352efc4 (diff)
[media] em28xx: Better support for the Terratec Cinergy HTC USB XS
This intializes the card just like the windows driver does - the "HTC USB XS HD" uses the same firmware as the "HTC Stick HD"; - both have different GPIO and reg init sequences; Tested only with DVB-C. Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/usb/em28xx/em28xx-dvb.c')
-rw-r--r--drivers/media/usb/em28xx/em28xx-dvb.c84
1 files changed, 82 insertions, 2 deletions
diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c
index 13ae821949e9..63f2e7070c00 100644
--- a/drivers/media/usb/em28xx/em28xx-dvb.c
+++ b/drivers/media/usb/em28xx/em28xx-dvb.c
@@ -331,7 +331,7 @@ static struct drxk_config hauppauge_930c_drxk = {
331 .load_firmware_sync = true, 331 .load_firmware_sync = true,
332}; 332};
333 333
334struct drxk_config terratec_htc_stick_drxk = { 334static struct drxk_config terratec_htc_stick_drxk = {
335 .adr = 0x29, 335 .adr = 0x29,
336 .single_master = 1, 336 .single_master = 1,
337 .no_i2c_bridge = 1, 337 .no_i2c_bridge = 1,
@@ -520,7 +520,10 @@ static void terratec_htc_stick_init(struct em28xx *dev)
520 { -1, -1, -1, -1}, 520 { -1, -1, -1, -1},
521 }; 521 };
522 522
523 /* Init the analog decoder? */ 523 /*
524 * Init the analog decoder (not yet supported), but
525 * it's probably still a good idea.
526 */
524 struct { 527 struct {
525 unsigned char r[4]; 528 unsigned char r[4];
526 int len; 529 int len;
@@ -547,6 +550,64 @@ static void terratec_htc_stick_init(struct em28xx *dev)
547 em28xx_gpio_set(dev, terratec_htc_stick_end); 550 em28xx_gpio_set(dev, terratec_htc_stick_end);
548}; 551};
549 552
553static void terratec_htc_usb_xs_init(struct em28xx *dev)
554{
555 int i;
556
557 struct em28xx_reg_seq terratec_htc_usb_xs_init[] = {
558 {EM28XX_R08_GPIO, 0xff, 0xff, 10},
559 {EM2874_R80_GPIO, 0xb2, 0xff, 100},
560 {EM2874_R80_GPIO, 0xb2, 0xff, 50},
561 {EM2874_R80_GPIO, 0xb6, 0xff, 100},
562 { -1, -1, -1, -1},
563 };
564 struct em28xx_reg_seq terratec_htc_usb_xs_end[] = {
565 {EM2874_R80_GPIO, 0xa6, 0xff, 100},
566 {EM2874_R80_GPIO, 0xa6, 0xff, 50},
567 {EM2874_R80_GPIO, 0xe6, 0xff, 100},
568 { -1, -1, -1, -1},
569 };
570
571 /*
572 * Init the analog decoder (not yet supported), but
573 * it's probably still a good idea.
574 */
575 struct {
576 unsigned char r[4];
577 int len;
578 } regs[] = {
579 {{ 0x06, 0x02, 0x00, 0x31 }, 4},
580 {{ 0x01, 0x02 }, 2},
581 {{ 0x01, 0x02, 0x00, 0xc6 }, 4},
582 {{ 0x01, 0x00 }, 2},
583 {{ 0x01, 0x00, 0xff, 0xaf }, 4},
584 {{ 0x01, 0x00, 0x03, 0xa0 }, 4},
585 {{ 0x01, 0x00 }, 2},
586 {{ 0x01, 0x00, 0x73, 0xaf }, 4},
587 {{ 0x04, 0x00 }, 2},
588 {{ 0x00, 0x04 }, 2},
589 {{ 0x00, 0x04, 0x00, 0x0a }, 4},
590 {{ 0x04, 0x14 }, 2},
591 {{ 0x04, 0x14, 0x00, 0x00 }, 4},
592 };
593
594 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40);
595
596 em28xx_gpio_set(dev, terratec_htc_usb_xs_init);
597
598 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40);
599 msleep(10);
600 em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44);
601 msleep(10);
602
603 dev->i2c_client.addr = 0x82 >> 1;
604
605 for (i = 0; i < ARRAY_SIZE(regs); i++)
606 i2c_master_send(&dev->i2c_client, regs[i].r, regs[i].len);
607
608 em28xx_gpio_set(dev, terratec_htc_usb_xs_end);
609};
610
550static void pctv_520e_init(struct em28xx *dev) 611static void pctv_520e_init(struct em28xx *dev)
551{ 612{
552 /* 613 /*
@@ -1155,6 +1216,25 @@ static int em28xx_dvb_init(struct em28xx *dev)
1155 goto out_free; 1216 goto out_free;
1156 } 1217 }
1157 break; 1218 break;
1219 case EM2884_BOARD_TERRATEC_HTC_USB_XS:
1220 terratec_htc_usb_xs_init(dev);
1221
1222 /* attach demodulator */
1223 dvb->fe[0] = dvb_attach(drxk_attach, &terratec_htc_stick_drxk,
1224 &dev->i2c_adap);
1225 if (!dvb->fe[0]) {
1226 result = -EINVAL;
1227 goto out_free;
1228 }
1229
1230 /* Attach the demodulator. */
1231 if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60,
1232 &dev->i2c_adap,
1233 &em28xx_cxd2820r_tda18271_config)) {
1234 result = -EINVAL;
1235 goto out_free;
1236 }
1237 break;
1158 default: 1238 default:
1159 em28xx_errdev("/2: The frontend of your DVB/ATSC card" 1239 em28xx_errdev("/2: The frontend of your DVB/ATSC card"
1160 " isn't supported yet\n"); 1240 " isn't supported yet\n");