realtek,bee-keyscan

Description

Bee Keyscan.

The Bee Keyscan should be used with an external keyscan matrix.
There is a total of 12 rows and 20 columns.
You can assign any available pins to row or colunm by pinctrl.
The rows and columns need to be indexed starting from 0.

Examples

&keyscan {
      pinctrl-0 = <&keyscan_default>;
      pinctrl-names = "default";
      row-size = <2>;
      col-size = <2>;
      debounce-down-ms = <10>;
      debounce-up-ms = <10>;
      poll-period-us = <10000>;
      release-time-us = <10000>;
      status = "okay";
  };

&pinctrl {
    keyscan_default: keyscan_default {
        group1 {
          psels = <BEE_PSEL(KEY_COL_0, P0_6)>,
                  <BEE_PSEL(KEY_COL_1, P0_7)>;
          output-enable;
          output-low;
          bias-disable;
        };

        group2 {
          psels = <BEE_PSEL(KEY_ROW_0, P2_4)>,
                  <BEE_PSEL(KEY_ROW_1, P2_5)>;
          output-disable;
          bias-pull-up;
          bias-pull-strong;
        };
    };
};

Properties

Properties not inherited from the base binding file.

Name

Type

Details

pinctrl-0

phandles

Pin configuration/s for the first state. Content is specific to the
selected pin controller driver implementation.

This property is required.

pinctrl-names

string-array

Names for the provided states. The number of names needs to match the
number of states.

This property is required.

row-size

int

Actual row size of the external keyscan matrix.
Hardware supports up to 12 rows.

This property is required.

Default value: 2

col-size

int

Actual column size of the external keyscan matrix.
Hardware supports up to 20 columns.

This property is required.

Default value: 2

scan-div

int

Clock divider for the Keyscan scanning clock.
Formula: scan_clock = source_clock / (scan-div + 1).
Assuming the source_clock is 5MHz, the default value 1 results in a 2.5MHz scan_clock.
Maximum value: 65535.

Default value: 1

delay-div

int

Clock divider for the Keyscan delay clock (used for debounce, poll interval and release).
Formula: delay_clock = scan_clock / (delay-div + 1).
With the default 2.5MHz scan_clock, the default value 49 results in a 50kHz delay_clock.
Maximum value: 255.
poll-period-us and release-time-us each depend on the delay_clock period
(T_delay = 1 / delay_clock), and each has its own maximum of 512 ticks.
With the default 50kHz delay_clock (20us period), all three properties have:
  - Resolution: 20us
  - Range: 0 to 10240us

Default value: 49

poll-period-us

int

Keyscan interval during scans, in microseconds.

In manual mode, there is no hardware limit on this value because key
scanning is driven by a software timer.

In auto mode, the allowed range depends on the delay clock period
(T_delay = 1 / delay_clock) and the maximum delay counter value
(512 ticks).

Default value: 5000

release-time-us

int

Time to detect all keys released in auto-scan mode.

Default value: 5000

stable-poll-period-us

int

Defines the poll period in usecs between matrix scans when the matrix is
stable, defaults to poll-period-us value if unspecified.

poll-timeout-ms

int

How long to wait before going from polling back to idle state. Defaults
to 100ms if unspecified.

Default value: 100

debounce-down-ms

int

Debouncing time for a key press event. Defaults to 10ms if unspecified.

Default value: 10

debounce-up-ms

int

Debouncing time for a key release event. Defaults to 20ms if unspecified.

Default value: 20

settle-time-us

int

Delay between setting column output and reading the row values. Defaults
to 50us if unspecified.

Default value: 50

actual-key-mask

array

Keyboard scanning mask. For each keyboard column, specify which keyboard rows actually exist. Can be used to avoid triggering the ghost detection on non existing keys. No masking by default, any combination is valid.

no-ghostkey-check

boolean

Ignore the ghost key checking in the driver if the diodes are used
in the matrix hardware.

pinctrl-1

phandles

Pin configuration/s for the second state. See pinctrl-0.

pinctrl-2

phandles

Pin configuration/s for the third state. See pinctrl-0.

pinctrl-3

phandles

Pin configuration/s for the fourth state. See pinctrl-0.

pinctrl-4

phandles

Pin configuration/s for the fifth state. See pinctrl-0.