u-boot/drivers
Alper Nebi Yasak 6900797678 cros_ec: Support keyboard scanning with EC_CMD_GET_NEXT_EVENT
The cros_ec_keyb driver currently uses EC_CMD_MKBP_STATE to scan the
keyboard, but this host command was superseded by EC_CMD_GET_NEXT_EVENT
and unavailable on more recent devices (including gru-kevin), as it was
removed in cros-ec commit 87a071941b89 ("mkbp: Add support for buttons
and switches.") dated 2016-07-06.

The EC_CMD_GET_NEXT_EVENT has been available since cros-ec commit
d1ed75815efe ("MKBP event signalling implementation") dated 2014-10-20,
but it looks like it isn't included in firmware-* branches for at least
link, nyan-big, samus, snow, spring, panther and peach-pit which have
defconfigs in U-Boot. So this patch falls back to the old method if the
EC doesn't recognize the newer command.

The implementation is mostly adapted from Depthcharge commit
f88af26b44fc ("cros_ec: Change keyboard scanning method.").

On a gru-kevin, the current driver before this patch fails to read the
pressed keys with:

    out: cmd=0x60: 03 9d 60 00 00 00 00 00
    in-header: 03 fc 01 00 00 00 00 00
    in-data:
    ec_command_inptr: len=-1, din=0000000000000000
    check_for_keys: keyboard scan failed

However the keyboard works fine with the newer command:

    out: cmd=0x67: 03 96 67 00 00 00 00 00
    in-header: 03 ef 00 00 0e 00 00 00
    in-data: 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    ec_command_inptr: len=14, din=00000000f412df30
    key_matrix_decode: num_keys = 0
      0 valid keycodes found
    out: cmd=0x67: 03 96 67 00 00 00 00 00
    in-header: 03 df 00 00 0e 00 00 00
    in-data: 00 00 00 00 00 00 00 00 00 00 00 00 10 00
    ec_command_inptr: len=14, din=00000000f412df30
    key_matrix_decode: num_keys = 1
      valid=1, row=4, col=11
        keycode=28
      1 valid keycodes found
     {0d}

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-11-05 09:11:31 -07:00
..
adc adc: Drop dm.h header file 2020-08-03 22:19:54 -04:00
ata ata: dwc-ahci: change trace level for phy errors managed by uclass 2020-09-08 08:46:32 -04:00
axi common: Drop linux/bitops.h from common header 2020-05-18 21:19:23 -04:00
bios_emulator common: Drop linux/delay.h from common header 2020-05-18 21:19:23 -04:00
block xen: pvblock: Add initial support for para-virtualized block driver 2020-08-14 15:18:30 -04:00
board common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
bootcount bootcount_ext: Add Ext4 build dependency 2020-06-02 17:27:04 -04:00
bus bus: uniphier-system-bus: move hardware init from board files 2020-07-11 21:30:21 +09:00
button dm: button: add a driver for button driven by gpio 2020-07-28 19:30:39 -06:00
cache common: Drop linux/bitops.h from common header 2020-05-18 21:19:23 -04:00
clk Merge tag 'u-boot-rockchip-20201031' of https://gitlab.denx.de/u-boot/custodians/u-boot-rockchip 2020-10-30 23:13:13 -04:00
core of-platdata and dtoc improvements 2020-10-30 15:24:30 -04:00
cpu First set of u-boot-atmel features for 2021.01 cycle 2020-10-05 10:54:27 -04:00
crypto crypto/fsl: add RNG support 2020-07-27 14:16:29 +05:30
ddr ARM: mvebu: a38x: Fix comment typo 2020-10-22 11:26:14 -04:00
demo common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
dfu dfu: add dfu_write_by_alt() 2020-10-30 14:20:27 +01:00
dma Merge tag 'ti-v2021.01-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-ti 2020-10-12 07:26:57 -04:00
fastboot fastboot: getvar: fix partition-size return value 2020-09-01 14:47:43 +02:00
firmware firmware: zynqmp: Swap addr_hi/low when PM_FPGA_LOAD is called 2020-10-27 08:13:31 +01:00
fpga arm: socfpga: agilex: Enable FPGA Full Reconfiguration support 2020-10-09 17:53:12 +08:00
gpio gpio: mpc8xxx: support fsl-layerscape platform 2020-10-23 16:52:09 +05:30
hwspinlock common: Drop linux/bitops.h from common header 2020-05-18 21:19:23 -04:00
i2c dm: Add a test for of-platdata parent information 2020-10-29 14:42:18 -06:00
input cros_ec: Support keyboard scanning with EC_CMD_GET_NEXT_EVENT 2020-11-05 09:11:31 -07:00
led led: gpio: Default to using node name if label is absent 2020-10-08 11:42:36 -04:00
mailbox mailbox: zynqmp: Extend timeout for getting observation bit 2020-10-27 08:13:31 +01:00
memory memory: stm32-fmc2-ebi: add STM32 FMC2 EBI controller driver 2020-08-13 09:53:34 +02:00
misc cros_ec: Support keyboard scanning with EC_CMD_GET_NEXT_EVENT 2020-11-05 09:11:31 -07:00
mmc of-platdata and dtoc improvements 2020-10-30 15:24:30 -04:00
mtd Merge https://gitlab.denx.de/u-boot/custodians/u-boot-marvell 2020-10-29 11:30:29 -04:00
mux drivers: mux: mmio-based syscon mux controller 2020-10-28 11:49:30 -04:00
net Merge https://gitlab.denx.de/u-boot/custodians/u-boot-fsl-qoriq 2020-10-29 09:10:24 -04:00
nvme nvme: Invalidate dcache before submitting admin cmd 2020-06-23 14:43:23 -04:00
pch common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
pci dm: pci: fsl: Correct the workaround of erratum A-007815 2020-10-23 16:52:09 +05:30
pci_endpoint Merge https://gitlab.denx.de/u-boot/custodians/u-boot-fsl-qoriq 2020-07-27 15:18:15 -04:00
phy phy: marvell: cp110: update mode parameter for pcie power on calls 2020-10-29 08:00:12 +01:00
pinctrl pinctrl: renesas: pfc-r8a77990: Sync PFC tables with Linux 5.9 2020-10-20 12:56:52 +02:00
power power: regulator: gpio-regulator: Convert to use APIs which support live DT 2020-10-23 13:33:07 -04:00
pwm pwm: Add driver for Amlogic Meson PWM controller 2020-10-05 18:02:16 +02:00
qe net, qe: add DM support for QE UEC ethernet 2020-09-17 06:09:53 +02:00
ram Merge tag 'u-boot-rockchip-20201031' of https://gitlab.denx.de/u-boot/custodians/u-boot-rockchip 2020-10-30 23:13:13 -04:00
remoteproc remoteproc: k3: Fix not calling dev_xxx with a device 2020-09-30 08:53:42 -04:00
reset cosmetic: reset: ast2500: Rename driver and configs 2020-10-22 11:26:14 -04:00
rng rng: Add Qualcomm MSM PRNG driver 2020-10-22 09:54:54 -04:00
rtc Pull request for UEFI sub-system for efi-2021-01-rc2 (2) 2020-11-01 10:56:37 -05:00
scsi common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
serial of-platdata and dtoc improvements 2020-10-30 15:24:30 -04:00
smem soc: qualcomm: Fix not calling dev_err with a device 2020-09-30 08:53:43 -04:00
soc soc: soc_ti_k3: Add device identification for J7200 SoC 2020-08-11 20:34:46 +05:30
sound dm: acpi: Use correct GPIO polarity type in acpi_dp_add_gpio() 2020-09-25 11:27:14 +08:00
spi of-platdata and dtoc improvements 2020-10-30 15:24:30 -04:00
spmi treewide: convert devfdt_get_addr() to dev_read_addr() 2020-07-25 14:46:57 -06:00
sysreset sandbox: implement reset 2020-11-05 09:11:30 -07:00
tee tee: optee: Include device_compat.h 2020-10-16 09:44:27 -04:00
thermal thermal: imx_scu_thermal: prevent boot hang with zero pdata 2020-05-22 13:29:25 +02:00
timer riscv: Move timer portions of SiFive CLINT to drivers/timer 2020-10-26 10:01:28 +08:00
tpm tpm: cr50: Correct logging statements 2020-10-22 09:54:52 -04:00
ufs ufs: Drop dm.h header file 2020-08-03 22:19:54 -04:00
usb usb: gadget: Add bcdDevice for the MTU3 USB Gadget Controller 2020-10-20 00:49:05 +02:00
video Merge tag 'u-boot-rockchip-20201031' of https://gitlab.denx.de/u-boot/custodians/u-boot-rockchip 2020-10-30 23:13:13 -04:00
virtio virtio_blk: set log2blksz correctly 2020-08-24 14:11:31 -04:00
w1 treewide: convert devfdt_get_addr() to dev_read_addr() 2020-07-25 14:46:57 -06:00
w1-eeprom common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
watchdog watchdog: octeontx_wdt: Add support for start and stop 2020-10-16 13:55:04 +02:00
xen xen: Code style conformity 2020-08-24 14:11:31 -04:00
Kconfig drivers: Add a new framework for multiplexer devices 2020-10-28 11:48:32 -04:00
Makefile drivers: Add a new framework for multiplexer devices 2020-10-28 11:48:32 -04:00