Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 298929
b: refs/heads/master
c: 4da2876
h: refs/heads/master
i:
  298927: 431aae6
v: v3
  • Loading branch information
Malcolm Priestley authored and Mauro Carvalho Chehab committed Apr 9, 2012
1 parent 4961321 commit 9c0db67
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bc169e35e3a72c6888b7d12f50f2c4063436d834
refs/heads/master: 4da28766140449e04270246fae310c137180652d
54 changes: 40 additions & 14 deletions trunk/drivers/media/dvb/dvb-usb/it913x.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,27 @@ static int it913x_read_reg(struct usb_device *udev, u32 reg)

static u32 it913x_query(struct usb_device *udev, u8 pro)
{
int ret;
int ret, i;
u8 data[4];
ret = it913x_io(udev, READ_LONG, pro, CMD_DEMOD_READ,
0x1222, 0, &data[0], 3);
u8 ver;

for (i = 0; i < 5; i++) {
ret = it913x_io(udev, READ_LONG, pro, CMD_DEMOD_READ,
0x1222, 0, &data[0], 3);
ver = data[0];
if (ver > 0 && ver < 3)
break;
msleep(100);
}

it913x_config.chip_ver = data[0];
if (ver < 1 || ver > 2) {
info("Failed to identify chip version applying 1");
it913x_config.chip_ver = 0x1;
it913x_config.chip_type = 0x9135;
return 0;
}

it913x_config.chip_ver = ver;
it913x_config.chip_type = (u16)(data[2] << 8) + data[1];

info("Chip Version=%02x Chip Type=%04x", it913x_config.chip_ver,
Expand Down Expand Up @@ -660,30 +675,41 @@ static int it913x_download_firmware(struct usb_device *udev,
if ((packet_size > min_pkt) || (i == fw->size)) {
fw_data = (u8 *)(fw->data + pos);
pos += packet_size;
if (packet_size > 0)
ret |= it913x_io(udev, WRITE_DATA,
if (packet_size > 0) {
ret = it913x_io(udev, WRITE_DATA,
DEV_0, CMD_SCATTER_WRITE, 0,
0, fw_data, packet_size);
if (ret < 0)
break;
}
udelay(1000);
}
}
i++;
}

ret |= it913x_io(udev, WRITE_CMD, DEV_0, CMD_BOOT, 0, 0, NULL, 0);

msleep(100);

if (ret < 0)
info("FRM Firmware Download Failed (%04x)" , ret);
info("FRM Firmware Download Failed (%d)" , ret);
else
info("FRM Firmware Download Completed - Resetting Device");

ret |= it913x_return_status(udev);
msleep(30);

ret = it913x_io(udev, WRITE_CMD, DEV_0, CMD_BOOT, 0, 0, NULL, 0);
if (ret < 0)
info("FRM Device not responding to reboot");

ret = it913x_return_status(udev);
if (ret == 0) {
info("FRM Failed to reboot device");
return -ENODEV;
}

msleep(30);

ret |= it913x_wr_reg(udev, DEV_0, I2C_CLK, I2C_CLK_400);
ret = it913x_wr_reg(udev, DEV_0, I2C_CLK, I2C_CLK_400);

msleep(30);

/* Tuner function */
if (it913x_config.dual_mode)
Expand Down Expand Up @@ -901,5 +927,5 @@ module_usb_driver(it913x_driver);

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

0 comments on commit 9c0db67

Please sign in to comment.