@@ -516,6 +516,57 @@ Description:
Integer > 0: representing full cycles
Integer = 0: cycle_count info is not available
+What: /sys/class/power_supply/<supply_name>/number_of_serial_cells
+Date: April 2024
+Contact: linux-pm@vger.kernel.org
+Description:
+ If the energy storage is composed of multiple cells in series,
+ this provides the number of stacked cells. Parallel cells aren't
+ considered here.
+
+ Access: Read
+
+ Valid values:
+ Integer > 0: number of cells
+ Integer = 0: info is not available
+
+What: /sys/class/power_supply/<supply_name>/cell1_voltage_now
+Date: April 2024
+Contact: linux-pm@vger.kernel.org
+Description:
+ Reports an instant, single cell voltage reading. The voltage is
+ measured across the cell. The battery reports voltages for up to
+ 'number_of_serial_cells' cells, in cell2_voltage_now and so on.
+
+ Access: Read
+
+ Valid values: Represented in microvolts
+
+What: /sys/class/power_supply/<supply_name>/cell_voltage_max
+Date: April 2024
+Contact: linux-pm@vger.kernel.org
+Description:
+ Maximum allowed voltage for a single cell. This value is shared
+ across all cells in the range 1 to 'number_of_serial_cells'.
+ Typically used to trigger an alert for userspace.
+
+ Access: Read, Write
+
+ Valid values: Represented in microvolts
+
+What: /sys/class/power_supply/<supply_name>/cell_voltage_min
+Date: April 2024
+Contact: linux-pm@vger.kernel.org
+Description:
+ Minimum allowed voltage for a single cell. This value is shared
+ across all cells in the range 1 to 'number_of_serial_cells'.
+ Typically used to trigger an alert for userspace.
+
+ Access: Read, Write
+
+ Valid values: Represented in microvolts
+
+
**USB Properties**
What: /sys/class/power_supply/<supply_name>/input_current_limit
@@ -213,6 +213,13 @@ TIME_TO_FULL
seconds left for battery to be considered full
(i.e. while battery is charging)
+NUMBER_OF_SERIAL_CELLS
+ If the energy storage is composed of multiple cells in series, this provides
+ the number of stacked cells. Parallel cells aren't considered here.
+CELLn_VOLTAGE
+ voltage measured of the n-th cell in the stack
+CELL_VOLTAGE
+ single cell voltage when the cells share the same value (usually MIN or MAX)
Battery <-> external power supply interaction
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -218,6 +218,13 @@ static struct power_supply_attr power_supply_attrs[] = {
POWER_SUPPLY_ATTR(MANUFACTURE_YEAR),
POWER_SUPPLY_ATTR(MANUFACTURE_MONTH),
POWER_SUPPLY_ATTR(MANUFACTURE_DAY),
+ POWER_SUPPLY_ATTR(NUMBER_OF_SERIAL_CELLS),
+ POWER_SUPPLY_ATTR(CELL1_VOLTAGE_NOW),
+ POWER_SUPPLY_ATTR(CELL2_VOLTAGE_NOW),
+ POWER_SUPPLY_ATTR(CELL3_VOLTAGE_NOW),
+ POWER_SUPPLY_ATTR(CELL4_VOLTAGE_NOW),
+ POWER_SUPPLY_ATTR(CELL_VOLTAGE_MIN),
+ POWER_SUPPLY_ATTR(CELL_VOLTAGE_MAX),
/* Properties of type `const char *' */
POWER_SUPPLY_ATTR(MODEL_NAME),
POWER_SUPPLY_ATTR(MANUFACTURER),
@@ -171,6 +171,13 @@ enum power_supply_property {
POWER_SUPPLY_PROP_MANUFACTURE_YEAR,
POWER_SUPPLY_PROP_MANUFACTURE_MONTH,
POWER_SUPPLY_PROP_MANUFACTURE_DAY,
+ POWER_SUPPLY_PROP_NUMBER_OF_SERIAL_CELLS,
+ POWER_SUPPLY_PROP_CELL1_VOLTAGE_NOW,
+ POWER_SUPPLY_PROP_CELL2_VOLTAGE_NOW,
+ POWER_SUPPLY_PROP_CELL3_VOLTAGE_NOW,
+ POWER_SUPPLY_PROP_CELL4_VOLTAGE_NOW,
+ POWER_SUPPLY_PROP_CELL_VOLTAGE_MIN,
+ POWER_SUPPLY_PROP_CELL_VOLTAGE_MAX,
/* Properties of type `const char *' */
POWER_SUPPLY_PROP_MODEL_NAME,
POWER_SUPPLY_PROP_MANUFACTURER,
For multi-cell chargers (or stacks of capacitors), allow to report the number of cells in series and the voltage of each cell. Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl> --- (no changes since v1) Documentation/ABI/testing/sysfs-class-power | 51 +++++++++++++++++++++ Documentation/power/power_supply_class.rst | 7 +++ drivers/power/supply/power_supply_sysfs.c | 7 +++ include/linux/power_supply.h | 7 +++ 4 files changed, 72 insertions(+)