[PATCH 12/14] power: supply: bq25890: show VSYS as output voltage

From: MichaÅ MirosÅaw
Date: Thu Apr 02 2020 - 10:58:55 EST


VSYS is the voltage that is provided to the rest of the system. Show
measurement OUTPUT_VOLTAGE and supplement it with VSYSMIN setting.

Signed-off-by: MichaÅ MirosÅaw <mirq-linux@xxxxxxxxxxxx>
---
drivers/power/supply/bq25890_charger.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
index d23274d13263..6c277f2dbae2 100644
--- a/drivers/power/supply/bq25890_charger.c
+++ b/drivers/power/supply/bq25890_charger.c
@@ -524,7 +524,7 @@ static int bq25890_power_supply_get_property(struct power_supply *psy,
val->intval = 2600000 + ret * 100000;
break;

- case POWER_SUPPLY_PROP_VOLTAGE_NOW:
+ case POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_NOW:
ret = bq25890_field_read(bq, F_SYSV); /* read measured value */
if (ret < 0)
return ret;
@@ -533,6 +533,10 @@ static int bq25890_power_supply_get_property(struct power_supply *psy,
val->intval = 2304000 + ret * 20000;
break;

+ case POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_MIN:
+ val->intval = bq25890_find_val(bq->init_data.sysvmin, TBL_SYSVMIN);
+ break;
+
case POWER_SUPPLY_PROP_CURRENT_NOW:
ret = bq25890_field_read(bq, F_ICHGR); /* read measured value */
if (ret < 0)
@@ -724,7 +728,8 @@ 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_INPUT_VOLTAGE_NOW,
- POWER_SUPPLY_PROP_VOLTAGE_NOW,
+ POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_NOW,
+ POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_MIN,
POWER_SUPPLY_PROP_CURRENT_NOW,
};

--
2.20.1