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: Harry Yang <harryy@codeaurora.org>
This commit is contained in:
Harry Yang 2018-05-30 15:49:04 -07:00
parent 9ee8946479
commit 810169d119
2 changed files with 9 additions and 0 deletions

View File

@ -1402,6 +1402,14 @@ static int smb5_configure_typec(struct smb_charger *chg)
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 */
rc = smblib_masked_write(chg, TYPE_C_VCONN_CONTROL_REG,
VCONN_EN_SRC_BIT | VCONN_EN_VALUE_BIT,

View File

@ -284,6 +284,7 @@ enum {
#define TYPE_C_MODE_CFG_REG (TYPEC_BASE + 0x44)
#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_SNK_ONLY_BIT BIT(1)
#define TYPEC_DISABLE_CMD_BIT BIT(0)