All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ricardo Rivera-Matos <r-rivera-matos@ti.com>
To: <sre@kernel.org>, <krzk@kernel.org>, <linux-pm@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Cc: Ricardo Rivera-Matos <r-rivera-matos@ti.com>
Subject: [PATCH v2 2/2] power: supply: bq25980: Move props from battery node
Date: Wed, 10 Feb 2021 16:56:46 -0600	[thread overview]
Message-ID: <20210210225646.10055-2-r-rivera-matos@ti.com> (raw)
In-Reply-To: <20210210225646.10055-1-r-rivera-matos@ti.com>

Currently POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT and

POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE are exposed on the battery node

and this is incorrect.

This patch exposes POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT and

POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE on the charger node rather

than the battery node.

Fixes: 5069185fc18e ("power: supply: bq25980: Add support for the BQ259xx family")
Signed-off-by: Ricardo Rivera-Matos <r-rivera-matos@ti.com>
---
 drivers/power/supply/bq25980_charger.c | 40 ++++++++------------------
 1 file changed, 12 insertions(+), 28 deletions(-)

diff --git a/drivers/power/supply/bq25980_charger.c b/drivers/power/supply/bq25980_charger.c
index 7c489a9e8877..ac73e2c19238 100644
--- a/drivers/power/supply/bq25980_charger.c
+++ b/drivers/power/supply/bq25980_charger.c
@@ -641,33 +641,6 @@ static int bq25980_get_state(struct bq25980_device *bq,
 	return 0;
 }
 
-static int bq25980_set_battery_property(struct power_supply *psy,
-				enum power_supply_property psp,
-				const union power_supply_propval *val)
-{
-	struct bq25980_device *bq = power_supply_get_drvdata(psy);
-	int ret = 0;
-
-	switch (psp) {
-	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT:
-		ret = bq25980_set_const_charge_curr(bq, val->intval);
-		if (ret)
-			return ret;
-		break;
-
-	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE:
-		ret = bq25980_set_const_charge_volt(bq, val->intval);
-		if (ret)
-			return ret;
-		break;
-
-	default:
-		return -EINVAL;
-	}
-
-	return ret;
-}
-
 static int bq25980_get_battery_property(struct power_supply *psy,
 				enum power_supply_property psp,
 				union power_supply_propval *val)
@@ -736,6 +709,18 @@ static int bq25980_set_charger_property(struct power_supply *psy,
 			return ret;
 		break;
 
+	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT:
+		ret = bq25980_set_const_charge_curr(bq, val->intval);
+		if (ret)
+			return ret;
+		break;
+
+	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE:
+		ret = bq25980_set_const_charge_volt(bq, val->intval);
+		if (ret)
+			return ret;
+		break;
+
 	default:
 		return -EINVAL;
 	}
@@ -957,7 +942,6 @@ static struct power_supply_desc bq25980_battery_desc = {
 	.name			= "bq25980-battery",
 	.type			= POWER_SUPPLY_TYPE_BATTERY,
 	.get_property		= bq25980_get_battery_property,
-	.set_property		= bq25980_set_battery_property,
 	.properties		= bq25980_battery_props,
 	.num_properties		= ARRAY_SIZE(bq25980_battery_props),
 	.property_is_writeable	= bq25980_property_is_writeable,
-- 
2.30.0


  reply	other threads:[~2021-02-10 22:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-10 22:56 [PATCH v2 1/2] power: supply: bq25980 Apply datasheet revision changes Ricardo Rivera-Matos
2021-02-10 22:56 ` Ricardo Rivera-Matos [this message]
2021-02-11  7:38   ` [PATCH v2 2/2] power: supply: bq25980: Move props from battery node Krzysztof Kozlowski
2021-04-05 16:11     ` Sebastian Reichel
2021-02-11  7:36 ` [PATCH v2 1/2] power: supply: bq25980 Apply datasheet revision changes Krzysztof Kozlowski
2021-04-05 16:09   ` Sebastian Reichel

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=20210210225646.10055-2-r-rivera-matos@ti.com \
    --to=r-rivera-matos@ti.com \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=sre@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.