Skip to contentSkip to conversation

dt-bindings: power: Convert bq27xxx dt to yaml

PATCH Superseded Dan Murphy 3 participants 11 messages May 7, 2020 – May 11, 2020

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Dan Murphy

author
#0 lore raw

PATCH v2 1/1 dt-bindings: power: Convert bq27xxx dt to yaml

Convert the bq27xxx.txt to yaml format

CC Pali Rohár <[email protected]>
CC Andrew F. Davis <[email protected]>
---
 .../bindings/power/supply/bq27xxx.txt         | 56 ------------
 .../bindings/power/supply/bq27xxx.yaml        | 86 +++++++++++++++++++
 2 files changed, 86 insertions(+), 56 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/power/supply/bq27xxx.txt
 create mode 100644 Documentation/devicetree/bindings/power/supply/bq27xxx.yaml
Documentation/devicetree/bindings/power/supply/bq27xxx.txt deleted +0 -56
deleted file mode 100644
index 4fa8e08df2b6..000000000000
@@ -1,56 +0,0 @@
-TI BQ27XXX fuel gauge family
-
-Required properties:
-- compatible: contains one of the following:
- * "ti,bq27200" - BQ27200
- * "ti,bq27210" - BQ27210
- * "ti,bq27500" - deprecated, use revision specific property below
- * "ti,bq27510" - deprecated, use revision specific property below
- * "ti,bq27520" - deprecated, use revision specific property below
- * "ti,bq27500-1" - BQ27500/1
- * "ti,bq27510g1" - BQ27510-g1
- * "ti,bq27510g2" - BQ27510-g2
- * "ti,bq27510g3" - BQ27510-g3
- * "ti,bq27520g1" - BQ27520-g1
- * "ti,bq27520g2" - BQ27520-g2
- * "ti,bq27520g3" - BQ27520-g3
- * "ti,bq27520g4" - BQ27520-g4
- * "ti,bq27521" - BQ27521
- * "ti,bq27530" - BQ27530
- * "ti,bq27531" - BQ27531
- * "ti,bq27541" - BQ27541
- * "ti,bq27542" - BQ27542
- * "ti,bq27546" - BQ27546
- * "ti,bq27742" - BQ27742
- * "ti,bq27545" - BQ27545
- * "ti,bq27411" - BQ27411
- * "ti,bq27421" - BQ27421
- * "ti,bq27425" - BQ27425
- * "ti,bq27426" - BQ27426
- * "ti,bq27441" - BQ27441
- * "ti,bq27621" - BQ27621
-- reg: integer, I2C address of the fuel gauge.
-
-Optional properties:
-- monitored-battery: 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.txt
-
-Example:
-
-	bat: battery {
-		compatible = "simple-battery";
-		voltage-min-design-microvolt = <3200000>;
-		energy-full-design-microwatt-hours = <5290000>;
-		charge-full-design-microamp-hours = <1430000>;
-	};
-
-	bq27510g3: fuel-gauge@55 {
-		compatible = "ti,bq27510g3";
-		reg = <0x55>;
-		monitored-battery = <&bat>;
-	};
Documentation/devicetree/bindings/power/supply/bq27xxx.yaml new file +86 -0

86 lines not on this page · raw message

Signature · 1 line
2.25.1
#1 lore raw

Hi Dan,

Quoted 6 lines · Dan Murphy

Convert the bq27xxx.txt to yaml format

CC Pali Rohár <[email protected]>
CC Andrew F. Davis <[email protected]>

---

This needs is missing the power-supplies property. The N900 DT contains a bq27200 referencing the charger, so it should fail the DT check without the property being listed here.

Quoted 81 lines
 .../bindings/power/supply/bq27xxx.txt         | 56 ------------
 .../bindings/power/supply/bq27xxx.yaml        | 86 +++++++++++++++++++
 2 files changed, 86 insertions(+), 56 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/power/supply/bq27xxx.txt
 create mode 100644 Documentation/devicetree/bindings/power/supply/bq27xxx.yaml
Documentation/devicetree/bindings/power/supply/bq27xxx.txt deleted +0 -56
deleted file mode 100644
index 4fa8e08df2b6..000000000000
@@ -1,56 +0,0 @@
-TI BQ27XXX fuel gauge family
-
-Required properties:
-- compatible: contains one of the following:
- * "ti,bq27200" - BQ27200
- * "ti,bq27210" - BQ27210
- * "ti,bq27500" - deprecated, use revision specific property below
- * "ti,bq27510" - deprecated, use revision specific property below
- * "ti,bq27520" - deprecated, use revision specific property below
- * "ti,bq27500-1" - BQ27500/1
- * "ti,bq27510g1" - BQ27510-g1
- * "ti,bq27510g2" - BQ27510-g2
- * "ti,bq27510g3" - BQ27510-g3
- * "ti,bq27520g1" - BQ27520-g1
- * "ti,bq27520g2" - BQ27520-g2
- * "ti,bq27520g3" - BQ27520-g3
- * "ti,bq27520g4" - BQ27520-g4
- * "ti,bq27521" - BQ27521
- * "ti,bq27530" - BQ27530
- * "ti,bq27531" - BQ27531
- * "ti,bq27541" - BQ27541
- * "ti,bq27542" - BQ27542
- * "ti,bq27546" - BQ27546
- * "ti,bq27742" - BQ27742
- * "ti,bq27545" - BQ27545
- * "ti,bq27411" - BQ27411
- * "ti,bq27421" - BQ27421
- * "ti,bq27425" - BQ27425
- * "ti,bq27426" - BQ27426
- * "ti,bq27441" - BQ27441
- * "ti,bq27621" - BQ27621
-- reg: integer, I2C address of the fuel gauge.
-
-Optional properties:
-- monitored-battery: 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.txt
-
-Example:
-
-	bat: battery {
-		compatible = "simple-battery";
-		voltage-min-design-microvolt = <3200000>;
-		energy-full-design-microwatt-hours = <5290000>;
-		charge-full-design-microamp-hours = <1430000>;
-	};
-
-	bq27510g3: fuel-gauge@55 {
-		compatible = "ti,bq27510g3";
-		reg = <0x55>;
-		monitored-battery = <&bat>;
-	};
Documentation/devicetree/bindings/power/supply/bq27xxx.yaml new file +7 -0
new file mode 100644
index 000000000000..54f497c291f2
@@ -0,0 +1,86 @@
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2020 Texas Instruments Incorporated
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/bq27xxx.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+

Documentation/devicetree/bindings/power/supply/bq27xxx.yaml line 17

Quoted 10 lines
Documentation/devicetree/bindings/power/supply/bq27xxx.yaml new file +10 -0
+title: TI BQ27XXX fuel gauge family
+
+maintainers:
+  - Pali Rohár <[email protected]>
+  - Andrew F. Davis <[email protected]>
+  - Sebastian Reichel <[email protected]>
+
+description: |
+  Support various Texas Instruments fuel gauge devices that share similar
+  register maps and power supply properties

allOf:
- $ref: power-supply.yaml#

Documentation/devicetree/bindings/power/supply/bq27xxx.yaml line 26

Quoted 8 lines
Documentation/devicetree/bindings/power/supply/bq27xxx.yaml new file +8 -0
+properties:
+  compatible:
+    enum:
+      - ti,bq27200 - BQ27200
+      - ti,bq27210 - BQ27210
+      - ti,bq27500 - deprecated, use revision specific property below
+      - ti,bq27510 - deprecated, use revision specific property below
+      - ti,bq27520 - deprecated, use revision specific property below

There is a deprecated property ("deprecated: true"), but IDK how to apply it to specific compatible values. Maybe Rob can help out here. Otherwise it's not a blocker, since the conversion is still an improvement without having explicit deprecation marks :)

Quoted 26 lines
Documentation/devicetree/bindings/power/supply/bq27xxx.yaml new file +26 -0
+      - ti,bq27500-1 - BQ27500/1
+      - ti,bq27510g1 - BQ27510-g1
+      - ti,bq27510g2 - BQ27510-g2
+      - ti,bq27510g3 - BQ27510-g3
+      - ti,bq27520g1 - BQ27520-g1
+      - ti,bq27520g2 - BQ27520-g2
+      - ti,bq27520g3 - BQ27520-g3
+      - ti,bq27520g4 - BQ27520-g4
+      - ti,bq27521 - BQ27521
+      - ti,bq27530 - BQ27530
+      - ti,bq27531 - BQ27531
+      - ti,bq27541 - BQ27541
+      - ti,bq27542 - BQ27542
+      - ti,bq27546 - BQ27546
+      - ti,bq27742 - BQ27742
+      - ti,bq27545 - BQ27545
+      - ti,bq27411 - BQ27411
+      - ti,bq27421 - BQ27421
+      - ti,bq27425 - BQ27425
+      - ti,bq27426 - BQ27426
+      - ti,bq27441 - BQ27441
+      - ti,bq27621 - BQ27621
+
+  reg:
+    maxItems: 1
+    description: integer, I2C address of the fuel gauge.

Documentation/devicetree/bindings/power/supply/bq27xxx.yaml line 62

Quoted 10 lines
Documentation/devicetree/bindings/power/supply/bq27xxx.yaml new file +10 -0
+
+  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.txt

power-supplies: true

Quoted 14 lines
Documentation/devicetree/bindings/power/supply/bq27xxx.yaml new file +14 -0
+
+required:
+  - compatible
+  - reg
+additionalProperties: false
+
+examples:
+  - |
+    i2c0 {
+      #address-cells = <1>;
+      #size-cells = <0>;
+      bat: battery {
+        compatible = "simple-battery";
+        voltage-min-design-microvolt = <3200000>;

Documentation/devicetree/bindings/power/supply/bq27xxx.yaml line 86

Quoted 10 lines
Documentation/devicetree/bindings/power/supply/bq27xxx.yaml new file +10 -0
+        energy-full-design-microwatt-hours = <5290000>;
+        charge-full-design-microamp-hours = <1430000>;
+      };
+
+      bq27510g3: fuel-gauge@55 {
+        compatible = "ti,bq27510g3";
+        reg = <0x55>;
+        monitored-battery = <&bat>;
+      };
+    };

Otherwise looks good to me.

-- Sebastian

author
#2 lore raw

Sebastian

Quoted 5 lines · Sebastian Reichel

Hi Dan,

Quoted 2 lines · Dan Murphy

Convert the bq27xxx.txt to yaml format

Quoted 7 lines
Quoted 4 lines
CC Pali Rohár <[email protected]>
CC Andrew F. Davis <[email protected]>

---

This needs is missing the power-supplies property. The N900 DT contains a bq27200 referencing the charger, so it should fail the DT check without the property being listed here.

Hmm.  I ran the dt checker specifically on the binding and it did not fail.  Unless I need to build some other DTs as well.

Either I will have the power-supplies property

Quoted 86 lines
Quoted 86 lines
  .../bindings/power/supply/bq27xxx.txt         | 56 ------------
  .../bindings/power/supply/bq27xxx.yaml        | 86 +++++++++++++++++++
  2 files changed, 86 insertions(+), 56 deletions(-)

delete mode 100644 Documentation/devicetree/bindings/power/supply/bq27xxx.txt create mode 100644 Documentation/devicetree/bindings/power/supply/bq27xxx.yaml

Documentation/devicetree/bindings/power/supply/bq27xxx.txt deleted +0 -56
deleted file mode 100644
index 4fa8e08df2b6..000000000000
@@ -1,56 +0,0 @@
-TI BQ27XXX fuel gauge family
-
-Required properties:
-- compatible: contains one of the following:
- * "ti,bq27200" - BQ27200
- * "ti,bq27210" - BQ27210
- * "ti,bq27500" - deprecated, use revision specific property below
- * "ti,bq27510" - deprecated, use revision specific property below
- * "ti,bq27520" - deprecated, use revision specific property below
- * "ti,bq27500-1" - BQ27500/1
- * "ti,bq27510g1" - BQ27510-g1
- * "ti,bq27510g2" - BQ27510-g2
- * "ti,bq27510g3" - BQ27510-g3
- * "ti,bq27520g1" - BQ27520-g1
- * "ti,bq27520g2" - BQ27520-g2
- * "ti,bq27520g3" - BQ27520-g3
- * "ti,bq27520g4" - BQ27520-g4
- * "ti,bq27521" - BQ27521
- * "ti,bq27530" - BQ27530
- * "ti,bq27531" - BQ27531
- * "ti,bq27541" - BQ27541
- * "ti,bq27542" - BQ27542
- * "ti,bq27546" - BQ27546
- * "ti,bq27742" - BQ27742
- * "ti,bq27545" - BQ27545
- * "ti,bq27411" - BQ27411
- * "ti,bq27421" - BQ27421
- * "ti,bq27425" - BQ27425
- * "ti,bq27426" - BQ27426
- * "ti,bq27441" - BQ27441
- * "ti,bq27621" - BQ27621
-- reg: integer, I2C address of the fuel gauge.
-
-Optional properties:
-- monitored-battery: 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.txt
-
-Example:
-
-	bat: battery {
-		compatible = "simple-battery";
-		voltage-min-design-microvolt = <3200000>;
-		energy-full-design-microwatt-hours = <5290000>;
-		charge-full-design-microamp-hours = <1430000>;
-	};
-
-	bq27510g3: fuel-gauge@55 {
-		compatible = "ti,bq27510g3";
-		reg = <0x55>;
-		monitored-battery = <&bat>;
-	};
Documentation/devicetree/bindings/power/supply/bq27xxx.yaml new file +11 -0
new file mode 100644
index 000000000000..54f497c291f2
@@ -0,0 +1,86 @@
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2020 Texas Instruments Incorporated
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/bq27xxx.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: TI BQ27XXX fuel gauge family
+
+maintainers:
+  - Pali Rohár <[email protected]>
Quoted 8 lines

Documentation/devicetree/bindings/power/supply/bq27xxx.yaml line 17

Quoted 6 lines
Documentation/devicetree/bindings/power/supply/bq27xxx.yaml new file +6 -0
+  - Andrew F. Davis <[email protected]>
+  - Sebastian Reichel <[email protected]>
+
+description: |
+  Support various Texas Instruments fuel gauge devices that share similar
+  register maps and power supply properties

allOf:
- $ref: power-supply.yaml#

Ack

Quoted 9 lines

Documentation/devicetree/bindings/power/supply/bq27xxx.yaml line 26

Quoted 9 lines
Documentation/devicetree/bindings/power/supply/bq27xxx.yaml new file +8 -0
+properties:
+  compatible:
+    enum:
+      - ti,bq27200 - BQ27200
+      - ti,bq27210 - BQ27210
+      - ti,bq27500 - deprecated, use revision specific property below
+      - ti,bq27510 - deprecated, use revision specific property below
+      - ti,bq27520 - deprecated, use revision specific property below
Quoted 5 lines

There is a deprecated property ("deprecated: true"), but IDK how to apply it to specific compatible values. Maybe Rob can help out here. Otherwise it's not a blocker, since the conversion is still an improvement without having explicit deprecation marks :)

I would prefer to do this in separate patches.

The code still contains these deprecated values.

So technically we should remove them in this conversion from the binding, code and the 2 bindings that they are associated with.

These have been marked deprecated since 2017.

I know we are not supposed to remove items from the bindings so at the very least we should remove them from the code and update the devicetree files and as you said mark these as deprecated and removed in this conversion.

Quoted 29 lines
Quoted 29 lines
Documentation/devicetree/bindings/power/supply/bq27xxx.yaml new file +29 -0
+      - ti,bq27500-1 - BQ27500/1
+      - ti,bq27510g1 - BQ27510-g1
+      - ti,bq27510g2 - BQ27510-g2
+      - ti,bq27510g3 - BQ27510-g3
+      - ti,bq27520g1 - BQ27520-g1
+      - ti,bq27520g2 - BQ27520-g2
+      - ti,bq27520g3 - BQ27520-g3
+      - ti,bq27520g4 - BQ27520-g4
+      - ti,bq27521 - BQ27521
+      - ti,bq27530 - BQ27530
+      - ti,bq27531 - BQ27531
+      - ti,bq27541 - BQ27541
+      - ti,bq27542 - BQ27542
+      - ti,bq27546 - BQ27546
+      - ti,bq27742 - BQ27742
+      - ti,bq27545 - BQ27545
+      - ti,bq27411 - BQ27411
+      - ti,bq27421 - BQ27421
+      - ti,bq27425 - BQ27425
+      - ti,bq27426 - BQ27426
+      - ti,bq27441 - BQ27441
+      - ti,bq27621 - BQ27621
+
+  reg:
+    maxItems: 1
+    description: integer, I2C address of the fuel gauge.
+
+  monitored-battery:
+    description: |
Quoted 8 lines

Documentation/devicetree/bindings/power/supply/bq27xxx.yaml line 62

Quoted 7 lines
Documentation/devicetree/bindings/power/supply/bq27xxx.yaml new file +7 -0
+       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.txt

power-supplies: true

Ack

Quoted 18 lines
Quoted 18 lines
Documentation/devicetree/bindings/power/supply/bq27xxx.yaml new file +17 -0
+
+required:
+  - compatible
+  - reg
+additionalProperties: false
+
+examples:
+  - |
+    i2c0 {
+      #address-cells = <1>;
+      #size-cells = <0>;
+      bat: battery {
+        compatible = "simple-battery";
+        voltage-min-design-microvolt = <3200000>;
+        energy-full-design-microwatt-hours = <5290000>;
+        charge-full-design-microamp-hours = <1430000>;
+      };
Quoted 8 lines

Documentation/devicetree/bindings/power/supply/bq27xxx.yaml line 86

Quoted 7 lines
Documentation/devicetree/bindings/power/supply/bq27xxx.yaml new file +7 -0
+
+      bq27510g3: fuel-gauge@55 {
+        compatible = "ti,bq27510g3";
+        reg = <0x55>;
+        monitored-battery = <&bat>;
+      };
+    };

Otherwise looks good to me.

Ack

Dan

Quoted 2 lines

-- Sebastian

#3 lore raw

Hi,

Quoted 8 lines · Dan Murphy
Quoted 3 lines · Sebastian Reichel

This needs is missing the power-supplies property. The N900 DT contains a bq27200 referencing the charger, so it should fail the DT check without the property being listed here.

Hmm.  I ran the dt checker specifically on the binding and it did not fail. Unless I need to build some other DTs as well.
Either I will have the power-supplies property

I just tried it myself. The problem is the way you are specifying the compatible strings. This is the parsing result:

enum: ['ti,bq27200 - BQ27200', 'ti,bq27210 - BQ27210', 'ti,bq27500 - deprecated,
use revision specific property below', ...

You can see this in Documentation/devicetree/bindings/processed-schema.yaml, which is generated by running the check. The compatible comments need a # as separation character like this to generate proper bindings:

properties:
compatible:
enum:
- ti,bq27200 # BQ27200
- ti,bq27210 # BQ27210
- ti,bq27500 # deprecated, use revision specific property below

-- Sebastian

author
#4 lore raw

Sebastian

Quoted 20 lines · Sebastian Reichel

Hi,

Quoted 7 lines · Dan Murphy
Quoted 3 lines · Sebastian Reichel

This needs is missing the power-supplies property. The N900 DT contains a bq27200 referencing the charger, so it should fail the DT check without the property being listed here.

Hmm.  I ran the dt checker specifically on the binding and it did not fail. Unless I need to build some other DTs as well.
Either I will have the power-supplies property

I just tried it myself. The problem is the way you are specifying the compatible strings. This is the parsing result:

enum: ['ti,bq27200 - BQ27200', 'ti,bq27210 - BQ27210', 'ti,bq27500 - deprecated,
use revision specific property below', ...

You can see this in Documentation/devicetree/bindings/processed-schema.yaml, which is generated by running the check. The compatible comments need a # as separation character like this to generate proper bindings:

Quoted 6 lines

properties:
compatible:
enum:
- ti,bq27200 # BQ27200
- ti,bq27210 # BQ27210
- ti,bq27500 # deprecated, use revision specific property below

Well honestly not sure why we need the comment either.   These are pretty self explanatory maybe we should just remove the additional comments

Any consideration on just removing the deprecated values?

Dan

Quoted 2 lines

-- Sebastian

#5 lore raw

Hi,

Quoted 26 lines · Dan Murphy
Quoted 18 lines · Sebastian Reichel
Quoted 7 lines · Dan Murphy
Quoted 3 lines · Sebastian Reichel

This needs is missing the power-supplies property. The N900 DT contains a bq27200 referencing the charger, so it should fail the DT check without the property being listed here.

Hmm.  I ran the dt checker specifically on the binding and it did not fail. Unless I need to build some other DTs as well.
Either I will have the power-supplies property

I just tried it myself. The problem is the way you are specifying the compatible strings. This is the parsing result:

enum: ['ti,bq27200 - BQ27200', 'ti,bq27210 - BQ27210', 'ti,bq27500 - deprecated,
use revision specific property below', ...

You can see this in Documentation/devicetree/bindings/processed-schema.yaml, which is generated by running the check. The compatible comments need a # as separation character like this to generate proper bindings:

Quoted 6 lines

properties:
compatible:
enum:
- ti,bq27200 # BQ27200
- ti,bq27210 # BQ27210
- ti,bq27500 # deprecated, use revision specific property below

Quoted 2 lines

Well honestly not sure why we need the comment either. These are pretty self explanatory maybe we should just remove the additional comments

Fine with me.

Quoted 1 line

Any consideration on just removing the deprecated values?

Let's keep them with their comment for now. Removing them should start with marking them as depracated in the binding and generating a runtime warning in the driver, so that people become aware of the problem. At least for ti,bq27500 we have mainline users At least for ti,bq27500 we have mainline users.

-- Sebastian

author
#6 lore raw

Sebastian

Quoted 28 lines · Sebastian Reichel

Hi,

Quoted 25 lines · Dan Murphy
Quoted 24 lines · Sebastian Reichel
Quoted 7 lines · Dan Murphy
Quoted 3 lines · Sebastian Reichel

This needs is missing the power-supplies property. The N900 DT contains a bq27200 referencing the charger, so it should fail the DT check without the property being listed here.

Hmm.  I ran the dt checker specifically on the binding and it did not fail. Unless I need to build some other DTs as well.
Either I will have the power-supplies property

I just tried it myself. The problem is the way you are specifying the compatible strings. This is the parsing result:

enum: ['ti,bq27200 - BQ27200', 'ti,bq27210 - BQ27210', 'ti,bq27500 - deprecated,
use revision specific property below', ...

You can see this in Documentation/devicetree/bindings/processed-schema.yaml, which is generated by running the check. The compatible comments need a # as separation character like this to generate proper bindings:

properties:
compatible:
enum:
- ti,bq27200 # BQ27200
- ti,bq27210 # BQ27210
- ti,bq27500 # deprecated, use revision specific property below

Quoted 3 lines
Quoted 2 lines

Well honestly not sure why we need the comment either. These are pretty self explanatory maybe we should just remove the additional comments

Fine with me.

Ack

Quoted 7 lines
Quoted 2 lines

Any consideration on just removing the deprecated values?

Let's keep them with their comment for now. Removing them should start with marking them as depracated in the binding and generating a runtime warning in the driver, so that people become aware of the problem. At least for ti,bq27500 we have mainline users At least for ti,bq27500 we have mainline users.

There are only 2 dts files that have this reference unless we are not sure which device is actually in use.

Dan

Quoted 1 line

-- Sebastian

#7 lore raw

Hi,

Quoted 33 lines · Dan Murphy
Quoted 26 lines · Sebastian Reichel
Quoted 25 lines · Dan Murphy
Quoted 24 lines · Sebastian Reichel
Quoted 7 lines · Dan Murphy
Quoted 3 lines · Sebastian Reichel

This needs is missing the power-supplies property. The N900 DT contains a bq27200 referencing the charger, so it should fail the DT check without the property being listed here.

Hmm.  I ran the dt checker specifically on the binding and it did not fail. Unless I need to build some other DTs as well.
Either I will have the power-supplies property

I just tried it myself. The problem is the way you are specifying the compatible strings. This is the parsing result:

enum: ['ti,bq27200 - BQ27200', 'ti,bq27210 - BQ27210', 'ti,bq27500 - deprecated,
use revision specific property below', ...

You can see this in Documentation/devicetree/bindings/processed-schema.yaml, which is generated by running the check. The compatible comments need a # as separation character like this to generate proper bindings:

properties:
compatible:
enum:
- ti,bq27200 # BQ27200
- ti,bq27210 # BQ27210
- ti,bq27500 # deprecated, use revision specific property below

Quoted 3 lines
Quoted 2 lines

Well honestly not sure why we need the comment either. These are pretty self explanatory maybe we should just remove the additional comments

Fine with me.

Ack

Quoted 2 lines
Quoted 2 lines

Any consideration on just removing the deprecated values?

Quoted 8 lines
Quoted 5 lines

Let's keep them with their comment for now. Removing them should start with marking them as depracated in the binding and generating a runtime warning in the driver, so that people become aware of the problem. At least for ti,bq27500 we have mainline users At least for ti,bq27500 we have mainline users.

There are only 2 dts files that have this reference unless we are not sure which device is actually in use.

DT is considered ABI and one is supposed to be able to boot a new kernel with an old DT. It's not enough to just update the in-tree dts files. I suppose we can consider removing support for the old compatible values after having the warning being printed for some time and the mainline users being converted to the new binding.

-- Sebastian

author
#8 lore raw

Sebastian

Quoted 40 lines · Sebastian Reichel

Hi,

Quoted 37 lines · Dan Murphy
Quoted 26 lines · Sebastian Reichel
Quoted 25 lines · Dan Murphy
Quoted 24 lines · Sebastian Reichel
Quoted 7 lines · Dan Murphy
Quoted 3 lines · Sebastian Reichel

This needs is missing the power-supplies property. The N900 DT contains a bq27200 referencing the charger, so it should fail the DT check without the property being listed here.

Hmm.  I ran the dt checker specifically on the binding and it did not fail. Unless I need to build some other DTs as well.
Either I will have the power-supplies property

I just tried it myself. The problem is the way you are specifying the compatible strings. This is the parsing result:

enum: ['ti,bq27200 - BQ27200', 'ti,bq27210 - BQ27210', 'ti,bq27500 - deprecated,
use revision specific property below', ...

You can see this in Documentation/devicetree/bindings/processed-schema.yaml, which is generated by running the check. The compatible comments need a # as separation character like this to generate proper bindings:

properties:
compatible:
enum:
- ti,bq27200 # BQ27200
- ti,bq27210 # BQ27210
- ti,bq27500 # deprecated, use revision specific property below

Quoted 3 lines
Quoted 2 lines

Well honestly not sure why we need the comment either. These are pretty self explanatory maybe we should just remove the additional comments

Fine with me.

Ack

Quoted 6 lines
Quoted 1 line

Any consideration on just removing the deprecated values?

Let's keep them with their comment for now. Removing them should start with marking them as depracated in the binding and generating a runtime warning in the driver, so that people become aware of the problem. At least for ti,bq27500 we have mainline users At least for ti,bq27500 we have mainline users.

Quoted 7 lines
Quoted 2 lines

There are only 2 dts files that have this reference unless we are not sure which device is actually in use.

DT is considered ABI and one is supposed to be able to boot a new kernel with an old DT. It's not enough to just update the in-tree dts files. I suppose we can consider removing support for the old compatible values after having the warning being printed for some time and the mainline users being converted to the new binding.

Yes I know. I may have said that before.

After looking at the driver and how this is all stitched together I think I am just going to stick to the DT conversion as is.

I will make the basic changes for conversion but any changes to the compatibles should be done later.

Dan

Quoted 1 line

-- Sebastian

#9 lore raw
In reply to Dan Murphy
Quoted 18 lines · Dan Murphy

Convert the bq27xxx.txt to yaml format

CC Pali Rohár <[email protected]>
CC Andrew F. Davis <[email protected]>
---
 .../bindings/power/supply/bq27xxx.txt         | 56 ------------
 .../bindings/power/supply/bq27xxx.yaml        | 86 +++++++++++++++++++
 2 files changed, 86 insertions(+), 56 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/power/supply/bq27xxx.txt
 create mode 100644 Documentation/devicetree/bindings/power/supply/bq27xxx.yaml
Documentation/devicetree/bindings/power/supply/bq27xxx.txt deleted +0 -0
deleted file mode 100644
index 4fa8e08df2b6..000000000000

Documentation/devicetree/bindings/power/supply/bq27xxx.txt line 10

Quoted 10 lines
Documentation/devicetree/bindings/power/supply/bq27xxx.txt deleted +0 -10
@@ -1,56 +0,0 @@
-TI BQ27XXX fuel gauge family
-
-Required properties:
-- compatible: contains one of the following:
- * "ti,bq27200" - BQ27200
- * "ti,bq27210" - BQ27210
- * "ti,bq27500" - deprecated, use revision specific property below
- * "ti,bq27510" - deprecated, use revision specific property below
- * "ti,bq27520" - deprecated, use revision specific property below
- * "ti,bq27500-1" - BQ27500/1

This doesn't look right, these are two parts, we should be specific in DT, so:

ti,bq27500
ti,bq27501

should be separate like that.

Andrew

Quoted 139 lines
Documentation/devicetree/bindings/power/supply/bq27xxx.txt deleted +0 -46
- * "ti,bq27510g1" - BQ27510-g1
- * "ti,bq27510g2" - BQ27510-g2
- * "ti,bq27510g3" - BQ27510-g3
- * "ti,bq27520g1" - BQ27520-g1
- * "ti,bq27520g2" - BQ27520-g2
- * "ti,bq27520g3" - BQ27520-g3
- * "ti,bq27520g4" - BQ27520-g4
- * "ti,bq27521" - BQ27521
- * "ti,bq27530" - BQ27530
- * "ti,bq27531" - BQ27531
- * "ti,bq27541" - BQ27541
- * "ti,bq27542" - BQ27542
- * "ti,bq27546" - BQ27546
- * "ti,bq27742" - BQ27742
- * "ti,bq27545" - BQ27545
- * "ti,bq27411" - BQ27411
- * "ti,bq27421" - BQ27421
- * "ti,bq27425" - BQ27425
- * "ti,bq27426" - BQ27426
- * "ti,bq27441" - BQ27441
- * "ti,bq27621" - BQ27621
-- reg: integer, I2C address of the fuel gauge.
-
-Optional properties:
-- monitored-battery: 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.txt
-
-Example:
-
-	bat: battery {
-		compatible = "simple-battery";
-		voltage-min-design-microvolt = <3200000>;
-		energy-full-design-microwatt-hours = <5290000>;
-		charge-full-design-microamp-hours = <1430000>;
-	};
-
-	bq27510g3: fuel-gauge@55 {
-		compatible = "ti,bq27510g3";
-		reg = <0x55>;
-		monitored-battery = <&bat>;
-	};
Documentation/devicetree/bindings/power/supply/bq27xxx.yaml new file +86 -0
new file mode 100644
index 000000000000..54f497c291f2
@@ -0,0 +1,86 @@
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2020 Texas Instruments Incorporated
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/power/supply/bq27xxx.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: TI BQ27XXX fuel gauge family
+
+maintainers:
+  - Pali Rohár <[email protected]>
+  - Andrew F. Davis <[email protected]>
+  - Sebastian Reichel <[email protected]>
+
+description: |
+  Support various Texas Instruments fuel gauge devices that share similar
+  register maps and power supply properties
+
+properties:
+  compatible:
+    enum:
+      - ti,bq27200 - BQ27200
+      - ti,bq27210 - BQ27210
+      - ti,bq27500 - deprecated, use revision specific property below
+      - ti,bq27510 - deprecated, use revision specific property below
+      - ti,bq27520 - deprecated, use revision specific property below
+      - ti,bq27500-1 - BQ27500/1
+      - ti,bq27510g1 - BQ27510-g1
+      - ti,bq27510g2 - BQ27510-g2
+      - ti,bq27510g3 - BQ27510-g3
+      - ti,bq27520g1 - BQ27520-g1
+      - ti,bq27520g2 - BQ27520-g2
+      - ti,bq27520g3 - BQ27520-g3
+      - ti,bq27520g4 - BQ27520-g4
+      - ti,bq27521 - BQ27521
+      - ti,bq27530 - BQ27530
+      - ti,bq27531 - BQ27531
+      - ti,bq27541 - BQ27541
+      - ti,bq27542 - BQ27542
+      - ti,bq27546 - BQ27546
+      - ti,bq27742 - BQ27742
+      - ti,bq27545 - BQ27545
+      - ti,bq27411 - BQ27411
+      - ti,bq27421 - BQ27421
+      - ti,bq27425 - BQ27425
+      - ti,bq27426 - BQ27426
+      - ti,bq27441 - BQ27441
+      - ti,bq27621 - BQ27621
+
+  reg:
+    maxItems: 1
+    description: integer, I2C address of the fuel gauge.
+
+  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.txt
+
+required:
+  - compatible
+  - reg
+additionalProperties: false
+
+examples:
+  - |
+    i2c0 {
+      #address-cells = <1>;
+      #size-cells = <0>;
+      bat: battery {
+        compatible = "simple-battery";
+        voltage-min-design-microvolt = <3200000>;
+        energy-full-design-microwatt-hours = <5290000>;
+        charge-full-design-microamp-hours = <1430000>;
+      };
+
+      bq27510g3: fuel-gauge@55 {
+        compatible = "ti,bq27510g3";
+        reg = <0x55>;
+        monitored-battery = <&bat>;
+      };
+    };
author
#10 lore raw

Andrew

Quoted 33 lines · Andrew F. Davis
Quoted 18 lines · Dan Murphy

Convert the bq27xxx.txt to yaml format

CC Pali Rohár <[email protected]>
CC Andrew F. Davis <[email protected]>
---
  .../bindings/power/supply/bq27xxx.txt         | 56 ------------
  .../bindings/power/supply/bq27xxx.yaml        | 86 +++++++++++++++++++
  2 files changed, 86 insertions(+), 56 deletions(-)

delete mode 100644 Documentation/devicetree/bindings/power/supply/bq27xxx.txt create mode 100644 Documentation/devicetree/bindings/power/supply/bq27xxx.yaml

Documentation/devicetree/bindings/power/supply/bq27xxx.txt deleted +0 -0
deleted file mode 100644
index 4fa8e08df2b6..000000000000

Documentation/devicetree/bindings/power/supply/bq27xxx.txt line 10

Quoted 10 lines
Documentation/devicetree/bindings/power/supply/bq27xxx.txt deleted +0 -10
@@ -1,56 +0,0 @@
-TI BQ27XXX fuel gauge family
-
-Required properties:
-- compatible: contains one of the following:
- * "ti,bq27200" - BQ27200
- * "ti,bq27210" - BQ27210
- * "ti,bq27500" - deprecated, use revision specific property below
- * "ti,bq27510" - deprecated, use revision specific property below
- * "ti,bq27520" - deprecated, use revision specific property below
- * "ti,bq27500-1" - BQ27500/1

This doesn't look right, these are two parts, we should be specific in DT, so:

Quoted 4 lines

ti,bq27500
ti,bq27501

should be separate like that.

I agree if they are 2 different parts but the code has

    { .compatible = "ti,bq27500-1" },

But it has no consumers.

So the ti,bq27500-1 compatible should be deprecated and ti,bq27501  should be added and the ti,bq27500 should be reinstated.

Dan