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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Sun, 8 Mar 2020 04:24:15 +0100
From:   Sebastian Reichel <sre@...nel.org>
To:     Baolin Wang <baolin.wang7@...il.com>
Cc:     linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
        zhang.lyra@...il.com, orsonzhai@...il.com
Subject: Re: [PATCH] power: supply: sc27xx: Add POWER_SUPPLY_PROP_CHARGE_NOW
 attribute

Hi,

On Fri, Feb 14, 2020 at 01:38:58PM +0800, Baolin Wang wrote:
> Add the POWER_SUPPLY_PROP_CHARGE_NOW attribute to allow user to get
> current battery capacity (uAh) to do measurement.
> 
> Signed-off-by: Baolin Wang <baolin.wang7@...il.com>
> ---

Thanks, queued to power-supply's for-next branch.

-- Sebastian

>  drivers/power/supply/sc27xx_fuel_gauge.c |   12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/power/supply/sc27xx_fuel_gauge.c b/drivers/power/supply/sc27xx_fuel_gauge.c
> index 469c83f..a7c8a84 100644
> --- a/drivers/power/supply/sc27xx_fuel_gauge.c
> +++ b/drivers/power/supply/sc27xx_fuel_gauge.c
> @@ -614,6 +614,17 @@ static int sc27xx_fgu_get_property(struct power_supply *psy,
>  		val->intval = data->total_cap * 1000;
>  		break;
>  
> +	case POWER_SUPPLY_PROP_CHARGE_NOW:
> +		ret = sc27xx_fgu_get_clbcnt(data, &value);
> +		if (ret)
> +			goto error;
> +
> +		value = DIV_ROUND_CLOSEST(value * 10,
> +					  36 * SC27XX_FGU_SAMPLE_HZ);
> +		val->intval = sc27xx_fgu_adc_to_current(data, value);
> +
> +		break;
> +
>  	default:
>  		ret = -EINVAL;
>  		break;
> @@ -682,6 +693,7 @@ static int sc27xx_fgu_property_is_writeable(struct power_supply *psy,
>  	POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE,
>  	POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN,
>  	POWER_SUPPLY_PROP_CALIBRATE,
> +	POWER_SUPPLY_PROP_CHARGE_NOW
>  };
>  
>  static const struct power_supply_desc sc27xx_fgu_desc = {
> -- 
> 1.7.9.5
> 

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