diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2017-01-30 20:16:01 -0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-01-30 20:16:01 -0800 |
commit | 42e1251b38729f7d0ec276e8a195db1d3ed22d41 (patch) | |
tree | 7e7b2eea69cd45934b61fbdf9d19247b89ecc0e3 /drivers | |
parent | 15632ada36671d7b06c6767e0ca0e2f9fb87420b (diff) | |
parent | 88b334d041876e5cada0339726b310425ff1122a (diff) |
Merge "smb-lib: disable APSD run on CC while APSD is disabled"
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/power/supply/qcom/smb-lib.c | 42 |
1 files changed, 35 insertions, 7 deletions
diff --git a/drivers/power/supply/qcom/smb-lib.c b/drivers/power/supply/qcom/smb-lib.c index dbda0b6a9c9a..2f612884fe0e 100644 --- a/drivers/power/supply/qcom/smb-lib.c +++ b/drivers/power/supply/qcom/smb-lib.c @@ -1053,13 +1053,41 @@ static int smblib_apsd_disable_vote_callback(struct votable *votable, struct smb_charger *chg = data; int rc; - rc = smblib_masked_write(chg, USBIN_OPTIONS_1_CFG_REG, - AUTO_SRC_DETECT_BIT, - apsd_disable ? 0 : AUTO_SRC_DETECT_BIT); - if (rc < 0) { - smblib_err(chg, "Couldn't %s APSD rc=%d\n", - apsd_disable ? "disable" : "enable", rc); - return rc; + if (apsd_disable) { + /* Don't run APSD on CC debounce when APSD is disabled */ + rc = smblib_masked_write(chg, TYPE_C_CFG_REG, + APSD_START_ON_CC_BIT, + 0); + if (rc < 0) { + smblib_err(chg, "Couldn't disable APSD_START_ON_CC rc=%d\n", + rc); + return rc; + } + + rc = smblib_masked_write(chg, USBIN_OPTIONS_1_CFG_REG, + AUTO_SRC_DETECT_BIT, + 0); + if (rc < 0) { + smblib_err(chg, "Couldn't disable APSD rc=%d\n", rc); + return rc; + } + } else { + rc = smblib_masked_write(chg, USBIN_OPTIONS_1_CFG_REG, + AUTO_SRC_DETECT_BIT, + AUTO_SRC_DETECT_BIT); + if (rc < 0) { + smblib_err(chg, "Couldn't enable APSD rc=%d\n", rc); + return rc; + } + + rc = smblib_masked_write(chg, TYPE_C_CFG_REG, + APSD_START_ON_CC_BIT, + APSD_START_ON_CC_BIT); + if (rc < 0) { + smblib_err(chg, "Couldn't enable APSD_START_ON_CC rc=%d\n", + rc); + return rc; + } } return 0; |