[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bb0b356c62c6f3460ce77b29ada02443c73c7545.1637061794.git.matti.vaittinen@fi.rohmeurope.com>
Date: Tue, 16 Nov 2021 14:27:07 +0200
From: Matti Vaittinen <matti.vaittinen@...rohmeurope.com>
To: Matti Vaittinen <mazziesaccount@...il.com>,
Matti Vaittinen <matti.vaittinen@...rohmeurope.com>
Cc: Sebastian Reichel <sre@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Matti Vaittinen <matti.vaittinen@...rohmeurope.com>,
Lee Jones <lee.jones@...aro.org>,
Linus Walleij <linus.walleij@...aro.org>, rostokus@...il.com,
fan.chen@...iatek.com, linux-pm@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-power@...rohmeurope.com
Subject: [RFC PATCH v3 5/9] power: supply: Add constant battery aging
degradation to batinfo
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@...rohmeurope.com>
---
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 =]
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists