diff --git a/drivers/power/qpnp-fg.c b/drivers/power/qpnp-fg.c index 2b0f98f4299597eb1127caea0cabf7b4f423857c..8aa4e502a9a317d2c1090a134cec2a6d8b10ab1e 100644 --- a/drivers/power/qpnp-fg.c +++ b/drivers/power/qpnp-fg.c @@ -4699,6 +4699,18 @@ static int fg_power_set_property(struct power_supply *psy, schedule_work(&chip->bcl_hi_power_work); } break; + case POWER_SUPPLY_PROP_CHARGE_FULL: + if (chip->learning_data.active) { + pr_warn("Capacity learning active!\n"); + return 0; + } + if (val->intval <= 0 || val->intval > chip->nom_cap_uah) { + pr_err("charge_full is out of bounds\n"); + return -EINVAL; + } + chip->learning_data.learned_cc_uah = val->intval; + fg_cap_learning_save_data(chip); + break; default: return -EINVAL; }; @@ -4715,6 +4727,7 @@ static int fg_property_is_writeable(struct power_supply *psy, #ifdef CONFIG_QPNP_LEGACY_CYCLE_COUNT case POWER_SUPPLY_PROP_CYCLE_COUNT_ID: #endif + case POWER_SUPPLY_PROP_CHARGE_FULL: return 1; default: break;