Merge tag 'u-boot-atmel-fixes-2021.01-b' of https://gitlab.denx.de/u-boot/custodians...
[platform/kernel/u-boot.git] / drivers / power / twl4030.c
index 42c9001..f48af84 100644 (file)
@@ -22,7 +22,9 @@
  *     Syed Mohammed Khasim <khasim at ti.com>
  */
 
+#include <command.h>
 #include <twl4030.h>
+#include <linux/delay.h>
 
 /*
  * Power Reset
@@ -172,7 +174,7 @@ void twl4030_power_mmc_init(int dev_index)
 }
 
 #ifdef CONFIG_CMD_POWEROFF
-int do_poweroff(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
        twl4030_power_off();
 
@@ -199,7 +201,7 @@ int twl4030_i2c_write_u8(u8 chip_no, u8 reg, u8 val)
        return 0;
 }
 
-int twl4030_i2c_read_u8(u8 chip_no, u8 reg, u8 *valp)
+int twl4030_i2c_read(u8 chip_no, u8 reg, u8 *valp, int len)
 {
        struct udevice *dev;
        int ret;
@@ -209,12 +211,11 @@ int twl4030_i2c_read_u8(u8 chip_no, u8 reg, u8 *valp)
                pr_err("unable to get I2C bus. ret %d\n", ret);
                return ret;
        }
-       ret = dm_i2c_reg_read(dev, reg);
-       if (ret < 0) {
+       ret = dm_i2c_read(dev, reg, valp, len);
+       if (ret) {
                pr_err("reading from twl4030 failed. ret %d\n", ret);
                return ret;
        }
-       *valp = (u8)ret;
        return 0;
 }
 #endif