* [PATCHv4 0/3] iio: Add a ChromeOS EC MKBP proximity driver @ 2021-02-02 18:44 Stephen Boyd 2021-02-02 18:44 ` [PATCH v4 2/3] dt-bindings: iio: Add cros ec proximity yaml doc Stephen Boyd 0 siblings, 1 reply; 5+ messages in thread From: Stephen Boyd @ 2021-02-02 18:44 UTC (permalink / raw) To: Jonathan Cameron Cc: linux-kernel, linux-iio, Dmitry Torokhov, Benson Leung, Guenter Roeck, Douglas Anderson, Gwendal Grignou, devicetree, Rob Herring, Enric Balletbo i Serra This is a different approach to [1] where I tried to add this proximity sensor logic to the input subsystem. Instead, we'll take the approach of making a small IIO proximity driver that parses the EC switch bitmap to find out if the front proximity sensor is detecting something or not. This allows us to treat proximity sensors as IIO devices all the time in userspace instead of handling this switch on the EC via the input subsystem and then other proximity sensors via IIO. I propose this is all merged through IIO subsystem. Please ack the first patch so it can be merged that way. Changes from v3: * Added SPI and cros-ec wrapper nodes to yaml example * Ignore notifier registration return code that is always zero Changes from v2: * Check iio clock and use IIO time if not boottime Changes from v1: * Driver moved location * Put mkbp everywhere * Fixed up DT binding to not fail and make sure is a child of cros-ec * Simplified logic for sending a message * Dropped CONFIG_OF usage * Sorted includes [1] https://lore.kernel.org/r/20201205004709.3126266-1-swboyd@chromium.org 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> Cc: Enric Balletbo i Serra <enric.balletbo@collabora.com> Stephen Boyd (3): platform/chrome: cros_ec: Add SW_FRONT_PROXIMITY MKBP define dt-bindings: iio: Add cros ec proximity yaml doc iio: proximity: Add a ChromeOS EC MKBP proximity driver .../google,cros-ec-mkbp-proximity.yaml | 46 ++++ .../bindings/mfd/google,cros-ec.yaml | 3 + drivers/iio/proximity/Kconfig | 11 + drivers/iio/proximity/Makefile | 1 + .../iio/proximity/cros_ec_mkbp_proximity.c | 242 ++++++++++++++++++ .../linux/platform_data/cros_ec_commands.h | 1 + 6 files changed, 304 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/proximity/google,cros-ec-mkbp-proximity.yaml create mode 100644 drivers/iio/proximity/cros_ec_mkbp_proximity.c base-commit: 19c329f6808995b142b3966301f217c831e7cf31 -- https://chromeos.dev ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v4 2/3] dt-bindings: iio: Add cros ec proximity yaml doc 2021-02-02 18:44 [PATCHv4 0/3] iio: Add a ChromeOS EC MKBP proximity driver Stephen Boyd @ 2021-02-02 18:44 ` Stephen Boyd 2021-02-03 8:29 ` Enric Balletbo Serra 2021-02-09 21:13 ` Rob Herring 0 siblings, 2 replies; 5+ messages in thread From: Stephen Boyd @ 2021-02-02 18:44 UTC (permalink / raw) To: Jonathan Cameron Cc: linux-kernel, linux-iio, Dmitry Torokhov, Benson Leung, Guenter Roeck, Douglas Anderson, Gwendal Grignou, devicetree, Rob Herring, Enric Balletbo i Serra 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> Cc: Enric Balletbo i Serra <enric.balletbo@collabora.com> Signed-off-by: Stephen Boyd <swboyd@chromium.org> --- .../google,cros-ec-mkbp-proximity.yaml | 46 +++++++++++++++++++ .../bindings/mfd/google,cros-ec.yaml | 3 ++ 2 files changed, 49 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..d82b929af445 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/proximity/google,cros-ec-mkbp-proximity.yaml @@ -0,0 +1,46 @@ +# 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: + - | + spi { + #address-cells = <1>; + #size-cells = <0>; + 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 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v4 2/3] dt-bindings: iio: Add cros ec proximity yaml doc 2021-02-02 18:44 ` [PATCH v4 2/3] dt-bindings: iio: Add cros ec proximity yaml doc Stephen Boyd @ 2021-02-03 8:29 ` Enric Balletbo Serra 2021-02-09 21:13 ` Rob Herring 1 sibling, 0 replies; 5+ messages in thread From: Enric Balletbo Serra @ 2021-02-03 8:29 UTC (permalink / raw) To: Stephen Boyd Cc: Jonathan Cameron, linux-kernel, linux-iio, Dmitry Torokhov, Benson Leung, Guenter Roeck, Douglas Anderson, Gwendal Grignou, devicetree@vger.kernel.org, Rob Herring, Enric Balletbo i Serra Hi Stephen, Missatge de Stephen Boyd <swboyd@chromium.org> del dia dt., 2 de febr. 2021 a les 19:53: > > 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> > Cc: Enric Balletbo i Serra <enric.balletbo@collabora.com> > Signed-off-by: Stephen Boyd <swboyd@chromium.org> Thanks for adding a full example, IIRC this is preferred by Rob and we are also trying to apply this rule on all the cros-ec related bindings, so the dt_bindings_check really checks a full example. From my side looks good to me. Reviewed-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> > --- > .../google,cros-ec-mkbp-proximity.yaml | 46 +++++++++++++++++++ > .../bindings/mfd/google,cros-ec.yaml | 3 ++ > 2 files changed, 49 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..d82b929af445 > --- /dev/null > +++ b/Documentation/devicetree/bindings/iio/proximity/google,cros-ec-mkbp-proximity.yaml > @@ -0,0 +1,46 @@ > +# 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: > + - | > + spi { > + #address-cells = <1>; > + #size-cells = <0>; > + 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 > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v4 2/3] dt-bindings: iio: Add cros ec proximity yaml doc 2021-02-02 18:44 ` [PATCH v4 2/3] dt-bindings: iio: Add cros ec proximity yaml doc Stephen Boyd 2021-02-03 8:29 ` Enric Balletbo Serra @ 2021-02-09 21:13 ` Rob Herring 2021-02-10 2:40 ` Stephen Boyd 1 sibling, 1 reply; 5+ messages in thread From: Rob Herring @ 2021-02-09 21:13 UTC (permalink / raw) To: Stephen Boyd Cc: Jonathan Cameron, linux-kernel, linux-iio, Dmitry Torokhov, Benson Leung, Guenter Roeck, Douglas Anderson, Gwendal Grignou, devicetree, Enric Balletbo i Serra On Tue, Feb 02, 2021 at 10:44:33AM -0800, Stephen Boyd wrote: > 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> > Cc: Enric Balletbo i Serra <enric.balletbo@collabora.com> > Signed-off-by: Stephen Boyd <swboyd@chromium.org> > --- > .../google,cros-ec-mkbp-proximity.yaml | 46 +++++++++++++++++++ > .../bindings/mfd/google,cros-ec.yaml | 3 ++ > 2 files changed, 49 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..d82b929af445 > --- /dev/null > +++ b/Documentation/devicetree/bindings/iio/proximity/google,cros-ec-mkbp-proximity.yaml > @@ -0,0 +1,46 @@ > +# 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 Only need one. In this case 'additionalProperties'. > + > +examples: > + - | > + spi { > + #address-cells = <1>; > + #size-cells = <0>; > + ec@0 { > + compatible = "google,cros-ec-spi"; > + reg = <0>; > + proximity { > + compatible = "google,cros-ec-mkbp-proximity"; > + label = "proximity-wifi-lte"; > + }; The complete examples I prefer is 1 example for the whole MFD in the MFD schema and no example here. > + }; > + }; > 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 > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v4 2/3] dt-bindings: iio: Add cros ec proximity yaml doc 2021-02-09 21:13 ` Rob Herring @ 2021-02-10 2:40 ` Stephen Boyd 0 siblings, 0 replies; 5+ messages in thread From: Stephen Boyd @ 2021-02-10 2:40 UTC (permalink / raw) To: Rob Herring Cc: Jonathan Cameron, linux-kernel, linux-iio, Dmitry Torokhov, Benson Leung, Guenter Roeck, Douglas Anderson, Gwendal Grignou, devicetree, Enric Balletbo i Serra Quoting Rob Herring (2021-02-09 13:13:47) > On Tue, Feb 02, 2021 at 10:44:33AM -0800, Stephen Boyd wrote: > > + description: Name for proximity sensor > > + > > +required: > > + - compatible > > + > > +unevaluatedProperties: false > > +additionalProperties: false > > Only need one. In this case 'additionalProperties'. Got it. > > > + > > +examples: > > + - | > > + spi { > > + #address-cells = <1>; > > + #size-cells = <0>; > > + ec@0 { > > + compatible = "google,cros-ec-spi"; > > + reg = <0>; > > + proximity { > > + compatible = "google,cros-ec-mkbp-proximity"; > > + label = "proximity-wifi-lte"; > > + }; > > The complete examples I prefer is 1 example for the whole MFD in the MFD > schema and no example here. Alright. I can add it to the mfd binding instead. > > > + }; > > + }; > > 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#" ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-02-10 2:43 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-02-02 18:44 [PATCHv4 0/3] iio: Add a ChromeOS EC MKBP proximity driver Stephen Boyd 2021-02-02 18:44 ` [PATCH v4 2/3] dt-bindings: iio: Add cros ec proximity yaml doc Stephen Boyd 2021-02-03 8:29 ` Enric Balletbo Serra 2021-02-09 21:13 ` Rob Herring 2021-02-10 2:40 ` Stephen Boyd
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).