Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 242096
b: refs/heads/master
c: 6ed9d56
h: refs/heads/master
v: v3
  • Loading branch information
Antti Palosaari authored and Mauro Carvalho Chehab committed Mar 22, 2011
1 parent 7e90c6b commit 57b1757
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 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: 109a29900a36b2b1e7b7f83a561c6af7e343461f
refs/heads/master: 6ed9d56086acb3bb4ec003ff6d2f54313774d72b
27 changes: 11 additions & 16 deletions trunk/drivers/media/dvb/frontends/af9013.c
Original file line number Diff line number Diff line change
Expand Up @@ -1323,13 +1323,11 @@ static struct dvb_frontend_ops af9013_ops;

static int af9013_download_firmware(struct af9013_state *state)
{
int i, len, packets, remainder, ret;
int i, len, remaining, ret;
const struct firmware *fw;
u16 addr = 0x5100; /* firmware start address */
u16 checksum = 0;
u8 val;
u8 fw_params[4];
u8 *data;
u8 *fw_file = AF9013_DEFAULT_FIRMWARE;

msleep(100);
Expand Down Expand Up @@ -1373,21 +1371,18 @@ static int af9013_download_firmware(struct af9013_state *state)
if (ret)
goto error_release;

#define FW_PACKET_MAX_DATA 16

packets = fw->size / FW_PACKET_MAX_DATA;
remainder = fw->size % FW_PACKET_MAX_DATA;
len = FW_PACKET_MAX_DATA;
for (i = 0; i <= packets; i++) {
if (i == packets) /* set size of the last packet */
len = remainder;

data = (u8 *)(fw->data + i * FW_PACKET_MAX_DATA);
ret = af9013_write_ofsm_regs(state, addr, data, len);
addr += FW_PACKET_MAX_DATA;
#define FW_ADDR 0x5100 /* firmware start address */
#define LEN_MAX 16 /* max packet size */
for (remaining = fw->size; remaining > 0; remaining -= LEN_MAX) {
len = remaining;
if (len > LEN_MAX)
len = LEN_MAX;

ret = af9013_write_ofsm_regs(state,
FW_ADDR + fw->size - remaining,
(u8 *) &fw->data[fw->size - remaining], len);
if (ret) {
err("firmware download failed at %d with %d", i, ret);
err("firmware download failed:%d", ret);
goto error_release;
}
}
Expand Down

0 comments on commit 57b1757

Please sign in to comment.