Skip to content

Commit

Permalink
[media] it913x Support it9135 Verions 2 chip
Browse files Browse the repository at this point in the history
Support for version 2 type chips and other LNA versions of version 1

Scripts may be compressed slightly at a later stage.

TODO
Firmware loader
However, things are a little confusing,  it is not clear that
dvb-usb-it9137-01.fw does not work with version 2 chips
as in recent files both firmwares are the same.

Should be applied to: 8133 Support for single ITE 9135 device.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Malcolm Priestley authored and Mauro Carvalho Chehab committed Nov 7, 2011
1 parent ead32d5 commit b7d425d
Show file tree
Hide file tree
Showing 4 changed files with 823 additions and 81 deletions.
52 changes: 15 additions & 37 deletions drivers/media/dvb/dvb-usb/it913x.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,6 @@ struct it913x_state {
u8 id;
};

struct ite_config {
u8 chip_ver;
u16 chip_type;
u32 firmware;
u8 tuner_id_0;
u8 tuner_id_1;
u8 dual_mode;
};

struct ite_config it913x_config;

static int it913x_bulk_write(struct usb_device *dev,
Expand Down Expand Up @@ -390,8 +381,8 @@ static int it913x_identify_state(struct usb_device *udev,
if (ret != 0)
ret = it913x_wr_reg(udev, DEV_0,
GPIOH1_O, 0x0);
props->num_adapters = 2;
}
props->num_adapters = 2;
} else
props->num_adapters = 1;

Expand Down Expand Up @@ -474,12 +465,17 @@ static int it913x_download_firmware(struct usb_device *udev,
/* Tuner function */
if (it913x_config.dual_mode)
ret |= it913x_wr_reg(udev, DEV_0_DMOD , 0xec4c, 0xa0);

ret |= it913x_wr_reg(udev, DEV_0, PADODPU, 0x0);
ret |= it913x_wr_reg(udev, DEV_0, AGC_O_D, 0x0);
if (it913x_config.dual_mode) {
ret |= it913x_wr_reg(udev, DEV_1, PADODPU, 0x0);
ret |= it913x_wr_reg(udev, DEV_1, AGC_O_D, 0x0);
else
ret |= it913x_wr_reg(udev, DEV_0_DMOD , 0xec4c, 0x68);

if ((it913x_config.chip_ver == 1) &&
(it913x_config.chip_type == 0x9135)) {
ret |= it913x_wr_reg(udev, DEV_0, PADODPU, 0x0);
ret |= it913x_wr_reg(udev, DEV_0, AGC_O_D, 0x0);
if (it913x_config.dual_mode) {
ret |= it913x_wr_reg(udev, DEV_1, PADODPU, 0x0);
ret |= it913x_wr_reg(udev, DEV_1, AGC_O_D, 0x0);
}
}

return (ret < 0) ? -ENODEV : 0;
Expand All @@ -501,31 +497,13 @@ static int it913x_frontend_attach(struct dvb_usb_adapter *adap)
{
struct usb_device *udev = adap->dev->udev;
int ret = 0;
u8 adf = it913x_read_reg(udev, IO_MUX_POWER_CLK);
u8 adap_addr = I2C_BASE_ADDR + (adap->id << 5);
u16 ep_size = adap->props.fe[0].stream.u.bulk.buffersize;
u8 tuner_id, tuner_type;

if (adap->id == 0)
tuner_id = it913x_config.tuner_id_0;
else
tuner_id = it913x_config.tuner_id_1;

/* TODO we always use IT9137 possible references here*/
/* Documentation suggests don't care */
switch (tuner_id) {
case 0x51:
case 0x52:
case 0x60:
case 0x61:
case 0x62:
default:
case 0x38:
tuner_type = IT9137;
}
it913x_config.adf = it913x_read_reg(udev, IO_MUX_POWER_CLK);

adap->fe_adap[0].fe = dvb_attach(it913x_fe_attach,
&adap->dev->i2c_adap, adap_addr, adf, tuner_type);
&adap->dev->i2c_adap, adap_addr, &it913x_config);

if (adap->id == 0 && adap->fe_adap[0].fe) {
ret = it913x_wr_reg(udev, DEV_0_DMOD, MP2_SW_RST, 0x1);
Expand Down Expand Up @@ -698,5 +676,5 @@ module_exit(it913x_module_exit);

MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>");
MODULE_DESCRIPTION("it913x USB 2 Driver");
MODULE_VERSION("1.07");
MODULE_VERSION("1.08");
MODULE_LICENSE("GPL");
Loading

0 comments on commit b7d425d

Please sign in to comment.