diff options
author | Pali Rohár <pali@kernel.org> | 2020-10-27 00:36:15 +0300 |
---|---|---|
committer | Lokesh Vutla <lokeshvutla@ti.com> | 2020-11-15 12:55:55 +0300 |
commit | 4fcc084eeb8cd7db77263672c6a43da629a4ed48 (patch) | |
tree | 8d6b9028f4ddf7a9ae4cc5daea6c03d8ac38bb47 /drivers/power/twl4030.c | |
parent | a1337e3581b74b62397767b5a8d8ff148ccb97c1 (diff) | |
download | u-boot-4fcc084eeb8cd7db77263672c6a43da629a4ed48.tar.xz |
power: twl4030: Add twl4030_i2c_read() function
Function twl4030_i2c_read() is like twl4030_i2c_read_u8() but instead of
single value it rather returns array of values.
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Diffstat (limited to 'drivers/power/twl4030.c')
-rw-r--r-- | drivers/power/twl4030.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/power/twl4030.c b/drivers/power/twl4030.c index b0d5cba2c4..f48af84e17 100644 --- a/drivers/power/twl4030.c +++ b/drivers/power/twl4030.c @@ -201,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; @@ -211,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 |