From a8e77d8c58d1ec1546f50e4558b24cd98ac519ef Mon Sep 17 00:00:00 2001 From: Yonghua Yan Date: Fri, 14 Jun 2019 18:17:22 +0800 Subject: [PATCH] smb5: limit usb icl to 1000mA for OCP type Limit the usb icl to 1000mA for OCP chargers(BELKIN 5V/1A) to avoid sudden vbus loss when the current load over 1000mA. Change-Id: Iad650afcb0263e861171223967d3ab5a688346c3 Signed-off-by: Yonghua Yan Reviewed-on: https://gerrit.mot.com/1371196 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Haijian Ma Reviewed-by: Huosheng Liao Submit-Approved: Jira Key Reviewed-on: https://gerrit.mot.com/1770268 --- drivers/power/supply/qcom/smb5-lib.c | 3 +++ drivers/power/supply/qcom/smb5-lib.h | 1 + 2 files changed, 4 insertions(+) diff --git a/drivers/power/supply/qcom/smb5-lib.c b/drivers/power/supply/qcom/smb5-lib.c index cbd1688f712e..dfaf35b9a9b3 100644 --- a/drivers/power/supply/qcom/smb5-lib.c +++ b/drivers/power/supply/qcom/smb5-lib.c @@ -5991,6 +5991,9 @@ 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); + break; case DCP_CHARGER_BIT: break; default: diff --git a/drivers/power/supply/qcom/smb5-lib.h b/drivers/power/supply/qcom/smb5-lib.h index 9071972a9a49..3428fd690991 100644 --- a/drivers/power/supply/qcom/smb5-lib.h +++ b/drivers/power/supply/qcom/smb5-lib.h @@ -96,6 +96,7 @@ enum print_reason { #define SDP_100_MA 100000 #define SDP_CURRENT_UA 500000 +#define OCP_CURRENT_UA 1000000 #define CDP_CURRENT_UA 1500000 #define DCP_CURRENT_UA 1500000 #define HVDCP_CURRENT_UA 3000000