power: qpnp-smb5: Do not set BC1P2_START_ON_CC on DAM

Do not set BC1P2_START_ON_CC on detecting a DAM cable to
avoid a device brown-out.

Change-Id: I9192c6d2e89170585b98cbbaa8762aeffe66949e
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
This commit is contained in:
Kiran Gunda 2020-06-09 11:53:29 +05:30 • committed by Gerrit - the friendly Code Review server
commit 2dbb68e04e
2 changed files with 14 additions and 3 deletions

View file

@ -1503,15 +1503,25 @@ static int smb5_configure_typec(struct smb_charger *chg)
smblib_apsd_enable(chg, true);
rc = smblib_masked_write(chg, TYPE_C_CFG_REG,
BC1P2_START_ON_CC_BIT, 0);
rc = smblib_read(chg, TYPE_C_SNK_STATUS_REG, &value);
if (rc < 0) {
dev_err(chg->dev, "failed to write TYPE_C_CFG_REG rc=%d\n",
dev_err(chg->dev, "failed to read TYPE_C_SNK_STATUS_REG rc=%d\n",
rc);
return rc;
}
if (!(value & SNK_DAM_MASK)) {
rc = smblib_masked_write(chg, TYPE_C_CFG_REG,
BC1P2_START_ON_CC_BIT, 0);
if (rc < 0) {
dev_err(chg->dev, "failed to write TYPE_C_CFG_REG rc=%d\n",
rc);
return rc;
}
}
/* Use simple write to clear interrupts */
rc = smblib_write(chg, TYPE_C_INTERRUPT_EN_CFG_1_REG, 0);
if (rc < 0) {

View file

@ -335,6 +335,7 @@ enum {
********************************/
#define TYPE_C_SNK_STATUS_REG (TYPEC_BASE + 0x06)
#define DETECTED_SRC_TYPE_MASK GENMASK(6, 0)
#define SNK_DAM_MASK GENMASK(6, 4)
#define SNK_DAM_500MA_BIT BIT(6)
#define SNK_DAM_1500MA_BIT BIT(5)
#define SNK_DAM_3000MA_BIT BIT(4)