diff options
author | Rob Barnes <robbarnes@google.com> | 2021-01-22 14:08:18 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-01-25 21:46:00 +0000 |
commit | 8aefdfec0778835098bdde541b8d42d126aab052 (patch) | |
tree | da29c252d0a888f37cceee1055e524c817f730c3 | |
parent | 10a919e0124ac226f299c18b7819dcce7cead3a2 (diff) | |
download | chrome-ec-8aefdfec0778835098bdde541b8d42d126aab052.tar.gz |
guybrush: Configure keyboard
Configure keyboard based on zork.
Enable keyboard tasks.
Enable pwm for keyboard backlight.
BUG=b:178213641
BRANCH=None
TEST=Build
Signed-off-by: Rob Barnes <robbarnes@google.com>
Change-Id: Iae9d31c9849a3500dbd000829bd1439901a6d1b6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2645076
Reviewed-by: Diana Z <dzigterman@chromium.org>
-rw-r--r-- | baseboard/guybrush/base_ec.tasklist | 2 | ||||
-rw-r--r-- | baseboard/guybrush/baseboard.c | 49 | ||||
-rw-r--r-- | baseboard/guybrush/baseboard.h | 25 |
3 files changed, 74 insertions, 2 deletions
diff --git a/baseboard/guybrush/base_ec.tasklist b/baseboard/guybrush/base_ec.tasklist index cb567355ef..434d4d54ed 100644 --- a/baseboard/guybrush/base_ec.tasklist +++ b/baseboard/guybrush/base_ec.tasklist @@ -14,8 +14,10 @@ TASK_ALWAYS(USB_CHG_P1, usb_charger_task, 1, TASK_STACK_SIZE) \ TASK_ALWAYS(CHARGER, charger_task, NULL, VENTI_TASK_STACK_SIZE) \ TASK_NOTEST(CHIPSET, chipset_task, NULL, VENTI_TASK_STACK_SIZE) \ + TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, TASK_STACK_SIZE) \ TASK_ALWAYS(HOSTCMD, host_command_task, NULL, LARGER_TASK_STACK_SIZE) \ TASK_ALWAYS(POWERBTN, power_button_task, NULL, VENTI_TASK_STACK_SIZE) \ + TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, LARGER_TASK_STACK_SIZE) \ TASK_ALWAYS(CONSOLE, console_task, NULL, VENTI_TASK_STACK_SIZE) \ TASK_ALWAYS(PD_C0, pd_task, NULL, VENTI_TASK_STACK_SIZE) \ TASK_ALWAYS(PD_C1, pd_task, NULL, VENTI_TASK_STACK_SIZE) \ diff --git a/baseboard/guybrush/baseboard.c b/baseboard/guybrush/baseboard.c index b166167761..be4eebe144 100644 --- a/baseboard/guybrush/baseboard.c +++ b/baseboard/guybrush/baseboard.c @@ -8,12 +8,14 @@ #include "adc.h" #include "adc_chip.h" #include "battery_fuel_gauge.h" -#include "chipset.h" #include "charge_manager.h" #include "charge_ramp.h" #include "charge_state.h" #include "charge_state_v2.h" #include "charger.h" +#include "chip/npcx/ps2_chip.h" +#include "chip/npcx/pwm_chip.h" +#include "chipset.h" #include "driver/ppc/aoz1380.h" #include "driver/ppc/nx20p348x.h" #include "driver/tcpm/nct38xx.h" @@ -23,9 +25,11 @@ #include "i2c.h" #include "ioexpander.h" #include "isl9241.h" +#include "keyboard_scan.h" #include "nct38xx.h" #include "pi3usb9201.h" #include "power.h" +#include "pwm.h" #include "temp_sensor.h" #include "thermal.h" #include "thermistor.h" @@ -403,6 +407,49 @@ struct ioexpander_config_t ioex_config[] = { BUILD_ASSERT(ARRAY_SIZE(ioex_config) == USBC_PORT_COUNT); BUILD_ASSERT(CONFIG_IO_EXPANDER_PORT_COUNT == USBC_PORT_COUNT); +/* 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 + */ + .output_settle_us = 80, + .debounce_down_us = 6 * MSEC, + .debounce_up_us = 30 * MSEC, + .scan_period_us = 1500, + .min_post_scan_delay_us = 1000, + .poll_timeout_us = SECOND, + .actual_key_mask = { + 0x3c, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xff, + 0xa4, 0xff, 0xfe, 0x55, 0xfa, 0xca /* full set */ + }, +}; + +const struct pwm_t pwm_channels[] = { + [PWM_CH_FAN] = { + .channel = 0, + .flags = PWM_CONFIG_OPEN_DRAIN, + .freq = 25000, + }, + [PWM_CH_KBLIGHT] = { + .channel = 1, + .flags = PWM_CONFIG_DSLEEP, + .freq = 100, + }, + [PWM_CH_LED_CHRG] = { + .channel = 2, + .flags = PWM_CONFIG_DSLEEP, + .freq = 100, + }, + [PWM_CH_LED_FULL] = { + .channel = 3, + .flags = PWM_CONFIG_DSLEEP, + .freq = 100, + }, +}; +BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); int board_set_active_charge_port(int port) { diff --git a/baseboard/guybrush/baseboard.h b/baseboard/guybrush/baseboard.h index f4998580ec..adbf1d1228 100644 --- a/baseboard/guybrush/baseboard.h +++ b/baseboard/guybrush/baseboard.h @@ -66,13 +66,23 @@ #define GPIO_WP_L GPIO_EC_WP_L /* Host communication */ +#define CONFIG_HOSTCMD_ESPI +#define CONFIG_MKBP_EVENT +#define CONFIG_MKBP_USE_GPIO_AND_HOST_EVENT +#define GPIO_EC_INT_L GPIO_EC_SOC_INT_L /* Chipset config */ #define CONFIG_CHIPSET_STONEY #define CONFIG_CHIPSET_CAN_THROTTLE #define CONFIG_CHIPSET_RESET_HOOK -/* Common Keyboard Defines */ +/* Keyboard Config */ +#define CONFIG_KEYBOARD_BACKLIGHT +#define CONFIG_KEYBOARD_BOARD_CONFIG +#define CONFIG_KEYBOARD_COL2_INVERTED +#define CONFIG_KEYBOARD_PROTOCOL_8042 +#define CONFIG_KEYBOARD_VIVALDI +#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV /* Sensors */ #define CONFIG_TABLET_MODE @@ -216,6 +226,10 @@ /* Fan features */ +/* LED Config */ +#define CONFIG_PWM +#define CONFIG_PWM_KBLIGHT + #ifndef __ASSEMBLER__ #include "gpio_signal.h" @@ -271,6 +285,15 @@ enum battery_type { BATTERY_TYPE_COUNT, }; +/* PWM Channels */ +enum pwm_channel { + PWM_CH_FAN = 0, + PWM_CH_KBLIGHT, + PWM_CH_LED_CHRG, + PWM_CH_LED_FULL, + PWM_CH_COUNT +}; + /* Common definition for the USB PD interrupt handlers. */ void tcpc_alert_event(enum gpio_signal signal); void bc12_interrupt(enum gpio_signal signal); |