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

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
...@@ -48,6 +48,7 @@ examples: ...@@ -48,6 +48,7 @@ examples:
cros_ec: ec@0 { cros_ec: ec@0 {
compatible = "google,cros-ec-spi"; compatible = "google,cros-ec-spi";
reg = <0>; reg = <0>;
interrupts = <35 0>;
typec { typec {
compatible = "google,cros-ec-typec"; compatible = "google,cros-ec-typec";
......
...@@ -27,6 +27,7 @@ examples: ...@@ -27,6 +27,7 @@ examples:
cros_ec: ec@0 { cros_ec: ec@0 {
compatible = "google,cros-ec-spi"; compatible = "google,cros-ec-spi";
reg = <0>; reg = <0>;
interrupts = <15 0>;
kbd-led-backlight { kbd-led-backlight {
compatible = "google,cros-kbd-led-backlight"; compatible = "google,cros-kbd-led-backlight";
......
...@@ -40,6 +40,7 @@ examples: ...@@ -40,6 +40,7 @@ examples:
cros-ec@0 { cros-ec@0 {
compatible = "google,cros-ec-spi"; compatible = "google,cros-ec-spi";
reg = <0>; reg = <0>;
interrupts = <44 0>;
usbc_extcon0: extcon0 { usbc_extcon0: extcon0 {
compatible = "google,extcon-usbc-cros-ec"; compatible = "google,extcon-usbc-cros-ec";
......
...@@ -47,6 +47,7 @@ examples: ...@@ -47,6 +47,7 @@ examples:
compatible = "google,cros-ec-spi"; compatible = "google,cros-ec-spi";
reg = <0>; reg = <0>;
spi-max-frequency = <5000000>; spi-max-frequency = <5000000>;
interrupts = <99 0>;
i2c-tunnel { i2c-tunnel {
compatible = "google,cros-ec-i2c-tunnel"; compatible = "google,cros-ec-i2c-tunnel";
......
...@@ -20,19 +20,16 @@ properties: ...@@ -20,19 +20,16 @@ properties:
compatible: compatible:
oneOf: oneOf:
- description: - description:
For implementations of the EC is connected through I2C. For implementations of the EC connected through I2C.
const: google,cros-ec-i2c const: google,cros-ec-i2c
- description: - description:
For implementations of the EC is connected through SPI. For implementations of the EC connected through SPI.
const: google,cros-ec-spi const: google,cros-ec-spi
- description: - description:
For implementations of the EC is connected through RPMSG. For implementations of the EC connected through RPMSG.
const: google,cros-ec-rpmsg const: google,cros-ec-rpmsg
controller-data: controller-data: true
description:
SPI controller data, see bindings/spi/samsung,spi-peripheral-props.yaml
type: object
google,cros-ec-spi-pre-delay: google,cros-ec-spi-pre-delay:
description: description:
...@@ -62,8 +59,7 @@ properties: ...@@ -62,8 +59,7 @@ properties:
the SCP. the SCP.
$ref: "/schemas/types.yaml#/definitions/string" $ref: "/schemas/types.yaml#/definitions/string"
spi-max-frequency: spi-max-frequency: true
description: Maximum SPI frequency of the device in Hz.
reg: reg:
maxItems: 1 maxItems: 1
...@@ -155,18 +151,32 @@ allOf: ...@@ -155,18 +151,32 @@ allOf:
- if: - if:
properties: properties:
compatible: compatible:
contains: not:
enum: contains:
- google,cros-ec-i2c const: google,cros-ec-spi
- google,cros-ec-rpmsg
then: then:
properties: properties:
controller-data: false
google,cros-ec-spi-pre-delay: false google,cros-ec-spi-pre-delay: false
google,cros-ec-spi-msg-delay: false google,cros-ec-spi-msg-delay: false
spi-max-frequency: false spi-max-frequency: false
else: else:
$ref: /schemas/spi/spi-peripheral-props.yaml $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 additionalProperties: false
examples: examples:
......
...@@ -48,6 +48,7 @@ examples: ...@@ -48,6 +48,7 @@ examples:
cros-ec@0 { cros-ec@0 {
compatible = "google,cros-ec-spi"; compatible = "google,cros-ec-spi";
reg = <0>; reg = <0>;
interrupts = <101 0>;
cros_ec_pwm: pwm { cros_ec_pwm: pwm {
compatible = "google,cros-ec-pwm"; compatible = "google,cros-ec-pwm";
......
...@@ -41,6 +41,7 @@ examples: ...@@ -41,6 +41,7 @@ examples:
reg = <0>; reg = <0>;
#address-cells = <1>; #address-cells = <1>;
#size-cells = <0>; #size-cells = <0>;
interrupts = <99 0>;
regulator@0 { regulator@0 {
compatible = "google,cros-ec-regulator"; compatible = "google,cros-ec-regulator";
......
...@@ -57,6 +57,7 @@ examples: ...@@ -57,6 +57,7 @@ examples:
cros-ec@0 { cros-ec@0 {
compatible = "google,cros-ec-spi"; compatible = "google,cros-ec-spi";
reg = <0>; reg = <0>;
interrupts = <93 0>;
codecs { codecs {
#address-cells = <2>; #address-cells = <2>;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment