QC3P:add afvc compensation voltage

AFVC enable project,add afvc compensation
voltage for qc3p policy algorithm.

Change-Id: I91b9fcf636c75e2664de04962caa8dd0cdf84bf4
Signed-off-by: xuwei9 <xuwei9@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1997670
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
xuwei9 2021-06-30 16:49:00 +08:00 • committed by Wei Xu
commit 0f97c8d407
3 changed files with 8 additions and 2 deletions

View file

@ -1776,6 +1776,11 @@ static int mmi_chrg_manager_parse_dt(struct mmi_charger_manager *chip)
}
}
rc = of_property_read_u32(node,
"mmi,afvc_enable_compensation_uv",
&chip->afvc_volt_comp);
if (rc < 0)
chip->afvc_volt_comp = 0;
return rc;
thermal_failed:
devm_kfree(chip->dev,chip->thermal_mitigation);

View file

@ -274,6 +274,7 @@ struct mmi_charger_manager {
struct mmi_charger_device **chrg_list; /*charger device list*/
enum qc3p_power_type qc3p_power;
bool qc3p_active;
int afvc_volt_comp; /*afvc enabled ,volt compensation uv*/
};
extern bool mmi_get_pps_result_history(struct mmi_charger_manager *chip);

View file

@ -1185,7 +1185,7 @@ static void mmi_chrg_sm_work_func(struct work_struct *work)
&& !chip->batt_therm_cooling) {
chrg_cv_taper_tunning_cnt = 0;
if (vbatt_volt > chrg_step->chrg_step_cv_volt + 10000) {
if (vbatt_volt > chrg_step->chrg_step_cv_volt + 10000 + chip->afvc_volt_comp) {
if (chrg_cv_delta_volt > 20000)
chip->pd_request_volt -= chrg_cv_delta_volt;
else
@ -1210,7 +1210,7 @@ static void mmi_chrg_sm_work_func(struct work_struct *work)
}else {
/*In this case, sys_therm_cooling or batt_therm_cooling is ture*/
if (vbatt_volt > chrg_step->chrg_step_cv_volt + 10000) {
if (vbatt_volt > chrg_step->chrg_step_cv_volt + 10000 + chip->afvc_volt_comp) {
if (chrg_cv_delta_volt > 20000)
chip->pd_request_volt -= chrg_cv_delta_volt;
else