diff mbox series

[v3,2/3] dt-bindings: iio: Add cros ec proximity yaml doc

Message ID 20210128084011.3270281-3-swboyd@chromium.org
State Superseded
Headers show
Series iio: Add a ChromeOS EC MKBP proximity driver | expand

Commit Message

Stephen Boyd Jan. 28, 2021, 8:40 a.m. UTC
Some cros ECs support a front proximity MKBP event via
'EC_MKBP_FRONT_PROXIMITY'. Add a DT binding to document this feature via
a node that is a child of the main cros_ec device node. Devices that
have this ability will describe this in firmware.

Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Benson Leung <bleung@chromium.org>
Cc: Guenter Roeck <groeck@chromium.org>
Cc: Douglas Anderson <dianders@chromium.org>
Cc: Gwendal Grignou <gwendal@chromium.org>
Cc: <devicetree@vger.kernel.org>
Cc: Rob Herring <robh+dt@kernel.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---

Changes from v2:
 * None

Changes from v1:
 * Added additionalProperties
 * Included proximity in cros-ec yaml

 .../google,cros-ec-mkbp-proximity.yaml        | 38 +++++++++++++++++++
 .../bindings/mfd/google,cros-ec.yaml          |  3 ++
 2 files changed, 41 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/proximity/google,cros-ec-mkbp-proximity.yaml

Comments

Enric Balletbo Serra Jan. 28, 2021, 9:44 a.m. UTC | #1
Hi Stephen,

Thank you for your patch. Just a minor comment.

Missatge de Stephen Boyd <swboyd@chromium.org> del dia dj., 28 de gen.
2021 a les 9:45:
>
> Some cros ECs support a front proximity MKBP event via
> 'EC_MKBP_FRONT_PROXIMITY'. Add a DT binding to document this feature via
> a node that is a child of the main cros_ec device node. Devices that
> have this ability will describe this in firmware.
>
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: Benson Leung <bleung@chromium.org>
> Cc: Guenter Roeck <groeck@chromium.org>
> Cc: Douglas Anderson <dianders@chromium.org>
> Cc: Gwendal Grignou <gwendal@chromium.org>
> Cc: <devicetree@vger.kernel.org>
> Cc: Rob Herring <robh+dt@kernel.org>
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
> ---
>
> Changes from v2:
>  * None
>
> Changes from v1:
>  * Added additionalProperties
>  * Included proximity in cros-ec yaml
>
>  .../google,cros-ec-mkbp-proximity.yaml        | 38 +++++++++++++++++++
>  .../bindings/mfd/google,cros-ec.yaml          |  3 ++
>  2 files changed, 41 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/iio/proximity/google,cros-ec-mkbp-proximity.yaml
>
> diff --git a/Documentation/devicetree/bindings/iio/proximity/google,cros-ec-mkbp-proximity.yaml b/Documentation/devicetree/bindings/iio/proximity/google,cros-ec-mkbp-proximity.yaml
> new file mode 100644
> index 000000000000..c3141c2be286
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/proximity/google,cros-ec-mkbp-proximity.yaml
> @@ -0,0 +1,38 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +
> +$id: http://devicetree.org/schemas/iio/proximity/google,cros-ec-mkbp-proximity.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: ChromeOS EC MKBP Proximity Sensor
> +
> +maintainers:
> +  - Stephen Boyd <swboyd@chromium.org>
> +  - Benson Leung <bleung@chromium.org>
> +  - Enric Balletbo i Serra <enric.balletbo@collabora.com>
> +
> +description: |
> +  Google's ChromeOS EC sometimes has the ability to detect user proximity.
> +  This is implemented on the EC as near/far logic and exposed to the OS
> +  via an MKBP switch bit.
> +
> +properties:
> +  compatible:
> +    const: google,cros-ec-mkbp-proximity
> +
> +  label:
> +    description: Name for proximity sensor
> +
> +required:
> +  - compatible
> +
> +unevaluatedProperties: false
> +additionalProperties: false
> +
> +examples:
> +  - |

For this kind of devices it is preferred to see a complete example
rather than pieces spread around different yaml. This helps proper
binding parsing.

    spi0 {
      #address-cells = <1>;
      #size-cells = <0>;

      cros_ec: ec@0 {
        compatible = "google,cros-ec-spi";
        reg = <0>;

> +    proximity {
> +        compatible = "google,cros-ec-mkbp-proximity";
> +        label = "proximity-wifi-lte";
> +    };
> diff --git a/Documentation/devicetree/bindings/mfd/google,cros-ec.yaml b/Documentation/devicetree/bindings/mfd/google,cros-ec.yaml
> index 76bf16ee27ec..479a9f15de32 100644
> --- a/Documentation/devicetree/bindings/mfd/google,cros-ec.yaml
> +++ b/Documentation/devicetree/bindings/mfd/google,cros-ec.yaml
> @@ -94,6 +94,9 @@ properties:
>    keyboard-controller:
>      $ref: "/schemas/input/google,cros-ec-keyb.yaml#"
>
> +  proximity:
> +    $ref: "/schemas/iio/proximity/google,cros-ec-mkbp-proximity.yaml#"
> +
>    codecs:
>      type: object
>      additionalProperties: false
> --
> https://chromeos.dev
>
Jonathan Cameron Jan. 31, 2021, 12:41 p.m. UTC | #2
On Thu, 28 Jan 2021 09:11:32 -0800
Stephen Boyd <swboyd@chromium.org> wrote:

> Quoting Enric Balletbo Serra (2021-01-28 01:44:23)

> > Missatge de Stephen Boyd <swboyd@chromium.org> del dia dj., 28 de gen.

> > 2021 a les 9:45:  

> > > +

> > > +  label:

> > > +    description: Name for proximity sensor

> > > +

> > > +required:

> > > +  - compatible

> > > +

> > > +unevaluatedProperties: false

> > > +additionalProperties: false

> > > +

> > > +examples:

> > > +  - |  

> > 

> > For this kind of devices it is preferred to see a complete example

> > rather than pieces spread around different yaml. This helps proper

> > binding parsing.

> > 

> >     spi0 {

> >       #address-cells = <1>;

> >       #size-cells = <0>;

> > 

> >       cros_ec: ec@0 {

> >         compatible = "google,cros-ec-spi";

> >         reg = <0>;  

> 

> What if it isn't on spi bus though? I'd rather leave it as is and let

> the google,cros-ec.yaml binding indicate that it is a child of the EC

> node.

It's an example. So definitely doesn't rule out other options than spi.

I think I'd also prefer to see the full example here to exercise more
of the relevant bindings when doing tests.

Mind you this is Rob's area, so I'll defer to Rob for preference.
@Rob?
> 

> >   

> > > +    proximity {

> > > +        compatible = "google,cros-ec-mkbp-proximity";

> > > +        label = "proximity-wifi-lte";

> > > +    };

> > > diff --git a/Documentation/devicetree/bindings/mfd/google,cros-ec.yaml b/Documentation/devicetree/bindings/mfd/google,cros-ec.yaml

> > > index 76bf16ee27ec..479a9f15de32 100644

> > > --- a/Documentation/devicetree/bindings/mfd/google,cros-ec.yaml

> > > +++ b/Documentation/devicetree/bindings/mfd/google,cros-ec.yaml

> > > @@ -94,6 +94,9 @@ properties:

> > >    keyboard-controller:

> > >      $ref: "/schemas/input/google,cros-ec-keyb.yaml#"

> > >

> > > +  proximity:

> > > +    $ref: "/schemas/iio/proximity/google,cros-ec-mkbp-proximity.yaml#"

> > > +

> > >    codecs:

> > >      type: object

> > >      additionalProperties: false
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/iio/proximity/google,cros-ec-mkbp-proximity.yaml b/Documentation/devicetree/bindings/iio/proximity/google,cros-ec-mkbp-proximity.yaml
new file mode 100644
index 000000000000..c3141c2be286
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/proximity/google,cros-ec-mkbp-proximity.yaml
@@ -0,0 +1,38 @@ 
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+
+$id: http://devicetree.org/schemas/iio/proximity/google,cros-ec-mkbp-proximity.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ChromeOS EC MKBP Proximity Sensor
+
+maintainers:
+  - Stephen Boyd <swboyd@chromium.org>
+  - Benson Leung <bleung@chromium.org>
+  - Enric Balletbo i Serra <enric.balletbo@collabora.com>
+
+description: |
+  Google's ChromeOS EC sometimes has the ability to detect user proximity.
+  This is implemented on the EC as near/far logic and exposed to the OS
+  via an MKBP switch bit.
+
+properties:
+  compatible:
+    const: google,cros-ec-mkbp-proximity
+
+  label:
+    description: Name for proximity sensor
+
+required:
+  - compatible
+
+unevaluatedProperties: false
+additionalProperties: false
+
+examples:
+  - |
+    proximity {
+        compatible = "google,cros-ec-mkbp-proximity";
+        label = "proximity-wifi-lte";
+    };
diff --git a/Documentation/devicetree/bindings/mfd/google,cros-ec.yaml b/Documentation/devicetree/bindings/mfd/google,cros-ec.yaml
index 76bf16ee27ec..479a9f15de32 100644
--- a/Documentation/devicetree/bindings/mfd/google,cros-ec.yaml
+++ b/Documentation/devicetree/bindings/mfd/google,cros-ec.yaml
@@ -94,6 +94,9 @@  properties:
   keyboard-controller:
     $ref: "/schemas/input/google,cros-ec-keyb.yaml#"
 
+  proximity:
+    $ref: "/schemas/iio/proximity/google,cros-ec-mkbp-proximity.yaml#"
+
   codecs:
     type: object
     additionalProperties: false