linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Reichel <sre@kernel.org>
To: Baolin Wang <baolin.wang7@gmail.com>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	zhang.lyra@gmail.com, orsonzhai@gmail.com
Subject: Re: [PATCH] power: supply: sc27xx: Add POWER_SUPPLY_PROP_CHARGE_NOW attribute
Date: Sun, 8 Mar 2020 04:24:15 +0100	[thread overview]
Message-ID: <20200308032415.pirjewmu4wjut2xo@earth.universe> (raw)
In-Reply-To: <33dba0929575461e38c2e17ac0cc4a8a4e46fa2f.1581658633.git.baolin.wang7@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1506 bytes --]

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@gmail.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
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2020-03-08  3:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-14  5:38 [PATCH] power: supply: sc27xx: Add POWER_SUPPLY_PROP_CHARGE_NOW attribute Baolin Wang
2020-03-08  3:24 ` Sebastian Reichel [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200308032415.pirjewmu4wjut2xo@earth.universe \
    --to=sre@kernel.org \
    --cc=baolin.wang7@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=orsonzhai@gmail.com \
    --cc=zhang.lyra@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).