From: "André Draszik" <andre.draszik@linaro.org>
To: Sebastian Reichel <sebastian.reichel@collabora.com>,
t.antoine@uclouvain.be
Cc: 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>,
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 v2 1/4] power: supply: add support for max77759 fuel gauge
Date: Mon, 07 Apr 2025 12:29:09 +0100 [thread overview]
Message-ID: <9264729152cb70ec910b391ab4ced82dc62f953c.camel@linaro.org> (raw)
In-Reply-To: <ocx5n42h25ztwo5twlir5zoajavpcxce2ra5jjyl6ae4qg6c3e@akhc3dylsprm>
Hi Sebastian,
On Wed, 2025-01-15 at 22:30 +0100, Sebastian Reichel wrote:
> Hi,
>
> On Thu, Jan 02, 2025 at 12:15:03PM +0100, Thomas Antoine via B4 Relay wrote:
> > From: Thomas Antoine <t.antoine@uclouvain.be>
> >
> > The interface of the Maxim max77759 fuel gauge has a lot of common with the
> > Maxim max1720x. The major difference is the lack of non-volatile memory
> > slave address. No slave is available at address 0xb of the i2c bus, which
> > is coherent with the following driver from google: line 5836 disables
> > non-volatile memory for m5 gauge.
> >
> > Link: https://android.googlesource.com/kernel/google-modules/bms/+/1a68c36bef474573cc8629cc1d121eb6a81ab68c/max1720x_battery.c
> >
> > Other differences include the lack of V_BATT register to read the battery
> > level and a difference in the way to identify the chip (the same register
> > is used but not the same mask).
> >
> > Add support for the max77759 by allowing to use the non-volatile
> > memory or not based on the chip. Also add the V_CELL regsister as a
> > fallback to read voltage value in the case where read of V_BATT fails.
> >
> > The cast is necessary to avoid an overflow when the value of the register
> > is above 54975 (equivalent to a voltage around 4.29 V).
> >
> > The regmap of the max77759 will lead the read to fail for V_BATT and to
> > correctly use V_CELL instead. This regmap was proposed by André Draszik in
> >
> > Link: https://lore.kernel.org/all/d1bade77b5281c1de6b2ddcb4dbbd033e455a116.camel@linaro.org/
> >
> > Signed-off-by: Thomas Antoine <t.antoine@uclouvain.be>
> > ---
>
> Please add output from to the cover letter to allow easily verifying
> that all values are correctly scaled.
>
> ./tools/testing/selftests/power_supply/test_power_supply_properties.sh
>
> > +static const struct regmap_access_table max77759_write_table = {
> > + .yes_ranges = max77759_registers,
> > + .n_yes_ranges = ARRAY_SIZE(max77759_registers),
> > + .no_ranges = max77759_ro_registers,
> > + .n_no_ranges = ARRAY_SIZE(max77759_ro_registers),
> > +};
>
> Drop the yes_range from the write table. It is wrong and confusing.
Can you please clarify why having yes_ranges is wrong? Without yes_ranges,
all registers not in no_ranges are allowed to be written to.
Here, max77759_registers already specifies all the registers that exist
(and is also used in the max77759_read_table), and for write-access this is
further limited by the read-only registers in no_ranges.
As an example, register 0x50 doesn't exist, and without yes_ranges this
would allow write access to it.
If yes_ranges was dropped, all the information about non-existing registers
would have to be duplicated into no_ranges by inversing max77759_registers.
We already know the non-existing registers, and inversing that list just to
add to no_ranges seems non-ideal, error-prone, and just duplicated information.
Cheers,
Andre'
next prev parent reply other threads:[~2025-04-07 11:29 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-02 11:15 [PATCH v2 0/4] Google Pixel 6 (oriole): max77759 fuel gauge enablement and driver support Thomas Antoine via B4 Relay
2025-01-02 11:15 ` [PATCH v2 1/4] power: supply: add support for max77759 fuel gauge Thomas Antoine via B4 Relay
2025-01-06 15:16 ` Dimitri Fedrau
2025-01-10 16:01 ` Thomas Antoine
2025-01-07 11:00 ` André Draszik
2025-01-10 16:56 ` Thomas Antoine
2025-01-07 18:10 ` Christophe JAILLET
2025-01-10 15:46 ` Thomas Antoine
2025-01-08 9:49 ` Peter Griffin
2025-01-15 21:30 ` Sebastian Reichel
2025-04-07 11:29 ` André Draszik [this message]
2025-01-02 11:15 ` [PATCH v2 2/4] dt-bindings: power: supply: add max77759-fg flavor Thomas Antoine via B4 Relay
2025-01-02 16:08 ` Krzysztof Kozlowski
2025-01-03 16:16 ` Thomas Antoine
2025-01-04 9:23 ` Krzysztof Kozlowski
2025-01-02 11:15 ` [PATCH v2 3/4] arm64: defconfig: enable Maxim max1720x driver Thomas Antoine via B4 Relay
2025-01-07 11:12 ` André Draszik
2025-01-02 11:15 ` [PATCH v2 4/4] arm64: dts: exynos: gs101-oriole: enable Maxim max77759 fuel gauge Thomas Antoine via B4 Relay
2025-01-07 9:06 ` André Draszik
2025-01-10 15:42 ` 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=9264729152cb70ec910b391ab4ced82dc62f953c.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=sebastian.reichel@collabora.com \
--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