lkml.org 
[lkml]   [2020]   [Jun]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/2] power: supply: Add new power supply prop for date of manufacture
Date
The Smart Battery Specification v1.1 defines Manufacture Date as one of
its availabe registers. This patch adds this as a property so that
power_supply drivers can support the property and report it in syfs.

Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Change-Id: I90bf8c67b0cd531f2155404424a98302a1c931d6
---
drivers/power/supply/power_supply_sysfs.c | 3 ++-
include/linux/power_supply.h | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c
index f37ad4eae60b9..ac6d9992a8675 100644
--- a/drivers/power/supply/power_supply_sysfs.c
+++ b/drivers/power/supply/power_supply_sysfs.c
@@ -171,7 +171,7 @@ static ssize_t power_supply_show_property(struct device *dev,
ret = sprintf(buf, "%s\n",
power_supply_scope_text[value.intval]);
break;
- case POWER_SUPPLY_PROP_MODEL_NAME ... POWER_SUPPLY_PROP_SERIAL_NUMBER:
+ case POWER_SUPPLY_PROP_MODEL_NAME ... POWER_SUPPLY_PROP_MANUFACTURE_DATE:
ret = sprintf(buf, "%s\n", value.strval);
break;
default:
@@ -310,6 +310,7 @@ static struct device_attribute power_supply_attrs[] = {
POWER_SUPPLY_ATTR(model_name),
POWER_SUPPLY_ATTR(manufacturer),
POWER_SUPPLY_ATTR(serial_number),
+ POWER_SUPPLY_ATTR(manufacture_date),
};

static struct attribute *
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 28413f737e7d0..67839bb0a46b6 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -162,6 +162,7 @@ enum power_supply_property {
POWER_SUPPLY_PROP_MODEL_NAME,
POWER_SUPPLY_PROP_MANUFACTURER,
POWER_SUPPLY_PROP_SERIAL_NUMBER,
+ POWER_SUPPLY_PROP_MANUFACTURE_DATE,
};

enum power_supply_type {
--
2.26.2
\
 
 \ /
  Last update: 2020-06-09 21:23    [W:0.033 / U:0.448 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site