diff options
author | Abylay Ospan <aospan@netup.ru> | 2009-06-14 20:10:05 +0300 |
---|---|---|
committer | Abylay Ospan <aospan@netup.ru> | 2009-06-14 20:10:05 +0300 |
commit | 0c34c03a8998a601da924c7f2679494992b548e6 (patch) | |
tree | e82c0a454d74d80b1a22d22d7e7c266ad588d3f4 /linux/drivers/media/dvb | |
parent | 4e89b9e36f8b8a7ad919333c7dcc6cbdd902a5e5 (diff) | |
download | mediapointer-dvb-s2-0c34c03a8998a601da924c7f2679494992b548e6.tar.gz mediapointer-dvb-s2-0c34c03a8998a601da924c7f2679494992b548e6.tar.bz2 |
Bug fix: stv0900 register read must using i2c in one transaction
From: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Abylay Ospan <aospan@netup.ru>
Diffstat (limited to 'linux/drivers/media/dvb')
-rw-r--r-- | linux/drivers/media/dvb/frontends/stv0900_core.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/linux/drivers/media/dvb/frontends/stv0900_core.c b/linux/drivers/media/dvb/frontends/stv0900_core.c index 899b1e7ed..156d269f7 100644 --- a/linux/drivers/media/dvb/frontends/stv0900_core.c +++ b/linux/drivers/media/dvb/frontends/stv0900_core.c @@ -149,31 +149,31 @@ void stv0900_write_reg(struct stv0900_internal *i_params, u16 reg_addr, dprintk(KERN_ERR "%s: i2c error %d\n", __func__, ret); } -u8 stv0900_read_reg(struct stv0900_internal *i_params, u16 reg_addr) +u8 stv0900_read_reg(struct stv0900_internal *i_params, u16 reg) { - u8 data[2]; int ret; - struct i2c_msg i2cmsg = { - .addr = i_params->i2c_addr, - .flags = 0, - .len = 2, - .buf = data, + u8 b0[] = { MSB(reg), LSB(reg) }; + u8 buf = 0; + struct i2c_msg msg[] = { + { + .addr = i_params->i2c_addr, + .flags = 0, + .buf = b0, + .len = 2, + }, { + .addr = i_params->i2c_addr, + .flags = I2C_M_RD, + .buf = &buf, + .len = 1, + }, }; - data[0] = MSB(reg_addr); - data[1] = LSB(reg_addr); - - ret = i2c_transfer(i_params->i2c_adap, &i2cmsg, 1); - if (ret != 1) - dprintk(KERN_ERR "%s: i2c error %d\n", __func__, ret); - - i2cmsg.flags = I2C_M_RD; - i2cmsg.len = 1; - ret = i2c_transfer(i_params->i2c_adap, &i2cmsg, 1); - if (ret != 1) - dprintk(KERN_ERR "%s: i2c error %d\n", __func__, ret); + ret = i2c_transfer(i_params->i2c_adap, msg, 2); + if (ret != 2) + dprintk(KERN_ERR "%s: i2c error %d, reg[0x%02x]\n", + __func__, ret, reg); - return data[0]; + return buf; } void extract_mask_pos(u32 label, u8 *mask, u8 *pos) |