From 2d22cb6ebbf6a88737ef0f513480de8b539bf921 Mon Sep 17 00:00:00 2001 From: Lei Chen Date: Wed, 10 May 2023 18:36:32 +0800 Subject: [PATCH] charger:optimize the qc3p request voltage The qc3p request voltage is too high while the vbat is float. Optimize the qc3p request voltage when charger pump entry. Change-Id: I206e23f6f21519cf59725ce5d0874e11582325c9 Signed-off-by: Lei Chen Reviewed-on: https://gerrit.mot.com/2603252 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Lei Chen Reviewed-by: Xiangpo Zhao Submit-Approved: Jira Key --- .../mmi_parallel_charger_iio/mmi_charger_pump_policy.c | 9 +++++++++ .../power/mmi_parallel_charger_iio/mmi_qc3p_cp_policy.c | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/drivers/power/mmi_parallel_charger_iio/mmi_charger_pump_policy.c b/drivers/power/mmi_parallel_charger_iio/mmi_charger_pump_policy.c index cb20daa15cac..5c76dc8dd18a 100644 --- a/drivers/power/mmi_parallel_charger_iio/mmi_charger_pump_policy.c +++ b/drivers/power/mmi_parallel_charger_iio/mmi_charger_pump_policy.c @@ -675,6 +675,15 @@ void mmi_chrg_sm_work_func(struct work_struct *work) } } + if (batt_soc >= 80) { + //Read the vbat aggin after the soc above 80% + msleep(20); + rc = power_supply_get_property(chrg_list->chrg_dev[CP_MASTER]->chrg_psy, + POWER_SUPPLY_PROP_VOLTAGE_NOW, &prop); + if (!rc) + vbatt_volt = prop.intval*1000; + } + /*Initial setup pps request power by the battery voltage*/ chip->pd_request_volt = (2 * vbatt_volt) % 20000; chip->pd_request_volt = 2 * vbatt_volt - chip->pd_request_volt diff --git a/drivers/power/mmi_parallel_charger_iio/mmi_qc3p_cp_policy.c b/drivers/power/mmi_parallel_charger_iio/mmi_qc3p_cp_policy.c index 1415edf45995..779fd9963d74 100644 --- a/drivers/power/mmi_parallel_charger_iio/mmi_qc3p_cp_policy.c +++ b/drivers/power/mmi_parallel_charger_iio/mmi_qc3p_cp_policy.c @@ -603,6 +603,15 @@ void mmi_qc3p_chrg_sm_work_func(struct work_struct *work) chrg_list->chrg_dev[PMIC_SW]->charger_limited = true; } + if (batt_soc >= 80) { + //Read the vbat aggin after the soc above 80% + msleep(20); + rc = power_supply_get_property(chrg_list->chrg_dev[CP_MASTER]->chrg_psy, + POWER_SUPPLY_PROP_VOLTAGE_NOW, &prop); + if (!rc) + vbatt_volt = prop.intval*1000; + } + /*Initial setup qc3p request power by the battery voltage*/ chip->qc3p_request_volt = (2 * vbatt_volt) % 20000; chip->qc3p_request_volt = 2 * vbatt_volt - chip->qc3p_request_volt