public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Antoine <t.antoine@uclouvain.be>
To: "André Draszik" <andre.draszik@linaro.org>,
	"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 2/4] dt-bindings: power: supply: add max77759-fg flavor and don't require nvme address
Date: Wed, 4 Dec 2024 14:13:13 +0100	[thread overview]
Message-ID: <5281f86d-6917-4f4e-b85d-70502a24c5bd@uclouvain.be> (raw)
In-Reply-To: <30b0995903fb7db3f866d1304783d878f563fe2f.camel@linaro.org>

On 12/3/24 11:40, André Draszik wrote:
> On Tue, 2024-12-03 at 11:23 +0100, Thomas Antoine wrote:
>> On 12/3/24 08:12, André Draszik wrote:
>>> On Mon, 2024-12-02 at 14:07 +0100, Thomas Antoine via B4 Relay wrote:
>>>> From: Thomas Antoine <t.antoine@uclouvain.be>
>>>>
>>>> As the Maxim max77759 fuel gauge has no non-volatile memory slave address,
>>>> make it non-obligatory. Except for this, the max77759 seems to behave the
>>>> same as the max1720x.
>>>
>>> What about the battery characterization tables? Aren't they needed for
>>> correct reporting?
>>
>> I checked some other patches which added fuel gauge and other bindings and I
>> couldn't find such characterization table. Can you point me to an example or
>> explain what it should contain if there needs one?
> 
> I haven't looked in detail, but there is
> 
> 
> https://android.googlesource.com/kernel/google-modules/raviole-device/+/refs/heads/android-gs-raviole-mainline/arch/arm64/boot/dts/google/gs101-oriole-battery.dtsi#13
> https://android.googlesource.com/kernel/google-modules/raviole-device/+/refs/heads/android-gs-raviole-mainline/arch/arm64/boot/dts/google/gs101-raven-battery.dtsi#13
> 
> which include
> https://android.googlesource.com/kernel/google-modules/raviole-device/+/refs/heads/android-gs-raviole-mainline/arch/arm64/boot/dts/google/gs101-oriole-battery-data.dtsi
> https://android.googlesource.com/kernel/google-modules/raviole-device/+/refs/heads/android-gs-raviole-mainline/arch/arm64/boot/dts/google/gs101-raven-battery-data.dtsi
> respectively
> 
> Both overlay
> https://android.googlesource.com/kernel/google-modules/raviole-device/+/refs/heads/android-gs-raviole-mainline/arch/arm64/boot/dts/google/gs101-raviole-battery.dtsi#177

I looked into it. The probe function launches a delay work
max1720x_model_work which will try multiple times to run
max1720x_model_load which leads to
max_m5_load_gauge_model -> max_m5_update_custom_model

This last function writes 0x0059 to 0x62 and 0x00c4 to 0x63 which unlocks
the addresses from 0x80 to 0xaf. Those actually contain the model but are
usually locked, returning only 0xff. It then writes the model and locks
back the register.

I tried it and I was indeed able to access this data on my device. The
registers contained a model very close to the default-a1-0k fg-model
contained in the downstream devicetree. The only diffrence is that all the
0x0100 are replaced with 0x0080.

I think those registers are similar to the registers 180h to 1AFh of the
max1720x ("ModelGauge m5 Algorithm Model registers" in the datasheet).

The fg-params is used to set individual registers like CGAIN or CONFIG2 but
from what I see, those are also on the max1720x.

If it is indeed the case and that all of those are equivalent to their
max1720x counterpart, I think the management of those values should be
added in another patch which implements it for both the max1720x (and possibly the
max77759) as the mainline driver does not do anything with those values
currently.

Best,
Thomas

  reply	other threads:[~2024-12-04 13:13 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
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 [this message]
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=5281f86d-6917-4f4e-b85d-70502a24c5bd@uclouvain.be \
    --to=t.antoine@uclouvain.be \
    --cc=alim.akhtar@samsung.com \
    --cc=andre.draszik@linaro.org \
    --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=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