Commit b302a0ae authored by Michał Mirosław's avatar Michał Mirosław Committed by Sebastian Reichel

power: bq25890: implement CHARGE_TYPE property

Report charging type based on recently read state.
Signed-off-by: default avatarMichał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
parent 3b4df57b
...@@ -427,6 +427,18 @@ static int bq25890_power_supply_get_property(struct power_supply *psy, ...@@ -427,6 +427,18 @@ static int bq25890_power_supply_get_property(struct power_supply *psy,
break; break;
case POWER_SUPPLY_PROP_CHARGE_TYPE:
if (!state.online || state.chrg_status == STATUS_NOT_CHARGING ||
state.chrg_status == STATUS_TERMINATION_DONE)
val->intval = POWER_SUPPLY_CHARGE_TYPE_NONE;
else if (state.chrg_status == STATUS_PRE_CHARGING)
val->intval = POWER_SUPPLY_CHARGE_TYPE_STANDARD;
else if (state.chrg_status == STATUS_FAST_CHARGING)
val->intval = POWER_SUPPLY_CHARGE_TYPE_FAST;
else /* unreachable */
val->intval = POWER_SUPPLY_CHARGE_TYPE_UNKNOWN;
break;
case POWER_SUPPLY_PROP_MANUFACTURER: case POWER_SUPPLY_PROP_MANUFACTURER:
val->strval = BQ25890_MANUFACTURER; val->strval = BQ25890_MANUFACTURER;
break; break;
...@@ -668,6 +680,7 @@ static const enum power_supply_property bq25890_power_supply_props[] = { ...@@ -668,6 +680,7 @@ static const enum power_supply_property bq25890_power_supply_props[] = {
POWER_SUPPLY_PROP_MANUFACTURER, POWER_SUPPLY_PROP_MANUFACTURER,
POWER_SUPPLY_PROP_MODEL_NAME, POWER_SUPPLY_PROP_MODEL_NAME,
POWER_SUPPLY_PROP_STATUS, POWER_SUPPLY_PROP_STATUS,
POWER_SUPPLY_PROP_CHARGE_TYPE,
POWER_SUPPLY_PROP_ONLINE, POWER_SUPPLY_PROP_ONLINE,
POWER_SUPPLY_PROP_HEALTH, POWER_SUPPLY_PROP_HEALTH,
POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX, POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment