diff options
author | Andrew de Quincy <devnull@localhost> | 2004-11-09 19:04:39 +0000 |
---|---|---|
committer | Andrew de Quincy <devnull@localhost> | 2004-11-09 19:04:39 +0000 |
commit | 6a7a1d7aaa0944f9257553fdc67c571c13d588aa (patch) | |
tree | 7beb1f8e5eaf86d2dca695dfe55b3e57d7bb4c60 /linux/drivers/media | |
parent | 47d424bcc8bed15d42714e6767541b8092a28127 (diff) | |
download | mediapointer-dvb-s2-6a7a1d7aaa0944f9257553fdc67c571c13d588aa.tar.gz mediapointer-dvb-s2-6a7a1d7aaa0944f9257553fdc67c571c13d588aa.tar.bz2 |
Added wait loop
Diffstat (limited to 'linux/drivers/media')
-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) |