Skip to contentSkip to conversation

power: supply: sysfs: Add manufacturing_date,first_usage_date

PATCH New shichunyong 1 participant 1 message Dec 19, 2024 Power supply

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 power: supply: sysfs: Add manufacturing_date,first_usage_date

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).

---
 drivers/power/supply/power_supply_sysfs.c | 3 +++
 include/linux/power_supply.h              | 3 +++
 2 files changed, 6 insertions(+)
drivers/power/supply/power_supply_sysfs.c +3 -0
index 571de43fcca9..0550073224f2 100644
@@ -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),
include/linux/power_supply.h +3 -0
index b98106e1a90f..c8d8a8bfbf9f 100644
@@ -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,
Signature · 1 line
2.17.1