diff options
Diffstat (limited to 'linux/drivers/media/dvb/frontends/stv0297.c')
-rw-r--r-- | linux/drivers/media/dvb/frontends/stv0297.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/linux/drivers/media/dvb/frontends/stv0297.c b/linux/drivers/media/dvb/frontends/stv0297.c index d6cda95b4..6a007a1ae 100644 --- a/linux/drivers/media/dvb/frontends/stv0297.c +++ b/linux/drivers/media/dvb/frontends/stv0297.c @@ -165,7 +165,7 @@ static int stv0297_readreg (struct stv0297_state* state, u8 reg) struct i2c_msg msg [] = { { .addr = state->config->demod_address, .flags = 0, .buf = b0, .len = 1 }, { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = b1, .len = 1 } }; - // this device cannot seem to handle having two transfers back to back */ + // this device needs a STOP between the register and data if ((ret = i2c_transfer (state->i2c, &msg[0], 1)) != 1) { dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg, ret); @@ -198,12 +198,19 @@ static int stv0297_readregs (struct stv0297_state* state, u8 reg1, u8 *b, u8 len struct i2c_msg msg [] = { { .addr = state->config->demod_address, .flags = 0, .buf = ®1, .len = 1 }, { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = b, .len = len } }; - ret = i2c_transfer (state->i2c, msg, 2); - - if (ret != 2) - dprintk("%s: readreg error (ret == %i)\n", __FUNCTION__, ret); + // this device needs a STOP between the register and data + if ((ret = i2c_transfer (state->i2c, &msg[0], 1)) != 1) { + dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", + __FUNCTION__, reg, ret); + return -1; + } + if ((ret = i2c_transfer (state->i2c, &msg[1], 1)) != 1) { + dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", + __FUNCTION__, reg, ret); + return -1; + } - return ret == 2 ? 0 : ret; + return 0; } static int stv0297_set_symbolrate (struct stv0297_state* state, u32 srate) |