diff options
author | Andrew de Quincy <devnull@localhost> | 2005-06-12 01:23:00 +0000 |
---|---|---|
committer | Andrew de Quincy <devnull@localhost> | 2005-06-12 01:23:00 +0000 |
commit | 502df9a802c518e57a4960a1fb5a0b0ed84c2fff (patch) | |
tree | b83ac42778cf1d83065e1f06032f32e367dcebfd /linux/drivers/media/dvb/frontends/s5h1420.c | |
parent | f9e04096c6769bf41dafcfd9c78b39ea89232a54 (diff) | |
download | mediapointer-dvb-s2-502df9a802c518e57a4960a1fb5a0b0ed84c2fff.tar.gz mediapointer-dvb-s2-502df9a802c518e57a4960a1fb5a0b0ed84c2fff.tar.bz2 |
Get i2c working properly
Diffstat (limited to 'linux/drivers/media/dvb/frontends/s5h1420.c')
-rw-r--r-- | linux/drivers/media/dvb/frontends/s5h1420.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/linux/drivers/media/dvb/frontends/s5h1420.c b/linux/drivers/media/dvb/frontends/s5h1420.c index 587718fa3..2d95c9d2a 100644 --- a/linux/drivers/media/dvb/frontends/s5h1420.c +++ b/linux/drivers/media/dvb/frontends/s5h1420.c @@ -51,7 +51,7 @@ static int debug = 0; static int s5h1420_writereg (struct s5h1420_state* state, u8 reg, u8 data) { u8 buf [] = { reg, data }; - struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 3 }; + struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 2 }; int err; if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { @@ -67,13 +67,15 @@ static u8 s5h1420_readreg (struct s5h1420_state* state, u8 reg) int ret; u8 b0 [] = { reg }; u8 b1 [] = { 0 }; - struct i2c_msg msg [] = { { .addr = state->config->demod_address, .flags = 0, .buf = b0, .len = 2 }, - { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = b1, .len = 1 } }; + struct i2c_msg msg1 = { .addr = state->config->demod_address, .flags = 0, .buf = b0, .len = 1 }; + struct i2c_msg msg2 = { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = b1, .len = 1 }; - ret = i2c_transfer (state->i2c, msg, 2); - - if (ret != 2) return ret; + if ((ret = i2c_transfer (state->i2c, &msg1, 1)) != 1) + return ret; + if ((ret = i2c_transfer (state->i2c, &msg2, 1)) != 1) + return ret; + return b1[0]; } |