mbox series

[v5,0/2] Input: cros-ec-keyb: Better matrixless support

Message ID 20220516183452.942008-1-swboyd@chromium.org (mailing list archive)
Headers show
Series Input: cros-ec-keyb: Better matrixless support | expand

Message

Stephen Boyd May 16, 2022, 6:34 p.m. UTC
This is a followup to my previous patch[1] that skips keyboard registration
when the matrix properties aren't present. This adds a compatible string
for this scenario so we can ease existing DTBs over to the new design.

Changes from v4 (https://lore.kernel.org/r/20220503204212.3907925-1-swboyd@chromium.org):
 * Make switches compatible fail probe if no switches present
 * Add description to compatible list

Changes from v3 (https://lore.kernel.org/r/20220503042242.3597561-1-swboyd@chromium.org):
 * s/register_keyboard/has_keyboard/
 * Pick up review tags
 * Indicate properties are required in example #2 in yaml file

Changes from v2 (https://lore.kernel.org/r/20220429233112.2851665-1-swboyd@chromium.org):
 * Drop rows/cols check now that compatible schema handles it
 * Make binding require rows,cols,keymap for cros-ec-keyb compatible

Changes from v1 (https://lore.kernel.org/r/20220427203026.828183-1-swboyd@chromium.org):
 * Better enforcement of properties in DT binding
 * Skip registration by means of adding compatible to device id list

Stephen Boyd (2):
  dt-bindings: google,cros-ec-keyb: Introduce switches only compatible
  Input: cros-ec-keyb - skip keyboard registration w/o cros-ec-keyb
    compatible

 .../bindings/input/google,cros-ec-keyb.yaml   | 91 +++++++++++++++++--
 drivers/input/keyboard/cros_ec_keyb.c         | 26 ++++--
 2 files changed, 101 insertions(+), 16 deletions(-)

Cc: Krzysztof Kozlowski <krzk+dt@kernel.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: <devicetree@vger.kernel.org>
Cc: Benson Leung <bleung@chromium.org>
Cc: Guenter Roeck <groeck@chromium.org>
Cc: Douglas Anderson <dianders@chromium.org>
Cc: Hsin-Yi Wang <hsinyi@chromium.org>
Cc: "Joseph S. Barrera III" <joebar@chromium.org>

[1] https://lore.kernel.org/all/20220425210726.3813477-1-swboyd@chromium.org/

base-commit: 4352e23a7ff2f8a4ff229dd1283ed2f2b708ec51

Comments

Dmitry Torokhov May 18, 2022, 5:06 a.m. UTC | #1
Hi Stephen,

On Mon, May 16, 2022 at 11:34:50AM -0700, Stephen Boyd wrote:
> This is a followup to my previous patch[1] that skips keyboard registration
> when the matrix properties aren't present. This adds a compatible string
> for this scenario so we can ease existing DTBs over to the new design.

As discussed offlist I massaged the binding and the driver code a bit
and applied it to an immutable branch off v5.17:

	git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git ib/5.17-cros-ec-keyb

that you can share with DTS maintainer(s) to accelerate DTS conversions.

I also dropped the original patch as it did not make it to Linus' tree
yet.

Thanks.
Stephen Boyd May 18, 2022, 8:07 p.m. UTC | #2
Quoting Dmitry Torokhov (2022-05-17 22:06:11)
> Hi Stephen,
>
> On Mon, May 16, 2022 at 11:34:50AM -0700, Stephen Boyd wrote:
> > This is a followup to my previous patch[1] that skips keyboard registration
> > when the matrix properties aren't present. This adds a compatible string
> > for this scenario so we can ease existing DTBs over to the new design.
>
> As discussed offlist I massaged the binding and the driver code a bit
> and applied it to an immutable branch off v5.17:
>
>         git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git ib/5.17-cros-ec-keyb
>
> that you can share with DTS maintainer(s) to accelerate DTS conversions.
>
> I also dropped the original patch as it did not make it to Linus' tree
> yet.
>

Ok thanks. Doug noticed some problems with the dt binding. Here's a
follow up patch that you can squash in or apply on top.

---8<---
From: Stephen Boyd <swboyd@chromium.org>
Date: Wed, 18 May 2022 13:03:58 -0700
Subject: [PATCH] dt-bindings: google,cros-ec-keyb: Fixup bad compatible match

This uses anyOf which is wrong. Use oneOf and move the items under the
description. Also drop allOf for $ref.

Reported-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 .../bindings/input/google,cros-ec-keyb.yaml           | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml
b/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml
index e11cbf508723..c31a02149f37 100644
--- a/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml
+++ b/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml
@@ -20,13 +20,11 @@ description: |

 properties:
   compatible:
-    anyOf:
+    oneOf:
       - description: ChromeOS EC with only buttons/switches
-      - items:
-          - const: google,cros-ec-keyb-switches
+        const: google,cros-ec-keyb-switches
       - description: ChromeOS EC with keyboard and possibly buttons/switches
-      - items:
-          - const: google,cros-ec-keyb
+        const: google,cros-ec-keyb

   google,needs-ghost-filter:
     description:
@@ -58,8 +56,7 @@ if:
       contains:
         const: google,cros-ec-keyb
 then:
-  allOf:
-    - $ref: "/schemas/input/matrix-keymap.yaml#"
+  $ref: "/schemas/input/matrix-keymap.yaml#"
   required:
     - keypad,num-rows
     - keypad,num-columns
Dmitry Torokhov May 18, 2022, 10:06 p.m. UTC | #3
On Wed, May 18, 2022 at 01:07:55PM -0700, Stephen Boyd wrote:
> Quoting Dmitry Torokhov (2022-05-17 22:06:11)
> > Hi Stephen,
> >
> > On Mon, May 16, 2022 at 11:34:50AM -0700, Stephen Boyd wrote:
> > > This is a followup to my previous patch[1] that skips keyboard registration
> > > when the matrix properties aren't present. This adds a compatible string
> > > for this scenario so we can ease existing DTBs over to the new design.
> >
> > As discussed offlist I massaged the binding and the driver code a bit
> > and applied it to an immutable branch off v5.17:
> >
> >         git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git ib/5.17-cros-ec-keyb
> >
> > that you can share with DTS maintainer(s) to accelerate DTS conversions.
> >
> > I also dropped the original patch as it did not make it to Linus' tree
> > yet.
> >
> 
> Ok thanks. Doug noticed some problems with the dt binding. Here's a
> follow up patch that you can squash in or apply on top.

Added to the same branch, thank you.

> 
> ---8<---
> From: Stephen Boyd <swboyd@chromium.org>
> Date: Wed, 18 May 2022 13:03:58 -0700
> Subject: [PATCH] dt-bindings: google,cros-ec-keyb: Fixup bad compatible match
> 
> This uses anyOf which is wrong. Use oneOf and move the items under the
> description. Also drop allOf for $ref.
> 
> Reported-by: Douglas Anderson <dianders@chromium.org>
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
> ---
>  .../bindings/input/google,cros-ec-keyb.yaml           | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml
> b/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml
> index e11cbf508723..c31a02149f37 100644
> --- a/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml
> +++ b/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml
> @@ -20,13 +20,11 @@ description: |
> 
>  properties:
>    compatible:
> -    anyOf:
> +    oneOf:
>        - description: ChromeOS EC with only buttons/switches
> -      - items:
> -          - const: google,cros-ec-keyb-switches
> +        const: google,cros-ec-keyb-switches
>        - description: ChromeOS EC with keyboard and possibly buttons/switches
> -      - items:
> -          - const: google,cros-ec-keyb
> +        const: google,cros-ec-keyb
> 
>    google,needs-ghost-filter:
>      description:
> @@ -58,8 +56,7 @@ if:
>        contains:
>          const: google,cros-ec-keyb
>  then:
> -  allOf:
> -    - $ref: "/schemas/input/matrix-keymap.yaml#"
> +  $ref: "/schemas/input/matrix-keymap.yaml#"
>    required:
>      - keypad,num-rows
>      - keypad,num-columns
> -- 
> https://chromeos.dev
patchwork-bot+chrome-platform@kernel.org June 6, 2022, 3:33 a.m. UTC | #4
Hello:

This series was applied to chrome-platform/linux.git (for-next)
by Dmitry Torokhov <dmitry.torokhov@gmail.com>:

On Mon, 16 May 2022 11:34:50 -0700 you wrote:
> This is a followup to my previous patch[1] that skips keyboard registration
> when the matrix properties aren't present. This adds a compatible string
> for this scenario so we can ease existing DTBs over to the new design.
> 
> Changes from v4 (https://lore.kernel.org/r/20220503204212.3907925-1-swboyd@chromium.org):
>  * Make switches compatible fail probe if no switches present
>  * Add description to compatible list
> 
> [...]

Here is the summary with links:
  - [v5,1/2] dt-bindings: google,cros-ec-keyb: Introduce switches only compatible
    https://git.kernel.org/chrome-platform/c/52dc6d3bea3b
  - [v5,2/2] Input: cros-ec-keyb - skip keyboard registration w/o cros-ec-keyb compatible
    https://git.kernel.org/chrome-platform/c/ca1eadbfcd36

You are awesome, thank you!