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

Commit 4fe68d00 authored by Nicholas Troast's avatar Nicholas Troast Committed by Harry Yang
Browse files

power: qpnp-smb2: expose CHARGE_COUNTER prop via batt psy



CHARGE_COUNTER is a required battery power supply property. Add it.

Change-Id: Ieb9c64447f88213479ce14b738f71fa703ffc194
Signed-off-by: default avatarNicholas Troast <ntroast@codeaurora.org>
parent 7f55c921
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -924,6 +924,7 @@ static enum power_supply_property smb2_batt_props[] = {
	POWER_SUPPLY_PROP_DP_DM,
	POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT_MAX,
	POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT,
	POWER_SUPPLY_PROP_CHARGE_COUNTER,
};

static int smb2_batt_get_prop(struct power_supply *psy,
@@ -1032,6 +1033,9 @@ static int smb2_batt_get_prop(struct power_supply *psy,
	case POWER_SUPPLY_PROP_RERUN_AICL:
		val->intval = 0;
		break;
	case POWER_SUPPLY_PROP_CHARGE_COUNTER:
		rc = smblib_get_prop_batt_charge_counter(chg, val);
		break;
	default:
		pr_err("batt power supply prop %d not supported\n", psp);
		return -EINVAL;
+13 −0
Original line number Diff line number Diff line
@@ -1857,6 +1857,19 @@ int smblib_get_prop_charge_qnovo_enable(struct smb_charger *chg,
	return 0;
}

int smblib_get_prop_batt_charge_counter(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_CHARGE_COUNTER, val);
	return rc;
}

/***********************
 * BATTERY PSY SETTERS *
 ***********************/
+2 −0
Original line number Diff line number Diff line
@@ -424,6 +424,8 @@ int smblib_get_prop_batt_current_now(struct smb_charger *chg,
				union power_supply_propval *val);
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_set_prop_input_suspend(struct smb_charger *chg,
				const union power_supply_propval *val);
int smblib_set_prop_batt_capacity(struct smb_charger *chg,