diff mbox series

[38/54] dt-bindings: w1: Convert 1-Wire GPIO binding to a schema

Message ID 20210721140424.725744-39-maxime@cerno.tech
State Accepted
Commit dd2c898bc20bdb46ec59eefafc8fdd86a93b6b8c
Headers show
Series ARM: dts: Last round of DT schema fixes | expand

Commit Message

Maxime Ripard July 21, 2021, 2:04 p.m. UTC
Bitbanged 1-Wire buses are supported by Linux thanks to their device
tree binding.

Now that we have the DT validation in place, let's convert the device
tree bindings for that driver over to a YAML schema.

Cc: Daniel Mack <zonque@gmail.com>
Cc: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 .../devicetree/bindings/w1/w1-gpio.txt        | 27 ------------
 .../devicetree/bindings/w1/w1-gpio.yaml       | 43 +++++++++++++++++++
 2 files changed, 43 insertions(+), 27 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/w1/w1-gpio.txt
 create mode 100644 Documentation/devicetree/bindings/w1/w1-gpio.yaml

Comments

Rob Herring (Arm) July 23, 2021, 10:19 p.m. UTC | #1
On Wed, Jul 21, 2021 at 04:04:08PM +0200, Maxime Ripard wrote:
> Bitbanged 1-Wire buses are supported by Linux thanks to their device

> tree binding.

> 

> Now that we have the DT validation in place, let's convert the device

> tree bindings for that driver over to a YAML schema.

> 

> Cc: Daniel Mack <zonque@gmail.com>

> Cc: Evgeniy Polyakov <zbr@ioremap.net>

> Signed-off-by: Maxime Ripard <maxime@cerno.tech>

> ---

>  .../devicetree/bindings/w1/w1-gpio.txt        | 27 ------------

>  .../devicetree/bindings/w1/w1-gpio.yaml       | 43 +++++++++++++++++++

>  2 files changed, 43 insertions(+), 27 deletions(-)

>  delete mode 100644 Documentation/devicetree/bindings/w1/w1-gpio.txt

>  create mode 100644 Documentation/devicetree/bindings/w1/w1-gpio.yaml

> 

> diff --git a/Documentation/devicetree/bindings/w1/w1-gpio.txt b/Documentation/devicetree/bindings/w1/w1-gpio.txt

> deleted file mode 100644

> index 3d6554eac240..000000000000

> --- a/Documentation/devicetree/bindings/w1/w1-gpio.txt

> +++ /dev/null

> @@ -1,27 +0,0 @@

> -w1-gpio devicetree bindings

> -

> -Required properties:

> -

> - - compatible: "w1-gpio"

> - - gpios: one or two GPIO specs:

> -		- the first one is used as data I/O pin

> -		- the second one is optional. If specified, it is used as

> -		  enable pin for an external pin pullup.

> -

> -Optional properties:

> -

> - - linux,open-drain: if specified, the data pin is considered in

> -		     open-drain mode.

> -

> -Also refer to the generic w1.txt document.

> -

> -Examples:

> -

> -	onewire {

> -		compatible = "w1-gpio";

> -		gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;

> -

> -		battery {

> -			// ...

> -		};

> -	};

> diff --git a/Documentation/devicetree/bindings/w1/w1-gpio.yaml b/Documentation/devicetree/bindings/w1/w1-gpio.yaml

> new file mode 100644

> index 000000000000..4a780a988718

> --- /dev/null

> +++ b/Documentation/devicetree/bindings/w1/w1-gpio.yaml

> @@ -0,0 +1,43 @@

> +# SPDX-License-Identifier: GPL-2.0

> +%YAML 1.2

> +---

> +$id: http://devicetree.org/schemas/w1/w1-gpio.yaml#

> +$schema: http://devicetree.org/meta-schemas/core.yaml#

> +

> +title: Bitbanged GPIO 1-Wire Bus Device Tree Bindings

> +

> +maintainers:

> +  - Daniel Mack <zonque@gmail.com>

> +

> +properties:

> +  compatible:

> +    const: w1-gpio

> +

> +  gpios:

> +    minItems: 1

> +    maxItems: 2

> +    items:

> +      - description: Data I/O pin

> +      - description: Enable pin for an external pull-up resistor

> +

> +  linux,open-drain:

> +    type: boolean

> +    description: >

> +      If specified, the data pin is considered in open-drain mode.

> +

> +required:

> +  - compatible

> +  - gpios

> +

> +additionalProperties: false


Presumably we might have child devices:

additionalProperties:
  type: object

> +

> +examples:

> +  - |

> +    #include <dt-bindings/gpio/gpio.h>

> +

> +    onewire {

> +        compatible = "w1-gpio";

> +        gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;

> +    };

> +

> +...

> -- 

> 2.31.1

> 

>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/w1/w1-gpio.txt b/Documentation/devicetree/bindings/w1/w1-gpio.txt
deleted file mode 100644
index 3d6554eac240..000000000000
--- a/Documentation/devicetree/bindings/w1/w1-gpio.txt
+++ /dev/null
@@ -1,27 +0,0 @@ 
-w1-gpio devicetree bindings
-
-Required properties:
-
- - compatible: "w1-gpio"
- - gpios: one or two GPIO specs:
-		- the first one is used as data I/O pin
-		- the second one is optional. If specified, it is used as
-		  enable pin for an external pin pullup.
-
-Optional properties:
-
- - linux,open-drain: if specified, the data pin is considered in
-		     open-drain mode.
-
-Also refer to the generic w1.txt document.
-
-Examples:
-
-	onewire {
-		compatible = "w1-gpio";
-		gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
-
-		battery {
-			// ...
-		};
-	};
diff --git a/Documentation/devicetree/bindings/w1/w1-gpio.yaml b/Documentation/devicetree/bindings/w1/w1-gpio.yaml
new file mode 100644
index 000000000000..4a780a988718
--- /dev/null
+++ b/Documentation/devicetree/bindings/w1/w1-gpio.yaml
@@ -0,0 +1,43 @@ 
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/w1/w1-gpio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Bitbanged GPIO 1-Wire Bus Device Tree Bindings
+
+maintainers:
+  - Daniel Mack <zonque@gmail.com>
+
+properties:
+  compatible:
+    const: w1-gpio
+
+  gpios:
+    minItems: 1
+    maxItems: 2
+    items:
+      - description: Data I/O pin
+      - description: Enable pin for an external pull-up resistor
+
+  linux,open-drain:
+    type: boolean
+    description: >
+      If specified, the data pin is considered in open-drain mode.
+
+required:
+  - compatible
+  - gpios
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    onewire {
+        compatible = "w1-gpio";
+        gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
+    };
+
+...