1# Copyright 2023 Google LLC
2# SPDX-License-Identifier: Apache-2.0
3
4description: |
5  GPIO based keyboard matrix input device
6
7  Implement an input device for a GPIO based keyboard matrix.
8
9  Example configuration:
10
11  kbd-matrix {
12          compatible = "gpio-kbd-matrix";
13          row-gpios = <&gpio0 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>,
14                      <&gpio0 1 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
15          col-gpios = <&gpio0 2 GPIO_ACTIVE_LOW>,
16                      <&gpio0 3 GPIO_ACTIVE_LOW>,
17                      <&gpio0 4 GPIO_ACTIVE_LOW>;
18          no-ghostkey-check;
19  };
20
21compatible: "gpio-kbd-matrix"
22
23include:
24  - name: kbd-matrix-common.yaml
25    property-blocklist:
26      - row-size
27      - col-size
28
29properties:
30  row-gpios:
31    type: phandle-array
32    required: true
33    description: |
34      GPIO for the keyboard matrix rows, up to 8 different GPIOs. All row GPIO
35      pins must have interrupt support if idle-mode is set to "interrupt"
36      (default).
37
38  col-gpios:
39    type: phandle-array
40    required: true
41    description: |
42      GPIO for the keyboard matrix columns, supports up to 32 different GPIOs.
43      When unselected, this pin will be either driven to inactive state or
44      configured to high impedance (input) depending on the col-drive-inactive
45      property.
46
47  col-drive-inactive:
48    type: boolean
49    description: |
50      If enabled, unselected column GPIOs will be driven to inactive state.
51      Default to configure unselected column GPIOs to high impedance.
52
53  idle-mode:
54    type: string
55    default: "interrupt"
56    enum:
57      - "interrupt"
58      - "poll"
59      - "scan"
60    description: |
61      Controls the driver behavior on idle, "interrupt" waits for a new key
62      press using GPIO interrupts on the row lines, "poll"  periodically polls
63      the row lines with all the columns selected, "scan" just keep scanning
64      the matrix continuously, requires "poll-timeout-ms" to be set to 0.
65