* [PATCH] mfd: mc34704: fix register reading
@ 2020-10-20 11:12 Uwe Kleine-König
2020-10-21 9:56 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Uwe Kleine-König @ 2020-10-20 11:12 UTC (permalink / raw)
To: barebox
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] mfd: mc34704: fix register reading
2020-10-20 11:12 [PATCH] mfd: mc34704: fix register reading Uwe Kleine-König
@ 2020-10-21 9:56 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2020-10-21 9:56 UTC (permalink / raw)
To: Uwe Kleine-König; +Cc: barebox
On Tue, Oct 20, 2020 at 01:12:08PM +0200, Uwe Kleine-König wrote:
> 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(-)
Applied, thanks
Sascha
>
> 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
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-10-21 9:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-20 11:12 [PATCH] mfd: mc34704: fix register reading Uwe Kleine-König
2020-10-21 9:56 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox