power: supply: core: add manufacture date properties
authorSebastian Reichel <sebastian.reichel@collabora.com>
Wed, 13 May 2020 18:55:59 +0000 (20:55 +0200)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Thu, 28 May 2020 17:25:31 +0000 (19:25 +0200)
Some smart batteries store their manufacture date, which is
useful to identify the battery and/or to know about the cell
quality.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Documentation/ABI/testing/sysfs-class-power
drivers/power/supply/power_supply_sysfs.c
include/linux/power_supply.h

index 2f89655..e6d7348 100644 (file)
@@ -680,3 +680,31 @@ Description:
                Valid values:
                - 1: enabled
                - 0: disabled
+
+What:          /sys/class/power_supply/<supply_name>/manufacture_year
+Date:          January 2020
+Contact:       linux-pm@vger.kernel.org
+Description:
+               Reports the year (following Gregorian calendar) when the device has been
+               manufactured.
+
+               Access: Read
+               Valid values: Reported as integer
+
+What:          /sys/class/power_supply/<supply_name>/manufacture_month
+Date:          January 2020
+Contact:       linux-pm@vger.kernel.org
+Description:
+               Reports the month when the device has been manufactured.
+
+               Access: Read
+               Valid values: 1-12
+
+What:          /sys/class/power_supply/<supply_name>/manufacture_day
+Date:          January 2020
+Contact:       linux-pm@vger.kernel.org
+Description:
+               Reports the day of month when the device has been manufactured.
+
+               Access: Read
+               Valid values: 1-31
index e664774..78d5382 100644 (file)
@@ -198,6 +198,9 @@ static struct power_supply_attr power_supply_attrs[] = {
        POWER_SUPPLY_ATTR(PRECHARGE_CURRENT),
        POWER_SUPPLY_ATTR(CHARGE_TERM_CURRENT),
        POWER_SUPPLY_ATTR(CALIBRATE),
+       POWER_SUPPLY_ATTR(MANUFACTURE_YEAR),
+       POWER_SUPPLY_ATTR(MANUFACTURE_MONTH),
+       POWER_SUPPLY_ATTR(MANUFACTURE_DAY),
        /* Properties of type `const char *' */
        POWER_SUPPLY_ATTR(MODEL_NAME),
        POWER_SUPPLY_ATTR(MANUFACTURER),
index 453a85f..63ffe2a 100644 (file)
@@ -159,6 +159,9 @@ enum power_supply_property {
        POWER_SUPPLY_PROP_PRECHARGE_CURRENT,
        POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT,
        POWER_SUPPLY_PROP_CALIBRATE,
+       POWER_SUPPLY_PROP_MANUFACTURE_YEAR,
+       POWER_SUPPLY_PROP_MANUFACTURE_MONTH,
+       POWER_SUPPLY_PROP_MANUFACTURE_DAY,
        /* Properties of type `const char *' */
        POWER_SUPPLY_PROP_MODEL_NAME,
        POWER_SUPPLY_PROP_MANUFACTURER,