summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Troast <ntroast@codeaurora.org>2016-11-09 15:13:38 -0800
committerNicholas Troast <ntroast@codeaurora.org>2016-11-21 11:50:40 -0800
commitca271780b481275e52cfa12ba310ff28324c2048 (patch)
treec42b22512e96165f7071ee66b1d1ad7010ace317
parente2787f510d8879a6608bf41d0a62e32244da18fc (diff)
qpnp-smb2: stay in Attached.SRC state when OC is detected on VCONN
Currently when OC is detected on VCONN the hardware will disable OTG and exit Attached.SRC state and go back to DRP toggling. If the OC persists then the hardware will enter an infinite cycle of trying to enable OTG. Fix this by changing the behavior such that the hardware remains in Attached.SRC state when OC is detected on VCONN. In this case VBUS will remain on and the OTG device may continue to work in a limited capacity without VCONN. Change-Id: If371ec24040ea6d45d64dec6fa32b7f9f2276dfa Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
-rw-r--r--drivers/power/qcom-charger/qpnp-smb2.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/power/qcom-charger/qpnp-smb2.c b/drivers/power/qcom-charger/qpnp-smb2.c
index 8248fcee341d..257099895e00 100644
--- a/drivers/power/qcom-charger/qpnp-smb2.c
+++ b/drivers/power/qcom-charger/qpnp-smb2.c
@@ -1169,12 +1169,14 @@ static int smb2_init_hw(struct smb2 *chip)
return rc;
}
- /* disable Type-C factory mode */
+ /*
+ * disable Type-C factory mode and stay in Attached.SRC state when VCONN
+ * over-current happens
+ */
rc = smblib_masked_write(chg, TYPE_C_CFG_REG,
- FACTORY_MODE_DETECTION_EN_BIT, 0);
+ FACTORY_MODE_DETECTION_EN_BIT | VCONN_OC_CFG_BIT, 0);
if (rc < 0) {
- dev_err(chg->dev,
- "Couldn't disable Type-C factory mode rc=%d\n", rc);
+ dev_err(chg->dev, "Couldn't configure Type-C rc=%d\n", rc);
return rc;
}