Loading drivers/power/supply/qcom/qpnp-fg-gen4.c +30 −5 Original line number Diff line number Diff line Loading @@ -264,6 +264,7 @@ struct fg_gen4_chip { struct cycle_counter *counter; struct cap_learning *cl; struct ttf *ttf; struct soh_profile *sp; struct device_node *pbs_dev; struct nvmem_device *fg_nvmem; struct votable *delta_esr_irq_en_votable; Loading Loading @@ -1933,13 +1934,35 @@ static int fg_gen4_get_batt_profile(struct fg_dev *fg) return -ENODATA; } if (chip->dt.multi_profile_load && chip->batt_age_level != avail_age_level) { if (chip->dt.multi_profile_load) { if (chip->batt_age_level != avail_age_level) { fg_dbg(fg, FG_STATUS, "Batt_age_level %d doesn't exist, using %d\n", chip->batt_age_level, avail_age_level); chip->batt_age_level = avail_age_level; } if (!chip->sp) chip->sp = devm_kzalloc(fg->dev, sizeof(*chip->sp), GFP_KERNEL); if (!chip->sp) return -ENOMEM; if (!chip->sp->initialized) { chip->sp->batt_id_kohms = fg->batt_id_ohms / 1000; chip->sp->last_batt_age_level = chip->batt_age_level; chip->sp->bp_node = batt_node; chip->sp->bms_psy = fg->fg_psy; rc = soh_profile_init(fg->dev, chip->sp); if (rc < 0) { devm_kfree(fg->dev, chip->sp); chip->sp = NULL; } else { fg_dbg(fg, FG_STATUS, "SOH profile count: %d\n", chip->sp->profile_count); } } } data = of_get_property(profile_node, "qcom,fg-profile-data", &len); if (!data) { pr_err("No profile data available\n"); Loading Loading @@ -4513,6 +4536,8 @@ static int fg_psy_set_property(struct power_supply *psy, break; case POWER_SUPPLY_PROP_SOH: chip->soh = pval->intval; if (chip->sp) soh_profile_update(chip->sp, chip->soh); break; case POWER_SUPPLY_PROP_CLEAR_SOH: if (chip->first_profile_load && !pval->intval) { Loading Loading
drivers/power/supply/qcom/qpnp-fg-gen4.c +30 −5 Original line number Diff line number Diff line Loading @@ -264,6 +264,7 @@ struct fg_gen4_chip { struct cycle_counter *counter; struct cap_learning *cl; struct ttf *ttf; struct soh_profile *sp; struct device_node *pbs_dev; struct nvmem_device *fg_nvmem; struct votable *delta_esr_irq_en_votable; Loading Loading @@ -1933,13 +1934,35 @@ static int fg_gen4_get_batt_profile(struct fg_dev *fg) return -ENODATA; } if (chip->dt.multi_profile_load && chip->batt_age_level != avail_age_level) { if (chip->dt.multi_profile_load) { if (chip->batt_age_level != avail_age_level) { fg_dbg(fg, FG_STATUS, "Batt_age_level %d doesn't exist, using %d\n", chip->batt_age_level, avail_age_level); chip->batt_age_level = avail_age_level; } if (!chip->sp) chip->sp = devm_kzalloc(fg->dev, sizeof(*chip->sp), GFP_KERNEL); if (!chip->sp) return -ENOMEM; if (!chip->sp->initialized) { chip->sp->batt_id_kohms = fg->batt_id_ohms / 1000; chip->sp->last_batt_age_level = chip->batt_age_level; chip->sp->bp_node = batt_node; chip->sp->bms_psy = fg->fg_psy; rc = soh_profile_init(fg->dev, chip->sp); if (rc < 0) { devm_kfree(fg->dev, chip->sp); chip->sp = NULL; } else { fg_dbg(fg, FG_STATUS, "SOH profile count: %d\n", chip->sp->profile_count); } } } data = of_get_property(profile_node, "qcom,fg-profile-data", &len); if (!data) { pr_err("No profile data available\n"); Loading Loading @@ -4513,6 +4536,8 @@ static int fg_psy_set_property(struct power_supply *psy, break; case POWER_SUPPLY_PROP_SOH: chip->soh = pval->intval; if (chip->sp) soh_profile_update(chip->sp, chip->soh); break; case POWER_SUPPLY_PROP_CLEAR_SOH: if (chip->first_profile_load && !pval->intval) { Loading