summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevin Lu <Devin.Lu@quantatw.com>2021-08-05 15:08:19 +0800
committerCommit Bot <commit-bot@chromium.org>2021-08-06 03:31:32 +0000
commit2a787c6a01071d7304ceb1b30022b80196b85661 (patch)
tree70e97208a95a2b6e2f7ac33f49efb3d1a47b8a11
parent18350622d9c819537da60e96bb77fec82ca85308 (diff)
downloadchrome-ec-2a787c6a01071d7304ceb1b30022b80196b85661.tar.gz
redrix: Initialize the vivaldi keyboard
Redrix has 2 keyboard layouts. One for privacy screen keyboard layout. Other for default keyboard layout. BUG=b:193752537 BRANCH=none TEST=evtest, make sure the keycode is correct. Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Change-Id: I7777866d1cfe91ee940eee97bdc03e26559c2481 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3073702 Reviewed-by: caveh jalali <caveh@chromium.org>
-rw-r--r--board/redrix/board.h9
-rw-r--r--board/redrix/fw_config.c5
-rw-r--r--board/redrix/fw_config.h15
-rw-r--r--board/redrix/keyboard.c52
4 files changed, 74 insertions, 7 deletions
diff --git a/board/redrix/board.h b/board/redrix/board.h
index 927a233c08..bf616872d8 100644
--- a/board/redrix/board.h
+++ b/board/redrix/board.h
@@ -10,11 +10,6 @@
#include "compile_time_macros.h"
-/*
- * Early redrix boards are not set up for vivaldi
- */
-#undef CONFIG_KEYBOARD_VIVALDI
-
/* Baseboard features */
#include "baseboard.h"
@@ -189,6 +184,10 @@
#define CONFIG_CHARGER_SENSE_RESISTOR 10
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
+/* Keyboard features */
+#define CONFIG_KEYBOARD_VIVALDI
+#define CONFIG_KEYBOARD_REFRESH_ROW3
+
#ifndef __ASSEMBLER__
#include "gpio_signal.h" /* needed by registers.h */
diff --git a/board/redrix/fw_config.c b/board/redrix/fw_config.c
index aaeba7d3a8..e59688b17d 100644
--- a/board/redrix/fw_config.c
+++ b/board/redrix/fw_config.c
@@ -48,3 +48,8 @@ union redrix_cbi_fw_config get_fw_config(void)
{
return fw_config;
}
+
+bool ec_cfg_has_eps(void)
+{
+ return (fw_config.eps == EPS_ENABLED);
+}
diff --git a/board/redrix/fw_config.h b/board/redrix/fw_config.h
index 1abfdedaf3..6480f07b35 100644
--- a/board/redrix/fw_config.h
+++ b/board/redrix/fw_config.h
@@ -19,6 +19,11 @@ enum ec_cfg_keyboard_backlight_type {
KEYBOARD_BACKLIGHT_ENABLED = 1
};
+enum ec_cfg_eps_type {
+ EPS_DISABLED = 0,
+ EPS_ENABLED = 1
+};
+
union redrix_cbi_fw_config {
struct {
uint32_t sd_db : 2;
@@ -26,7 +31,7 @@ union redrix_cbi_fw_config {
uint32_t audio : 3;
uint32_t lte_db : 2;
uint32_t ufc : 2;
- uint32_t eps : 1;
+ enum ec_cfg_eps_type eps : 1;
uint32_t reserved_1 : 21;
};
uint32_t raw_value;
@@ -39,4 +44,12 @@ union redrix_cbi_fw_config {
*/
union redrix_cbi_fw_config get_fw_config(void);
+/**
+ * Check if the FW_CONFIG has enabled privacy screen.
+ *
+ * @return true if board supports privacy screen, false if the board
+ * doesn't support it.
+ */
+bool ec_cfg_has_eps(void);
+
#endif /* __BOARD_BRYA_FW_CONFIG_H_ */
diff --git a/board/redrix/keyboard.c b/board/redrix/keyboard.c
index a9f033130d..0e865b5a1b 100644
--- a/board/redrix/keyboard.c
+++ b/board/redrix/keyboard.c
@@ -4,7 +4,8 @@
*/
#include "common.h"
-
+#include "ec_commands.h"
+#include "fw_config.h"
#include "keyboard_scan.h"
#include "timer.h"
@@ -23,3 +24,52 @@ __override struct keyboard_scan_config keyscan_config = {
0xa4, 0xff, 0xfe, 0x55, 0xfa, 0xca /* full set */
},
};
+
+static const struct ec_response_keybd_config keybd1 = {
+ .num_top_row_keys = 13,
+ .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_MICMUTE, /* T8 */
+ TK_KBD_BKLIGHT_TOGGLE, /* T9 */
+ TK_PLAY_PAUSE, /* T10 */
+ TK_VOL_MUTE, /* T11 */
+ TK_VOL_DOWN, /* T12 */
+ TK_VOL_UP, /* T13 */
+ },
+ .capabilities = KEYBD_CAP_SCRNLOCK_KEY,
+};
+
+static const struct ec_response_keybd_config keybd2 = {
+ .num_top_row_keys = 13,
+ .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_PRIVACY_SCRN_TOGGLE, /* T8 */
+ TK_MICMUTE, /* T9 */
+ TK_KBD_BKLIGHT_TOGGLE, /* T10 */
+ TK_VOL_MUTE, /* T11 */
+ TK_VOL_DOWN, /* T12 */
+ TK_VOL_UP, /* T13 */
+ },
+ .capabilities = KEYBD_CAP_SCRNLOCK_KEY,
+};
+
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
+{
+ if (ec_cfg_has_eps() == 0)
+ return &keybd1;
+ else
+ return &keybd2;
+}