diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/i2c/algos/i2c-algo-pca.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/drivers/i2c/algos/i2c-algo-pca.c b/drivers/i2c/algos/i2c-algo-pca.c index dcdaf8e675b..2b9a8f54bb2 100644 --- a/drivers/i2c/algos/i2c-algo-pca.c +++ b/drivers/i2c/algos/i2c-algo-pca.c | |||
@@ -109,13 +109,13 @@ static void pca_stop(struct i2c_algo_pca_data *adap) | |||
109 | * returns after the address has been sent | 109 | * returns after the address has been sent |
110 | */ | 110 | */ |
111 | static int pca_address(struct i2c_algo_pca_data *adap, | 111 | static int pca_address(struct i2c_algo_pca_data *adap, |
112 | struct i2c_msg *msg) | 112 | struct i2c_msg *msg) |
113 | { | 113 | { |
114 | int sta = pca_get_con(adap); | 114 | int sta = pca_get_con(adap); |
115 | int addr; | 115 | int addr; |
116 | 116 | ||
117 | addr = ( (0x7f & msg->addr) << 1 ); | 117 | addr = ((0x7f & msg->addr) << 1); |
118 | if (msg->flags & I2C_M_RD ) | 118 | if (msg->flags & I2C_M_RD) |
119 | addr |= 1; | 119 | addr |= 1; |
120 | DEB2("=== SLAVE ADDRESS %#04x+%c=%#04x\n", | 120 | DEB2("=== SLAVE ADDRESS %#04x+%c=%#04x\n", |
121 | msg->addr, msg->flags & I2C_M_RD ? 'R' : 'W', addr); | 121 | msg->addr, msg->flags & I2C_M_RD ? 'R' : 'W', addr); |
@@ -134,7 +134,7 @@ static int pca_address(struct i2c_algo_pca_data *adap, | |||
134 | * Returns after the byte has been transmitted | 134 | * Returns after the byte has been transmitted |
135 | */ | 135 | */ |
136 | static int pca_tx_byte(struct i2c_algo_pca_data *adap, | 136 | static int pca_tx_byte(struct i2c_algo_pca_data *adap, |
137 | __u8 b) | 137 | __u8 b) |
138 | { | 138 | { |
139 | int sta = pca_get_con(adap); | 139 | int sta = pca_get_con(adap); |
140 | DEB2("=== WRITE %#04x\n", b); | 140 | DEB2("=== WRITE %#04x\n", b); |
@@ -164,13 +164,13 @@ static void pca_rx_byte(struct i2c_algo_pca_data *adap, | |||
164 | * Returns after next byte has arrived. | 164 | * Returns after next byte has arrived. |
165 | */ | 165 | */ |
166 | static int pca_rx_ack(struct i2c_algo_pca_data *adap, | 166 | static int pca_rx_ack(struct i2c_algo_pca_data *adap, |
167 | int ack) | 167 | int ack) |
168 | { | 168 | { |
169 | int sta = pca_get_con(adap); | 169 | int sta = pca_get_con(adap); |
170 | 170 | ||
171 | sta &= ~(I2C_PCA_CON_STO|I2C_PCA_CON_STA|I2C_PCA_CON_SI|I2C_PCA_CON_AA); | 171 | sta &= ~(I2C_PCA_CON_STO|I2C_PCA_CON_STA|I2C_PCA_CON_SI|I2C_PCA_CON_AA); |
172 | 172 | ||
173 | if ( ack ) | 173 | if (ack) |
174 | sta |= I2C_PCA_CON_AA; | 174 | sta |= I2C_PCA_CON_AA; |
175 | 175 | ||
176 | pca_set_con(adap, sta); | 176 | pca_set_con(adap, sta); |
@@ -178,12 +178,12 @@ static int pca_rx_ack(struct i2c_algo_pca_data *adap, | |||
178 | } | 178 | } |
179 | 179 | ||
180 | static int pca_xfer(struct i2c_adapter *i2c_adap, | 180 | static int pca_xfer(struct i2c_adapter *i2c_adap, |
181 | struct i2c_msg *msgs, | 181 | struct i2c_msg *msgs, |
182 | int num) | 182 | int num) |
183 | { | 183 | { |
184 | struct i2c_algo_pca_data *adap = i2c_adap->algo_data; | 184 | struct i2c_algo_pca_data *adap = i2c_adap->algo_data; |
185 | struct i2c_msg *msg = NULL; | 185 | struct i2c_msg *msg = NULL; |
186 | int curmsg; | 186 | int curmsg; |
187 | int numbytes = 0; | 187 | int numbytes = 0; |
188 | int state; | 188 | int state; |
189 | int ret; | 189 | int ret; |
@@ -202,21 +202,21 @@ static int pca_xfer(struct i2c_adapter *i2c_adap, | |||
202 | 202 | ||
203 | DEB1("{{{ XFER %d messages\n", num); | 203 | DEB1("{{{ XFER %d messages\n", num); |
204 | 204 | ||
205 | if (i2c_debug>=2) { | 205 | if (i2c_debug >= 2) { |
206 | for (curmsg = 0; curmsg < num; curmsg++) { | 206 | for (curmsg = 0; curmsg < num; curmsg++) { |
207 | int addr, i; | 207 | int addr, i; |
208 | msg = &msgs[curmsg]; | 208 | msg = &msgs[curmsg]; |
209 | 209 | ||
210 | addr = (0x7f & msg->addr) ; | 210 | addr = (0x7f & msg->addr) ; |
211 | 211 | ||
212 | if (msg->flags & I2C_M_RD ) | 212 | if (msg->flags & I2C_M_RD) |
213 | printk(KERN_INFO " [%02d] RD %d bytes from %#02x [%#02x, ...]\n", | 213 | printk(KERN_INFO " [%02d] RD %d bytes from %#02x [%#02x, ...]\n", |
214 | curmsg, msg->len, addr, (addr<<1) | 1); | 214 | curmsg, msg->len, addr, (addr << 1) | 1); |
215 | else { | 215 | else { |
216 | printk(KERN_INFO " [%02d] WR %d bytes to %#02x [%#02x%s", | 216 | printk(KERN_INFO " [%02d] WR %d bytes to %#02x [%#02x%s", |
217 | curmsg, msg->len, addr, addr<<1, | 217 | curmsg, msg->len, addr, addr << 1, |
218 | msg->len == 0 ? "" : ", "); | 218 | msg->len == 0 ? "" : ", "); |
219 | for(i=0; i < msg->len; i++) | 219 | for (i = 0; i < msg->len; i++) |
220 | printk("%#04x%s", msg->buf[i], i == msg->len - 1 ? "" : ", "); | 220 | printk("%#04x%s", msg->buf[i], i == msg->len - 1 ? "" : ", "); |
221 | printk("]\n"); | 221 | printk("]\n"); |
222 | } | 222 | } |
@@ -305,7 +305,7 @@ static int pca_xfer(struct i2c_adapter *i2c_adap, | |||
305 | goto out; | 305 | goto out; |
306 | 306 | ||
307 | case 0x58: /* Data byte has been received; NOT ACK has been returned */ | 307 | case 0x58: /* Data byte has been received; NOT ACK has been returned */ |
308 | if ( numbytes == msg->len - 1 ) { | 308 | if (numbytes == msg->len - 1) { |
309 | pca_rx_byte(adap, &msg->buf[numbytes], 0); | 309 | pca_rx_byte(adap, &msg->buf[numbytes], 0); |
310 | curmsg++; numbytes = 0; | 310 | curmsg++; numbytes = 0; |
311 | if (curmsg == num) | 311 | if (curmsg == num) |
@@ -352,7 +352,7 @@ static int pca_xfer(struct i2c_adapter *i2c_adap, | |||
352 | 352 | ||
353 | static u32 pca_func(struct i2c_adapter *adap) | 353 | static u32 pca_func(struct i2c_adapter *adap) |
354 | { | 354 | { |
355 | return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; | 355 | return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; |
356 | } | 356 | } |
357 | 357 | ||
358 | static const struct i2c_algorithm pca_algo = { | 358 | static const struct i2c_algorithm pca_algo = { |