diff options
author | Scott Collyer <scollyer@google.com> | 2018-08-01 16:49:27 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-08-08 23:52:11 -0700 |
commit | 0053a564e8ed3b529a599aea2e1bd10bce6be60b (patch) | |
tree | 0f3fd748f2f736601634398a3edf22ac5cc3a9c4 | |
parent | eb980c168c5e8c9242f79f3aa97bfb3efb35e851 (diff) | |
download | chrome-ec-0053a564e8ed3b529a599aea2e1bd10bce6be60b.tar.gz |
DragonEgg: Add config options and task for keyboard scan
Keyboard scan was not working as the KEYSCAN task was not added and
some of the keyboard config options were not defined.
BUG=b:112110028
BRANCH=none
TEST=Verified that keyboard inputs are received now and sent to AP
Change-Id: I36c053d807e83477e044857f5087dcccdf891bfa
Signed-off-by: Scott Collyer <scollyer@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1159835
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
-rw-r--r-- | baseboard/dragonegg/baseboard.c | 22 | ||||
-rw-r--r-- | baseboard/dragonegg/baseboard.h | 8 | ||||
-rw-r--r-- | board/dragonegg/board.c | 8 | ||||
-rw-r--r-- | board/dragonegg/board.h | 9 | ||||
-rw-r--r-- | board/dragonegg/ec.tasklist | 1 |
5 files changed, 43 insertions, 5 deletions
diff --git a/baseboard/dragonegg/baseboard.c b/baseboard/dragonegg/baseboard.c index e4353cbe4e..678d84d040 100644 --- a/baseboard/dragonegg/baseboard.c +++ b/baseboard/dragonegg/baseboard.c @@ -16,6 +16,7 @@ #include "gpio.h" #include "hooks.h" #include "i2c.h" +#include "keyboard_scan.h" #include "power.h" #include "timer.h" #include "util.h" @@ -32,6 +33,27 @@ #define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args) /******************************************************************************/ +/* Keyboard scan setting */ +struct keyboard_scan_config keyscan_config = { + /* + * F3 key scan cycle completed but scan input is not + * charging to logic high when EC start scan next + * column for "T" key, so we set .output_settle_us + * to 80us from 50us. + */ + .output_settle_us = 80, + .debounce_down_us = 9 * MSEC, + .debounce_up_us = 30 * MSEC, + .scan_period_us = 3 * MSEC, + .min_post_scan_delay_us = 1000, + .poll_timeout_us = 100 * MSEC, + .actual_key_mask = { + 0x14, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xff, + 0xa4, 0xff, 0xfe, 0x55, 0xfa, 0xca /* full set */ + }, +}; + +/******************************************************************************/ /* Wake up pins */ const enum gpio_signal hibernate_wake_pins[] = { GPIO_LID_OPEN, diff --git a/baseboard/dragonegg/baseboard.h b/baseboard/dragonegg/baseboard.h index 29c52bb295..535d1731c7 100644 --- a/baseboard/dragonegg/baseboard.h +++ b/baseboard/dragonegg/baseboard.h @@ -21,10 +21,18 @@ /* #define CONFIG_POWER_TRACK_HOST_SLEEP_STATE */ /* EC Defines */ +#define CONFIG_PWM #define CONFIG_VBOOT_HASH #define CONFIG_VSTORE #define CONFIG_VSTORE_SLOT_COUNT 1 +/* Common Keyboard Defines */ +#define CONFIG_CMD_KEYBOARD +#define CONFIG_KEYBOARD_BOARD_CONFIG +#define CONFIG_KEYBOARD_PROTOCOL_8042 +#define CONFIG_KEYBOARD_COL2_INVERTED +#define CONFIG_KEYBOARD_PWRBTN_ASSERTS_KSI2 + /* Common charger defines */ #define CONFIG_CHARGE_MANAGER /* TODO (b/111309500): Enable this option when support for MAX14637 is added */ diff --git a/board/dragonegg/board.c b/board/dragonegg/board.c index e192af33c9..162f596b38 100644 --- a/board/dragonegg/board.c +++ b/board/dragonegg/board.c @@ -15,6 +15,7 @@ #include "lid_switch.h" #include "power.h" #include "power_button.h" +#include "pwm_chip.h" #include "spi.h" #include "switch.h" #include "system.h" @@ -36,6 +37,13 @@ const struct spi_device_t spi_devices[] = { }; const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices); +/******************************************************************************/ +/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */ +const struct pwm_t pwm_channels[] = { + [PWM_CH_KBLIGHT] = { .channel = 0, .flags = 0, .freq_hz = 100 }, +}; +BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); + /* GPIO to enable/disable the USB Type-A port. */ const int usb_port_enable[CONFIG_USB_PORT_POWER_SMART_PORT_COUNT] = { GPIO_EN_USB_A_5V, diff --git a/board/dragonegg/board.h b/board/dragonegg/board.h index 17549b3d49..0f6c83a3ee 100644 --- a/board/dragonegg/board.h +++ b/board/dragonegg/board.h @@ -13,16 +13,14 @@ /* Optional features */ #define CONFIG_SYSTEM_UNLOCKED /* Allow dangerous commands while in dev. */ - -#define CONFIG_KEYBOARD_BOARD_CONFIG -#define CONFIG_KEYBOARD_PROTOCOL_8042 #define CONFIG_LOW_POWER_IDLE - #define CONFIG_HOSTCMD_ESPI - #undef CONFIG_UART_TX_BUF_SIZE #define CONFIG_UART_TX_BUF_SIZE 4096 +/* Keyboard features */ +#define CONFIG_PWM_KBLIGHT + /* USB and USBC features */ #define CONFIG_USB_PORT_POWER_SMART #undef CONFIG_USB_PORT_POWER_SMART_PORT_COUNT @@ -54,6 +52,7 @@ enum adc_channel { }; enum pwm_channel { + PWM_CH_KBLIGHT, PWM_CH_COUNT }; diff --git a/board/dragonegg/ec.tasklist b/board/dragonegg/ec.tasklist index b6092a60a2..afe7ed4aa0 100644 --- a/board/dragonegg/ec.tasklist +++ b/board/dragonegg/ec.tasklist @@ -29,5 +29,6 @@ TASK_ALWAYS(HOSTCMD, host_command_task, NULL, LARGER_TASK_STACK_SIZE) \ TASK_ALWAYS(CONSOLE, console_task, NULL, VENTI_TASK_STACK_SIZE) \ TASK_ALWAYS(POWERBTN, power_button_task, NULL, LARGER_TASK_STACK_SIZE) \ + TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, TASK_STACK_SIZE) \ TASK_ALWAYS(PD_C0, pd_task, NULL, LARGER_TASK_STACK_SIZE) |