Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 366703
b: refs/heads/master
c: 3bf5e55
h: refs/heads/master
i:
  366701: a6a7684
  366699: 0d23835
  366695: 6f43af3
  366687: 96dfe1b
v: v3
  • Loading branch information
Antti Palosaari authored and Mauro Carvalho Chehab committed Mar 21, 2013
1 parent 7a70fe0 commit 6d8b53e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 11 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: 0c13c54d8527df03decf7c522f35886fb721f282
refs/heads/master: 3bf5e55299ac5a389a4e6b9991f900579a765172
47 changes: 37 additions & 10 deletions trunk/drivers/media/dvb-frontends/af9033.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,37 @@ static int af9033_rd_reg_mask(struct af9033_state *state, u32 reg, u8 *val,
return 0;
}

/* write reg val table using reg addr auto increment */
static int af9033_wr_reg_val_tab(struct af9033_state *state,
const struct reg_val *tab, int tab_len)
{
int ret, i, j;
u8 buf[tab_len];

dev_dbg(&state->i2c->dev, "%s: tab_len=%d\n", __func__, tab_len);

for (i = 0, j = 0; i < tab_len; i++) {
buf[j] = tab[i].val;

if (i == tab_len - 1 || tab[i].reg != tab[i + 1].reg - 1) {
ret = af9033_wr_regs(state, tab[i].reg - j, buf, j + 1);
if (ret < 0)
goto err;

j = 0;
} else {
j++;
}
}

return 0;

err:
dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);

return ret;
}

static u32 af9033_div(struct af9033_state *state, u32 a, u32 b, u32 x)
{
u32 r = 0, c = 0, i;
Expand Down Expand Up @@ -306,11 +337,9 @@ static int af9033_init(struct dvb_frontend *fe)
break;
}

for (i = 0; i < len; i++) {
ret = af9033_wr_reg(state, init[i].reg, init[i].val);
if (ret < 0)
goto err;
}
ret = af9033_wr_reg_val_tab(state, init, len);
if (ret < 0)
goto err;

/* load tuner specific settings */
dev_dbg(&state->i2c->dev, "%s: load tuner specific settings\n",
Expand Down Expand Up @@ -371,11 +400,9 @@ static int af9033_init(struct dvb_frontend *fe)
goto err;
}

for (i = 0; i < len; i++) {
ret = af9033_wr_reg(state, init[i].reg, init[i].val);
if (ret < 0)
goto err;
}
ret = af9033_wr_reg_val_tab(state, init, len);
if (ret < 0)
goto err;

if (state->cfg.ts_mode == AF9033_TS_MODE_SERIAL) {
ret = af9033_wr_reg_mask(state, 0x00d91c, 0x01, 0x01);
Expand Down

0 comments on commit 6d8b53e

Please sign in to comment.