diff options
author | Ben Chen <ben.chen2@quanta.corp-partner.google.com> | 2021-01-19 19:24:56 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-01-28 06:34:47 +0000 |
commit | d6df35e977a68ed7f58e761eb2550609f343208a (patch) | |
tree | fd864914db1c637397b5f9bb9a578727d86c8e2e /board/magolor | |
parent | 302eff661a321bee4bb6420c490f6610e8e48c23 (diff) | |
download | chrome-ec-d6df35e977a68ed7f58e761eb2550609f343208a.tar.gz |
magolor: Support keypad function
1. Using CONFIG_KEYBOARD_KEYPAD to choose actual_key_mask w or w/o keypad.
2. Enable keypad function on Magpie.
3. Disable scan KSO13 & 14 and modify actual_key_mask for SKU w/o keypad
on Magolor.
BUG=b:173908972
BRANCH=cros/main
TEST=`make buildall` both PASS
Change-Id: Ia23945f01ca142926551fe3f5a6bb83e43e29ff2
Signed-off-by: Ben Chen <ben.chen2@quanta.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2637163
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Henry Sun <henrysun@google.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'board/magolor')
-rw-r--r-- | board/magolor/board.c | 57 | ||||
-rw-r--r-- | board/magolor/board.h | 4 |
2 files changed, 56 insertions, 5 deletions
diff --git a/board/magolor/board.c b/board/magolor/board.c index 8a4a083343..e9fcba566d 100644 --- a/board/magolor/board.c +++ b/board/magolor/board.c @@ -9,6 +9,7 @@ #include "button.h" #include "cbi_fw_config.h" #include "cbi_ssfc.h" +#include "cbi_fw_config.h" #include "charge_manager.h" #include "charge_state_v2.h" #include "charger.h" @@ -32,6 +33,8 @@ #include "gpio.h" #include "hooks.h" #include "i2c.h" +#include "keyboard_config.h" +#include "keyboard_raw.h" #include "keyboard_scan.h" #include "lid_switch.h" #include "motion_sense.h" @@ -68,6 +71,27 @@ const int usb_port_enable[USB_PORT_COUNT] = { GPIO_EN_USB_A1_VBUS, }; +#ifdef BOARD_MAGOLOR +/* 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, 0xfe, 0xff, 0xff, 0xff, /* full set */ + }, +}; +#endif /* C0 interrupt line shared by BC 1.2 and charger */ static void check_c0_line(void); @@ -190,7 +214,6 @@ const struct temp_sensor_t temp_sensors[] = { }; BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); - const static struct ec_thermal_config thermal_a = { .temp_host = { [EC_TEMP_THRESH_WARN] = 0, @@ -225,6 +248,24 @@ static void setup_thermal(void) thermal_params[TEMP_SENSOR_2] = thermal_b; } +#ifdef BOARD_MAGOLOR +static void board_update_no_keypad_by_fwconfig(void) +{ + if (!get_cbi_fw_config_numeric_pad()) { +#ifndef TEST_BUILD + /* Disable scanning KSO13 & 14 if keypad isn't present. */ + keyboard_raw_set_cols(KEYBOARD_COLS_NO_KEYPAD); + keyscan_config.actual_key_mask[11] = 0xfa; + keyscan_config.actual_key_mask[12] = 0xca; + + /* Search key is moved back to col=1,row=0 */ + keyscan_config.actual_key_mask[0] = 0x14; + keyscan_config.actual_key_mask[1] = 0xff; +#endif + } +} +#endif + void board_hibernate(void) { /* @@ -591,7 +632,7 @@ void board_init(void) /* Enable gpio interrupt for base accelgyro sensor */ gpio_enable_interrupt(GPIO_BASE_SIXAXIS_INT_L); if (get_cbi_fw_config_tablet_mode()) { - #ifdef BOARD_MAGOLOR +#ifdef BOARD_MAGOLOR if (get_cbi_ssfc_base_sensor() == SSFC_SENSOR_ICM426XX) { motion_sensors[BASE_ACCEL] = icm426xx_base_accel; motion_sensors[BASE_GYRO] = icm426xx_base_gyro; @@ -604,7 +645,7 @@ void board_init(void) ccprints("LID_ACCEL is KX022"); } else ccprints("LID_ACCEL is BMA253"); - #endif +#endif motion_sensor_count = ARRAY_SIZE(motion_sensors); /* Enable gpio interrupt for base accelgyro sensor */ gpio_enable_interrupt(GPIO_BASE_SIXAXIS_INT_L); @@ -623,12 +664,18 @@ void board_init(void) /* Initialize THERMAL */ setup_thermal(); + +#ifdef BOARD_MAGOLOR + /* Support Keyboard Pad */ + board_update_no_keypad_by_fwconfig(); +#endif + } DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); void motion_interrupt(enum gpio_signal signal) { - #ifdef BOARD_MAGOLOR +#ifdef BOARD_MAGOLOR switch (get_cbi_ssfc_base_sensor()) { case SSFC_SENSOR_ICM426XX: icm426xx_interrupt(signal); @@ -640,7 +687,7 @@ void motion_interrupt(enum gpio_signal signal) } #else bmi160_interrupt(signal); - #endif +#endif } __override void ocpc_get_pid_constants(int *kp, int *kp_div, diff --git a/board/magolor/board.h b/board/magolor/board.h index f2bee3c30a..440f1422cf 100644 --- a/board/magolor/board.h +++ b/board/magolor/board.h @@ -51,6 +51,10 @@ #define GPIO_USB_C1_INT_ODL GPIO_SUB_USB_C1_INT_ODL /* Keyboard */ +#ifdef BOARD_MAGOLOR +#define CONFIG_KEYBOARD_BOARD_CONFIG +#define CONFIG_KEYBOARD_KEYPAD +#endif #define CONFIG_PWM_KBLIGHT /* LED defines */ |