charge: Fix OCP charger icl more then 1A in COM

When using OCP charger in charge only mode,the input current limit is 2A.
But the expected icl is 1A.
In smblib_apsd_results:
[OCP] = {
.name	= "OCP",
.bit	= OCP_CHARGER_BIT,
.val	= POWER_SUPPLY_TYPE_USB_DCP
}
So the OCP charger power supply type is USB_DCP.
And in func update_sw_icl_max,it will using
"vote(chg->usb_icl_votable, SW_ICL_MAX_VOTER, true, rp_ua);"
to set the usb_icl to be 2A.
So we need to recheck the OCP_CHARGER_BIT and reset usb_icl
to OCP_CURRENT_UA (1A).

Change-Id: Ifd4ccceb91c227c12e5f4b628606f2de166155af
Signed-off-by: Guocheng Wang <wanggc6@motorola.com>
Reviewed-on: https://gerrit.mot.com/2775176
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Haijian Ma <mahj8@motorola.com>
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
Guocheng Wang 2023-10-24 15:14:52 +08:00 • committed by Xiaojun Ji
commit 2a0f6e2bf4

View file

@ -6156,6 +6156,7 @@ static void update_sw_icl_max(struct smb_charger *chg, int val)
{
int typec_mode;
int rp_ua;
const struct apsd_result *apsd = NULL;
/* while PD is active it should have complete ICL control */
if (chg->pd_active)
@ -6198,8 +6199,14 @@ static void update_sw_icl_max(struct smb_charger *chg, int val)
vote(chg->usb_icl_votable, USB_PSY_VOTER, false, 0);
break;
case POWER_SUPPLY_TYPE_USB_DCP:
rp_ua = get_rp_based_dcp_current(chg, typec_mode);
vote(chg->usb_icl_votable, SW_ICL_MAX_VOTER, true, rp_ua);
apsd = smblib_get_apsd_result(chg);
if (apsd->bit == OCP_CHARGER_BIT) {
vote(chg->usb_icl_votable, SW_ICL_MAX_VOTER, true,
OCP_CURRENT_UA);
} else {
rp_ua = get_rp_based_dcp_current(chg, typec_mode);
vote(chg->usb_icl_votable, SW_ICL_MAX_VOTER, true, rp_ua);
}
vote(chg->usb_icl_votable, USB_PSY_VOTER, false, 0);
break;
case QTI_POWER_SUPPLY_TYPE_USB_FLOAT: