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] [day] [month] [year] [list]
Message-ID: <20230719205927.5gdxmwsj4tgeckwq@mercury.elektranox.org>
Date:   Wed, 19 Jul 2023 22:59:27 +0200
From:   Sebastian Reichel <sebastian.reichel@...labora.com>
To:     Ricardo Rivera-Matos <rriveram@...nsource.cirrus.com>
Cc:     linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
        David Rhodes <drhodes@...nsource.cirrus.com>
Subject: Re: [PATCH] power: supply: bq24190: Considers FORCE_20PCT when
 getting IPRECHG

Hi,

On Fri, Jul 14, 2023 at 12:45:29PM -0500, Ricardo Rivera-Matos wrote:
> Adds a check of the FORCE_20PCT bit when getting the precharge
> current value.
> 
> According to the bit description for the FORCE_20PCT bit, when
> FORCE_20PCT is true, the precharge current target is 50% of
> what is configured in the IPRECHG bit field.
> 
> Signed-off-by: Ricardo Rivera-Matos <rriveram@...nsource.cirrus.com>
> Reviewed-by: David Rhodes <drhodes@...nsource.cirrus.com>
> ---

Thanks, queued.

-- Sebastian

>  drivers/power/supply/bq24190_charger.c | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/power/supply/bq24190_charger.c b/drivers/power/supply/bq24190_charger.c
> index ef8235848f56..3f99cb9590ba 100644
> --- a/drivers/power/supply/bq24190_charger.c
> +++ b/drivers/power/supply/bq24190_charger.c
> @@ -965,7 +965,7 @@ static int bq24190_charger_get_precharge(struct bq24190_dev_info *bdi,
>  		union power_supply_propval *val)
>  {
>  	u8 v;
> -	int ret;
> +	int curr, ret;
>  
>  	ret = bq24190_read_mask(bdi, BQ24190_REG_PCTCC,
>  			BQ24190_REG_PCTCC_IPRECHG_MASK,
> @@ -973,7 +973,20 @@ static int bq24190_charger_get_precharge(struct bq24190_dev_info *bdi,
>  	if (ret < 0)
>  		return ret;
>  
> -	val->intval = ++v * 128 * 1000;
> +	curr = ++v * 128 * 1000;
> +
> +	ret = bq24190_read_mask(bdi, BQ24190_REG_CCC,
> +			BQ24190_REG_CCC_FORCE_20PCT_MASK,
> +			BQ24190_REG_CCC_FORCE_20PCT_SHIFT, &v);
> +	if (ret < 0)
> +		return ret;
> +
> +	/* If FORCE_20PCT is enabled, then current is 50% of IPRECHG value */
> +	if (v)
> +		curr /= 2;
> +
> +	val->intval = curr;
> +
>  	return 0;
>  }
>  
> -- 
> 2.34.1
> 

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ