Loading Documentation/devicetree/bindings/power/supply/qcom/qpnp-fg-gen3.txt +8 −0 Original line number Diff line number Diff line Loading @@ -271,6 +271,14 @@ First Level Node - FG Gen3 device Definition: A boolean property that when defined holds SOC at 100% when the battery is full. - qcom,linearize-soc Usage: optional Value type: <empty> Definition: A boolean property that when defined linearizes SOC when the SOC drops after charge termination monotonically to improve the user experience. This is applicable only if "qcom,hold-soc-while-full" is specified. - qcom,ki-coeff-soc-dischg Usage: optional Value type: <prop-encoded-array> Loading drivers/power/supply/qcom/fg-core.h +1 −0 Original line number Diff line number Diff line Loading @@ -239,6 +239,7 @@ enum ttf_mode { struct fg_dt_props { bool force_load_profile; bool hold_soc_while_full; bool linearize_soc; bool auto_recharge_soc; int cutoff_volt_mv; int empty_volt_mv; Loading drivers/power/supply/qcom/qpnp-fg-gen3.c +26 −14 Original line number Diff line number Diff line Loading @@ -838,7 +838,7 @@ static int fg_get_prop_capacity(struct fg_chip *chip, int *val) if (rc < 0) return rc; if (chip->delta_soc > 0) if (chip->dt.linearize_soc && chip->delta_soc > 0) *val = chip->maint_soc; else *val = msoc; Loading Loading @@ -1750,13 +1750,14 @@ static int fg_charge_full_update(struct fg_chip *chip) fg_dbg(chip, FG_STATUS, "Terminated charging @ SOC%d\n", msoc); } } else if (msoc_raw < recharge_soc && chip->charge_full) { } else if (msoc_raw <= recharge_soc && chip->charge_full) { if (chip->dt.linearize_soc) { chip->delta_soc = FULL_CAPACITY - msoc; /* * We're spreading out the delta SOC over every 10% change * in monotonic SOC. We cannot spread more than 9% in the * range of 0-100 skipping the first 10%. * We're spreading out the delta SOC over every 10% * change in monotonic SOC. We cannot spread more than * 9% in the range of 0-100 skipping the first 10%. */ if (chip->delta_soc > 9) { chip->delta_soc = 0; Loading @@ -1765,6 +1766,7 @@ static int fg_charge_full_update(struct fg_chip *chip) chip->maint_soc = FULL_CAPACITY; chip->last_msoc = msoc; } } /* * Raise the recharge voltage so that VBAT_LT_RECHG signal Loading Loading @@ -3150,6 +3152,9 @@ static int fg_update_maint_soc(struct fg_chip *chip) { int rc = 0, msoc; if (!chip->dt.linearize_soc) return 0; mutex_lock(&chip->charge_full_lock); if (chip->delta_soc <= 0) goto out; Loading Loading @@ -3378,6 +3383,9 @@ static int fg_psy_get_property(struct power_supply *psy, case POWER_SUPPLY_PROP_CAPACITY: rc = fg_get_prop_capacity(chip, &pval->intval); break; case POWER_SUPPLY_PROP_CAPACITY_RAW: rc = fg_get_msoc_raw(chip, &pval->intval); break; case POWER_SUPPLY_PROP_VOLTAGE_NOW: if (chip->battery_missing) pval->intval = 3700000; Loading Loading @@ -3568,6 +3576,7 @@ static int fg_notifier_cb(struct notifier_block *nb, static enum power_supply_property fg_psy_props[] = { POWER_SUPPLY_PROP_CAPACITY, POWER_SUPPLY_PROP_CAPACITY_RAW, POWER_SUPPLY_PROP_TEMP, POWER_SUPPLY_PROP_VOLTAGE_NOW, POWER_SUPPLY_PROP_VOLTAGE_OCV, Loading Loading @@ -4671,6 +4680,9 @@ static int fg_parse_dt(struct fg_chip *chip) chip->dt.hold_soc_while_full = of_property_read_bool(node, "qcom,hold-soc-while-full"); chip->dt.linearize_soc = of_property_read_bool(node, "qcom,linearize-soc"); rc = fg_parse_ki_coefficients(chip); if (rc < 0) pr_err("Error in parsing Ki coefficients, rc=%d\n", rc); Loading Loading
Documentation/devicetree/bindings/power/supply/qcom/qpnp-fg-gen3.txt +8 −0 Original line number Diff line number Diff line Loading @@ -271,6 +271,14 @@ First Level Node - FG Gen3 device Definition: A boolean property that when defined holds SOC at 100% when the battery is full. - qcom,linearize-soc Usage: optional Value type: <empty> Definition: A boolean property that when defined linearizes SOC when the SOC drops after charge termination monotonically to improve the user experience. This is applicable only if "qcom,hold-soc-while-full" is specified. - qcom,ki-coeff-soc-dischg Usage: optional Value type: <prop-encoded-array> Loading
drivers/power/supply/qcom/fg-core.h +1 −0 Original line number Diff line number Diff line Loading @@ -239,6 +239,7 @@ enum ttf_mode { struct fg_dt_props { bool force_load_profile; bool hold_soc_while_full; bool linearize_soc; bool auto_recharge_soc; int cutoff_volt_mv; int empty_volt_mv; Loading
drivers/power/supply/qcom/qpnp-fg-gen3.c +26 −14 Original line number Diff line number Diff line Loading @@ -838,7 +838,7 @@ static int fg_get_prop_capacity(struct fg_chip *chip, int *val) if (rc < 0) return rc; if (chip->delta_soc > 0) if (chip->dt.linearize_soc && chip->delta_soc > 0) *val = chip->maint_soc; else *val = msoc; Loading Loading @@ -1750,13 +1750,14 @@ static int fg_charge_full_update(struct fg_chip *chip) fg_dbg(chip, FG_STATUS, "Terminated charging @ SOC%d\n", msoc); } } else if (msoc_raw < recharge_soc && chip->charge_full) { } else if (msoc_raw <= recharge_soc && chip->charge_full) { if (chip->dt.linearize_soc) { chip->delta_soc = FULL_CAPACITY - msoc; /* * We're spreading out the delta SOC over every 10% change * in monotonic SOC. We cannot spread more than 9% in the * range of 0-100 skipping the first 10%. * We're spreading out the delta SOC over every 10% * change in monotonic SOC. We cannot spread more than * 9% in the range of 0-100 skipping the first 10%. */ if (chip->delta_soc > 9) { chip->delta_soc = 0; Loading @@ -1765,6 +1766,7 @@ static int fg_charge_full_update(struct fg_chip *chip) chip->maint_soc = FULL_CAPACITY; chip->last_msoc = msoc; } } /* * Raise the recharge voltage so that VBAT_LT_RECHG signal Loading Loading @@ -3150,6 +3152,9 @@ static int fg_update_maint_soc(struct fg_chip *chip) { int rc = 0, msoc; if (!chip->dt.linearize_soc) return 0; mutex_lock(&chip->charge_full_lock); if (chip->delta_soc <= 0) goto out; Loading Loading @@ -3378,6 +3383,9 @@ static int fg_psy_get_property(struct power_supply *psy, case POWER_SUPPLY_PROP_CAPACITY: rc = fg_get_prop_capacity(chip, &pval->intval); break; case POWER_SUPPLY_PROP_CAPACITY_RAW: rc = fg_get_msoc_raw(chip, &pval->intval); break; case POWER_SUPPLY_PROP_VOLTAGE_NOW: if (chip->battery_missing) pval->intval = 3700000; Loading Loading @@ -3568,6 +3576,7 @@ static int fg_notifier_cb(struct notifier_block *nb, static enum power_supply_property fg_psy_props[] = { POWER_SUPPLY_PROP_CAPACITY, POWER_SUPPLY_PROP_CAPACITY_RAW, POWER_SUPPLY_PROP_TEMP, POWER_SUPPLY_PROP_VOLTAGE_NOW, POWER_SUPPLY_PROP_VOLTAGE_OCV, Loading Loading @@ -4671,6 +4680,9 @@ static int fg_parse_dt(struct fg_chip *chip) chip->dt.hold_soc_while_full = of_property_read_bool(node, "qcom,hold-soc-while-full"); chip->dt.linearize_soc = of_property_read_bool(node, "qcom,linearize-soc"); rc = fg_parse_ki_coefficients(chip); if (rc < 0) pr_err("Error in parsing Ki coefficients, rc=%d\n", rc); Loading