Commit c8dce008 authored by Martin Blumenstingl's avatar Martin Blumenstingl Committed by Mauro Carvalho Chehab

[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: default avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
Tested-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 729841ed
...@@ -974,12 +974,8 @@ struct em28xx_board em28xx_boards[] = { ...@@ -974,12 +974,8 @@ struct em28xx_board em28xx_boards[] = {
[EM2884_BOARD_CINERGY_HTC_STICK] = { [EM2884_BOARD_CINERGY_HTC_STICK] = {
.name = "Terratec Cinergy HTC Stick", .name = "Terratec Cinergy HTC Stick",
.has_dvb = 1, .has_dvb = 1,
#if 0 .ir_codes = RC_MAP_NEC_TERRATEC_CINERGY_XS,
.tuner_type = TUNER_PHILIPS_TDA8290, .tuner_type = TUNER_ABSENT,
.tuner_addr = 0x41,
.dvb_gpio = terratec_h5_digital, /* FIXME: probably wrong */
.tuner_gpio = terratec_h5_gpio,
#endif
.i2c_speed = EM2874_I2C_SECONDARY_BUS_SELECT | .i2c_speed = EM2874_I2C_SECONDARY_BUS_SELECT |
EM28XX_I2C_CLK_WAIT_ENABLE | EM28XX_I2C_CLK_WAIT_ENABLE |
EM28XX_I2C_FREQ_400_KHZ, EM28XX_I2C_FREQ_400_KHZ,
......
...@@ -325,6 +325,18 @@ static struct drxk_config hauppauge_930c_drxk = { ...@@ -325,6 +325,18 @@ static struct drxk_config hauppauge_930c_drxk = {
.chunk_size = 56, .chunk_size = 56,
}; };
struct drxk_config terratec_htc_stick_drxk = {
.adr = 0x29,
.single_master = 1,
.no_i2c_bridge = 1,
.microcode_name = "dvb-usb-terratec-htc-stick-drxk.fw",
.chunk_size = 54,
/* Required for the antenna_gpio to disable LNA. */
.antenna_dvbt = true,
/* The windows driver uses the same. This will disable LNA. */
.antenna_gpio = 0x6,
};
static struct drxk_config maxmedia_ub425_tc_drxk = { static struct drxk_config maxmedia_ub425_tc_drxk = {
.adr = 0x29, .adr = 0x29,
.single_master = 1, .single_master = 1,
...@@ -473,6 +485,57 @@ static void terratec_h5_init(struct em28xx *dev) ...@@ -473,6 +485,57 @@ static void terratec_h5_init(struct em28xx *dev)
em28xx_gpio_set(dev, terratec_h5_end); em28xx_gpio_set(dev, terratec_h5_end);
}; };
static void terratec_htc_stick_init(struct em28xx *dev)
{
int i;
/*
* GPIO configuration:
* 0xff: unknown (does not affect DVB-T).
* 0xf6: DRX-K (demodulator).
* 0xe6: unknown (does not affect DVB-T).
* 0xb6: unknown (does not affect DVB-T).
*/
struct em28xx_reg_seq terratec_htc_stick_init[] = {
{EM28XX_R08_GPIO, 0xff, 0xff, 10},
{EM2874_R80_GPIO, 0xf6, 0xff, 100},
{EM2874_R80_GPIO, 0xe6, 0xff, 50},
{EM2874_R80_GPIO, 0xf6, 0xff, 100},
{ -1, -1, -1, -1},
};
struct em28xx_reg_seq terratec_htc_stick_end[] = {
{EM2874_R80_GPIO, 0xb6, 0xff, 100},
{EM2874_R80_GPIO, 0xf6, 0xff, 50},
{ -1, -1, -1, -1},
};
/* Init the analog decoder? */
struct {
unsigned char r[4];
int len;
} regs[] = {
{{ 0x06, 0x02, 0x00, 0x31 }, 4},
{{ 0x01, 0x02 }, 2},
{{ 0x01, 0x02, 0x00, 0xc6 }, 4},
{{ 0x01, 0x00 }, 2},
{{ 0x01, 0x00, 0xff, 0xaf }, 4},
};
em28xx_gpio_set(dev, terratec_htc_stick_init);
em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40);
msleep(10);
em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44);
msleep(10);
dev->i2c_client.addr = 0x82 >> 1;
for (i = 0; i < ARRAY_SIZE(regs); i++)
i2c_master_send(&dev->i2c_client, regs[i].r, regs[i].len);
em28xx_gpio_set(dev, terratec_htc_stick_end);
};
static void pctv_520e_init(struct em28xx *dev) static void pctv_520e_init(struct em28xx *dev)
{ {
/* /*
...@@ -944,7 +1007,6 @@ static int em28xx_dvb_init(struct em28xx *dev) ...@@ -944,7 +1007,6 @@ static int em28xx_dvb_init(struct em28xx *dev)
break; break;
} }
case EM2884_BOARD_TERRATEC_H5: case EM2884_BOARD_TERRATEC_H5:
case EM2884_BOARD_CINERGY_HTC_STICK:
terratec_h5_init(dev); terratec_h5_init(dev);
dvb->fe[0] = dvb_attach(drxk_attach, &terratec_h5_drxk, &dev->i2c_adap); 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,6 +1083,25 @@ static int em28xx_dvb_init(struct em28xx *dev)
} }
} }
break; break;
case EM2884_BOARD_CINERGY_HTC_STICK:
terratec_htc_stick_init(dev);
/* attach demodulator */
dvb->fe[0] = dvb_attach(drxk_attach, &terratec_htc_stick_drxk,
&dev->i2c_adap);
if (!dvb->fe[0]) {
result = -EINVAL;
goto out_free;
}
/* Attach the demodulator. */
if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60,
&dev->i2c_adap,
&em28xx_cxd2820r_tda18271_config)) {
result = -EINVAL;
goto out_free;
}
break;
default: default:
em28xx_errdev("/2: The frontend of your DVB/ATSC card" em28xx_errdev("/2: The frontend of your DVB/ATSC card"
" isn't supported yet\n"); " isn't supported yet\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment