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: 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
This commit is contained in:
Stephen Boyd
2022-10-25 17:36:40 -07:00
committed by Tzung-Bi Shih
parent d8cb88f154
commit 7a2f36828c
8 changed files with 30 additions and 13 deletions
@@ -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";
@@ -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";
@@ -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";
@@ -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";
@@ -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:
@@ -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";
@@ -41,6 +41,7 @@ examples:
reg = <0>;
#address-cells = <1>;
#size-cells = <0>;
interrupts = <99 0>;
regulator@0 {
compatible = "google,cros-ec-regulator";
@@ -57,6 +57,7 @@ examples:
cros-ec@0 {
compatible = "google,cros-ec-spi";
reg = <0>;
interrupts = <93 0>;
codecs {
#address-cells = <2>;