From 3f275d7116f360ef283bb429591d956f5838649e Mon Sep 17 00:00:00 2001 From: mahj8 Date: Tue, 21 Dec 2021 14:41:10 +0800 Subject: [PATCH] charging: Ignore the PD vote icl unless BC1.2 done Third charging ic IINLIM bits will be changed auto when BC1.2 done. So we need to Ignore the PD vote icl untill BC1.2 done. Change-Id: I394f80b71c427e5b2a98b6012aeb7a852329ce4f Signed-off-by: mahj8 Reviewed-on: https://gerrit.mot.com/2150599 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Lu Chai Reviewed-by: Huosheng Liao Submit-Approved: Jira Key --- .../mmi_discrete_charger_core.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/power/mmi_discrete_charger/mmi_discrete_charger_core.c b/drivers/power/mmi_discrete_charger/mmi_discrete_charger_core.c index 1ea61afd34c9..5c759e72e570 100644 --- a/drivers/power/mmi_discrete_charger/mmi_discrete_charger_core.c +++ b/drivers/power/mmi_discrete_charger/mmi_discrete_charger_core.c @@ -925,9 +925,18 @@ static void mmi_discrete_config_pd_charger(struct mmi_discrete_charger *chg) } mmi_set_pd30_cap(chg, req_pdo, req_pd_volt, req_pd_curr); } - rc = vote(chg->usb_icl_votable, PD_VOTER, true, req_pd_curr * 1000); - if (rc < 0) - mmi_info(chg, "vote PD USB_ICL failed %duA\n", req_pd_curr); + + /* + * Third charging ic IINLIM bits will be changed auto + * when BC1.2 done. So we need to Ignore the PD + * vote unless BC1.2 done. + */ + if (chg->real_charger_type != POWER_SUPPLY_TYPE_UNKNOWN) { + rc = vote(chg->usb_icl_votable, PD_VOTER, true, req_pd_curr * 1000); + if (rc < 0) + mmi_info(chg, "vote PD USB_ICL failed %duA\n", req_pd_curr); + } else + mmi_info(chg, "Ignore PD VOTER ICL before bc1.2\n"); mmi_info(chg, "Request PD power, fixed %d, pps %d, pdo %d, "