power: supply: qcom_fg: Report online property

This commit is contained in:
Jami Kettunen 2021-04-25 17:33:06 +03:00
parent f96cfaff29
commit 1918745f5f
2 changed files with 6 additions and 0 deletions

View file

@ -594,6 +594,7 @@ int qcom_fg_get_prop_batt_status(struct qcom_fg_chip *chip, int *val){
}
dev_dbg(chip->dev, "USB ONLINE val : %d\n", usb_online_val);
usb_online = (bool)usb_online_val;
chip->online = usb_online;
if (!usb_online) {
*val = POWER_SUPPLY_STATUS_DISCHARGING;
@ -828,6 +829,9 @@ static int fg_get_property(struct power_supply *psy,
case POWER_SUPPLY_PROP_STATUS:
error = chip->ops->get_batt_status(chip, &val->intval);
break;
case POWER_SUPPLY_PROP_ONLINE:
val->intval = chip->online;
break;
case POWER_SUPPLY_PROP_HEALTH:
error = chip->ops->get_health_status(chip, &val->intval);
break;

View file

@ -125,6 +125,7 @@ static enum power_supply_property fg_properties[] = {
POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN,
POWER_SUPPLY_PROP_STATUS,
POWER_SUPPLY_PROP_ONLINE,
POWER_SUPPLY_PROP_HEALTH,
POWER_SUPPLY_PROP_CHARGE_FULL,
POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
@ -171,4 +172,5 @@ struct qcom_fg_chip {
int health;
int status;
bool online;
};