Skip to content

Commit feabe49

Browse files
committed
power: supply: core: add manufacture date properties
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 <[email protected]>
1 parent bac705a commit feabe49

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

Documentation/ABI/testing/sysfs-class-power

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,3 +680,31 @@ Description:
680680
Valid values:
681681
- 1: enabled
682682
- 0: disabled
683+
684+
What: /sys/class/power_supply/<supply_name>/manufacture_year
685+
Date: January 2020
686+
687+
Description:
688+
Reports the year (following Gregorian calendar) when the device has been
689+
manufactured.
690+
691+
Access: Read
692+
Valid values: Reported as integer
693+
694+
What: /sys/class/power_supply/<supply_name>/manufacture_month
695+
Date: January 2020
696+
697+
Description:
698+
Reports the month when the device has been manufactured.
699+
700+
Access: Read
701+
Valid values: 1-12
702+
703+
What: /sys/class/power_supply/<supply_name>/manufacture_day
704+
Date: January 2020
705+
706+
Description:
707+
Reports the day of month when the device has been manufactured.
708+
709+
Access: Read
710+
Valid values: 1-31

drivers/power/supply/power_supply_sysfs.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,9 @@ static struct power_supply_attr power_supply_attrs[] = {
198198
POWER_SUPPLY_ATTR(PRECHARGE_CURRENT),
199199
POWER_SUPPLY_ATTR(CHARGE_TERM_CURRENT),
200200
POWER_SUPPLY_ATTR(CALIBRATE),
201+
POWER_SUPPLY_ATTR(MANUFACTURE_YEAR),
202+
POWER_SUPPLY_ATTR(MANUFACTURE_MONTH),
203+
POWER_SUPPLY_ATTR(MANUFACTURE_DAY),
201204
/* Properties of type `const char *' */
202205
POWER_SUPPLY_ATTR(MODEL_NAME),
203206
POWER_SUPPLY_ATTR(MANUFACTURER),

include/linux/power_supply.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ enum power_supply_property {
159159
POWER_SUPPLY_PROP_PRECHARGE_CURRENT,
160160
POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT,
161161
POWER_SUPPLY_PROP_CALIBRATE,
162+
POWER_SUPPLY_PROP_MANUFACTURE_YEAR,
163+
POWER_SUPPLY_PROP_MANUFACTURE_MONTH,
164+
POWER_SUPPLY_PROP_MANUFACTURE_DAY,
162165
/* Properties of type `const char *' */
163166
POWER_SUPPLY_PROP_MODEL_NAME,
164167
POWER_SUPPLY_PROP_MANUFACTURER,

0 commit comments

Comments
 (0)