Loading drivers/power/supply/qcom/qpnp-fg-gen4.c +49 −28 Original line number Diff line number Diff line Loading @@ -246,6 +246,7 @@ struct fg_gen4_chip { int esr_actual; int esr_nominal; int soh; int esr_soh_cycle_count; bool first_profile_load; bool ki_coeff_dischg_en; bool slope_limit_en; Loading @@ -254,6 +255,7 @@ struct fg_gen4_chip { bool esr_fast_cal_timer_expired; bool esr_fast_calib_retry; bool esr_fcc_ctrl_en; bool esr_soh_notified; bool rslow_low; bool rapid_soc_dec_en; bool vbatt_low; Loading Loading @@ -1946,7 +1948,7 @@ static void get_batt_psy_props(struct fg_dev *fg) static int fg_gen4_esr_soh_update(struct fg_dev *fg) { struct fg_gen4_chip *chip = container_of(fg, struct fg_gen4_chip, fg); int rc, msoc, esr_uohms; int rc, msoc, esr_uohms, tmp; if (!fg->soc_reporting_ready || fg->battery_missing) { chip->esr_actual = -EINVAL; Loading @@ -1954,14 +1956,28 @@ static int fg_gen4_esr_soh_update(struct fg_dev *fg) return 0; } if (fg->charge_status == POWER_SUPPLY_STATUS_CHARGING) { rc = get_cycle_count(chip->counter, &tmp); if (rc < 0) pr_err("Couldn't get cycle count rc=%d\n", rc); else if (tmp != chip->esr_soh_cycle_count) chip->esr_soh_notified = false; if (fg->charge_status != POWER_SUPPLY_STATUS_CHARGING || chip->esr_soh_notified) return 0; rc = fg_get_msoc(fg, &msoc); if (rc < 0) { pr_err("Error in getting msoc, rc=%d\n", rc); return rc; } if (msoc == ESR_SOH_SOC) { if (msoc != ESR_SOH_SOC) { fg_dbg(fg, FG_STATUS, "msoc: %d, not publishing ESR params\n", msoc); return 0; } rc = fg_get_sram_prop(fg, FG_SRAM_ESR_ACT, &esr_uohms); if (rc < 0) { pr_err("Error in getting esr_actual, rc=%d\n", Loading @@ -1984,8 +2000,12 @@ static int fg_gen4_esr_soh_update(struct fg_dev *fg) if (fg->batt_psy) power_supply_changed(fg->batt_psy); } } rc = get_cycle_count(chip->counter, &chip->esr_soh_cycle_count); if (rc < 0) pr_err("Couldn't get cycle count rc=%d\n", rc); chip->esr_soh_notified = true; return 0; } Loading Loading @@ -4690,6 +4710,7 @@ static int fg_gen4_probe(struct platform_device *pdev) fg->batt_id_ohms = -EINVAL; chip->ki_coeff_full_soc[0] = -EINVAL; chip->ki_coeff_full_soc[1] = -EINVAL; chip->esr_soh_cycle_count = -EINVAL; fg->regmap = dev_get_regmap(fg->dev->parent, NULL); if (!fg->regmap) { dev_err(fg->dev, "Parent regmap is unavailable\n"); Loading Loading
drivers/power/supply/qcom/qpnp-fg-gen4.c +49 −28 Original line number Diff line number Diff line Loading @@ -246,6 +246,7 @@ struct fg_gen4_chip { int esr_actual; int esr_nominal; int soh; int esr_soh_cycle_count; bool first_profile_load; bool ki_coeff_dischg_en; bool slope_limit_en; Loading @@ -254,6 +255,7 @@ struct fg_gen4_chip { bool esr_fast_cal_timer_expired; bool esr_fast_calib_retry; bool esr_fcc_ctrl_en; bool esr_soh_notified; bool rslow_low; bool rapid_soc_dec_en; bool vbatt_low; Loading Loading @@ -1946,7 +1948,7 @@ static void get_batt_psy_props(struct fg_dev *fg) static int fg_gen4_esr_soh_update(struct fg_dev *fg) { struct fg_gen4_chip *chip = container_of(fg, struct fg_gen4_chip, fg); int rc, msoc, esr_uohms; int rc, msoc, esr_uohms, tmp; if (!fg->soc_reporting_ready || fg->battery_missing) { chip->esr_actual = -EINVAL; Loading @@ -1954,14 +1956,28 @@ static int fg_gen4_esr_soh_update(struct fg_dev *fg) return 0; } if (fg->charge_status == POWER_SUPPLY_STATUS_CHARGING) { rc = get_cycle_count(chip->counter, &tmp); if (rc < 0) pr_err("Couldn't get cycle count rc=%d\n", rc); else if (tmp != chip->esr_soh_cycle_count) chip->esr_soh_notified = false; if (fg->charge_status != POWER_SUPPLY_STATUS_CHARGING || chip->esr_soh_notified) return 0; rc = fg_get_msoc(fg, &msoc); if (rc < 0) { pr_err("Error in getting msoc, rc=%d\n", rc); return rc; } if (msoc == ESR_SOH_SOC) { if (msoc != ESR_SOH_SOC) { fg_dbg(fg, FG_STATUS, "msoc: %d, not publishing ESR params\n", msoc); return 0; } rc = fg_get_sram_prop(fg, FG_SRAM_ESR_ACT, &esr_uohms); if (rc < 0) { pr_err("Error in getting esr_actual, rc=%d\n", Loading @@ -1984,8 +2000,12 @@ static int fg_gen4_esr_soh_update(struct fg_dev *fg) if (fg->batt_psy) power_supply_changed(fg->batt_psy); } } rc = get_cycle_count(chip->counter, &chip->esr_soh_cycle_count); if (rc < 0) pr_err("Couldn't get cycle count rc=%d\n", rc); chip->esr_soh_notified = true; return 0; } Loading Loading @@ -4690,6 +4710,7 @@ static int fg_gen4_probe(struct platform_device *pdev) fg->batt_id_ohms = -EINVAL; chip->ki_coeff_full_soc[0] = -EINVAL; chip->ki_coeff_full_soc[1] = -EINVAL; chip->esr_soh_cycle_count = -EINVAL; fg->regmap = dev_get_regmap(fg->dev->parent, NULL); if (!fg->regmap) { dev_err(fg->dev, "Parent regmap is unavailable\n"); Loading