From: Dimitri Fedrau <dima.fedrau@gmail.com>
To: t.antoine@uclouvain.be
Cc: "Rob Herring" <robh@kernel.org>,
"Peter Griffin" <peter.griffin@linaro.org>,
"André Draszik" <andre.draszik@linaro.org>,
"Tudor Ambarus" <tudor.ambarus@linaro.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Alim Akhtar" <alim.akhtar@samsung.com>,
"Catalin Marinas" <catalin.marinas@arm.com>,
"Will Deacon" <will@kernel.org>,
"Sebastian Reichel" <sre@kernel.org>,
linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org
Subject: Re: [PATCH v3 1/5] power: supply: correct capacity computation
Date: Tue, 22 Apr 2025 11:46:56 +0200 [thread overview]
Message-ID: <20250422094656.GA159257@legfed1> (raw)
In-Reply-To: <20250421-b4-gs101_max77759_fg-v3-1-50cd8caf9017@uclouvain.be>
Hi Thomas,
On Mon, Apr 21, 2025 at 08:13:32PM +0200, Thomas Antoine via B4 Relay wrote:
> From: Thomas Antoine <t.antoine@uclouvain.be>
>
> From the datasheet of the MAX17201/17205, the LSB should be
> "5.0μVh/RSENSE". The current computation sets it at 0.5mAh=5.0μVh/10mOhm
> which does not take into account the value of rsense which can be
> different from 10mOhm.
>
> Change the computation to fit the specs.
>
> Signed-off-by: Thomas Antoine <t.antoine@uclouvain.be>
> ---
> drivers/power/supply/max1720x_battery.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/power/supply/max1720x_battery.c b/drivers/power/supply/max1720x_battery.c
> index ea3912fd1de8bfd0d029c16f276316d06e1b105c..cca5f8b5071fb731f9b60420239ea03d46cb1bf3 100644
> --- a/drivers/power/supply/max1720x_battery.c
> +++ b/drivers/power/supply/max1720x_battery.c
> @@ -288,9 +288,10 @@ static int max172xx_voltage_to_ps(unsigned int reg)
> return reg * 1250; /* in uV */
> }
>
> -static int max172xx_capacity_to_ps(unsigned int reg)
> +static int max172xx_capacity_to_ps(unsigned int reg,
> + struct max1720x_device_info *info)
> {
> - return reg * 500; /* in uAh */
> + return reg * (500000 / info->rsense); /* in uAh */
> }
>
> /*
>
> --
> 2.49.0
>
>
thanks for finding this.
Reviewed-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
Best regards,
Dimitri Fedrau
next prev parent reply other threads:[~2025-04-22 10:58 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-21 18:13 [PATCH v3 0/5] Google Pixel 6 (oriole): max77759 fuel gauge enablement and driver support Thomas Antoine
2025-04-21 18:13 ` Thomas Antoine via B4 Relay
2025-04-21 18:13 ` [PATCH v3 1/5] power: supply: correct capacity computation Thomas Antoine
2025-04-21 18:13 ` Thomas Antoine via B4 Relay
2025-04-22 9:46 ` Dimitri Fedrau [this message]
2025-04-23 7:48 ` Thomas Antoine
2025-04-21 18:13 ` [PATCH v3 2/5] power: supply: add support for max77759 fuel gauge Thomas Antoine
2025-04-21 18:13 ` Thomas Antoine via B4 Relay
2025-04-22 18:48 ` Dimitri Fedrau
2025-04-23 8:02 ` Thomas Antoine
2025-04-30 0:36 ` Sebastian Reichel
2025-04-30 13:49 ` Thomas Antoine
2025-04-21 18:13 ` [PATCH v3 3/5] dt-bindings: power: supply: add max77759-fg flavor Thomas Antoine
2025-04-21 18:13 ` Thomas Antoine via B4 Relay
2025-04-22 10:05 ` Krzysztof Kozlowski
2025-04-23 8:05 ` Thomas Antoine
2025-04-23 13:45 ` Krzysztof Kozlowski
2025-04-30 13:51 ` Thomas Antoine
2025-04-21 18:13 ` [PATCH v3 4/5] arm64: defconfig: enable Maxim max1720x driver Thomas Antoine
2025-04-21 18:13 ` Thomas Antoine via B4 Relay
2025-04-21 18:13 ` [PATCH v3 5/5] arm64: dts: exynos: gs101-oriole: enable Maxim max77759 fuel gauge Thomas Antoine
2025-04-21 18:13 ` Thomas Antoine via B4 Relay
2025-04-21 21:53 ` [PATCH v3 0/5] Google Pixel 6 (oriole): max77759 fuel gauge enablement and driver support Rob Herring (Arm)
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=20250422094656.GA159257@legfed1 \
--to=dima.fedrau@gmail.com \
--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=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=tudor.ambarus@linaro.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 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.