From: "André Draszik" <andre.draszik@linaro.org>
To: Thomas Antoine <t.antoine@uclouvain.be>,
Sebastian Reichel <sre@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Dimitri Fedrau <dima.fedrau@gmail.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Peter Griffin <peter.griffin@linaro.org>,
Alim Akhtar <alim.akhtar@samsung.com>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org
Subject: Re: [PATCH 1/4] power: supply: add support for max77759 fuel gauge
Date: Tue, 03 Dec 2024 11:02:20 +0000 [thread overview]
Message-ID: <16f9b5f8aed79e9313b4638512896743fa5a8d6d.camel@linaro.org> (raw)
In-Reply-To: <bce22ca8-aed2-41ae-b2ef-fdc71266709a@uclouvain.be>
On Tue, 2024-12-03 at 11:11 +0100, Thomas Antoine wrote:
> On 12/3/24 10:31, André Draszik wrote:
> > On Tue, 2024-12-03 at 10:08 +0100, Thomas Antoine wrote:
> > > On 12/3/24 07:47, André Draszik wrote:
> > > > > From: Thomas Antoine <t.antoine@uclouvain.be>
> > > > >
[...]
> > > > > /*
> > > > > * Model Gauge M5 Algorithm output register
> > > > > * Volatile data (must not be cached)
> > > > > @@ -369,6 +387,8 @@ static int max1720x_battery_get_property(struct
> > > > > power_supply *psy,
> > > > > val->strval = max17201_model;
> > > > > else if (reg_val == MAX172XX_DEV_NAME_TYPE_MAX17205)
> > > > > val->strval = max17205_model;
> > > > > + else if (reg_val == MAX172XX_DEV_NAME_TYPE_MAX77759)
> > > > > + val->strval = max77759_model;
> > > > > else
> > > >
> > > > This is a 16 bit register, and while yes, MAX172XX_DEV_NAME_TYPE_MASK only
> > > > cares about the bottom 4 bits, the register is described as 'Firmware
> > > > Version Information'.
> > > >
> > > > But maybe it's ok to do it like that, at least for now.
> > >
> > > I thought this method would be ok as long as there is no collision on
> > > values. I hesitated to change the model evaluation method based on chip
> > > model, where the max77759 would thus have an hard-coded value and the
> > > max1720x would still evaluate the register value. I did not do it because
> > > it led to a lot more changes for no difference.
> >
> > Downstream uses the upper bits for max77759:
> > https://android.googlesource.com/kernel/google-modules/bms/+/refs/heads/android-gs-raviole-mainline/max_m5.h#135
> >
> > I don't know what the original max17201/5 report in this register
> > for those bits, though. Given for max77759 this register returns
> > the firmware version, I assume the lower bits can change.
>
> Based on this datasheet of the max1720x, the upper bits are the revision
> and the four lower bits are device. So it could change.
> https://www.analog.com/media/en/technical-documentation/data-sheets/MAX17201-MAX17215.pdf#MAX17201%20DS.indd%3A.213504%3A15892
>
> If the four lower bits are not always 0 for the max77759 then I guess it
> is necessary to change this as it wouldn't work with all max77759.
Maybe the best way forward is to go by the compatible (from DT), and
if max77759 to then print a warning if the upper bits are != 0x62 and
!= 0x63. And maybe even refuse to load in that case.
Cheers,
Andre'
next prev parent reply other threads:[~2024-12-03 11:02 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-02 13:07 [PATCH 0/4] Google Pixel 6 (oriole): max77759 fuel gauge enablement and driver support Thomas Antoine via B4 Relay
2024-12-02 13:07 ` [PATCH 1/4] power: supply: add support for max77759 fuel gauge Thomas Antoine via B4 Relay
2024-12-03 6:47 ` André Draszik
2024-12-03 7:23 ` André Draszik
2024-12-03 9:45 ` André Draszik
2024-12-03 10:30 ` Thomas Antoine
2024-12-03 11:06 ` André Draszik
2024-12-04 8:49 ` Thomas Antoine
2024-12-03 9:08 ` Thomas Antoine
2024-12-03 9:31 ` André Draszik
2024-12-03 10:11 ` Thomas Antoine
2024-12-03 10:50 ` Peter Griffin
2024-12-03 11:02 ` André Draszik [this message]
2024-12-04 8:53 ` Thomas Antoine
2024-12-03 7:35 ` Dimitri Fedrau
2024-12-03 9:25 ` Thomas Antoine
2024-12-02 13:07 ` [PATCH 2/4] dt-bindings: power: supply: add max77759-fg flavor and don't require nvme address Thomas Antoine via B4 Relay
2024-12-02 13:39 ` Krzysztof Kozlowski
2024-12-02 14:42 ` Thomas Antoine
2024-12-03 6:57 ` André Draszik
2024-12-03 9:32 ` Thomas Antoine
2024-12-03 10:07 ` André Draszik
2024-12-03 7:12 ` André Draszik
2024-12-03 10:23 ` Thomas Antoine
2024-12-03 10:40 ` André Draszik
2024-12-04 13:13 ` Thomas Antoine
2024-12-05 6:22 ` André Draszik
2024-12-02 13:07 ` [PATCH 3/4] arm64: defconfig: enable Maxim max1720x driver Thomas Antoine via B4 Relay
2024-12-02 13:40 ` Krzysztof Kozlowski
2024-12-02 14:54 ` Thomas Antoine
2024-12-02 13:07 ` [PATCH 4/4] arm64: dts: exynos: gs101-oriole: enable Maxim max77759 fuel gauge Thomas Antoine via B4 Relay
2024-12-02 13:41 ` Krzysztof Kozlowski
2024-12-02 15:03 ` Thomas Antoine
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=16f9b5f8aed79e9313b4638512896743fa5a8d6d.camel@linaro.org \
--to=andre.draszik@linaro.org \
--cc=alim.akhtar@samsung.com \
--cc=catalin.marinas@arm.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dima.fedrau@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=peter.griffin@linaro.org \
--cc=robh@kernel.org \
--cc=sre@kernel.org \
--cc=t.antoine@uclouvain.be \
--cc=will@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox