lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250422094656.GA159257@legfed1>
Date: Tue, 22 Apr 2025 11:46:56 +0200
From: Dimitri Fedrau <dima.fedrau@...il.com>
To: t.antoine@...ouvain.be
Cc: Rob Herring <robh@...nel.org>, Peter Griffin <peter.griffin@...aro.org>,
	André Draszik <andre.draszik@...aro.org>,
	Tudor Ambarus <tudor.ambarus@...aro.org>,
	Krzysztof Kozlowski <krzk+dt@...nel.org>,
	Conor Dooley <conor+dt@...nel.org>,
	Alim Akhtar <alim.akhtar@...sung.com>,
	Catalin Marinas <catalin.marinas@....com>,
	Will Deacon <will@...nel.org>, Sebastian Reichel <sre@...nel.org>,
	linux-arm-kernel@...ts.infradead.org,
	linux-samsung-soc@...r.kernel.org, devicetree@...r.kernel.org,
	linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org
Subject: Re: [PATCH v3 1/5] power: supply: correct capacity computation

Hi Thomas,

On Mon, Apr 21, 2025 at 08:13:32PM +0200, Thomas Antoine via B4 Relay wrote:
> From: Thomas Antoine <t.antoine@...ouvain.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@...ouvain.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@...bherr.com>

Best regards,
Dimitri Fedrau

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ