arm64: rockchip: rk805: Switch to iicdev_{readfrom,writeto}
This simpify the code a bit.
This commit is contained in:
parent
5c28c9d734
commit
c976945339
@ -227,24 +227,16 @@ static struct rk805_regdef rk808_regdefs[] = {
|
|||||||
static int
|
static int
|
||||||
rk805_read(device_t dev, uint8_t reg, uint8_t *data, uint8_t size)
|
rk805_read(device_t dev, uint8_t reg, uint8_t *data, uint8_t size)
|
||||||
{
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
return (iicdev_readfrom(dev, reg, data, size, IIC_INTRWAIT));
|
err = iicdev_readfrom(dev, reg, data, size, IIC_INTRWAIT);
|
||||||
|
return (err);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
rk805_write(device_t dev, uint8_t reg, uint8_t data)
|
rk805_write(device_t dev, uint8_t reg, uint8_t data)
|
||||||
{
|
{
|
||||||
struct iic_msg msg;
|
return (iicdev_writeto(dev, reg, &data, 1, IIC_INTRWAIT));
|
||||||
uint8_t buf[2];
|
|
||||||
|
|
||||||
buf[0] = reg;
|
|
||||||
buf[1] = data;
|
|
||||||
msg.slave = iicbus_get_addr(dev);
|
|
||||||
msg.flags = IIC_M_WR;
|
|
||||||
msg.buf = buf;
|
|
||||||
msg.len = sizeof(buf);
|
|
||||||
|
|
||||||
return (iicbus_transfer_excl(dev, &msg, 1, IIC_INTRWAIT));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
Loading…
Reference in New Issue
Block a user