Linux Power Management development
 help / color / mirror / Atom feed
* [PATCH] power: supply: sbs-battery: Add PbAc, NiZn, RAM, and ZnAr support
@ 2026-06-21 14:59 Boris Shtrasman
  2026-06-22 20:39 ` Sebastian Reichel
  0 siblings, 1 reply; 2+ messages in thread
From: Boris Shtrasman @ 2026-06-21 14:59 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: linux-pm, linux-kernel, 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)

Map the missing specification values to their respective core kernel
POWER_SUPPLY_TECHNOLOGY definitions.

Link: https://sbs-forum.org/specs/sbdat110.pdf
Signed-off-by: Boris Shtrasman <borissh1983@gmail.com>
---
 drivers/power/supply/sbs-battery.c | 8 ++++++++
 include/linux/power_supply.h       | 4 ++++
 2 files changed, 12 insertions(+)

diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c
index 43c48196c167..42a941e99155 100644
--- a/drivers/power/supply/sbs-battery.c
+++ b/drivers/power/supply/sbs-battery.c
@@ -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;
 
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 7a5e4c3242a0..034800cd21da 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -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 {
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] power: supply: sbs-battery: Add PbAc, NiZn, RAM, and ZnAr support
  2026-06-21 14:59 [PATCH] power: supply: sbs-battery: Add PbAc, NiZn, RAM, and ZnAr support Boris Shtrasman
@ 2026-06-22 20:39 ` Sebastian Reichel
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Reichel @ 2026-06-22 20:39 UTC (permalink / raw)
  To: Boris Shtrasman; +Cc: linux-pm, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2616 bytes --]

Hi,

On Sun, Jun 21, 2026 at 05:59:52PM +0300, Boris Shtrasman wrote:
> 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.
> 
> Link: https://sbs-forum.org/specs/sbdat110.pdf
> Signed-off-by: Boris Shtrasman <borissh1983@gmail.com>
> ---
>  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.

>  2 files changed, 12 insertions(+)
> 
> diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c
> index 43c48196c167..42a941e99155 100644
> --- a/drivers/power/supply/sbs-battery.c
> +++ b/drivers/power/supply/sbs-battery.c
> @@ -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;
>  
> diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
> index 7a5e4c3242a0..034800cd21da 100644
> --- a/include/linux/power_supply.h
> +++ b/include/linux/power_supply.h
> @@ -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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-22 20:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-21 14:59 [PATCH] power: supply: sbs-battery: Add PbAc, NiZn, RAM, and ZnAr support Boris Shtrasman
2026-06-22 20:39 ` Sebastian Reichel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox