Skip to contentSkip to conversation

dt-bindings: convert extcon-usbc-cros-ec.txt extcon-usbc-cros-ec.yaml

PATCH Superseded Dafna Hirschfeld 3 participants 4 messages Feb 5, 2020 – Feb 7, 2020

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 dt-bindings: convert extcon-usbc-cros-ec.txt extcon-usbc-cros-ec.yaml

convert the binding file extcon-usbc-cros-ec.txt to yaml format
This was tested and verified on ARM with:
make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.yaml make dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.yaml

---
Changes since v1:
1 - changing the license to (GPL-2.0-only OR BSD-2-Clause)
2 - changing the maintainers
3 - changing the google,usb-port-id property to have minimum 0 and maximum 255

 .../bindings/extcon/extcon-usbc-cros-ec.txt   | 24 ----------
 .../bindings/extcon/extcon-usbc-cros-ec.yaml  | 45 +++++++++++++++++++
 2 files changed, 45 insertions(+), 24 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.txt
 create mode 100644 Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.yaml
Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.txt deleted +0 -24
deleted file mode 100644
index 8e8625c00dfa..000000000000
@@ -1,24 +0,0 @@
-ChromeOS EC USB Type-C cable and accessories detection
-
-On ChromeOS systems with USB Type C ports, the ChromeOS Embedded Controller is
-able to detect the state of external accessories such as display adapters
-or USB devices when said accessories are attached or detached.
-
-The node for this device must be under a cros-ec node like google,cros-ec-spi
-or google,cros-ec-i2c.
-
-Required properties:
-- compatible:		Should be "google,extcon-usbc-cros-ec".
-- google,usb-port-id:	Specifies the USB port ID to use.
-
-Example:
-	cros-ec@0 {
-		compatible = "google,cros-ec-i2c";
-
-		...
-
-		extcon {
-			compatible = "google,extcon-usbc-cros-ec";
-			google,usb-port-id = <0>;
-		};
-	}
Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.yaml new file +45 -0

45 lines not on this page · raw message

Signature · 1 line
2.17.1
#1 lore raw

Hi Dafna,

Quoted 84 lines · Dafna Hirschfeld

convert the binding file extcon-usbc-cros-ec.txt to yaml format
This was tested and verified on ARM with:
make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.yaml make dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.yaml

---
Changes since v1:
1 - changing the license to (GPL-2.0-only OR BSD-2-Clause)
2 - changing the maintainers
3 - changing the google,usb-port-id property to have minimum 0 and maximum 255

 .../bindings/extcon/extcon-usbc-cros-ec.txt   | 24 ----------
 .../bindings/extcon/extcon-usbc-cros-ec.yaml  | 45 +++++++++++++++++++
 2 files changed, 45 insertions(+), 24 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.txt
 create mode 100644 Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.yaml
Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.txt deleted +0 -24
deleted file mode 100644
index 8e8625c00dfa..000000000000
@@ -1,24 +0,0 @@
-ChromeOS EC USB Type-C cable and accessories detection
-
-On ChromeOS systems with USB Type C ports, the ChromeOS Embedded Controller is
-able to detect the state of external accessories such as display adapters
-or USB devices when said accessories are attached or detached.
-
-The node for this device must be under a cros-ec node like google,cros-ec-spi
-or google,cros-ec-i2c.
-
-Required properties:
-- compatible:		Should be "google,extcon-usbc-cros-ec".
-- google,usb-port-id:	Specifies the USB port ID to use.
-
-Example:
-	cros-ec@0 {
-		compatible = "google,cros-ec-i2c";
-
-		...
-
-		extcon {
-			compatible = "google,extcon-usbc-cros-ec";
-			google,usb-port-id = <0>;
-		};
-	}
Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.yaml new file +30 -0
new file mode 100644
index 000000000000..fd95e413d46f
@@ -0,0 +1,45 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/extcon/extcon-usbc-cros-ec.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ChromeOS EC USB Type-C cable and accessories detection
+
+maintainers:
+  - Benson Leung <[email protected]>
+  - Enric Balletbo i Serra <[email protected]>
+
+description: |
+  On ChromeOS systems with USB Type C ports, the ChromeOS Embedded Controller is
+  able to detect the state of external accessories such as display adapters
+  or USB devices when said accessories are attached or detached.
+  The node for this device must be under a cros-ec node like google,cros-ec-spi
+  or google,cros-ec-i2c.
+
+properties:
+  compatible:
+    const: google,extcon-usbc-cros-ec
+
+  google,usb-port-id:
+    allOf:
+      - $ref: /schemas/types.yaml#/definitions/uint32
+    description: the port id
+    minimum: 0
+    maximum: 255
+

Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.yaml line 40

Quoted 10 lines
Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.yaml new file +10 -0
+required:
+  - compatible
+  - google,usb-port-id
+
+additionalProperties: false
+
+examples:
+  - |
+    cros-ec@0 {
+        compatible = "google,cros-ec-i2c";

Now that you are here ... could you use compatible = "google,cros-ec-spi" here?

The reason is that the label above, cros-ec@0 is not really correct for an i2c device because after the @ you should put the address, cros-ec@1e will have more sense here. But cros-ec-i2c is rarely used, so I'd change the compatible to use "google,cros-ec-spi" and the entry "cros-ec@0" is fine.

Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.yaml line 44

Quoted 4 lines
Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.yaml new file +4 -0
+        extcon {
+            compatible = "google,extcon-usbc-cros-ec";
+            google,usb-port-id = <0>;
+        };

And maybe would be useful have a more complete example like this?

    cros-ec@0 {
        compatible = "google,cros-ec-spi";

	usbc_extcon0: extcon@0 {
		compatible = "google,extcon-usbc-cros-ec";
		google,usb-port-id = <0>;
	};


	usbc_extcon1: extcon@1 {
		compatible = "google,extcon-usbc-cros-ec";
		google,usb-port-id = <1>;
	};
    };
maintainer
#2 lore raw
Quoted 110 lines · Enric Balletbo i Serra

Hi Dafna,

Quoted 84 lines · Dafna Hirschfeld

convert the binding file extcon-usbc-cros-ec.txt to yaml format
This was tested and verified on ARM with:
make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.yaml make dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.yaml

---
Changes since v1:
1 - changing the license to (GPL-2.0-only OR BSD-2-Clause)
2 - changing the maintainers
3 - changing the google,usb-port-id property to have minimum 0 and maximum 255

 .../bindings/extcon/extcon-usbc-cros-ec.txt   | 24 ----------
 .../bindings/extcon/extcon-usbc-cros-ec.yaml  | 45 +++++++++++++++++++
 2 files changed, 45 insertions(+), 24 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.txt
 create mode 100644 Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.yaml
Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.txt deleted +0 -24
deleted file mode 100644
index 8e8625c00dfa..000000000000
@@ -1,24 +0,0 @@
-ChromeOS EC USB Type-C cable and accessories detection
-
-On ChromeOS systems with USB Type C ports, the ChromeOS Embedded Controller is
-able to detect the state of external accessories such as display adapters
-or USB devices when said accessories are attached or detached.
-
-The node for this device must be under a cros-ec node like google,cros-ec-spi
-or google,cros-ec-i2c.
-
-Required properties:
-- compatible:		Should be "google,extcon-usbc-cros-ec".
-- google,usb-port-id:	Specifies the USB port ID to use.
-
-Example:
-	cros-ec@0 {
-		compatible = "google,cros-ec-i2c";
-
-		...
-
-		extcon {
-			compatible = "google,extcon-usbc-cros-ec";
-			google,usb-port-id = <0>;
-		};
-	}
Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.yaml new file +30 -0
new file mode 100644
index 000000000000..fd95e413d46f
@@ -0,0 +1,45 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/extcon/extcon-usbc-cros-ec.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ChromeOS EC USB Type-C cable and accessories detection
+
+maintainers:
+  - Benson Leung <[email protected]>
+  - Enric Balletbo i Serra <[email protected]>
+
+description: |
+  On ChromeOS systems with USB Type C ports, the ChromeOS Embedded Controller is
+  able to detect the state of external accessories such as display adapters
+  or USB devices when said accessories are attached or detached.
+  The node for this device must be under a cros-ec node like google,cros-ec-spi
+  or google,cros-ec-i2c.
+
+properties:
+  compatible:
+    const: google,extcon-usbc-cros-ec
+
+  google,usb-port-id:
+    allOf:
+      - $ref: /schemas/types.yaml#/definitions/uint32
+    description: the port id
+    minimum: 0
+    maximum: 255
+

Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.yaml line 40

Quoted 10 lines
Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.yaml new file +10 -0
+required:
+  - compatible
+  - google,usb-port-id
+
+additionalProperties: false
+
+examples:
+  - |
+    cros-ec@0 {
+        compatible = "google,cros-ec-i2c";

Now that you are here ... could you use compatible = "google,cros-ec-spi" here?

The reason is that the label above, cros-ec@0 is not really correct for an i2c device because after the @ you should put the address, cros-ec@1e will have more sense here. But cros-ec-i2c is rarely used, so I'd change the compatible to use "google,cros-ec-spi" and the entry "cros-ec@0" is fine.

Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.yaml line 44

Quoted 4 lines
Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.yaml new file +4 -0
+        extcon {
+            compatible = "google,extcon-usbc-cros-ec";
+            google,usb-port-id = <0>;
+        };
Quoted 4 lines

And maybe would be useful have a more complete example like this?

    cros-ec@0 {
        compatible = "google,cros-ec-spi";

There should also be a 'spi' parent node and 'reg' here.

Quoted 2 lines
	usbc_extcon0: extcon@0 {

And no unit-address here as there's no 'reg'.

Quoted 10 lines
		compatible = "google,extcon-usbc-cros-ec";
		google,usb-port-id = <0>;
	};


	usbc_extcon1: extcon@1 {
		compatible = "google,extcon-usbc-cros-ec";
		google,usb-port-id = <1>;
	};
    };
#3 lore raw
Quoted 116 lines · Rob Herring
Quoted 110 lines · Enric Balletbo i Serra

Hi Dafna,

Quoted 84 lines · Dafna Hirschfeld

convert the binding file extcon-usbc-cros-ec.txt to yaml format
This was tested and verified on ARM with:
make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.yaml make dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.yaml

---
Changes since v1:
1 - changing the license to (GPL-2.0-only OR BSD-2-Clause)
2 - changing the maintainers
3 - changing the google,usb-port-id property to have minimum 0 and maximum 255

 .../bindings/extcon/extcon-usbc-cros-ec.txt   | 24 ----------
 .../bindings/extcon/extcon-usbc-cros-ec.yaml  | 45 +++++++++++++++++++
 2 files changed, 45 insertions(+), 24 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.txt
 create mode 100644 Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.yaml
Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.txt deleted +0 -24
deleted file mode 100644
index 8e8625c00dfa..000000000000
@@ -1,24 +0,0 @@
-ChromeOS EC USB Type-C cable and accessories detection
-
-On ChromeOS systems with USB Type C ports, the ChromeOS Embedded Controller is
-able to detect the state of external accessories such as display adapters
-or USB devices when said accessories are attached or detached.
-
-The node for this device must be under a cros-ec node like google,cros-ec-spi
-or google,cros-ec-i2c.
-
-Required properties:
-- compatible:		Should be "google,extcon-usbc-cros-ec".
-- google,usb-port-id:	Specifies the USB port ID to use.
-
-Example:
-	cros-ec@0 {
-		compatible = "google,cros-ec-i2c";
-
-		...
-
-		extcon {
-			compatible = "google,extcon-usbc-cros-ec";
-			google,usb-port-id = <0>;
-		};
-	}
Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.yaml new file +30 -0
new file mode 100644
index 000000000000..fd95e413d46f
@@ -0,0 +1,45 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/extcon/extcon-usbc-cros-ec.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ChromeOS EC USB Type-C cable and accessories detection
+
+maintainers:
+  - Benson Leung <[email protected]>
+  - Enric Balletbo i Serra <[email protected]>
+
+description: |
+  On ChromeOS systems with USB Type C ports, the ChromeOS Embedded Controller is
+  able to detect the state of external accessories such as display adapters
+  or USB devices when said accessories are attached or detached.
+  The node for this device must be under a cros-ec node like google,cros-ec-spi
+  or google,cros-ec-i2c.
+
+properties:
+  compatible:
+    const: google,extcon-usbc-cros-ec
+
+  google,usb-port-id:
+    allOf:
+      - $ref: /schemas/types.yaml#/definitions/uint32
+    description: the port id
+    minimum: 0
+    maximum: 255
+

Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.yaml line 40

Quoted 10 lines
Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.yaml new file +10 -0
+required:
+  - compatible
+  - google,usb-port-id
+
+additionalProperties: false
+
+examples:
+  - |
+    cros-ec@0 {
+        compatible = "google,cros-ec-i2c";

Now that you are here ... could you use compatible = "google,cros-ec-spi" here?

The reason is that the label above, cros-ec@0 is not really correct for an i2c device because after the @ you should put the address, cros-ec@1e will have more sense here. But cros-ec-i2c is rarely used, so I'd change the compatible to use "google,cros-ec-spi" and the entry "cros-ec@0" is fine.

Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.yaml line 44

Quoted 4 lines
Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.yaml new file +4 -0
+        extcon {
+            compatible = "google,extcon-usbc-cros-ec";
+            google,usb-port-id = <0>;
+        };
Quoted 4 lines

And maybe would be useful have a more complete example like this?

    cros-ec@0 {
        compatible = "google,cros-ec-spi";
Quoted 7 lines

There should also be a 'spi' parent node and 'reg' here.

Quoted 2 lines
	usbc_extcon0: extcon@0 {

And no unit-address here as there's no 'reg'.

Thanks for pointing all this, I'll fix current users of this binding, as they are wrong.

Thanks,
Enric

Quoted 10 lines
Quoted 10 lines
		compatible = "google,extcon-usbc-cros-ec";
		google,usb-port-id = <0>;
	};


	usbc_extcon1: extcon@1 {
		compatible = "google,extcon-usbc-cros-ec";
		google,usb-port-id = <1>;
	};
    };