[PATCH 2/2] power: supply: core: Add SiLION battery technology

Rakesh Kota posted 2 patches 1 week ago
[PATCH 2/2] power: supply: core: Add SiLION battery technology
Posted by Rakesh Kota 1 week ago
Add support for lithium-ion-silicon-anode (SiLION) battery technology
to enable proper identification of devices using this newer battery
chemistry. Without this change, such batteries would report as
unknown technology.

Introduce POWER_SUPPLY_TECHNOLOGY_SiLION and update technology
mappings across core, sysfs, and test interfaces.

Signed-off-by: Rakesh Kota <rakesh.kota@oss.qualcomm.com>
---
 Documentation/ABI/testing/sysfs-class-power | 2 +-
 drivers/power/supply/power_supply_core.c    | 2 ++
 drivers/power/supply/power_supply_sysfs.c   | 1 +
 drivers/power/supply/test_power.c           | 3 ++-
 include/linux/power_supply.h                | 1 +
 5 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/Documentation/ABI/testing/sysfs-class-power b/Documentation/ABI/testing/sysfs-class-power
index 4b21d5d2325136be65126d4d1d6e64608280fe44..1f42e6f138ea8ae0fe8c232c38d0ff6fb20180e7 100644
--- a/Documentation/ABI/testing/sysfs-class-power
+++ b/Documentation/ABI/testing/sysfs-class-power
@@ -525,7 +525,7 @@ Description:
 
 		Valid values:
 			      "Unknown", "NiMH", "Li-ion", "Li-poly", "LiFe",
-			      "NiCd", "LiMn"
+			      "NiCd", "LiMn", "Si-Li-ion"
 
 
 What:		/sys/class/power_supply/<supply_name>/voltage_avg,
diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
index 9a28381e2607d650fa9b719b683af375bb118fad..385ab8aa7e69f3f804e7ac0ee3782446f18e2c3f 100644
--- a/drivers/power/supply/power_supply_core.c
+++ b/drivers/power/supply/power_supply_core.c
@@ -677,6 +677,8 @@ int power_supply_get_battery_info(struct power_supply *psy,
 			info->technology = POWER_SUPPLY_TECHNOLOGY_LiFe;
 		else if (!strcmp("lithium-ion-manganese-oxide", value))
 			info->technology = POWER_SUPPLY_TECHNOLOGY_LiMn;
+		else if (!strcmp("lithium-ion-silicon-anode", value))
+			info->technology = POWER_SUPPLY_TECHNOLOGY_SiLION;
 		else
 			dev_warn(&psy->dev, "%s unknown battery type\n", value);
 	}
diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c
index 198405f7126f96a57a549cd1ecb9b71089b9c3d0..f2a5ec519b2ef60fb5ede101ca461d899218e186 100644
--- a/drivers/power/supply/power_supply_sysfs.c
+++ b/drivers/power/supply/power_supply_sysfs.c
@@ -122,6 +122,7 @@ static const char * const POWER_SUPPLY_TECHNOLOGY_TEXT[] = {
 	[POWER_SUPPLY_TECHNOLOGY_LiFe]		= "LiFe",
 	[POWER_SUPPLY_TECHNOLOGY_NiCd]		= "NiCd",
 	[POWER_SUPPLY_TECHNOLOGY_LiMn]		= "LiMn",
+	[POWER_SUPPLY_TECHNOLOGY_SiLION]	= "Si-Li-ion",
 };
 
 static const char * const POWER_SUPPLY_CAPACITY_LEVEL_TEXT[] = {
diff --git a/drivers/power/supply/test_power.c b/drivers/power/supply/test_power.c
index 2c0e9ad820c0db23165758303a16bddac1a1634b..64bd4a1147ca06566a909513a80760ad707a8605 100644
--- a/drivers/power/supply/test_power.c
+++ b/drivers/power/supply/test_power.c
@@ -437,6 +437,7 @@ static struct battery_property_map map_technology[] = {
 	{ POWER_SUPPLY_TECHNOLOGY_LiFe, "LiFe" },
 	{ POWER_SUPPLY_TECHNOLOGY_NiCd, "NiCd" },
 	{ POWER_SUPPLY_TECHNOLOGY_LiMn, "LiMn" },
+	{ POWER_SUPPLY_TECHNOLOGY_SiLION, "SiLION" },
 	{ -1,				NULL   },
 };
 
@@ -733,7 +734,7 @@ MODULE_PARM_DESC(battery_present,
 
 module_param(battery_technology, battery_technology, 0644);
 MODULE_PARM_DESC(battery_technology,
-	"battery technology <NiMH|LION|LIPO|LiFe|NiCd|LiMn>");
+	"battery technology <NiMH|LION|LIPO|LiFe|NiCd|LiMn|SiLION>");
 
 module_param(battery_health, battery_health, 0644);
 MODULE_PARM_DESC(battery_health,
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 360ffdf272dab86241f1aac4650d1a91a088a84b..04996037219d5a22d2b2a7f136e5d3565a4507ca 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -83,6 +83,7 @@ enum {
 	POWER_SUPPLY_TECHNOLOGY_LiFe,
 	POWER_SUPPLY_TECHNOLOGY_NiCd,
 	POWER_SUPPLY_TECHNOLOGY_LiMn,
+	POWER_SUPPLY_TECHNOLOGY_SiLION,
 };
 
 enum {

-- 
2.34.1