Skip to content

Commit 52dc6d3

Browse files
bebarinodtor
authored andcommitted
dt-bindings: google,cros-ec-keyb: Introduce switches only compatible
If the ChromeOS board is a detachable, this cros-ec-keyb device won't have a matrix keyboard but it may have some button switches, e.g. volume buttons and power buttons. The driver still registers a keyboard though and that leads to userspace confusion around where the keyboard is. We tried to work around this by only registering the keyboard device when rows/columns properties were specified for the device, but that led to another problem where removing the rows/columns properties breaks the existing binding. Technically before that commit the rows/columns properties were required, otherwise the driver would fail to probe. Removing the properties from devicetrees makes the driver fail to probe unless the corresponding driver patch is present. Furthermore, this makes requiring matrix keyboard properties for devices that really have a keyboard impossible because the compatible drives the schema and now the properties are optional. Add a more specific compatible for this type of device that indicates to the OS that there are only switches and no matrix keyboard present. Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Reviewed-by: Douglas Anderson <dianders@chromium.org> Signed-off-by: Stephen Boyd <swboyd@chromium.org> Link: https://lore.kernel.org/r/20220516183452.942008-2-swboyd@chromium.org Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent f443e37 commit 52dc6d3

1 file changed

Lines changed: 33 additions & 6 deletions

File tree

Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,18 @@ description: |
1515
Google's ChromeOS EC Keyboard is a simple matrix keyboard
1616
implemented on a separate EC (Embedded Controller) device. It provides
1717
a message for reading key scans from the EC. These are then converted
18-
into keycodes for processing by the kernel.
19-
20-
allOf:
21-
- $ref: "/schemas/input/matrix-keymap.yaml#"
18+
into keycodes for processing by the kernel. This device also supports
19+
switches/buttons like power and volume buttons.
2220
2321
properties:
2422
compatible:
25-
const: google,cros-ec-keyb
23+
anyOf:
24+
- description: ChromeOS EC with only buttons/switches
25+
- items:
26+
- const: google,cros-ec-keyb-switches
27+
- description: ChromeOS EC with keyboard and possibly buttons/switches
28+
- items:
29+
- const: google,cros-ec-keyb
2630

2731
google,needs-ghost-filter:
2832
description:
@@ -41,15 +45,32 @@ properties:
4145
where the lower 16 bits are reserved. This property is specified only
4246
when the keyboard has a custom design for the top row keys.
4347
48+
dependencies:
49+
function-row-phsymap: [ 'linux,keymap' ]
50+
google,needs-ghost-filter: [ 'linux,keymap' ]
51+
4452
required:
4553
- compatible
4654

55+
if:
56+
properties:
57+
compatible:
58+
contains:
59+
const: google,cros-ec-keyb
60+
then:
61+
allOf:
62+
- $ref: "/schemas/input/matrix-keymap.yaml#"
63+
required:
64+
- keypad,num-rows
65+
- keypad,num-columns
66+
- linux,keymap
67+
4768
unevaluatedProperties: false
4869

4970
examples:
5071
- |
5172
#include <dt-bindings/input/input.h>
52-
cros-ec-keyb {
73+
keyboard-controller {
5374
compatible = "google,cros-ec-keyb";
5475
keypad,num-rows = <8>;
5576
keypad,num-columns = <13>;
@@ -113,3 +134,9 @@ examples:
113134
/* UP LEFT */
114135
0x070b0067 0x070c0069>;
115136
};
137+
- |
138+
/* No matrix keyboard, just buttons/switches */
139+
keyboard-controller {
140+
compatible = "google,cros-ec-keyb-switches";
141+
};
142+
...

0 commit comments

Comments
 (0)