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  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Sun, 10 May 2020 22:09:36 +0200
From:   Sebastian Reichel <sebastian.reichel@...labora.com>
To:     Jonathan Bakker <xc-racer2@...e.ca>
Cc:     linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
        robh+dt@...nel.org, devicetree@...r.kernel.org
Subject: Re: [PATCH 1/3] power: supply: max17040: Correct voltage reading

Hi,

On Mon, May 04, 2020 at 03:12:58PM -0700, Jonathan Bakker wrote:
> According to the datasheet available at (1), the bottom four
> bits are always zero and the actual voltage is 1.25x this value
> in mV.  Since the kernel API specifies that voltages should be in
> uV, it should report 1250x the shifted value.
> 
> 1) https://datasheets.maximintegrated.com/en/ds/MAX17040-MAX17041.pdf
> 
> Signed-off-by: Jonathan Bakker <xc-racer2@...e.ca>
> ---

Thanks, queued.

-- Sebastian

>  drivers/power/supply/max17040_battery.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/power/supply/max17040_battery.c b/drivers/power/supply/max17040_battery.c
> index 8a1f0ee493aa..48aa44665e2f 100644
> --- a/drivers/power/supply/max17040_battery.c
> +++ b/drivers/power/supply/max17040_battery.c
> @@ -126,7 +126,7 @@ static void max17040_get_vcell(struct i2c_client *client)
>  
>  	vcell = max17040_read_reg(client, MAX17040_VCELL);
>  
> -	chip->vcell = vcell;
> +	chip->vcell = (vcell >> 4) * 1250;
>  }
>  
>  static void max17040_get_soc(struct i2c_client *client)
> -- 
> 2.20.1
> 

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists