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

Commit 68e77900 authored by Anirudh Ghayal's avatar Anirudh Ghayal
Browse files

power: qpnp-smb5: Add FORCE_RECHARGE power-supply property



Disable/re-enable charging to force a recharge.

Change-Id: I417d46cc07f455792906a18f4b6dc8e5ca8ca3da
Signed-off-by: default avatarAnirudh Ghayal <aghayal@codeaurora.org>
parent b2c8946b
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -1173,6 +1173,7 @@ static enum power_supply_property smb5_batt_props[] = {
	POWER_SUPPLY_PROP_CYCLE_COUNT,
	POWER_SUPPLY_PROP_RECHARGE_SOC,
	POWER_SUPPLY_PROP_CHARGE_FULL,
	POWER_SUPPLY_PROP_FORCE_RECHARGE,
};

static int smb5_batt_get_prop(struct power_supply *psy,
@@ -1288,6 +1289,9 @@ static int smb5_batt_get_prop(struct power_supply *psy,
		rc = smblib_get_prop_from_bms(chg,
				POWER_SUPPLY_PROP_CHARGE_FULL, val);
		break;
	case POWER_SUPPLY_PROP_FORCE_RECHARGE:
		val->intval = 0;
		break;
	default:
		pr_err("batt power supply prop %d not supported\n", psp);
		return -EINVAL;
@@ -1367,6 +1371,15 @@ static int smb5_batt_set_prop(struct power_supply *psy,
	case POWER_SUPPLY_PROP_RECHARGE_SOC:
		rc = smblib_set_prop_rechg_soc_thresh(chg, val);
		break;
	case POWER_SUPPLY_PROP_FORCE_RECHARGE:
			/* toggle charging to force recharge */
			vote(chg->chg_disable_votable, FORCE_RECHARGE_VOTER,
					true, 0);
			/* charge disable delay */
			msleep(50);
			vote(chg->chg_disable_votable, FORCE_RECHARGE_VOTER,
					false, 0);
		break;
	default:
		rc = -EINVAL;
	}
+1 −0
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ enum print_reason {
#define WBC_VOTER			"WBC_VOTER"
#define HW_LIMIT_VOTER			"HW_LIMIT_VOTER"
#define PL_SMB_EN_VOTER			"PL_SMB_EN_VOTER"
#define FORCE_RECHARGE_VOTER		"FORCE_RECHARGE_VOTER"

#define BOOST_BACK_STORM_COUNT	3
#define WEAK_CHG_STORM_COUNT	8