2021-02-10 23:03:24

by Ricardo Rivera-Matos

[permalink] [raw]
Subject: [PATCH v2 2/2] power: supply: bq25980: Move props from battery node

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 <[email protected]>
---
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


2021-02-11 07:41:09

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] power: supply: bq25980: Move props from battery node

On Wed, Feb 10, 2021 at 04:56:46PM -0600, Ricardo Rivera-Matos wrote:
> 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.

Now it makes sense if you only formatted it in human-readable way.
Please fix your git/editor/email client/desktop unless you used such
formatting intentionally. If it was intentional, then please don't - do
like everyone else in Linux kernel (git log will help).

Best regards,
Krzysztof

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

2021-04-06 03:21:11

by Sebastian Reichel

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] power: supply: bq25980: Move props from battery node

Hi,

On Thu, Feb 11, 2021 at 08:38:07AM +0100, Krzysztof Kozlowski wrote:
> On Wed, Feb 10, 2021 at 04:56:46PM -0600, Ricardo Rivera-Matos wrote:
> > 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.
>
> Now it makes sense if you only formatted it in human-readable way.
> Please fix your git/editor/email client/desktop unless you used such
> formatting intentionally. If it was intentional, then please don't - do
> like everyone else in Linux kernel (git log will help).

Thanks, queued to the power-supply tree (I fixed up the broken
commit message).

-- Sebastian

>
> Best regards,
> Krzysztof
>
> >
> > Fixes: 5069185fc18e ("power: supply: bq25980: Add support for the BQ259xx family")
> > Signed-off-by: Ricardo Rivera-Matos <[email protected]>
> > ---
> > drivers/power/supply/bq25980_charger.c | 40 ++++++++------------------
> > 1 file changed, 12 insertions(+), 28 deletions(-)


Attachments:
(No filename) (1.19 kB)
signature.asc (849.00 B)
Download all attachments