summaryrefslogtreecommitdiff
path: root/board/galtic
diff options
context:
space:
mode:
authorMichael5 Chen <michael5_chen1@pegatron.corp-partner.google.com>2020-12-17 21:52:08 +0800
committerCommit Bot <commit-bot@chromium.org>2020-12-22 02:32:55 +0000
commitf4433328164d2a57dfe9dd0b0ae908e6786f1852 (patch)
tree799a2e7b8cc1377a0a744d0480bc81bc6bdd2e50 /board/galtic
parent453c5bca2181c26697042ff0512ab045cc46f338 (diff)
downloadchrome-ec-f4433328164d2a57dfe9dd0b0ae908e6786f1852.tar.gz
galtic: Implement keyboard function.
The galtic/galnat keyboard without keyboard numpad. The galith keyboard with keyboard numpad. BUG=b:175857578 BRANCH=dedede TEST=make BOARD=galtic Signed-off-by: Michael5 Chen <michael5_chen1@pegatron.corp-partner.google.com> Change-Id: I6c143105e67fab207ef50be87ea06caa22e59107 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2597128 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'board/galtic')
-rw-r--r--board/galtic/board.c56
-rw-r--r--board/galtic/board.h5
2 files changed, 61 insertions, 0 deletions
diff --git a/board/galtic/board.c b/board/galtic/board.c
index 1ed1511ab6..b0f52fb21a 100644
--- a/board/galtic/board.c
+++ b/board/galtic/board.c
@@ -7,6 +7,7 @@
#include "adc_chip.h"
#include "button.h"
+#include "cbi_fw_config.h"
#include "charge_manager.h"
#include "charge_state_v2.h"
#include "charger.h"
@@ -21,6 +22,7 @@
#include "gpio.h"
#include "hooks.h"
#include "intc.h"
+#include "keyboard_raw.h"
#include "keyboard_scan.h"
#include "lid_switch.h"
#include "power.h"
@@ -234,6 +236,49 @@ const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
+static const struct ec_response_keybd_config galith_kb = {
+ .num_top_row_keys = 10,
+ .action_keys = {
+ TK_BACK, /* T1 */
+ TK_REFRESH, /* T2 */
+ TK_FULLSCREEN, /* T3 */
+ TK_OVERVIEW, /* T4 */
+ TK_SNAPSHOT, /* T5 */
+ TK_BRIGHTNESS_DOWN, /* T6 */
+ TK_BRIGHTNESS_UP, /* T7 */
+ TK_VOL_MUTE, /* T8 */
+ TK_VOL_DOWN, /* T9 */
+ TK_VOL_UP, /* T10 */
+ },
+ .capabilities = KEYBD_CAP_SCRNLOCK_KEY | KEYBD_CAP_NUMERIC_KEYPAD,
+};
+
+static const struct ec_response_keybd_config galtic_kb = {
+ .num_top_row_keys = 10,
+ .action_keys = {
+ TK_BACK, /* T1 */
+ TK_FORWARD, /* T2 */
+ TK_REFRESH, /* T3 */
+ TK_FULLSCREEN, /* T4 */
+ TK_SNAPSHOT, /* T5 */
+ TK_BRIGHTNESS_DOWN, /* T6 */
+ TK_BRIGHTNESS_UP, /* T7 */
+ TK_VOL_MUTE, /* T8 */
+ TK_VOL_DOWN, /* T9 */
+ TK_VOL_UP, /* T10 */
+ },
+ .capabilities = KEYBD_CAP_SCRNLOCK_KEY,
+};
+
+__override const struct ec_response_keybd_config
+*board_vivaldi_keybd_config(void)
+{
+ if (get_cbi_fw_config_numeric_pad() == NUMERIC_PAD_PRESENT)
+ return &galith_kb;
+ else
+ return &galtic_kb;
+}
+
void board_init(void)
{
int on;
@@ -258,6 +303,17 @@ void board_init(void)
on = chipset_in_state(CHIPSET_STATE_ON | CHIPSET_STATE_ANY_SUSPEND |
CHIPSET_STATE_SOFT_OFF);
board_power_5v_enable(on);
+
+ if (get_cbi_fw_config_numeric_pad() == NUMERIC_PAD_ABSENT) {
+ /* Disable scanning KSO13 and 14 if keypad isn't present. */
+ keyboard_raw_set_cols(KEYBOARD_COLS_NO_KEYPAD);
+ } else {
+ /* Setting scan mask KSO11, KSO12, KSO13 and KSO14 */
+ keyscan_config.actual_key_mask[11] = 0xfe;
+ keyscan_config.actual_key_mask[12] = 0xff;
+ keyscan_config.actual_key_mask[13] = 0xff;
+ keyscan_config.actual_key_mask[14] = 0xff;
+ }
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
diff --git a/board/galtic/board.h b/board/galtic/board.h
index f152dba213..c5e15f757b 100644
--- a/board/galtic/board.h
+++ b/board/galtic/board.h
@@ -83,6 +83,11 @@
#define CONFIG_USBC_RETIMER_TUSB544 /* C1 Redriver: TUSB544 */
+/* Keyboard */
+#define CONFIG_KEYBOARD_VIVALDI
+#define CONFIG_KEYBOARD_REFRESH_ROW3
+#define CONFIG_KEYBOARD_KEYPAD
+
#ifndef __ASSEMBLER__
#include "gpio_signal.h"