@@ -506,6 +506,24 @@ static int bq25890_power_supply_get_property(struct power_supply *psy,
val->intval = bq25890_find_val(ret, TBL_IILIM);
break;
+ case POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW:
+ ret = bq25890_field_read(bq, F_VBUS_GD); /* is VBUS connected? */
+ if (ret < 0)
+ return ret;
+
+ if (!ret) {
+ val->intval = 0;
+ break;
+ }
+
+ ret = bq25890_field_read(bq, F_VBUSV); /* read measured value */
+ if (ret < 0)
+ return ret;
+
+ /* converted_val = 2.6V + ADC_val * 100mV */
+ val->intval = 2600000 + ret * 100000;
+ break;
+
case POWER_SUPPLY_PROP_VOLTAGE_NOW:
ret = bq25890_field_read(bq, F_SYSV); /* read measured value */
if (ret < 0)
@@ -705,6 +723,7 @@ static const enum power_supply_property bq25890_power_supply_props[] = {
POWER_SUPPLY_PROP_PRECHARGE_CURRENT,
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_CURRENT_NOW,
};
Export VBUS measurement via INPUT_VOLTAGE_NOW property. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> --- drivers/power/supply/bq25890_charger.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)