diff mbox series

power: supply: sysfs: Add manufacturing_date,first_usage_date

Message ID f9250641f7674ee59276539253363d4a@honor.com
State New
Headers show
Series power: supply: sysfs: Add manufacturing_date,first_usage_date | expand

Commit Message

shichunyong Dec. 19, 2024, 9:51 a.m. UTC
manufacturing_date/first_usage_date/state_of_health are the battery data
required by EU regulations that are accessible for end-users.

manufacturing_date is the date of manufacturing of the battery.
first_usage_date is the date of first use of the battery
after the set-up of the device by the first user.
Both dates are the seconds since the epoch (1970-01-01 UTC).
state_of_health(SoH) is a figure of merit of the condition of a battery,
compared to its ideal conditions. The unit of SoH is percent
(100% = the battery's conditions match the battery's specifications).

Signed-off-by: ShiChunyong <shichunyong@honor.com>
---
 drivers/power/supply/power_supply_sysfs.c | 3 +++
 include/linux/power_supply.h              | 3 +++
 2 files changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c
index 571de43fcca9..0550073224f2 100644
--- a/drivers/power/supply/power_supply_sysfs.c
+++ b/drivers/power/supply/power_supply_sysfs.c
@@ -217,6 +217,9 @@  static struct power_supply_attr power_supply_attrs[] __ro_after_init = {
 	POWER_SUPPLY_ATTR(MANUFACTURE_YEAR),
 	POWER_SUPPLY_ATTR(MANUFACTURE_MONTH),
 	POWER_SUPPLY_ATTR(MANUFACTURE_DAY),
+	POWER_SUPPLY_ATTR(MANUFACTURING_DATE),
+	POWER_SUPPLY_ATTR(FIRST_USAGE_DATE),
+	POWER_SUPPLY_ATTR(STATE_OF_HEALTH),
 	/* Properties of type `const char *' */
 	POWER_SUPPLY_ATTR(MODEL_NAME),
 	POWER_SUPPLY_ATTR(MANUFACTURER),
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index b98106e1a90f..c8d8a8bfbf9f 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -170,6 +170,9 @@  enum power_supply_property {
 	POWER_SUPPLY_PROP_MANUFACTURE_YEAR,
 	POWER_SUPPLY_PROP_MANUFACTURE_MONTH,
 	POWER_SUPPLY_PROP_MANUFACTURE_DAY,
+	POWER_SUPPLY_PROP_MANUFACTURING_DATE,
+	POWER_SUPPLY_PROP_FIRST_USAGE_DATE,
+	POWER_SUPPLY_PROP_STATE_OF_HEALTH,
 	/* Properties of type `const char *' */
 	POWER_SUPPLY_PROP_MODEL_NAME,
 	POWER_SUPPLY_PROP_MANUFACTURER,