u8 byte;
int ret;
+ debug("%s: reg=%x", __func__, reg);
ret = pmic_read(dev, reg, &byte, 1);
- debug("%s: reg=%x, value=%x\n", __func__, reg, byte);
+ debug(", value=%x, ret=%d\n", byte, ret);
return ret ? ret : byte;
}
int pmic_reg_write(struct udevice *dev, uint reg, uint value)
{
u8 byte = value;
+ int ret;
+
+ debug("%s: reg=%x, value=%x", __func__, reg, value);
+ ret = pmic_write(dev, reg, &byte, 1);
+ debug(", ret=%d\n", ret);
- debug("%s: reg=%x, value=%x\n", __func__, reg, value);
- return pmic_write(dev, reg, &byte, 1);
+ return ret;
}
int pmic_clrsetbits(struct udevice *dev, uint reg, uint clr, uint set)
static int rk808_write(struct udevice *dev, uint reg, const uint8_t *buff,
int len)
{
- if (dm_i2c_write(dev, reg, buff, len)) {
+ int ret;
+
+ ret = dm_i2c_write(dev, reg, buff, len);
+ if (ret) {
debug("write error to device: %p register: %#x!", dev, reg);
- return -EIO;
+ return ret;
}
return 0;
static int rk808_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
{
- if (dm_i2c_read(dev, reg, buff, len)) {
+ int ret;
+
+ ret = dm_i2c_read(dev, reg, buff, len);
+ if (ret) {
debug("read error from device: %p register: %#x!", dev, reg);
- return -EIO;
+ return ret;
}
return 0;