From 9a07f7885f8a6583ffb23644b815b068b6fbb1e7 Mon Sep 17 00:00:00 2001 From: xuwt2 Date: Mon, 22 Jun 2020 17:29:40 +0800 Subject: [PATCH] power: smb5-lib: Vote USB_ICL after PD active the usb_icl_votable has been voted at policy-engine through the PD communication protocol, In smblib_pd_contract_work, we actually needn't override its setting, if want to re-vote it, the value must not be greater than the result after PD contract. Change-Id: I4a9c7c52709c60fa51a6d1aa2125bbafb52e81df Signed-off-by: xuwt2 Reviewed-on: https://gerrit.mot.com/1636223 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Yonghua Yan Reviewed-by: Haijian Ma Reviewed-by: Huosheng Liao Submit-Approved: Jira Key Reviewed-on: https://gerrit.mot.com/1771126 --- drivers/power/supply/qcom/smb5-lib.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/power/supply/qcom/smb5-lib.c b/drivers/power/supply/qcom/smb5-lib.c index 1446086625c4..52708b3f2423 100644 --- a/drivers/power/supply/qcom/smb5-lib.c +++ b/drivers/power/supply/qcom/smb5-lib.c @@ -7436,6 +7436,10 @@ static void smblib_pd_contract_work(struct work_struct *work) smblib_set_opt_switcher_freq(chg, chg->chg_freq.freq_5V); max_ua = (MAX_INPUT_PWR_UW / (chg->pd_contract_uv / 1000)) * 1000; + + if (get_client_vote(chg->usb_icl_votable, PD_VOTER) > 0) + max_ua = min(max_ua, get_client_vote(chg->usb_icl_votable, PD_VOTER)); + smblib_err(chg, "smblib_pd_contract_work: %d uV, %d uA\n", chg->pd_contract_uv, max_ua);