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

Commit 055e4854 authored by Anirudh Ghayal's avatar Anirudh Ghayal Committed by Ashay Jaiswal
Browse files

power: smb5-lib: Disable charging on detecting a debug battery



Disable battery charging on detecting a debug board to avoid
damaging it.

Change-Id: I160c62e69cbc987131d57099c94698de1d684c2c
Signed-off-by: default avatarAnirudh Ghayal <aghayal@codeaurora.org>
parent f6328cb7
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -707,20 +707,21 @@ void smblib_suspend_on_debug_battery(struct smb_charger *chg)
	int rc;
	union power_supply_propval val;

	if (!chg->suspend_input_on_debug_batt)
		return;

	rc = power_supply_get_property(chg->bms_psy,
			POWER_SUPPLY_PROP_DEBUG_BATTERY, &val);
	if (rc < 0) {
		smblib_err(chg, "Couldn't get debug battery prop rc=%d\n", rc);
		return;
	}

	if (chg->suspend_input_on_debug_batt) {
		vote(chg->usb_icl_votable, DEBUG_BOARD_VOTER, val.intval, 0);
		vote(chg->dc_suspend_votable, DEBUG_BOARD_VOTER, val.intval, 0);
		if (val.intval)
			pr_info("Input suspended: Fake battery\n");
	} else {
		vote(chg->chg_disable_votable, DEBUG_BOARD_VOTER,
					val.intval, 0);
	}
}

int smblib_rerun_apsd_if_required(struct smb_charger *chg)