From e9fc550caff22a1ac126a2db701c4fafea30465f Mon Sep 17 00:00:00 2001 From: Haijian Ma Date: Wed, 4 Dec 2019 17:48:04 +0800 Subject: [PATCH] smb5-lib: fixed BC1.2 current override type-c current ICL is set to 1000ma when BC1.2 result is OCP charger with med or high type-c rp current. (think plus usb-c book charger pack) So don't override USB icl when type-c rp current is med or high. Change-Id: Id3f9daedfbcf905b99612ba1977b2c710a764cba Signed-off-by: Haijian Ma Reviewed-on: https://gerrit.mot.com/1465715 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Lu Chai Reviewed-by: Huosheng Liao Submit-Approved: Jira Key Reviewed-by: Yonghua Yan Reviewed-on: https://gerrit.mot.com/1503915 Reviewed-on: https://gerrit.mot.com/1770998 --- drivers/power/supply/qcom/smb5-lib.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/power/supply/qcom/smb5-lib.c b/drivers/power/supply/qcom/smb5-lib.c index bb8cef8a8390..184f8cb93255 100644 --- a/drivers/power/supply/qcom/smb5-lib.c +++ b/drivers/power/supply/qcom/smb5-lib.c @@ -5973,6 +5973,7 @@ static void update_sw_icl_max(struct smb_charger *chg, int val) static void smblib_handle_apsd_done(struct smb_charger *chg, bool rising) { const struct apsd_result *apsd_result; + int typec_mode; if (!rising) return; @@ -5989,8 +5990,11 @@ static void smblib_handle_apsd_done(struct smb_charger *chg, bool rising) smblib_notify_device_mode(chg, true); break; case OCP_CHARGER_BIT: - vote(chg->usb_icl_votable, SW_ICL_MAX_VOTER, true, - OCP_CURRENT_UA); + typec_mode = smblib_get_prop_typec_mode(chg); + if (!typec_rp_med_high(chg, typec_mode)) { + vote(chg->usb_icl_votable, SW_ICL_MAX_VOTER, true, + OCP_CURRENT_UA); + } break; case DCP_CHARGER_BIT: break;