Commit 7a2f3682 authored by Stephen Boyd's avatar Stephen Boyd Committed by Tzung-Bi Shih
Browse files

dt-bindings: cros-ec: Reorganize and enforce property availability



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: default avatarRob 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: default avatarDouglas 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: default avatarStephen Boyd <swboyd@chromium.org>
Signed-off-by: default avatarTzung-Bi Shih <tzungbi@kernel.org>
Link: https://lore.kernel.org/r/20221026003641.2688765-2-swboyd@chromium.org
parent d8cb88f1
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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";
+1 −0
Original line number Diff line number Diff line
@@ -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";
+1 −0
Original line number Diff line number Diff line
@@ -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";
+1 −0
Original line number Diff line number Diff line
@@ -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";
+23 −13
Original line number Diff line number Diff line
@@ -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:
          not:
            contains:
            enum:
              - google,cros-ec-i2c
              - google,cros-ec-rpmsg
              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:
Loading