mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH] mfd: mc34704: fix register reading
Date: Tue, 20 Oct 2020 13:12:08 +0200	[thread overview]
Message-ID: <20201020111208.14216-1-u.kleine-koenig@pengutronix.de> (raw)

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@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2020-10-20 11:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-20 11:12 Uwe Kleine-König [this message]
2020-10-21  9:56 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201020111208.14216-1-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --subject='Re: [PATCH] mfd: mc34704: fix register reading' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox