diff options
author | Dmitry Torokhov <dtor@chromium.org> | 2018-08-15 17:16:35 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-08-22 00:10:42 -0700 |
commit | f70528e53dfbdc1f33508d157b05c608934a660f (patch) | |
tree | 214ba254482057090389c2e3170447fd51ef3f4b /include | |
parent | b8489de98f1cf3e32fbcbe4b6f6163dff4a55c78 (diff) | |
download | chrome-ec-f70528e53dfbdc1f33508d157b05c608934a660f.tar.gz |
common: add API to expose detachable "base" state
On some detachables, when base is attached, we know right away that the
device should transition from tablet to clamshell mode. However on other
detachables we need additional information (i.e. base position) before
we decide whether to transition in/out of tablet mode. For such
detachables let's allow them to signal a new "base attached" switch
event, so that the rest of the stack is not confused.
BUG=b:73133611
BRANCH=nocturne
TEST=Build and boot
Change-Id: I9be3450cba52bf9f0bad8333402f68b0c7903090
Signed-off-by: Dmitry Torokhov <dtor@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1176801
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/base_state.h | 15 | ||||
-rw-r--r-- | include/config.h | 6 | ||||
-rw-r--r-- | include/ec_commands.h | 3 |
3 files changed, 23 insertions, 1 deletions
diff --git a/include/base_state.h b/include/base_state.h new file mode 100644 index 0000000000..6ee0948e5f --- /dev/null +++ b/include/base_state.h @@ -0,0 +1,15 @@ +/* Copyright 2018 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * Return 1 if base attached, 0 otherwise. + */ +int base_get_state(void); + +/** + * Sets the current state of the base, with 0 meaning detached, + * and non-zero meaning attached. + */ +void base_set_state(int state); diff --git a/include/config.h b/include/config.h index 84f3b0ad65..c5a79901c4 100644 --- a/include/config.h +++ b/include/config.h @@ -2751,6 +2751,12 @@ #undef CONFIG_TABLET_SWITCH /* + * Add a virtual switch to indicate when detachable device has + * base attached. + */ +#undef CONFIG_BASE_ATTACHED_SWITCH + +/* * Microchip Trace FIFO Debug Port */ #undef CONFIG_MCHP_TFDP diff --git a/include/ec_commands.h b/include/ec_commands.h index 30b02024d7..e45e56911c 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -596,7 +596,7 @@ enum host_event_code { /* EC desires to change state of host-controlled USB mux */ EC_HOST_EVENT_USB_MUX = 28, - /* TABLET/LAPTOP mode event*/ + /* TABLET/LAPTOP mode or detachable base attach/detach event */ EC_HOST_EVENT_MODE_CHANGE = 29, /* Keyboard recovery combo with hardware reinitialization */ @@ -3285,6 +3285,7 @@ struct __ec_align1 ec_response_get_next_event_v1 { /* Switches */ #define EC_MKBP_LID_OPEN 0 #define EC_MKBP_TABLET_MODE 1 +#define EC_MKBP_BASE_ATTACHED 2 /* Run keyboard factory test scanning */ #define EC_CMD_KEYBOARD_FACTORY_TEST 0x0068 |