Loading drivers/power/supply/qcom/qpnp-fg-gen3.c +3 −0 Original line number Diff line number Diff line Loading @@ -3270,15 +3270,18 @@ static int fg_get_time_to_empty(struct fg_dev *fg, int *val) struct fg_gen3_chip *chip = container_of(fg, struct fg_gen3_chip, fg); int rc, ibatt_avg, msoc, full_soc, act_cap_mah, divisor; mutex_lock(&chip->ttf.lock); rc = fg_circ_buf_median(&chip->ttf.ibatt, &ibatt_avg); if (rc < 0) { /* try to get instantaneous current */ rc = fg_get_battery_current(fg, &ibatt_avg); if (rc < 0) { pr_err("failed to get battery current, rc=%d\n", rc); mutex_unlock(&chip->ttf.lock); return rc; } } mutex_unlock(&chip->ttf.lock); ibatt_avg /= MILLI_UNIT; /* clamp ibatt_avg to 100mA */ Loading Loading
drivers/power/supply/qcom/qpnp-fg-gen3.c +3 −0 Original line number Diff line number Diff line Loading @@ -3270,15 +3270,18 @@ static int fg_get_time_to_empty(struct fg_dev *fg, int *val) struct fg_gen3_chip *chip = container_of(fg, struct fg_gen3_chip, fg); int rc, ibatt_avg, msoc, full_soc, act_cap_mah, divisor; mutex_lock(&chip->ttf.lock); rc = fg_circ_buf_median(&chip->ttf.ibatt, &ibatt_avg); if (rc < 0) { /* try to get instantaneous current */ rc = fg_get_battery_current(fg, &ibatt_avg); if (rc < 0) { pr_err("failed to get battery current, rc=%d\n", rc); mutex_unlock(&chip->ttf.lock); return rc; } } mutex_unlock(&chip->ttf.lock); ibatt_avg /= MILLI_UNIT; /* clamp ibatt_avg to 100mA */ Loading