| 147 | } |
| 148 | |
| 149 | int as3722_write_buf(struct as3722_softc *sc, uint8_t reg, uint8_t *buf, |
| 150 | size_t size) |
| 151 | { |
| 152 | uint8_t data[1]; |
| 153 | int rv; |
| 154 | struct iic_msg msgs[2] = { |
| 155 | {0, IIC_M_WR, 1, data}, |
| 156 | {0, IIC_M_WR | IIC_M_NOSTART, size, buf}, |
| 157 | }; |
| 158 | |
| 159 | msgs[0].slave = sc->bus_addr; |
| 160 | msgs[1].slave = sc->bus_addr; |
| 161 | data[0] = reg; |
| 162 | |
| 163 | rv = iicbus_transfer(sc->dev, msgs, 2); |
| 164 | if (rv != 0) { |
| 165 | device_printf(sc->dev, |
| 166 | "Error when writing reg 0x%02X, rv: %d\n", reg, rv); |
| 167 | return (EIO); |
| 168 | } |
| 169 | return (0); |
| 170 | } |
| 171 | |
| 172 | int |
| 173 | as3722_modify(struct as3722_softc *sc, uint8_t reg, uint8_t clear, uint8_t set) |
no test coverage detected