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: <201310151556.23557@pali>
Date:	Tue, 15 Oct 2013 15:56:23 +0200
From:	Pali Rohár <pali.rohar@...il.com>
To:	Alexandre Belloni <alexandre.belloni@...e-electrons.com>
Cc:	Anton Vorontsov <anton@...msg.org>, linux-kernel@...r.kernel.org,
	David Woodhouse <dwmw2@...radead.org>
Subject: Re: [PATCH] bq2415x_charger: fix max battery regulation voltage

On Wednesday 02 October 2013 12:24:22 Alexandre Belloni wrote:
> As per the datasheets, maximum battery regulation voltage is
> 4440mV.
> 
> The formula is (voltage - offset) / step, so the maximum value
> is: (4440 - 3500) / 20 = 47
> 
> Signed-off-by: Alexandre Belloni
> <alexandre.belloni@...e-electrons.com> ---
>  drivers/power/bq2415x_charger.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/power/bq2415x_charger.c
> b/drivers/power/bq2415x_charger.c index 0727f92..0aa643e
> 100644
> --- a/drivers/power/bq2415x_charger.c
> +++ b/drivers/power/bq2415x_charger.c
> @@ -607,7 +607,7 @@ static int
> bq2415x_set_battery_regulation_voltage(struct bq2415x_device
> *bq,
> 
>  	if (val < 0)
>  		val = 0;
> -	else if (val > 94) /* FIXME: Max is 94 or 122 ? Set max
> value ? */ +	else if (val > 47)
>  		return -EINVAL;
> 
>  	return bq2415x_i2c_write_mask(bq, BQ2415X_REG_VOLTAGE, val,

Right, max is 47 (101111) and not 94 (1011110). But if you set 
all six registers to 1 then you get 63 (111111) and not 122.

I do not know from where I got above bad values, but you should 
add comment to code that according to datasheet max value is 
4440mV (101111) and not 4760mV (111111).

-- 
Pali Rohár
pali.rohar@...il.com

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ