summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Troast <ntroast@codeaurora.org>2016-11-21 16:36:05 -0800
committerNicholas Troast <ntroast@codeaurora.org>2016-11-21 16:49:41 -0800
commit38fbbf2ca0182a8aa95bfbb453532b0ae260f8d9 (patch)
tree56a8bf851aa3c27d1f0935c62bad9a43ff1a7f9a
parente2787f510d8879a6608bf41d0a62e32244da18fc (diff)
qpnp-smb2: force UFP mode before shutdown
If a legacy Type-A to Type-C cable is attached to the phone, but the Type-A end is left disconnected, then the VBUS capacitor will be charged when DRP toggles to DFP mode. Since VBUS is charged it will prevent the device from staying in power off state when shutdown. Fix this by forcing UFP mode before shutdown so the VBUS capacitor will be discharged, and therefore it will not trigger PON to restart the device. Change-Id: I53f89cf6b7c11f32c5e8e5a51a5986fa31424b92 Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
-rw-r--r--drivers/power/qcom-charger/qpnp-smb2.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/power/qcom-charger/qpnp-smb2.c b/drivers/power/qcom-charger/qpnp-smb2.c
index 8248fcee341d..226527d71573 100644
--- a/drivers/power/qcom-charger/qpnp-smb2.c
+++ b/drivers/power/qcom-charger/qpnp-smb2.c
@@ -1837,8 +1837,13 @@ static void smb2_shutdown(struct platform_device *pdev)
struct smb2 *chip = platform_get_drvdata(pdev);
struct smb_charger *chg = &chip->chg;
+ /* configure power role for UFP */
+ smblib_masked_write(chg, TYPE_C_INTRPT_ENB_SOFTWARE_CTRL_REG,
+ TYPEC_POWER_ROLE_CMD_MASK, UFP_EN_CMD_BIT);
+
+ /* force HVDCP to 5V */
smblib_masked_write(chg, USBIN_OPTIONS_1_CFG_REG,
- HVDCP_AUTONOMOUS_MODE_EN_CFG_BIT, 0);
+ HVDCP_AUTONOMOUS_MODE_EN_CFG_BIT, 0);
smblib_write(chg, CMD_HVDCP_2_REG, FORCE_5V_BIT);
}