| 210 | } |
| 211 | |
| 212 | static int in_byte(unsigned int bus, int ack) |
| 213 | { |
| 214 | u8 byte = 0; |
| 215 | int i, ret; |
| 216 | for (i = 0; i < 8; ++i) { |
| 217 | int bit = in_bit(bus); |
| 218 | if (bit < 0) |
| 219 | return bit; |
| 220 | byte = (byte << 1) | bit; |
| 221 | } |
| 222 | |
| 223 | if ((ret = out_bit(bus, !ack)) < 0) |
| 224 | return ret; |
| 225 | |
| 226 | if (DEBUG) |
| 227 | printk(BIOS_DEBUG, "software_i2c(%d): read byte 0x%02x, " |
| 228 | "sent %s\n", bus, byte, ack ? "ACK" : "NAK"); |
| 229 | |
| 230 | return byte; |
| 231 | } |
| 232 | |
| 233 | int software_i2c_transfer(unsigned int bus, struct i2c_msg *segments, int count) |
| 234 | { |
no test coverage detected