summaryrefslogtreecommitdiff
path: root/drivers/power/supply/power_supply_core.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2022-02-26 00:27:55 +0100
committerSebastian Reichel <sebastian.reichel@collabora.com>2022-02-28 11:34:31 +0100
commitd72ce7d324786257410bec6b36e3756647dd76fd (patch)
tree4e78091df0147a5be8385d9686d7c5a7c7338bc3 /drivers/power/supply/power_supply_core.c
parentd69fc86aca7eda7bd7405c16f35f260c154e14e3 (diff)
power: supply: ab8500: Standardize maintenance charging
Maintenance charging is the phase of keeping up the charge after the battery has charged fully using CC/CV charging. This can be done in many successive phases and is usually done with a slightly lower constant voltage than CV, and a slightly lower allowed current. Add an array of maintenance charging points each with a current, voltage and safety timer, and add helper functions to use these. Migrate the AB8500 code over. This is used in several Samsung products using the AB8500 and these batteries and their complete parameters will be added later as full examples, but the default battery in the AB8500 code serves as a reasonable example so far. Reviewed-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'drivers/power/supply/power_supply_core.c')
-rw-r--r--drivers/power/supply/power_supply_core.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
index 8dbd1197cc62..accbbd36bfe7 100644
--- a/drivers/power/supply/power_supply_core.c
+++ b/drivers/power/supply/power_supply_core.c
@@ -595,6 +595,7 @@ int power_supply_get_battery_info(struct power_supply *psy,
info->precharge_voltage_max_uv = -EINVAL;
info->charge_restart_voltage_uv = -EINVAL;
info->overvoltage_limit_uv = -EINVAL;
+ info->maintenance_charge = NULL;
info->temp_ambient_alert_min = INT_MIN;
info->temp_ambient_alert_max = INT_MAX;
info->temp_alert_min = INT_MIN;
@@ -844,6 +845,16 @@ int power_supply_temp2resist_simple(struct power_supply_resistance_temp_table *t
}
EXPORT_SYMBOL_GPL(power_supply_temp2resist_simple);
+struct power_supply_maintenance_charge_table *
+power_supply_get_maintenance_charging_setting(struct power_supply_battery_info *info,
+ int index)
+{
+ if (index >= info->maintenance_charge_size)
+ return NULL;
+ return &info->maintenance_charge[index];
+}
+EXPORT_SYMBOL_GPL(power_supply_get_maintenance_charging_setting);
+
/**
* power_supply_ocv2cap_simple() - find the battery capacity
* @table: Pointer to battery OCV lookup table