PATCH v2 0/2] Power: supply: Add PbAc, NiZn, RAM, and ZnAr support
Subsystems (3)
These series adds 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 and documenation, declare these values into selftest.
In selftest LiMn is moved to the next line to comply with checkpatch warning after adding said types.
It is an update for
https://lore.kernel.org/linux-pm/ajmc_naB7zYv0SPY@venus.
--
Changes in V2:
1. Seperate into two patches.
2. Modify Documenation, self test and sysfs interface. self test is updated as the documeation is now mentioning them.
--
Boris Shtrasman (2):
power: supply: Add PbAc, NiZn, RAM, and ZnAr support
power: supply: sbs-battery: Add PbAc, NiZn, RAM, and ZnAr support
Documentation/ABI/testing/sysfs-class-power | 2 +- drivers/power/supply/power_supply_sysfs.c | 4 ++++ drivers/power/supply/sbs-battery.c | 8 ++++++++ include/linux/power_supply.h | 4 ++++ .../power_supply/test_power_supply_properties.sh | 3 ++- 5 files changed, 19 insertions(+), 2 deletions(-)
Signature · 1 line
2.47.3
PATCH v2 1/2 power: supply: Add PbAc, NiZn, RAM, and ZnAr support
Add four new members to the POWER_SUPPLY_TECHNOLOGY
enum and sysfs interface to represent the Smart Battery
Data Specification v1.1 (Section 5.1.30 DeviceChemistry) battery types:
- Lead Acid (PbAc)
- Nickel Zinc (NiZn)
- Rechargeable Alkaline-Manganese (RAM)
- Zinc Air (ZnAr)
Update documentation to express these types.
Update ABI testing for these types.
--- Documentation/ABI/testing/sysfs-class-power | 2 +- drivers/power/supply/power_supply_sysfs.c | 4 ++++ include/linux/power_supply.h | 4 ++++ .../selftests/power_supply/test_power_supply_properties.sh | 3 ++- 4 files changed, 11 insertions(+), 2 deletions(-)
Documentation/ABI/testing/sysfs-class-power +1 -1
@@ -525,7 +525,7 @@ Description: Valid values: "Unknown", "NiMH", "Li-ion", "Li-poly", "LiFe", - "NiCd", "LiMn" + "NiCd", "LiMn", "PbAc", "NiZn", "RAM", "ZnAr" What: /sys/class/power_supply/<supply_name>/voltage_avg,
drivers/power/supply/power_supply_sysfs.c +4 -0
@@ -124,6 +124,10 @@ 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_PbAc] = "PbAc", + [POWER_SUPPLY_TECHNOLOGY_NiZn] = "NiZn", + [POWER_SUPPLY_TECHNOLOGY_RAM] = "RAM", + [POWER_SUPPLY_TECHNOLOGY_ZnAr] = "ZnAr", };static const char *const POWER_SUPPLY_CAPACITY_LEVEL_TEXT [] = {
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 {
tools/testing/selftests/power_supply/test_power_supply_properties.sh +2 -1
@@ -74,7 +74,8 @@ for DEVNAME in $supplies; do test_sysfs_prop_optional model_name test_sysfs_prop_optional manufacturer test_sysfs_prop_optional serial_number - test_sysfs_prop_optional_list technology "Unknown","NiMH","Li-ion","Li-poly","LiFe","NiCd","LiMn" + test_sysfs_prop_optional_list technology "Unknown","NiMH","Li-ion","Li-poly","LiFe","NiCd"\ + ,"LiMn","PbAc","NiZn","RAM","ZnAr" test_sysfs_prop_optional cycle_count
Signature · 1 line
2.47.3
PATCH v2 2/2 power: supply: sbs-battery: Add PbAc, NiZn, RAM, and ZnAr support
In reply to Boris ShtrasmanAdd 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)
--- drivers/power/supply/sbs-battery.c | 8 ++++++++ 1 file changed, 8 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;
Signature · 1 line
2.47.3
Sebastian Reichel
AppliedQuoted 15 lines · Boris Shtrasman
These series adds 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 1 line
[...]
Applied, thanks!
[1/2] power: supply: Add PbAc, NiZn, RAM, and ZnAr support
commit: defb072f411c630337946f3babf1bf9b38b23a84
[2/2] power: supply: sbs-battery: Add PbAc, NiZn, RAM, and ZnAr support
commit: 751253c3c3a40c43de8014a9d81e9e9a9f7b1039Best regards,
Signature · 1 line
Sebastian Reichel <[email protected]>