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

Commit fe9a9bb8 authored by Ashay Jaiswal's avatar Ashay Jaiswal Committed by Guru Das Srinagesh
Browse files

power: smb5-lib: fix adapter allowance for PMI632



PMI632 only supports VBUS voltage upto 9V, add support
to limit adapter allowance to maximum 9V for PMI632.

Change-Id: I6604fd50957287aef5e8570e66e370cb95bcbca3
Signed-off-by: default avatarAshay Jaiswal <ashayj@codeaurora.org>
parent d8bc42f4
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -739,6 +739,23 @@ static int smblib_set_adapter_allowance(struct smb_charger *chg,
{
	int rc = 0;

	/* PMI632 only support max. 9V */
	if (chg->smb_version == PMI632_SUBTYPE) {
		switch (allowed_voltage) {
		case USBIN_ADAPTER_ALLOW_12V:
		case USBIN_ADAPTER_ALLOW_9V_TO_12V:
			allowed_voltage = USBIN_ADAPTER_ALLOW_9V;
			break;
		case USBIN_ADAPTER_ALLOW_5V_OR_12V:
		case USBIN_ADAPTER_ALLOW_5V_OR_9V_TO_12V:
			allowed_voltage = USBIN_ADAPTER_ALLOW_5V_OR_9V;
			break;
		case USBIN_ADAPTER_ALLOW_5V_TO_12V:
			allowed_voltage = USBIN_ADAPTER_ALLOW_5V_TO_9V;
			break;
		}
	}

	rc = smblib_write(chg, USBIN_ADAPTER_ALLOW_CFG_REG, allowed_voltage);
	if (rc < 0) {
		smblib_err(chg, "Couldn't write 0x%02x to USBIN_ADAPTER_ALLOW_CFG rc=%d\n",