From 56a85f8a0da0364cc0750689c5878174816f3e2c Mon Sep 17 00:00:00 2001 From: chailu1 Date: Thu, 24 Dec 2020 20:38:03 +0800 Subject: [PATCH] smb5-lib: Update USB ICL for USB phy speed Override the SDP current if it needs to increase for SDP USB2.0 500mA or USB3.0 900mA. Porting from (CR) Change-Id: Ib0136a2674e8f9ac6e7e5646a82052971a4bbf08 Reviewed-on: https://gerrit.mot.com/1836523 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Haijian Ma Reviewed-by: Huosheng Liao Submit-Approved: Jira Key --- drivers/power/supply/qcom/smb5-lib.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/power/supply/qcom/smb5-lib.c b/drivers/power/supply/qcom/smb5-lib.c index aa256e484e28..c75e1e091e40 100644 --- a/drivers/power/supply/qcom/smb5-lib.c +++ b/drivers/power/supply/qcom/smb5-lib.c @@ -5950,7 +5950,11 @@ static void update_sw_icl_max(struct smb_charger *chg, int val) /* rp-std or legacy, USB BC 1.2 */ switch (val) { case POWER_SUPPLY_TYPE_USB: - vote(chg->usb_icl_votable, USB_PSY_VOTER, true, SDP_CURRENT_UA); + if (get_client_vote(chg->usb_icl_votable, + USB_PSY_VOTER) < SDP_CURRENT_UA) { + vote(chg->usb_icl_votable, USB_PSY_VOTER, true, + SDP_CURRENT_UA); + } vote(chg->usb_icl_votable, SW_ICL_MAX_VOTER, false, 0); break; case POWER_SUPPLY_TYPE_USB_CDP: