Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 331063
b: refs/heads/master
c: 0d2d603
h: refs/heads/master
i:
  331061: 06a9252
  331059: 2602714
  331055: 2e7307c
v: v3
  • Loading branch information
Antti Palosaari authored and Mauro Carvalho Chehab committed Sep 23, 2012
1 parent 48166ff commit ea21463
Show file tree
Hide file tree
Showing 2 changed files with 30 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: 20399b3b0e3494ccd4a74bdd86cd870847f196fe
refs/heads/master: 0d2d603124fe08a226d348495f345acd9a399214
45 changes: 29 additions & 16 deletions trunk/drivers/media/dvb-frontends/ec100.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,33 @@ struct ec100_state {
/* write single register */
static int ec100_write_reg(struct ec100_state *state, u8 reg, u8 val)
{
int ret;
u8 buf[2] = {reg, val};
struct i2c_msg msg = {
.addr = state->config.demod_address,
.flags = 0,
.len = 2,
.buf = buf};

if (i2c_transfer(state->i2c, &msg, 1) != 1) {
dev_warn(&state->i2c->dev, "%s: i2c wr failed reg=%02x\n",
KBUILD_MODNAME, reg);
return -EREMOTEIO;
struct i2c_msg msg[1] = {
{
.addr = state->config.demod_address,
.flags = 0,
.len = sizeof(buf),
.buf = buf,
}
};

ret = i2c_transfer(state->i2c, msg, 1);
if (ret == 1) {
ret = 0;
} else {
dev_warn(&state->i2c->dev, "%s: i2c wr failed=%d reg=%02x\n",
KBUILD_MODNAME, ret, reg);
ret = -EREMOTEIO;
}
return 0;

return ret;
}

/* read single register */
static int ec100_read_reg(struct ec100_state *state, u8 reg, u8 *val)
{
int ret;
struct i2c_msg msg[2] = {
{
.addr = state->config.demod_address,
Expand All @@ -65,12 +74,16 @@ static int ec100_read_reg(struct ec100_state *state, u8 reg, u8 *val)
}
};

if (i2c_transfer(state->i2c, msg, 2) != 2) {
dev_warn(&state->i2c->dev, "%s: i2c rd failed reg=%02x\n",
KBUILD_MODNAME, reg);
return -EREMOTEIO;
ret = i2c_transfer(state->i2c, msg, 2);
if (ret == 2) {
ret = 0;
} else {
dev_warn(&state->i2c->dev, "%s: i2c rd failed=%d reg=%02x\n",
KBUILD_MODNAME, ret, reg);
ret = -EREMOTEIO;
}
return 0;

return ret;
}

static int ec100_set_frontend(struct dvb_frontend *fe)
Expand Down

0 comments on commit ea21463

Please sign in to comment.