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

Commit 425616e8 authored by Subbaraman Narayanamurthy's avatar Subbaraman Narayanamurthy
Browse files

power: qpnp-fg-gen4: Add CC_SOC property



Add CC_SOC property to expose coulomb counter value in centi
percentage so that charger driver can make use of it for certain
workarounds.

Change-Id: Ic427c65f4602220088e97c811de1cfb32dfff8f9
Signed-off-by: default avatarSubbaraman Narayanamurthy <subbaram@codeaurora.org>
parent 0635add4
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -3476,7 +3476,7 @@ static int fg_psy_get_property(struct power_supply *psy,
{
	struct fg_gen4_chip *chip = power_supply_get_drvdata(psy);
	struct fg_dev *fg = &chip->fg;
	int rc = 0;
	int rc = 0, val;
	int64_t temp;

	switch (psp) {
@@ -3486,6 +3486,15 @@ static int fg_psy_get_property(struct power_supply *psy,
	case POWER_SUPPLY_PROP_CAPACITY_RAW:
		rc = fg_get_msoc_raw(fg, &pval->intval);
		break;
	case POWER_SUPPLY_PROP_CC_SOC:
		rc = fg_get_sram_prop(&chip->fg, FG_SRAM_CC_SOC, &val);
		if (rc < 0) {
			pr_err("Error in getting CC_SOC, rc=%d\n", rc);
			return rc;
		}
		/* Show it in centi-percentage */
		pval->intval = div_s64((int64_t)val * 10000,  CC_SOC_30BIT);
		break;
	case POWER_SUPPLY_PROP_VOLTAGE_NOW:
		if (fg->battery_missing)
			pval->intval = 3700000;
@@ -3706,6 +3715,7 @@ static int fg_property_is_writeable(struct power_supply *psy,
static enum power_supply_property fg_psy_props[] = {
	POWER_SUPPLY_PROP_CAPACITY,
	POWER_SUPPLY_PROP_CAPACITY_RAW,
	POWER_SUPPLY_PROP_CC_SOC,
	POWER_SUPPLY_PROP_TEMP,
	POWER_SUPPLY_PROP_VOLTAGE_NOW,
	POWER_SUPPLY_PROP_VOLTAGE_OCV,