diff options
author | Chris Pascoe <c.pascoe@itee.uq.edu.au> | 2007-11-19 01:01:22 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-01-25 16:02:20 -0500 |
commit | 272479d7ab067344d118e7633b624bf98f8896f3 (patch) | |
tree | d707fd55df3ee60adb45a48956508d2900bff735 /drivers | |
parent | 13e001dfe3aeb9e7b05445af76e5b47235e81285 (diff) |
V4L/DVB (6626): CXUSB: support only-read i2c requests
Any i2c read request that was not immediately preceded by a write request was
incorrectly taking the write path. Add the capability to handle individual
read requests.
Signed-off-by: Chris Pascoe <c.pascoe@itee.uq.edu.au>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/dvb/dvb-usb/cxusb.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c index 86fbd6c73ea9..016a3780b714 100644 --- a/drivers/media/dvb/dvb-usb/cxusb.c +++ b/drivers/media/dvb/dvb-usb/cxusb.c | |||
@@ -98,8 +98,21 @@ static int cxusb_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], | |||
98 | break; | 98 | break; |
99 | } | 99 | } |
100 | 100 | ||
101 | /* read request */ | 101 | if (msg[i].flags & I2C_M_RD) { |
102 | if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) { | 102 | /* read only */ |
103 | u8 obuf[3], ibuf[1+msg[i].len]; | ||
104 | obuf[0] = 0; | ||
105 | obuf[1] = msg[i].len; | ||
106 | obuf[2] = msg[i].addr; | ||
107 | if (cxusb_ctrl_msg(d, CMD_I2C_READ, | ||
108 | obuf, 3, | ||
109 | ibuf, 1+msg[i].len) < 0) { | ||
110 | warn("i2c read failed"); | ||
111 | break; | ||
112 | } | ||
113 | memcpy(msg[i].buf, &ibuf[1], msg[i].len); | ||
114 | } else if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) { | ||
115 | /* write then read */ | ||
103 | u8 obuf[3+msg[i].len], ibuf[1+msg[i+1].len]; | 116 | u8 obuf[3+msg[i].len], ibuf[1+msg[i+1].len]; |
104 | obuf[0] = msg[i].len; | 117 | obuf[0] = msg[i].len; |
105 | obuf[1] = msg[i+1].len; | 118 | obuf[1] = msg[i+1].len; |
@@ -117,7 +130,8 @@ static int cxusb_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], | |||
117 | memcpy(msg[i+1].buf, &ibuf[1], msg[i+1].len); | 130 | memcpy(msg[i+1].buf, &ibuf[1], msg[i+1].len); |
118 | 131 | ||
119 | i++; | 132 | i++; |
120 | } else { /* write */ | 133 | } else { |
134 | /* write only */ | ||
121 | u8 obuf[2+msg[i].len], ibuf; | 135 | u8 obuf[2+msg[i].len], ibuf; |
122 | obuf[0] = msg[i].addr; | 136 | obuf[0] = msg[i].addr; |
123 | obuf[1] = msg[i].len; | 137 | obuf[1] = msg[i].len; |