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

Commit 123a8dfd authored by Guru Das Srinagesh's avatar Guru Das Srinagesh
Browse files

power: smb1390: Turn off due to high SOC threshold only at start



Currently, Battery SoC exceeding a user-configurable threshold causes
the SMB1390s to turn off in the following conditions via
SOC_LEVEL_VOTER:
- Upon initial bootup, and
- After initial bootup if charging mode is Constant-Voltage (CV).

Remove the second condition. Now, a high SoC threshold will cause the
SMB1390s to turn off only at bootup. This rule applies to both CV and
Constant-Current (CC) charging modes, irrespective of whether the output
topology is VPH or VBATT.

In addition, if the SoC falls below the threshold after bootup, remove
vote from SOC_LEVEL_VOTER. Without this, CPs will never get re-enabled
if they get disabled by SOC_LEVEL_VOTER upon bootup.

Change-Id: If0ce2661f25fd227cbe969fdbed468236806238f
Signed-off-by: default avatarGuru Das Srinagesh <gurus@codeaurora.org>
parent 62839c2f
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -1004,9 +1004,13 @@ static void smb1390_status_change_work(struct work_struct *work)
	if (!is_psy_voter_available(chip))
		goto out;

	if (!smb1390_is_adapter_cc_mode(chip))
		vote(chip->disable_votable, SOC_LEVEL_VOTER,
		     smb1390_is_batt_soc_valid(chip) ? false : true, 0);
	/*
	 * If batt soc is not valid upon bootup, but becomes
	 * valid due to the battery discharging later, remove
	 * vote from SOC_LEVEL_VOTER.
	 */
	if (smb1390_is_batt_soc_valid(chip))
		vote(chip->disable_votable, SOC_LEVEL_VOTER, false, 0);

	rc = power_supply_get_property(chip->usb_psy,
			POWER_SUPPLY_PROP_SMB_EN_MODE, &pval);