From 86cee62b3a5f46da0756928e4941f4b64a7406f7 Mon Sep 17 00:00:00 2001 From: Sahil Chandna Date: Wed, 27 Mar 2019 18:57:20 +0530 Subject: [PATCH] power: qpnp-fg: qpnp-qg: fg-alg: Improve code readability of TTF algorithm For voltage based step charging, used in TTF algorithm, improve the code readability by changing ttf_mode from TTF_MODE_V_STEP_CHG to TTF_MODE_VBAT_STEP_CHG. Change-Id: Ia3b7dd0f2fc1b354c5afaa745c1117719fb9df66 Signed-off-by: Sahil Chandna --- drivers/power/supply/qcom/fg-alg.c | 8 ++++---- drivers/power/supply/qcom/fg-alg.h | 2 +- drivers/power/supply/qcom/qpnp-fg-gen4.c | 2 +- drivers/power/supply/qcom/qpnp-qg.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/power/supply/qcom/fg-alg.c b/drivers/power/supply/qcom/fg-alg.c index 3a1db2ce99b3b..a382d60299d9f 100644 --- a/drivers/power/supply/qcom/fg-alg.c +++ b/drivers/power/supply/qcom/fg-alg.c @@ -898,7 +898,7 @@ static int get_step_chg_current_window(struct ttf *ttf) struct range_data *step_chg_cfg = ttf->step_chg_cfg; int i, rc, curr_window, vbatt; - if (ttf->mode == TTF_MODE_V_STEP_CHG) { + if (ttf->mode == TTF_MODE_VBAT_STEP_CHG) { rc = ttf->get_ttf_param(ttf->data, TTF_VBAT, &vbatt); if (rc < 0) { pr_err("failed to get battery voltage, rc=%d\n", rc); @@ -1024,7 +1024,7 @@ static int get_time_to_full_locked(struct ttf *ttf, int *val) /* estimated battery current at the CC to CV transition */ switch (ttf->mode) { case TTF_MODE_NORMAL: - case TTF_MODE_V_STEP_CHG: + case TTF_MODE_VBAT_STEP_CHG: case TTF_MODE_OCV_STEP_CHG: i_cc2cv = ibatt_avg * vbatt_avg / max(MILLI_UNIT, float_volt_uv / MILLI_UNIT); @@ -1082,7 +1082,7 @@ static int get_time_to_full_locked(struct ttf *ttf, int *val) ibatt_this_step, t_predicted_this_step); } break; - case TTF_MODE_V_STEP_CHG: + case TTF_MODE_VBAT_STEP_CHG: case TTF_MODE_OCV_STEP_CHG: if (!step_chg_data || !step_chg_cfg) break; @@ -1123,7 +1123,7 @@ static int get_time_to_full_locked(struct ttf *ttf, int *val) MILLI_UNIT); } - if (ttf->mode == TTF_MODE_V_STEP_CHG) + if (ttf->mode == TTF_MODE_VBAT_STEP_CHG) step_chg_data[i].ocv = step_chg_cfg[i].high_threshold - (rbatt * i_step); diff --git a/drivers/power/supply/qcom/fg-alg.h b/drivers/power/supply/qcom/fg-alg.h index 24d078735c676..24fc37b033629 100644 --- a/drivers/power/supply/qcom/fg-alg.h +++ b/drivers/power/supply/qcom/fg-alg.h @@ -75,7 +75,7 @@ struct cap_learning { enum ttf_mode { TTF_MODE_NORMAL = 0, TTF_MODE_QNOVO, - TTF_MODE_V_STEP_CHG, + TTF_MODE_VBAT_STEP_CHG, TTF_MODE_OCV_STEP_CHG, }; diff --git a/drivers/power/supply/qcom/qpnp-fg-gen4.c b/drivers/power/supply/qcom/qpnp-fg-gen4.c index 76e91cd82bf3b..197027688f6f4 100644 --- a/drivers/power/supply/qcom/qpnp-fg-gen4.c +++ b/drivers/power/supply/qcom/qpnp-fg-gen4.c @@ -951,7 +951,7 @@ static int fg_gen4_get_ttf_param(void *data, enum ttf_param param, int *val) if (is_qnovo_en(fg)) *val = TTF_MODE_QNOVO; else if (chip->ttf->step_chg_cfg_valid) - *val = TTF_MODE_V_STEP_CHG; + *val = TTF_MODE_VBAT_STEP_CHG; else if (chip->ttf->ocv_step_chg_cfg_valid) *val = TTF_MODE_OCV_STEP_CHG; else diff --git a/drivers/power/supply/qcom/qpnp-qg.c b/drivers/power/supply/qcom/qpnp-qg.c index 13c3fca11e9a1..4debea696ef75 100644 --- a/drivers/power/supply/qcom/qpnp-qg.c +++ b/drivers/power/supply/qcom/qpnp-qg.c @@ -1615,7 +1615,7 @@ static int qg_get_ttf_param(void *data, enum ttf_param param, int *val) break; case TTF_MODE: if (chip->ttf->step_chg_cfg_valid) - *val = TTF_MODE_V_STEP_CHG; + *val = TTF_MODE_VBAT_STEP_CHG; else *val = TTF_MODE_NORMAL; break;