Skip to content

Commit

Permalink
Merge "power: qpnp-fg: qpnp-qg: fg-alg: Improve code readability of T…
Browse files Browse the repository at this point in the history
…TF algorithm"
  • Loading branch information
qctecmdr authored and Gerrit - the friendly Code Review server committed Aug 4, 2019
2 parents 8849200 + 86cee62 commit a82e3f9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions drivers/power/supply/qcom/fg-alg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion drivers/power/supply/qcom/fg-alg.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/power/supply/qcom/qpnp-fg-gen4.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion drivers/power/supply/qcom/qpnp-qg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a82e3f9

Please sign in to comment.