diff mbox series

[v2,1/3] dt-bindings: power: supply: define monitored-battery in common place

Message ID 20221102184501.109148-1-krzysztof.kozlowski@linaro.org (mailing list archive)
State Handled Elsewhere, archived
Headers show
Series [v2,1/3] dt-bindings: power: supply: define monitored-battery in common place | expand

Commit Message

Krzysztof Kozlowski Nov. 2, 2022, 6:44 p.m. UTC
Define the type of monitored-battery in power-supply.yaml common schema.
Reference the schema where applicable to enforce the above in bindings
which have monitored-battery property.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

---

Changes since v1:
1. Re-work the patch - define the type in power-supply.yaml.
---
 Documentation/devicetree/bindings/mfd/ene-kb930.yaml        | 6 +++---
 Documentation/devicetree/bindings/mfd/rockchip,rk817.yaml   | 2 ++
 Documentation/devicetree/bindings/power/supply/bq27xxx.yaml | 2 --
 .../devicetree/bindings/power/supply/ingenic,battery.yaml   | 4 ++--
 .../devicetree/bindings/power/supply/power-supply.yaml      | 6 ++++++
 .../devicetree/bindings/power/supply/rohm,bd99954.yaml      | 1 +
 .../devicetree/bindings/power/supply/sc2731-charger.yaml    | 1 -
 7 files changed, 14 insertions(+), 8 deletions(-)

Comments

Rob Herring (Arm) Nov. 4, 2022, 9:54 p.m. UTC | #1
On Wed, 02 Nov 2022 14:44:59 -0400, Krzysztof Kozlowski wrote:
> Define the type of monitored-battery in power-supply.yaml common schema.
> Reference the schema where applicable to enforce the above in bindings
> which have monitored-battery property.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> 
> ---
> 
> Changes since v1:
> 1. Re-work the patch - define the type in power-supply.yaml.
> ---
>  Documentation/devicetree/bindings/mfd/ene-kb930.yaml        | 6 +++---
>  Documentation/devicetree/bindings/mfd/rockchip,rk817.yaml   | 2 ++
>  Documentation/devicetree/bindings/power/supply/bq27xxx.yaml | 2 --
>  .../devicetree/bindings/power/supply/ingenic,battery.yaml   | 4 ++--
>  .../devicetree/bindings/power/supply/power-supply.yaml      | 6 ++++++
>  .../devicetree/bindings/power/supply/rohm,bd99954.yaml      | 1 +
>  .../devicetree/bindings/power/supply/sc2731-charger.yaml    | 1 -
>  7 files changed, 14 insertions(+), 8 deletions(-)
> 

Reviewed-by: Rob Herring <robh@kernel.org>
Sebastian Reichel Nov. 5, 2022, 8:20 p.m. UTC | #2
Hi,

On Fri, Nov 04, 2022 at 04:54:31PM -0500, Rob Herring wrote:
> On Wed, 02 Nov 2022 14:44:59 -0400, Krzysztof Kozlowski wrote:
> > Define the type of monitored-battery in power-supply.yaml common schema.
> > Reference the schema where applicable to enforce the above in bindings
> > which have monitored-battery property.
> > 
> > Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> > 
> > ---
> > 
> > Changes since v1:
> > 1. Re-work the patch - define the type in power-supply.yaml.
> > ---
> >  Documentation/devicetree/bindings/mfd/ene-kb930.yaml        | 6 +++---
> >  Documentation/devicetree/bindings/mfd/rockchip,rk817.yaml   | 2 ++
> >  Documentation/devicetree/bindings/power/supply/bq27xxx.yaml | 2 --
> >  .../devicetree/bindings/power/supply/ingenic,battery.yaml   | 4 ++--
> >  .../devicetree/bindings/power/supply/power-supply.yaml      | 6 ++++++
> >  .../devicetree/bindings/power/supply/rohm,bd99954.yaml      | 1 +
> >  .../devicetree/bindings/power/supply/sc2731-charger.yaml    | 1 -
> >  7 files changed, 14 insertions(+), 8 deletions(-)

Thanks, queued.

-- Sebastian
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/mfd/ene-kb930.yaml b/Documentation/devicetree/bindings/mfd/ene-kb930.yaml
index 06ed9ec8f4bb..7c0a42390f18 100644
--- a/Documentation/devicetree/bindings/mfd/ene-kb930.yaml
+++ b/Documentation/devicetree/bindings/mfd/ene-kb930.yaml
@@ -13,6 +13,8 @@  description: |
 maintainers:
   - Dmitry Osipenko <digetx@gmail.com>
 
+$ref: /schemas/power/supply/power-supply.yaml
+
 properties:
   compatible:
     items:
@@ -22,15 +24,13 @@  properties:
   reg:
     maxItems: 1
 
-  monitored-battery: true
-  power-supplies: true
   system-power-controller: true
 
 required:
   - compatible
   - reg
 
-additionalProperties: false
+unevaluatedProperties: false
 
 examples:
   - |
diff --git a/Documentation/devicetree/bindings/mfd/rockchip,rk817.yaml b/Documentation/devicetree/bindings/mfd/rockchip,rk817.yaml
index 935e17099213..269fb85b2027 100644
--- a/Documentation/devicetree/bindings/mfd/rockchip,rk817.yaml
+++ b/Documentation/devicetree/bindings/mfd/rockchip,rk817.yaml
@@ -124,6 +124,8 @@  properties:
       The child node for the charger to hold additional properties. If a
       battery is not in use, this node can be omitted.
     type: object
+    $ref: /schemas/power/supply/power-supply.yaml
+
     properties:
       monitored-battery:
         description: |
diff --git a/Documentation/devicetree/bindings/power/supply/bq27xxx.yaml b/Documentation/devicetree/bindings/power/supply/bq27xxx.yaml
index 65fc6049efc1..347d4433adc5 100644
--- a/Documentation/devicetree/bindings/power/supply/bq27xxx.yaml
+++ b/Documentation/devicetree/bindings/power/supply/bq27xxx.yaml
@@ -60,13 +60,11 @@  properties:
 
   monitored-battery:
     description: |
-       phandle of battery characteristics node.
        The fuel gauge uses the following battery properties:
        - energy-full-design-microwatt-hours
        - charge-full-design-microamp-hours
        - voltage-min-design-microvolt
        Both or neither of the *-full-design-*-hours properties must be set.
-       See Documentation/devicetree/bindings/power/supply/battery.yaml
 
   power-supplies: true
 
diff --git a/Documentation/devicetree/bindings/power/supply/ingenic,battery.yaml b/Documentation/devicetree/bindings/power/supply/ingenic,battery.yaml
index 46527038bf22..42fcfc026972 100644
--- a/Documentation/devicetree/bindings/power/supply/ingenic,battery.yaml
+++ b/Documentation/devicetree/bindings/power/supply/ingenic,battery.yaml
@@ -10,6 +10,8 @@  title: Ingenic JZ47xx battery bindings
 maintainers:
   - Artur Rojek <contact@artur-rojek.eu>
 
+$ref: power-supply.yaml#
+
 properties:
   compatible:
     oneOf:
@@ -28,8 +30,6 @@  properties:
 
   monitored-battery:
     description: >
-      phandle to a "simple-battery" compatible node.
-
       This property must be a phandle to a node using the format described
       in battery.yaml, with the following properties being required:
       - voltage-min-design-microvolt: drained battery voltage,
diff --git a/Documentation/devicetree/bindings/power/supply/power-supply.yaml b/Documentation/devicetree/bindings/power/supply/power-supply.yaml
index 2f672e6e8d72..4e54c937973e 100644
--- a/Documentation/devicetree/bindings/power/supply/power-supply.yaml
+++ b/Documentation/devicetree/bindings/power/supply/power-supply.yaml
@@ -18,4 +18,10 @@  properties:
       This property is added to a supply in order to list the devices which
       supply it power, referenced by their phandles.
 
+  monitored-battery:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      The battery (with "simple-battery" compatible) being monitored by this
+      power supply.
+
 additionalProperties: true
diff --git a/Documentation/devicetree/bindings/power/supply/rohm,bd99954.yaml b/Documentation/devicetree/bindings/power/supply/rohm,bd99954.yaml
index 24b06957b4ca..14d9b42eda27 100644
--- a/Documentation/devicetree/bindings/power/supply/rohm,bd99954.yaml
+++ b/Documentation/devicetree/bindings/power/supply/rohm,bd99954.yaml
@@ -18,6 +18,7 @@  description: |
   provides a Dual-source Battery Charger, two port BC1.2 detection and a
   Battery Monitor.
 
+$ref: power-supply.yaml#
 
 properties:
   compatible:
diff --git a/Documentation/devicetree/bindings/power/supply/sc2731-charger.yaml b/Documentation/devicetree/bindings/power/supply/sc2731-charger.yaml
index eeb043f9bb4f..735f7d372ae1 100644
--- a/Documentation/devicetree/bindings/power/supply/sc2731-charger.yaml
+++ b/Documentation/devicetree/bindings/power/supply/sc2731-charger.yaml
@@ -28,7 +28,6 @@  properties:
       The charger uses the following battery properties
       - charge-term-current-microamp: current for charge termination phase.
       - constant-charge-voltage-max-microvolt: maximum constant input voltage.
-      See Documentation/devicetree/bindings/power/supply/battery.yaml
 
 additionalProperties: false