aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/cx23885/cx23885-i2c.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/media/video/cx23885/cx23885-i2c.c b/drivers/media/video/cx23885/cx23885-i2c.c
index 71da528932df..f7e8a481696d 100644
--- a/drivers/media/video/cx23885/cx23885-i2c.c
+++ b/drivers/media/video/cx23885/cx23885-i2c.c
@@ -84,7 +84,8 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap,
84 u32 wdata, addr, ctrl; 84 u32 wdata, addr, ctrl;
85 int retval, cnt; 85 int retval, cnt;
86 86
87 dprintk(1, "%s()\n", __FUNCTION__); 87 dprintk(1, "%s(msg->len=%d, last=%d)\n", __FUNCTION__, msg->len, last);
88
88 /* Deal with i2c probe functions with zero payload */ 89 /* Deal with i2c probe functions with zero payload */
89 if (msg->len == 0) { 90 if (msg->len == 0) {
90 cx_write(bus->reg_addr, msg->addr << 25); 91 cx_write(bus->reg_addr, msg->addr << 25);
@@ -127,7 +128,7 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap,
127 wdata = msg->buf[cnt]; 128 wdata = msg->buf[cnt];
128 ctrl = bus->i2c_period | (1 << 12) | (1 << 2); 129 ctrl = bus->i2c_period | (1 << 12) | (1 << 2);
129 130
130 if (cnt < msg->len-1 || !last) 131 if (cnt < msg->len - 1)
131 ctrl |= I2C_NOSTOP | I2C_EXTEND; 132 ctrl |= I2C_NOSTOP | I2C_EXTEND;
132 133
133 cx_write(bus->reg_addr, addr); 134 cx_write(bus->reg_addr, addr);
@@ -162,7 +163,7 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap,
162 u32 ctrl, cnt; 163 u32 ctrl, cnt;
163 int retval; 164 int retval;
164 165
165 dprintk(1, "%s()\n", __FUNCTION__); 166 dprintk(1, "%s(msg->len=%d, last=%d)\n", __FUNCTION__, msg->len, last);
166 167
167 /* Deal with i2c probe functions with zero payload */ 168 /* Deal with i2c probe functions with zero payload */
168 if (msg->len == 0) { 169 if (msg->len == 0) {
@@ -178,11 +179,14 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap,
178 return 0; 179 return 0;
179 } 180 }
180 181
182 if (i2c_debug)
183 printk(" <R %02x", (msg->addr << 1) + 1);
184
181 for(cnt = 0; cnt < msg->len; cnt++) { 185 for(cnt = 0; cnt < msg->len; cnt++) {
182 186
183 ctrl = bus->i2c_period | (1 << 12) | (1 << 2) | 1; 187 ctrl = bus->i2c_period | (1 << 12) | (1 << 2) | 1;
184 188
185 if (cnt < msg->len-1 || !last) 189 if (cnt < msg->len - 1)
186 ctrl |= I2C_NOSTOP | I2C_EXTEND; 190 ctrl |= I2C_NOSTOP | I2C_EXTEND;
187 191
188 cx_write(bus->reg_addr, msg->addr << 25); 192 cx_write(bus->reg_addr, msg->addr << 25);
@@ -195,9 +199,7 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap,
195 goto eio; 199 goto eio;
196 msg->buf[cnt] = cx_read(bus->reg_rdata) & 0xff; 200 msg->buf[cnt] = cx_read(bus->reg_rdata) & 0xff;
197 if (i2c_debug) { 201 if (i2c_debug) {
198 if (!(ctrl & I2C_NOSTOP)) 202 printk(" %02x", msg->buf[cnt]);
199 printk(" <R %02x", (msg->addr << 1) +1);
200 printk(" =%02x", msg->buf[cnt]);
201 if (!(ctrl & I2C_NOSTOP)) 203 if (!(ctrl & I2C_NOSTOP))
202 printk(" >\n"); 204 printk(" >\n");
203 } 205 }