power: supply: sbs-battery: Add PbAc, NiZn, RAM, and ZnAr support
PATCH 1/1 power: supply: sbs-battery: Add PbAc, NiZn, RAM, and ZnAr support
Add support for PbAc, NiZn, RAM, and ZnAr chemistries as defined in the Smart Battery Data Specification v1.1 (Section 5.1.30 DeviceChemistry).
Currently, the sbs-battery driver only handles LION, LiP, NiCd and NiMH. The Smart Battery specification defines 8 possible values:
- Lead Acid (PbAc)
- Lithium Ion (LION)
- Nickel Cadmium (NiCd)
- Nickel Metal Hydride (NiMH)
- Nickel Zinc (NiZn)
- Rechargeable Alkaline-Manganese (RAM)
- Zinc Air (ZnAr)
- Lithium Polymer (LiP)
Map the missing specification values to their respective core kernel POWER_SUPPLY_TECHNOLOGY definitions.
--- drivers/power/supply/sbs-battery.c | 8 ++++++++ include/linux/power_supply.h | 4 ++++ 2 files changed, 12 insertions(+)
drivers/power/supply/sbs-battery.c +8 -0
@@ -860,6 +860,14 @@ static int sbs_get_chemistry(struct sbs_info *chip, chip->technology = POWER_SUPPLY_TECHNOLOGY_NiCd; else if (!strncasecmp(chemistry, "NiMH", 4)) chip->technology = POWER_SUPPLY_TECHNOLOGY_NiMH; + else if (!strncasecmp(chemistry, "PbAc", 4)) + chip->technology = POWER_SUPPLY_TECHNOLOGY_PbAc; + else if (!strncasecmp(chemistry, "NiZn", 4)) + chip->technology = POWER_SUPPLY_TECHNOLOGY_NiZn; + else if (!strncasecmp(chemistry, "RAM", 3)) + chip->technology =POWER_SUPPLY_TECHNOLOGY_RAM ; + else if (!strncasecmp(chemistry, "ZnAr", 4)) + chip->technology = POWER_SUPPLY_TECHNOLOGY_ZnAr; else chip->technology = POWER_SUPPLY_TECHNOLOGY_UNKNOWN;
include/linux/power_supply.h +4 -0
@@ -83,6 +83,10 @@ enum { POWER_SUPPLY_TECHNOLOGY_LiFe, POWER_SUPPLY_TECHNOLOGY_NiCd, POWER_SUPPLY_TECHNOLOGY_LiMn, + POWER_SUPPLY_TECHNOLOGY_PbAc, + POWER_SUPPLY_TECHNOLOGY_NiZn, +POWER_SUPPLY_TECHNOLOGY_RAM , + POWER_SUPPLY_TECHNOLOGY_ZnAr, }; enum {
Signature · 1 line
2.47.3
Hi,
Quoted 14 lines · Boris Shtrasman
Add support for PbAc, NiZn, RAM, and ZnAr chemistries as defined in the Smart Battery Data Specification v1.1 (Section 5.1.30 DeviceChemistry).
Currently, the sbs-battery driver only handles LION, LiP, NiCd and NiMH. The Smart Battery specification defines 8 possible values:
- Lead Acid (PbAc)
- Lithium Ion (LION)
- Nickel Cadmium (NiCd)
- Nickel Metal Hydride (NiMH)
- Nickel Zinc (NiZn)
- Rechargeable Alkaline-Manganese (RAM)
- Zinc Air (ZnAr)
- Lithium Polymer (LiP)
Quoted 8 lines
Map the missing specification values to their respective core kernel
POWER_SUPPLY_TECHNOLOGYdefinitions.Signed-off-by Boris Shtrasman <[email protected]>--- drivers/power/supply/sbs-battery.c | 8 ++++++++ include/linux/power_supply.h | 4 ++++
This should be two patches, one for the power-supply core and one for the SBS battery driver.
Quoted 26 lines
2 files changed, 12 insertions(+)drivers/power/supply/sbs-battery.c +8
-0@@ -860,6 +860,14 @@ static int sbs_get_chemistry(struct sbs_info *chip, chip->technology = POWER_SUPPLY_TECHNOLOGY_NiCd; else if (!strncasecmp(chemistry, "NiMH", 4)) chip->technology = POWER_SUPPLY_TECHNOLOGY_NiMH; + else if (!strncasecmp(chemistry, "PbAc", 4)) + chip->technology = POWER_SUPPLY_TECHNOLOGY_PbAc; + else if (!strncasecmp(chemistry, "NiZn", 4)) + chip->technology = POWER_SUPPLY_TECHNOLOGY_NiZn; + else if (!strncasecmp(chemistry, "RAM", 3)) + chip->technology =POWER_SUPPLY_TECHNOLOGY_RAM ; + else if (!strncasecmp(chemistry, "ZnAr", 4)) + chip->technology = POWER_SUPPLY_TECHNOLOGY_ZnAr; else chip->technology = POWER_SUPPLY_TECHNOLOGY_UNKNOWN;include/linux/power_supply.h +0
-0
include/linux/power_supply.h enum { · line 90
Quoted 8 lines
include/linux/power_supply.h +4
-0@@ -83,6 +83,10 @@ enum { POWER_SUPPLY_TECHNOLOGY_LiFe, POWER_SUPPLY_TECHNOLOGY_NiCd, POWER_SUPPLY_TECHNOLOGY_LiMn, + POWER_SUPPLY_TECHNOLOGY_PbAc, + POWER_SUPPLY_TECHNOLOGY_NiZn, +POWER_SUPPLY_TECHNOLOGY_RAM , + POWER_SUPPLY_TECHNOLOGY_ZnAr, };
You need to update the ABI Documentation and the sysfs code to handle the new properties.
Greetings,
-- Sebastian
Hi.
Quoted 27 lines · On Monday, 22 June 2026 23:39:26 Israel Daylight Time Sebastian Reichel wrote:
Hi,
Quoted 24 lines · Boris Shtrasman
Add support for PbAc, NiZn, RAM, and ZnAr chemistries as defined in the Smart Battery Data Specification v1.1 (Section 5.1.30 DeviceChemistry).
2 files changed, 12 insertions(+)drivers/power/supply/sbs-battery.c +8
-0@@ -860,6 +860,14 @@ static int sbs_get_chemistry(struct sbs_info *chip, chip->technology = POWER_SUPPLY_TECHNOLOGY_NiCd; else if (!strncasecmp(chemistry, "NiMH", 4)) chip->technology = POWER_SUPPLY_TECHNOLOGY_NiMH; + else if (!strncasecmp(chemistry, "PbAc", 4)) + chip->technology = POWER_SUPPLY_TECHNOLOGY_PbAc; + else if (!strncasecmp(chemistry, "NiZn", 4)) + chip->technology = POWER_SUPPLY_TECHNOLOGY_NiZn; + else if (!strncasecmp(chemistry, "RAM", 3)) + chip->technology =POWER_SUPPLY_TECHNOLOGY_RAM ; + else if (!strncasecmp(chemistry, "ZnAr", 4)) + chip->technology = POWER_SUPPLY_TECHNOLOGY_ZnAr; else chip->technology = POWER_SUPPLY_TECHNOLOGY_UNKNOWN;
Quoted 17 lines
include/linux/power_supply.h enum { · line 90
Quoted 13 lines
include/linux/power_supply.h +4
-0@@ -83,6 +83,10 @@ enum { POWER_SUPPLY_TECHNOLOGY_LiFe, POWER_SUPPLY_TECHNOLOGY_NiCd, POWER_SUPPLY_TECHNOLOGY_LiMn, + POWER_SUPPLY_TECHNOLOGY_PbAc, + POWER_SUPPLY_TECHNOLOGY_NiZn, +POWER_SUPPLY_TECHNOLOGY_RAM , + POWER_SUPPLY_TECHNOLOGY_ZnAr, };You need to update the ABI Documentation and the sysfs code to handle the new properties.
I assume I should have two patches one that include ABI documentation,
sysfs , selftest and the power_supply.h while the other is only for the sbs-battery.
Or should it be three patches ,power_supply ,h + sysfs , documentation
and self test, and sbs-battery ?
Quoted 4 lines
Greetings,
-- Sebastian
Thank you .