[PATCH v2] dt-bindings: power: supply: battery: allow 101 ocv-capacity points

Ryan Brue posted 1 patch 9 hours ago
Documentation/devicetree/bindings/power/supply/battery.yaml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH v2] dt-bindings: power: supply: battery: allow 101 ocv-capacity points
Posted by Ryan Brue 9 hours ago
ocv-capacity-table-N is capped at 100 points, while the capacity percent
in each point may be anything from 0 to 100. A table with a point for
every percent, both ends included, needs 101 and does not fit. Raise the
cap to 101.

power_supply_get_battery_info() sizes each table from the property, so
no kernel change is needed.

Assisted-by: LLM
Signed-off-by: Ryan Brue <ryanbrue.dev@gmail.com>
---
As discussed with Henrik on v1: rather than a larger cap for one vendor's
tables, which fit in 100 points once resampled, allow the one extra point
that a table at every percent from 0 to 100 needs, and say so in the
binding.
---
Changes in v2:
- Raise the cap to 101 instead of 128, with a comment saying why (Henrik)
- Drop the justification from the vendor's tables; the figures in v1
  were for a different cell, and resampled tables fit in 100 points
- Rebase on v7.3-rc4
- Link to v1: https://patch.msgid.link/20260918-rbrue-suez-upstreaming-battery-ocv-table-128-v1-1-f477ef39ef0d@gmail.com
---
 Documentation/devicetree/bindings/power/supply/battery.yaml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/power/supply/battery.yaml b/Documentation/devicetree/bindings/power/supply/battery.yaml
index 8ebf05d9497c..9575ee1491bb 100644
--- a/Documentation/devicetree/bindings/power/supply/battery.yaml
+++ b/Documentation/devicetree/bindings/power/supply/battery.yaml
@@ -154,7 +154,8 @@ patternProperties:
       of the battery and corresponding battery capacity percent, which is used
       to look up battery capacity according to current OCV value. And the open
       circuit voltage unit is microvolt.
-    maxItems: 100
+    # One point for each capacity percent from 0 to 100
+    maxItems: 101
     items:
       items:
         - description: open circuit voltage (OCV) in microvolts

---
base-commit: 93f51579e7df248780214094418f205253383cc5
change-id: 20260917-rbrue-suez-upstreaming-battery-ocv-table-128-9ba83f9313bb

Best regards,
--  
Ryan Brue <ryanbrue.dev@gmail.com>