Linux Power Management development
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: linux-pm@vger.kernel.org
Cc: "Marek Vasut" <marex@denx.de>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Michał Mirosław" <mirq-linux@rere.qmqm.pl>,
	"Sebastian Reichel" <sebastian.reichel@collabora.com>
Subject: [PATCH 2/2] power: supply: bq25890: Rename POWER_SUPPLY_PROP_CURRENT_NOW to CC current
Date: Sun,  9 Oct 2022 21:18:39 +0200	[thread overview]
Message-ID: <20221009191839.102686-2-marex@denx.de> (raw)
In-Reply-To: <20221009191839.102686-1-marex@denx.de>

The POWER_SUPPLY_PROP_CURRENT_NOW property represents, as far as I can tell,
the immediate power supply input current, however, this driver reports the
immediate battery charge current using that property, i.e. content of REG12
ICHGR -- ADC conversion of Charge Current (IBAT). Replace the property with
POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT, which as far as I can tell should
be used to report immediate battery charge voltage.

This also aligns the behavior of POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT
with POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE, as the former reports IBAT
and the later reports VBAT.

Fixes: 1e4724d0b7d1 ("power: bq25890: use proper CURRENT_NOW property for I_BAT")
Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Cc: Sebastian Reichel <sebastian.reichel@collabora.com>
To: linux-pm@vger.kernel.org
---
 drivers/power/supply/bq25890_charger.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
index 34dbd498f0f51..c4c830247e0e0 100644
--- a/drivers/power/supply/bq25890_charger.c
+++ b/drivers/power/supply/bq25890_charger.c
@@ -432,8 +432,8 @@ static bool bq25890_is_adc_property(enum power_supply_property psp)
 {
 	switch (psp) {
 	case POWER_SUPPLY_PROP_VOLTAGE_NOW:
+	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT:
 	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE:
-	case POWER_SUPPLY_PROP_CURRENT_NOW:
 	case POWER_SUPPLY_PROP_TEMP:
 		return true;
 
@@ -589,7 +589,7 @@ static int bq25890_power_supply_get_property(struct power_supply *psy,
 		val->intval = 2304000 + ret * 20000;
 		break;
 
-	case POWER_SUPPLY_PROP_CURRENT_NOW:
+	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT:
 		ret = bq25890_field_read(bq, F_ICHGR); /* read measured value */
 		if (ret < 0)
 			return ret;
@@ -881,6 +881,7 @@ static const enum power_supply_property bq25890_power_supply_props[] = {
 	POWER_SUPPLY_PROP_CHARGE_TYPE,
 	POWER_SUPPLY_PROP_ONLINE,
 	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT,
 	POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX,
 	POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE,
 	POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX,
@@ -888,7 +889,6 @@ static const enum power_supply_property bq25890_power_supply_props[] = {
 	POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT,
 	POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT,
 	POWER_SUPPLY_PROP_VOLTAGE_NOW,
-	POWER_SUPPLY_PROP_CURRENT_NOW,
 	POWER_SUPPLY_PROP_TEMP,
 };
 
-- 
2.35.1


  reply	other threads:[~2022-10-09 19:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-09 19:18 [PATCH 1/2] power: supply: bq25890: Add CC voltage to ADC properties Marek Vasut
2022-10-09 19:18 ` Marek Vasut [this message]
2022-10-09 22:58   ` [PATCH 2/2] power: supply: bq25890: Rename POWER_SUPPLY_PROP_CURRENT_NOW to CC current Michał Mirosław
2022-10-10  0:00     ` Marek Vasut
2022-10-10 13:27       ` Hans de Goede
2022-10-10 16:45         ` Marek Vasut
2022-10-10 17:31           ` Hans de Goede
2022-10-10 17:39             ` Marek Vasut
2022-10-09 23:08 ` [PATCH 1/2] power: supply: bq25890: Add CC voltage to ADC properties Michał Mirosław
2022-10-10 13:50   ` Hans de Goede
2022-10-10 19:22     ` Marek Vasut
2022-10-11  7:38       ` Hans de Goede
2022-10-11 16:35         ` Marek Vasut

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=20221009191839.102686-2-marex@denx.de \
    --to=marex@denx.de \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=mirq-linux@rere.qmqm.pl \
    --cc=sebastian.reichel@collabora.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