From: Dimitri Fedrau <dima.fedrau@gmail.com>
To: Sebastian Reichel <sebastian.reichel@collabora.com>
Cc: "Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
linux-pm@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Thomas Weißschuh" <thomas@t-8ch.de>
Subject: Re: [PATCH v4 2/2] power: supply: add support for MAX1720x standalone fuel gauge
Date: Wed, 19 Jun 2024 08:14:07 +0200 [thread overview]
Message-ID: <20240619061407.GA51605@debian> (raw)
In-Reply-To: <dzrsh5dsraz62sc3mfhlmf5yolkzjet2agv2ochg3xg4ryfofs@bnmxbtsavv4o>
Am Wed, Jun 19, 2024 at 01:19:32AM +0200 schrieb Sebastian Reichel:
> Hi,
>
> On Mon, Jun 17, 2024 at 08:45:04PM GMT, Dimitri Fedrau wrote:
> > The MAX17201 monitors a single cell pack. The MAX17205 monitors and
> > balances a 2S or 3S pack or monitors a multiple-series cell pack. Both
> > devices use a I2C interface.
> >
> > Signed-off-by: Dimitri Fedrau <dima.fedrau@gmail.com>
> > ---
>
> [...]
>
> > +static int max1720x_read_word_data_nvmem(struct i2c_client *ancillary, u8 addr)
> > +{
> > + u8 rx[2];
> > + struct i2c_msg msgs[] = {
> > + {
> > + .addr = ancillary->addr,
> > + .flags = 0,
> > + .len = 1,
> > + .buf = &addr,
> > + },
> > + {
> > + .addr = ancillary->addr,
> > + .flags = I2C_M_RD,
> > + .len = 2,
> > + .buf = &rx[0],
> > + },
> > + };
> > + int ret;
> > +
> > + ret = i2c_transfer(ancillary->adapter, msgs, ARRAY_SIZE(msgs));
> > + if (ret != ARRAY_SIZE(msgs))
> > + return ret < 0 ? ret : -EIO;
> > +
> > + return get_unaligned_le16(&rx[0]);
> > +}
>
> Have you tried using i2c_smbus_read_word_data(ancillary, addr)
> instead of the above?
>
Yes, I did and it worked. Used it in V3 and changed it due to review
comments by Thomas which make sense to me. I don't have any preference on
this. Should I change it back ?
> [...]
>
[...]
Dimitri
next prev parent reply other threads:[~2024-06-19 6:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-17 18:45 [PATCH v4 0/2] power: supply: add support for MAX1720x standalone fuel Dimitri Fedrau
2024-06-17 18:45 ` [PATCH v4 1/2] dt-bindings: power: supply: add support for MAX17201/MAX17205 fuel gauge Dimitri Fedrau
2024-06-18 6:54 ` Krzysztof Kozlowski
2024-06-18 23:22 ` Sebastian Reichel
2024-06-17 18:45 ` [PATCH v4 2/2] power: supply: add support for MAX1720x standalone " Dimitri Fedrau
2024-06-18 23:19 ` Sebastian Reichel
2024-06-19 6:14 ` Dimitri Fedrau [this message]
2024-06-19 15:30 ` Sebastian Reichel
2024-06-19 16:09 ` Dimitri Fedrau
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=20240619061407.GA51605@debian \
--to=dima.fedrau@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sebastian.reichel@collabora.com \
--cc=thomas@t-8ch.de \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.