Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 181515
b: refs/heads/master
c: 0c3f9fd
h: refs/heads/master
i:
  181513: 86ba473
  181511: 3154b64
v: v3
  • Loading branch information
Andreas Regel authored and Mauro Carvalho Chehab committed Feb 26, 2010
1 parent d2e5ce9 commit 7598f5e
Show file tree
Hide file tree
Showing 2 changed files with 25 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: f91e59cb5e6add13d4e45c5cc8d45a614e1dc8e4
refs/heads/master: 0c3f9fd807d9ef842fcc7e47e447ed2c68d63e49
34 changes: 24 additions & 10 deletions trunk/drivers/media/dvb/frontends/stv6110x.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,23 @@ static int stv6110x_read_reg(struct stv6110x_state *stv6110x, u8 reg, u8 *data)
return 0;
}

static int stv6110x_write_reg(struct stv6110x_state *stv6110x, u8 reg, u8 data)
static int stv6110x_write_regs(struct stv6110x_state *stv6110x, int start, u8 data[], int len)
{
int ret;
const struct stv6110x_config *config = stv6110x->config;
u8 buf[] = { reg, data };
struct i2c_msg msg = { .addr = config->addr, .flags = 0, . buf = buf, .len = 2 };
u8 buf[len + 1];
struct i2c_msg msg = {
.addr = config->addr,
.flags = 0,
.buf = buf,
.len = len + 1
};

if (start + len > 8)
return -EINVAL;

buf[0] = start;
memcpy(&buf[1], data, len);

ret = i2c_transfer(stv6110x->i2c, &msg, 1);
if (ret != 1) {
Expand All @@ -74,18 +85,21 @@ static int stv6110x_write_reg(struct stv6110x_state *stv6110x, u8 reg, u8 data)
return 0;
}

static int stv6110x_write_reg(struct stv6110x_state *stv6110x, u8 reg, u8 data)
{
return stv6110x_write_regs(stv6110x, reg, &data, 1);
}

static int stv6110x_init(struct dvb_frontend *fe)
{
struct stv6110x_state *stv6110x = fe->tuner_priv;
int ret;
u8 i;

for (i = 0; i < ARRAY_SIZE(stv6110x_regs); i++) {
ret = stv6110x_write_reg(stv6110x, i, stv6110x_regs[i]);
if (ret < 0) {
dprintk(FE_ERROR, 1, "Initialization failed");
return -1;
}
ret = stv6110x_write_regs(stv6110x, 0, stv6110x_regs,
ARRAY_SIZE(stv6110x_regs));
if (ret < 0) {
dprintk(FE_ERROR, 1, "Initialization failed");
return -1;
}

return 0;
Expand Down

0 comments on commit 7598f5e

Please sign in to comment.