kbscan: Switch from GPIO mode to KBS (Normal) mode

Use the default mode for reading the keyboard scan matrix when being
used as a keyboard. There should be no perceived change in behavior, but
should make the code easier to understand.

Note: `KSO[17:16]` are configured by `GPCRC` on boards that use them.
They are now set to alternate function to use in KBS mode rather than
GPIO mode, with the pull-up enabled to prevent them from floating when
configured as open-drain.

As part of this change, we now only read the hardware matrix state once
upfront, instead of on every iteration through the loop applying the
logic.

Tested by verifying that typing still works on darp9.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
This commit is contained in:
Tim Crawford
2023-06-02 12:13:49 -06:00
committed by Jeremy Soller
parent 546458e368
commit 0f2ff7e540
21 changed files with 103 additions and 126 deletions

View File

@ -128,11 +128,11 @@ void gpio_init() {
// SMD_VGA_THERM
GPCRC2 = GPIO_ALT | GPIO_UP;
// KB_SO16
GPCRC3 = GPIO_IN;
GPCRC3 = GPIO_ALT | GPIO_UP;
// CNVI_DET#
GPCRC4 = GPIO_IN | GPIO_UP;
// KB_SO17
GPCRC5 = GPIO_IN;
GPCRC5 = GPIO_ALT | GPIO_UP;
// PM_PWROK
GPCRC6 = GPIO_OUT;
// BKL_EN