dt-bindings: cros-ec: Reorganize and enforce property availability
authorStephen Boyd <swboyd@chromium.org>
Wed, 26 Oct 2022 00:36:40 +0000 (17:36 -0700)
committerTzung-Bi Shih <tzungbi@kernel.org>
Mon, 31 Oct 2022 04:02:56 +0000 (12:02 +0800)
Various properties in the cros-ec binding only apply to different
compatible strings. For example, the interrupts and reg property are
required for all cros-ec devices except for the rpmsg version. Add some
conditions to update the availability of properties so that they can't
be used with compatibles that don't support them.

This reveals that many of the examples in bindings that use cros-ec were
missing the interrupts property. Add the property to make those bindings
whole again.

Reviewed-by: Rob Herring <robh@kernel.org>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
Cc: <devicetree@vger.kernel.org>
Cc: <chrome-platform@lists.linux.dev>
Cc: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Cc: Craig Hesling <hesling@chromium.org>
Cc: Tom Hughes <tomhughes@chromium.org>
Cc: Alexandru M Stan <amstan@chromium.org>
Cc: Tzung-Bi Shih <tzungbi@kernel.org>
Cc: Matthias Kaehlcke <mka@chromium.org>
Cc: Benson Leung <bleung@chromium.org>
Cc: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
Link: https://lore.kernel.org/r/20221026003641.2688765-2-swboyd@chromium.org
Documentation/devicetree/bindings/chrome/google,cros-ec-typec.yaml
Documentation/devicetree/bindings/chrome/google,cros-kbd-led-backlight.yaml
Documentation/devicetree/bindings/extcon/extcon-usbc-cros-ec.yaml
Documentation/devicetree/bindings/i2c/google,cros-ec-i2c-tunnel.yaml
Documentation/devicetree/bindings/mfd/google,cros-ec.yaml
Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.yaml
Documentation/devicetree/bindings/regulator/google,cros-ec-regulator.yaml
Documentation/devicetree/bindings/sound/google,cros-ec-codec.yaml

index 50ebd8c57795167a949cc3cbb7a1909b099ccfac..defcf1e12aa17eef28932191e57311bd2de781ec 100644 (file)
@@ -48,6 +48,7 @@ examples:
       cros_ec: ec@0 {
         compatible = "google,cros-ec-spi";
         reg = <0>;
+        interrupts = <35 0>;
 
         typec {
           compatible = "google,cros-ec-typec";
index 5b875af6a95ab97183e4ae88b3288e8da052e942..40244d003c325a1aeb1727c353035919050576ec 100644 (file)
@@ -27,6 +27,7 @@ examples:
       cros_ec: ec@0 {
         compatible = "google,cros-ec-spi";
         reg = <0>;
+        interrupts = <15 0>;
 
         kbd-led-backlight {
           compatible = "google,cros-kbd-led-backlight";
index 2d82b44268dbd7dbb38da6baf6abd1011f268fab..2e5b398814490e41177c315dc5de8053c62bb921 100644 (file)
@@ -40,6 +40,7 @@ examples:
         cros-ec@0 {
             compatible = "google,cros-ec-spi";
             reg = <0>;
+            interrupts = <44 0>;
 
             usbc_extcon0: extcon0 {
                 compatible = "google,extcon-usbc-cros-ec";
index 6e1c70e9275ecd7438f681b243fb9933d5817bf8..cf523615f5e39311e9b91c4e52b51665ea0d033a 100644 (file)
@@ -47,6 +47,7 @@ examples:
             compatible = "google,cros-ec-spi";
             reg = <0>;
             spi-max-frequency = <5000000>;
+            interrupts = <99 0>;
 
             i2c-tunnel {
                 compatible = "google,cros-ec-i2c-tunnel";
index 04962bb29576e39cb1eeeb7b5a9cbacad47af4b2..659d3f64b550bbc464a70840b8c9c32b8c28c805 100644 (file)
@@ -20,19 +20,16 @@ properties:
   compatible:
     oneOf:
       - description:
-          For implementations of the EC is connected through I2C.
+          For implementations of the EC connected through I2C.
         const: google,cros-ec-i2c
       - description:
-          For implementations of the EC is connected through SPI.
+          For implementations of the EC connected through SPI.
         const: google,cros-ec-spi
       - description:
-          For implementations of the EC is connected through RPMSG.
+          For implementations of the EC connected through RPMSG.
         const: google,cros-ec-rpmsg
 
-  controller-data:
-    description:
-      SPI controller data, see bindings/spi/samsung,spi-peripheral-props.yaml
-    type: object
+  controller-data: true
 
   google,cros-ec-spi-pre-delay:
     description:
@@ -62,8 +59,7 @@ properties:
       the SCP.
     $ref: "/schemas/types.yaml#/definitions/string"
 
-  spi-max-frequency:
-    description: Maximum SPI frequency of the device in Hz.
+  spi-max-frequency: true
 
   reg:
     maxItems: 1
@@ -155,18 +151,32 @@ allOf:
   - if:
       properties:
         compatible:
-          contains:
-            enum:
-              - google,cros-ec-i2c
-              - google,cros-ec-rpmsg
+          not:
+            contains:
+              const: google,cros-ec-spi
     then:
       properties:
+        controller-data: false
         google,cros-ec-spi-pre-delay: false
         google,cros-ec-spi-msg-delay: false
         spi-max-frequency: false
     else:
       $ref: /schemas/spi/spi-peripheral-props.yaml
 
+  - if:
+      properties:
+        compatible:
+          not:
+            contains:
+              const: google,cros-ec-rpmsg
+    then:
+      properties:
+        mediatek,rpmsg-name: false
+
+      required:
+        - reg
+        - interrupts
+
 additionalProperties: false
 
 examples:
index c8577bdf6c946fb9db852c72e0d386f3b4a30099..3afe1480df5200de49c59c0388d9a578972fc729 100644 (file)
@@ -48,6 +48,7 @@ examples:
         cros-ec@0 {
             compatible = "google,cros-ec-spi";
             reg = <0>;
+            interrupts = <101 0>;
 
             cros_ec_pwm: pwm {
                 compatible = "google,cros-ec-pwm";
index 69e5402da7612e6c7e0184ce7455dbf061ca4abb..0921f012c9018e3c3d08f91175188baa985846cc 100644 (file)
@@ -41,6 +41,7 @@ examples:
             reg = <0>;
             #address-cells = <1>;
             #size-cells = <0>;
+            interrupts = <99 0>;
 
             regulator@0 {
                 compatible = "google,cros-ec-regulator";
index c3e9f3485449e33ede0ba10509de7021e5404879..67134e06765afad39082906c9d7dba065a49bd5e 100644 (file)
@@ -57,6 +57,7 @@ examples:
         cros-ec@0 {
             compatible = "google,cros-ec-spi";
             reg = <0>;
+            interrupts = <93 0>;
 
             codecs {
                 #address-cells = <2>;