Charge: Config step first current comp for CP

Config step first current comp for different products.
If not define at dts, default is 300mA.

Change-Id: Iad22e6dfce8ec99d4d12d71287466526247bcfc6
Reviewed-on: https://gerrit.mot.com/1663791
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Reviewed-by: Haijian Ma <mahj8@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1893610
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Reviewed-by: Wei Xu <xuwei9@lenovo.com>
This commit is contained in:
chailu1 2020-07-05 21:15:50 +08:00 committed by Wei Xu
parent 60d2e7a6f1
commit 0204dc4652
3 changed files with 10 additions and 3 deletions

View file

@ -1557,6 +1557,13 @@ static int mmi_chrg_manager_parse_dt(struct mmi_charger_manager *chip)
chip->typec_middle_current =
TYPEC_MIDDLE_CURRENT_UA;
rc = of_property_read_u32(node,
"mmi,step-first-current-comp",
&chip->step_first_curr_comp);
if (rc < 0)
chip->step_first_curr_comp =
STEP_FIREST_CURR_COMP;
rc = of_property_read_u32(node,
"mmi,pps-volt-steps",
&chip->pps_volt_steps);

View file

@ -131,6 +131,7 @@ struct mmi_chrg_dts_info {
#define PD_SRC_PDO_TYPE_BATTERY 1
#define PD_SRC_PDO_TYPE_VARIABLE 2
#define PD_SRC_PDO_TYPE_AUGMENTED 3
#define STEP_FIREST_CURR_COMP 300000
#define TYPEC_HIGH_CURRENT_UA 3000000
#define TYPEC_MIDDLE_CURRENT_UA 2000000
#define SWITCH_CHARGER_PPS_VOLT 5000000
@ -166,7 +167,7 @@ struct mmi_charger_manager {
int pl_chrg_vbatt_min; /*the minimum battery voltage to enable parallel charging*/
int typec_middle_current;
int step_first_curr_comp;
int pps_volt_comp;
int pd_request_volt;
int pd_request_curr;

View file

@ -349,7 +349,6 @@ void mmi_chrg_enable_all_cp(struct mmi_charger_manager *chip, int val)
#define HEARTBEAT_PPS_TUNNING_MS 100
#define HEARTBEAT_NEXT_STATE_MS 100
#define HEARTBEAT_CANCEL -1
#define STEP_FIREST_CURR_COMP 300000
#define CC_CURR_DEBOUNCE 100000
#define CV_TAPPER_COUNT 3
#define CC_POWER_COUNT 3
@ -887,7 +886,7 @@ static void mmi_chrg_sm_work_func(struct work_struct *work)
<= chip->pd_volt_max
&& vbatt_volt < chrg_step->chrg_step_cv_volt
&& ibatt_curr < ((chrg_step->pres_chrg_step == STEP_FIRST) ?
chrg_step->chrg_step_cc_curr + STEP_FIREST_CURR_COMP :
chrg_step->chrg_step_cc_curr + chip->step_first_curr_comp:
chrg_step->chrg_step_cc_curr)) {
chip->pd_request_volt += chip->pps_volt_steps;
mmi_chrg_dbg(chip, PR_MOTO, "Increase pps volt %d\n",