[PATCH] mfd: mc34704: fix register reading

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Tue Oct 20 07:12:08 EDT 2020


According to the data sheet (MC34704 Rev. 8.0, 12/2014) must always have
the MSB set in the "Sub-address" byte for reads.

This fixes reading out registers on a MC34704AEP chip.

Fixes: 514387711f2d ("i2c: add driver for the MC34704 PMIC")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
---
 drivers/mfd/mc34704.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/mc34704.c b/drivers/mfd/mc34704.c
index 4aa02b74ff20..29071c5ccfce 100644
--- a/drivers/mfd/mc34704.c
+++ b/drivers/mfd/mc34704.c
@@ -43,7 +43,7 @@ int mc34704_reg_read(struct mc34704 *mc34704, u8 reg, u8 *val)
 {
 	int ret;
 
-	ret = i2c_read_reg(mc34704->client, reg, val, 1);
+	ret = i2c_read_reg(mc34704->client, 1 << 7 | reg, val, 1);
 
 	return ret == 1 ? 0 : ret;
 }
@@ -112,7 +112,7 @@ static int mc34704_probe(struct device_d *dev)
 	mc34704_dev = xzalloc(sizeof(struct mc34704));
 	mc34704_dev->cdev.name = DRIVERNAME;
 	mc34704_dev->client = to_i2c_client(dev);
-	mc34704_dev->cdev.size = 256;
+	mc34704_dev->cdev.size = 128;
 	mc34704_dev->cdev.dev = dev;
 	mc34704_dev->cdev.ops = &mc34704_fops;
 
-- 
2.28.0




More information about the barebox mailing list