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

Commit 06646d21 authored by Harry Yang's avatar Harry Yang Committed by Guru Das Srinagesh
Browse files

power: smb5: initialize Type-C to DRP mode on boot



When the device is shutdown/reboot with a charger connected, some of the
charger related PMIC configurations won't get reset because VBUS is
present.

This can cause issues like detecting a sink device. Currently, Type-C/PMIC
is always forced into sink mode right before shutdown, which, if not
altered after boot, will fail subsequent sink device connections.

Fix it by resetting Type-C to DRP mode on boot.

CRs-Fixed: 2364374
Change-Id: Ibed56ca63582e60f0b0f9e738bd1f01a3cca799a
Signed-off-by: default avatarHarry Yang <harryy@codeaurora.org>
parent 7e2f2e5c
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -1664,11 +1664,14 @@ static int smb5_configure_typec(struct smb_charger *chg)
		return rc;
	}

	/* enable try.snk and clear force sink for DRP mode */
	rc = smblib_masked_write(chg, TYPE_C_MODE_CFG_REG,
				EN_TRY_SNK_BIT, EN_TRY_SNK_BIT);
				EN_TRY_SNK_BIT | EN_SNK_ONLY_BIT,
				EN_TRY_SNK_BIT);
	if (rc < 0) {
		dev_err(chg->dev,
			"Couldn't enable try.snk rc=%d\n", rc);
			"Couldn't configure TYPE_C_MODE_CFG_REG rc=%d\n",
				rc);
		return rc;
	}
	chg->typec_try_mode |= EN_TRY_SNK_BIT;