From 635dca1f6ae9ed278357666b8210fcffc348cf29 Mon Sep 17 00:00:00 2001 From: Nicholas Troast Date: Fri, 27 Jan 2017 13:55:49 -0800 Subject: smb-lib: fix unknown APSD result after CC2 workaround If APSD is triggered while APSD is disabled the APSD_RESULT_STATUS register will be reset. APSD will trigger whenever both VBUS and CC have been debounced. This includes when VBUS is stable and CC is re-asserted. This is an issue particularly when the CC2 workaround re-asserts CC when PD performs a hard reset since APSD will be disabled. Fix this by configuring APSD to trigger only on VBUS before CC is re-asserted by the CC2 workaround. Change-Id: I507646faaab7aafeedb4104ad0ad5c32970270a6 Signed-off-by: Nicholas Troast --- drivers/power/supply/qcom/smb-lib.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/power/supply/qcom/smb-lib.c b/drivers/power/supply/qcom/smb-lib.c index 62d8ae0c5f36..d3d79ec0c071 100644 --- a/drivers/power/supply/qcom/smb-lib.c +++ b/drivers/power/supply/qcom/smb-lib.c @@ -2314,6 +2314,12 @@ int smblib_reg_block_restore(struct smb_charger *chg, } static struct reg_info cc2_detach_settings[] = { + { + .reg = TYPE_C_CFG_REG, + .mask = APSD_START_ON_CC_BIT, + .val = 0, + .desc = "TYPE_C_CFG_REG", + }, { .reg = TYPE_C_CFG_2_REG, .mask = TYPE_C_UFP_MODE_BIT | EN_TRY_SOURCE_MODE_BIT, -- cgit v1.2.3