Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 727bc67f authored by Subbaraman Narayanamurthy's avatar Subbaraman Narayanamurthy
Browse files

power: smb5: Import CYCLE_COUNT property



Healthd can read CYCLE_COUNT property under battery power supply
and expose it in the logs. Import CYCLE_COUNT property from FG
driver and show it under battery power supply.

Change-Id: I0f044004c3826dec223a0bde0f65adde1c305da9
Signed-off-by: default avatarSubbaraman Narayanamurthy <subbaram@codeaurora.org>
parent 27c60c16
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1032,6 +1032,7 @@ static enum power_supply_property smb5_batt_props[] = {
	POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT_MAX,
	POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT,
	POWER_SUPPLY_PROP_CHARGE_COUNTER,
	POWER_SUPPLY_PROP_CYCLE_COUNT,
	POWER_SUPPLY_PROP_RECHARGE_SOC,
};

@@ -1133,6 +1134,9 @@ static int smb5_batt_get_prop(struct power_supply *psy,
	case POWER_SUPPLY_PROP_CHARGE_COUNTER:
		rc = smblib_get_prop_batt_charge_counter(chg, val);
		break;
	case POWER_SUPPLY_PROP_CYCLE_COUNT:
		rc = smblib_get_prop_batt_cycle_count(chg, val);
		break;
	case POWER_SUPPLY_PROP_RECHARGE_SOC:
		val->intval = chg->auto_recharge_soc;
		break;
+13 −0
Original line number Diff line number Diff line
@@ -1453,6 +1453,19 @@ int smblib_get_prop_batt_charge_counter(struct smb_charger *chg,
	return rc;
}

int smblib_get_prop_batt_cycle_count(struct smb_charger *chg,
				     union power_supply_propval *val)
{
	int rc;

	if (!chg->bms_psy)
		return -EINVAL;

	rc = power_supply_get_property(chg->bms_psy,
				       POWER_SUPPLY_PROP_CYCLE_COUNT, val);
	return rc;
}

/***********************
 * BATTERY PSY SETTERS *
 ***********************/
+2 −0
Original line number Diff line number Diff line
@@ -457,6 +457,8 @@ int smblib_get_prop_batt_temp(struct smb_charger *chg,
				union power_supply_propval *val);
int smblib_get_prop_batt_charge_counter(struct smb_charger *chg,
				union power_supply_propval *val);
int smblib_get_prop_batt_cycle_count(struct smb_charger *chg,
				union power_supply_propval *val);
int smblib_set_prop_input_suspend(struct smb_charger *chg,
				const union power_supply_propval *val);
int smblib_set_prop_batt_capacity(struct smb_charger *chg,