diff options
| author | Abhijeet Dharmapurikar <adharmap@codeaurora.org> | 2017-05-31 16:21:57 -0700 |
|---|---|---|
| committer | Abhijeet Dharmapurikar <adharmap@codeaurora.org> | 2017-05-31 17:04:26 -0700 |
| commit | 35b0ff80d1eb85048ce7bca8f6d160cd6dbfefb9 (patch) | |
| tree | c6a04db66aa932962e88601ed93e87a2378b500b /drivers/power | |
| parent | a5706c4fdac1a427fac7b30a49912a1d9d148cb9 (diff) | |
smb-lib: change debounce time to 20mS while in pr_swap
We observe that while PR_SWAP is done from PD stack, the typeC
block could be running its tCC debounce timer. This causes the
driver to prematurely declare that the cable is removed.
Fix this by reducing the tCC debounce time to 20mS while in
PR_SWAP.
Change-Id: Ie8b3628cd6931ff2da92d95c153d0d2c7ddb20b2
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Diffstat (limited to 'drivers/power')
| -rw-r--r-- | drivers/power/supply/qcom/smb-lib.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/power/supply/qcom/smb-lib.c b/drivers/power/supply/qcom/smb-lib.c index dee387bc87e7..83c577bf75a0 100644 --- a/drivers/power/supply/qcom/smb-lib.c +++ b/drivers/power/supply/qcom/smb-lib.c @@ -3629,6 +3629,11 @@ static void smblib_handle_typec_removal(struct smb_charger *chg) chg->pd_hard_reset = 0; chg->typec_legacy_valid = false; + /* reset back to 120mS tCC debounce */ + rc = smblib_masked_write(chg, MISC_CFG_REG, TCC_DEBOUNCE_20MS_BIT, 0); + if (rc < 0) + smblib_err(chg, "Couldn't set 120mS tCC debounce rc=%d\n", rc); + /* enable APSD CC trigger for next insertion */ rc = smblib_masked_write(chg, TYPE_C_CFG_REG, APSD_START_ON_CC_BIT, APSD_START_ON_CC_BIT); @@ -3867,12 +3872,18 @@ int smblib_get_prop_pr_swap_in_progress(struct smb_charger *chg, int smblib_set_prop_pr_swap_in_progress(struct smb_charger *chg, const union power_supply_propval *val) { + int rc; + chg->pr_swap_in_progress = val->intval; /* * call the cc changed irq to handle real removals while * PR_SWAP was in progress */ smblib_usb_typec_change(chg); + rc = smblib_masked_write(chg, MISC_CFG_REG, TCC_DEBOUNCE_20MS_BIT, + val->intval ? TCC_DEBOUNCE_20MS_BIT : 0); + if (rc < 0) + smblib_err(chg, "Couldn't set tCC debounce rc=%d\n", rc); return 0; } |
