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: <86b85127-3f2b-8b1f-a884-6431066636e6@ti.com>
Date:	Tue, 26 Jul 2016 08:04:04 -0500
From:	"Andrew F. Davis" <afd@...com>
To:	"H. Nikolaus Schaller" <hns@...delico.com>,
	Ivaylo Dimitrov <ivo.g.dimitrov.75@...il.com>,
	Andrzej Hajda <a.hajda@...sung.com>,
	Pali Rohár <pali.rohar@...il.com>,
	Sebastian Reichel <sre@...nel.org>,
	Dmitry Eremin-Solenikov <dbaryshkov@...il.com>,
	David Woodhouse <dwmw2@...radead.org>
CC:	<linux-pm@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	<letux-kernel@...nphoenux.org>
Subject: Re: [PATCH] power:bq27xxx: 27000/10 read FLAGS register as single

On 07/18/2016 11:12 AM, H. Nikolaus Schaller wrote:
> The bq27000 and bq27010 have a single byte FLAGS register.
> Other gauges have 16 bit FLAGS registers.
> 
> For reading the FLAGS register it is sufficient to read the single
> register instead of reading RSOC at the next higher address as
> well and then ignore the high byte.
> 
> This does not change functionality but optimizes i2c and hdq
> traffic.
> 
> Signed-off-by: H. Nikolaus Schaller <hns@...delico.com>
> ---

Matches the datasheet,

Acked-by: Andrew F. Davis <afd@...com>

>  drivers/power/bq27xxx_battery.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/power/bq27xxx_battery.c b/drivers/power/bq27xxx_battery.c
> index 45f6ebf..56712b2 100644
> --- a/drivers/power/bq27xxx_battery.c
> +++ b/drivers/power/bq27xxx_battery.c
> @@ -656,8 +656,9 @@ static bool bq27xxx_battery_dead(struct bq27xxx_device_info *di, u16 flags)
>  static int bq27xxx_battery_read_health(struct bq27xxx_device_info *di)
>  {
>  	int flags;
> +	bool has_singe_flag = di->chip == BQ27000 || di->chip == BQ27010;
>  
> -	flags = bq27xxx_read(di, BQ27XXX_REG_FLAGS, false);
> +	flags = bq27xxx_read(di, BQ27XXX_REG_FLAGS, has_singe_flag);
>  	if (flags < 0) {
>  		dev_err(di->dev, "error reading flag register:%d\n", flags);
>  		return flags;
> @@ -760,7 +761,7 @@ static int bq27xxx_battery_current(struct bq27xxx_device_info *di,
>  	}
>  
>  	if (di->chip == BQ27000 || di->chip == BQ27010) {
> -		flags = bq27xxx_read(di, BQ27XXX_REG_FLAGS, false);
> +		flags = bq27xxx_read(di, BQ27XXX_REG_FLAGS, true);
>  		if (flags & BQ27000_FLAG_CHGS) {
>  			dev_dbg(di->dev, "negative current!\n");
>  			curr = -curr;
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ