From efb48c6cf7bbb57e7b2ea6ce7671905e84384963 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Fri, 30 May 2008 14:23:04 -0400 Subject: Fix ivch i2c read function to use the "special" i2c format. --- linux-core/dvo_ivch.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'linux-core') diff --git a/linux-core/dvo_ivch.c b/linux-core/dvo_ivch.c index 5fce2462..9209dd02 100644 --- a/linux-core/dvo_ivch.c +++ b/linux-core/dvo_ivch.c @@ -186,28 +186,32 @@ static bool ivch_read(struct intel_dvo_device *dvo, int addr, uint16_t *data) { struct ivch_priv *priv = dvo->dev_priv; struct intel_i2c_chan *i2cbus = dvo->i2c_bus; - u8 out_buf[2]; + u8 out_buf[1]; u8 in_buf[2]; struct i2c_msg msgs[] = { { .addr = i2cbus->slave_addr, - .flags = 0, + .flags = I2C_M_RD, + .len = 0, + }, + { + .addr = 0, + .flags = I2C_M_NOSTART, .len = 1, .buf = out_buf, }, { .addr = i2cbus->slave_addr, - .flags = I2C_M_RD, + .flags = I2C_M_RD | I2C_M_NOSTART, .len = 2, .buf = in_buf, } }; out_buf[0] = addr; - out_buf[1] = 0; - if (i2c_transfer(&i2cbus->adapter, msgs, 2) == 2) { + if (i2c_transfer(&i2cbus->adapter, msgs, 3) == 3) { *data = (in_buf[1] << 8) | in_buf[0]; return true; }; -- cgit v1.2.3