Few batteries can be modelled to degrade at constant rate for each increased cycle. Add degradation constant for such simple model to batinfo. Signed-off-by: Matti Vaittinen <matti.vaittinen@xxxxxxxxxxxxxxxxx> --- RFCv3: New patch --- drivers/power/supply/power_supply_core.c | 3 +++ include/linux/power_supply.h | 1 + 2 files changed, 4 insertions(+) diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c index 47176ed2570b..ebc961b5aa45 100644 --- a/drivers/power/supply/power_supply_core.c +++ b/drivers/power/supply/power_supply_core.c @@ -639,6 +639,7 @@ int power_supply_dev_get_battery_info(struct device *dev, info->resist_table = NULL; info->temp_dgrd_values = 0; info->temp_dgrd = NULL; + info->degrade_cycle_uah = 0; for (index = 0; index < POWER_SUPPLY_OCV_TEMP_MAX; index++) { info->ocv_table[index] = NULL; @@ -689,6 +690,8 @@ int power_supply_dev_get_battery_info(struct device *dev, dev_warn(dev, "%s unknown battery type\n", value); } + fwnode_property_read_u32(battery_node, "degrade-cycle-microamp-hours", + &info->degrade_cycle_uah); fwnode_property_read_u32(battery_node, "energy-full-design-microwatt-hours", &info->energy_full_design_uwh); fwnode_property_read_u32(battery_node, "charge-full-design-microamp-hours", diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index ef7db73a5bd1..c5118265b3ab 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h @@ -403,6 +403,7 @@ struct power_supply_battery_info { int resist_table_size; int temp_dgrd_values; struct power_supply_temp_degr *temp_dgrd; + int degrade_cycle_uah; }; extern struct atomic_notifier_head power_supply_notifier; -- 2.31.1 -- Matti Vaittinen, Linux device drivers ROHM Semiconductors, Finland SWDC Kiviharjunlenkki 1E 90220 OULU FINLAND ~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~ Simon says - in Latin please. ~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~ Thanks to Simon Glass for the translation =]
Attachment:
signature.asc
Description: PGP signature