From e31bf366e3203db940666e22f89e9c08fc4670c2 Mon Sep 17 00:00:00 2001 From: Yonghua Yan Date: Thu, 16 May 2019 22:15:15 +0800 Subject: [PATCH] smb5-lib: Skip USB ICL vote for high or medium typec When connect the device to the typec port of a PC with high or medium source advertise, the USB ICL is overridden by USB phy voter with 500mA. But for non-legacy typec, the typec source advertise should be prior to usb bc1.2. So add condition check when set the USB ICL vote from USB driver, if there is high or mid typec source advertise, and just skip the USB driver ICL voter. Change-Id: I519cf1afec40857ca640727fee6cc11f262af492 Signed-off-by: Yonghua Yan Reviewed-on: https://gerrit.mot.com/1355853 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Huosheng Liao Reviewed-by: Jianqi Yang Submit-Approved: Jira Key Reviewed-on: https://gerrit.mot.com/1770259 --- 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 ce1134ad2d7b..cbd1688f712e 100644 --- a/drivers/power/supply/qcom/smb5-lib.c +++ b/drivers/power/supply/qcom/smb5-lib.c @@ -4487,6 +4487,10 @@ static int smblib_handle_usb_current(struct smb_charger *chg, if (!rc && !val.intval) return 0; + typec_mode = smblib_get_prop_typec_mode(chg); + if (typec_rp_med_high(chg, typec_mode)) + return 0; + /* if flash is active force 500mA */ if ((usb_current < SDP_CURRENT_UA) && is_flash_active(chg)) usb_current = SDP_CURRENT_UA;