summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRajat Jain <rajatja@google.com>2020-04-01 17:50:44 -0700
committerCommit Bot <commit-bot@chromium.org>2020-04-15 06:38:28 +0000
commitdb664eaccf085e83e8495063655ac9cf871d8e29 (patch)
treea7b9dccbf36f70dbc6a12626d7cf4e9eb7354863
parenteea6c70bd8cc3f8727031e06d0ecf99a4423b287 (diff)
downloadchrome-ec-db664eaccf085e83e8495063655ac9cf871d8e29.tar.gz
ec_commands.h: Add host command EC_CMD_GET_KEYBD_CONFIG
Add command to query the EC for the keyboard layout. Also add supporting data structures for the exchange. BUG=b:146501925 TEST=Build BRANCH=firmware-hatch-12672.B Signed-off-by: Rajat Jain <rajatja@google.com> Change-Id: I7031196bc1f7f86e8dcd6baaa9fd967bef16d2e2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2133824 Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r--include/ec_commands.h78
1 files changed, 78 insertions, 0 deletions
diff --git a/include/ec_commands.h b/include/ec_commands.h
index 07700a89d5..ca8d3e5f29 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -6058,6 +6058,84 @@ enum keyboard_button_type {
};
/*****************************************************************************/
+/*
+ * "Get the Keyboard Config". An EC implementing this command is expected to be
+ * vivaldi capable, i.e. can send action codes for the top row keys.
+ * Additionally, capability to send function codes for the same keys is
+ * optional and acceptable.
+ *
+ * Note: If the top row can generate both function and action codes by
+ * using a dedicated Fn key, it does not matter whether the key sends
+ * "function" or "action" codes by default. In both cases, the response
+ * for this command will look the same.
+ */
+#define EC_CMD_GET_KEYBD_CONFIG 0x012A
+
+/* Possible values for the top row keys */
+enum action_key {
+ TK_ABSENT = 0,
+ TK_BACK = 1,
+ TK_FORWARD = 2,
+ TK_REFRESH = 3,
+ TK_FULLSCREEN = 4,
+ TK_OVERVIEW = 5,
+ TK_BRIGHTNESS_DOWN = 6,
+ TK_BRIGHTNESS_UP = 7,
+ TK_VOL_MUTE = 8,
+ TK_VOL_DOWN = 9,
+ TK_VOL_UP = 10,
+ TK_SNAPSHOT = 11,
+ TK_PRIVACY_SCRN_TOGGLE = 12,
+ TK_KBD_BKLIGHT_DOWN = 13,
+ TK_KBD_BKLIGHT_UP = 14,
+ TK_PLAY_PAUSE = 15,
+ TK_NEXT_TRACK = 16,
+ TK_PREV_TRACK = 17,
+};
+
+/*
+ * Max & Min number of top row keys, excluding Esc and Screenlock keys.
+ * If this needs to change, please create a new version of the command.
+ */
+#define MAX_TOP_ROW_KEYS 15
+#define MIN_TOP_ROW_KEYS 10
+
+/*
+ * Is the keyboard capable of sending function keys *in addition to*
+ * action keys. This is possible for e.g. if the keyboard has a
+ * dedicated Fn key.
+ */
+#define KEYBD_CAP_FUNCTION_KEYS BIT(0)
+/*
+ * Whether the keyboard has a dedicated numeric keyboard.
+ */
+#define KEYBD_CAP_NUMERIC_KEYPAD BIT(1)
+/*
+ * Whether the keyboard has a screenlock key.
+ */
+#define KEYBD_CAP_SCRNLOCK_KEY BIT(2)
+
+struct ec_response_keybd_config {
+ /*
+ * Number of top row keys, excluding Esc and Screenlock.
+ * If this is 0, all Vivaldi keyboard code is disabled.
+ * (i.e. does not expose any tables to the kernel).
+ */
+ uint8_t num_top_row_keys;
+
+ /*
+ * The action keys in the top row, in order from left to right.
+ * The values are filled from enum action_key. Esc and Screenlock
+ * keys are not considered part of top row keys.
+ */
+ uint8_t action_keys[MAX_TOP_ROW_KEYS];
+
+ /* Capability flags */
+ uint8_t capabilities;
+
+} __ec_align1;
+
+/*****************************************************************************/
/* The command range 0x200-0x2FF is reserved for Rotor. */
/*****************************************************************************/