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

Commit 810169d1 authored by Harry Yang's avatar Harry Yang
Browse files

power: smb5: Enable Type-C DRP try.snk support



Support type-c module in DRP (Dual Role Power) with try.snk enabled.

Try.SNK allows a DRP that has a policy based preference to be a Sink
when connecting to another DRP to effect a transition from a
destined Source role to the Sink role.

CRs-Fixed: 2251295
Change-Id: I4db2e94985e066ba8c4e06490515e6f428026002
Signed-off-by: default avatarHarry Yang <harryy@codeaurora.org>
parent 9ee89464
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -1402,6 +1402,14 @@ static int smb5_configure_typec(struct smb_charger *chg)
		return rc;
		return rc;
	}
	}


	rc = smblib_masked_write(chg, TYPE_C_MODE_CFG_REG,
				EN_TRY_SNK_BIT, EN_TRY_SNK_BIT);
	if (rc < 0) {
		dev_err(chg->dev,
			"Couldn't enable try.snk rc=%d\n", rc);
		return rc;
	}

	/* configure VCONN for software control */
	/* configure VCONN for software control */
	rc = smblib_masked_write(chg, TYPE_C_VCONN_CONTROL_REG,
	rc = smblib_masked_write(chg, TYPE_C_VCONN_CONTROL_REG,
				 VCONN_EN_SRC_BIT | VCONN_EN_VALUE_BIT,
				 VCONN_EN_SRC_BIT | VCONN_EN_VALUE_BIT,
+1 −0
Original line number Original line Diff line number Diff line
@@ -284,6 +284,7 @@ enum {


#define TYPE_C_MODE_CFG_REG			(TYPEC_BASE + 0x44)
#define TYPE_C_MODE_CFG_REG			(TYPEC_BASE + 0x44)
#define TYPEC_POWER_ROLE_CMD_MASK		GENMASK(2, 1)
#define TYPEC_POWER_ROLE_CMD_MASK		GENMASK(2, 1)
#define EN_TRY_SNK_BIT				BIT(4)
#define EN_SRC_ONLY_BIT				BIT(2)
#define EN_SRC_ONLY_BIT				BIT(2)
#define EN_SNK_ONLY_BIT				BIT(1)
#define EN_SNK_ONLY_BIT				BIT(1)
#define TYPEC_DISABLE_CMD_BIT			BIT(0)
#define TYPEC_DISABLE_CMD_BIT			BIT(0)