summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2023-04-24 10:51:35 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-04-25 16:20:45 +0000
commit274103718a763e50679061f44ad693aadd260e85 (patch)
tree0eecc326e6b6205d6739f44e5309d3c6c34f99b6
parent4823777d16699104c3c02c25621c9845ce980d60 (diff)
downloadchrome-ec-firmware-trogdor-13577.B-master.tar.gz
common/tablet: Fix printing the tablet modefirmware-trogdor-13577.B-master
table_mode is not just a boolean, it stores the cause(s) for getting in tablet mode. Fixes: c1f6b2a249250 ("common/tablet: Allow getting out of tablet mode when sensors are broken") BUG=b:279135356 TEST=Compile Change-Id: I4a50118004285da2f7ba4229e537d6cd8d7b07d1 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4468727 Reviewed-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> (cherry picked from commit 375ed4452465e6858e62b77b3927be4c7b678477) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4471507 Commit-Queue: Douglas Anderson <dianders@chromium.org> Tested-by: Sue Chen <sue.chen@quanta.corp-partner.google.com> Reviewed-by: Sue Chen <sue.chen@quanta.corp-partner.google.com>
-rw-r--r--common/tablet_mode.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/common/tablet_mode.c b/common/tablet_mode.c
index 93b7ff8a55..949989dcd9 100644
--- a/common/tablet_mode.c
+++ b/common/tablet_mode.c
@@ -19,7 +19,11 @@
/*
* Other code modules assume that notebook mode (i.e. tablet_mode = 0) at
- * startup
+ * startup.
+ * tablet_mode is mask, one bit for each source that can trigger a change to
+ * tablet mode:
+ * - TABLET_TRIGGER_LID: the lid angle is over the threshold.
+ * - TABLET_TRIGGER_BASE: the detachable keyboard is disconnected.
*/
static uint32_t tablet_mode;
@@ -45,6 +49,7 @@ static const char *const tablet_mode_names[] = {
"clamshell",
"tablet",
};
+BUILD_ASSERT(ARRAY_SIZE(tablet_mode_names) == 2);
int tablet_get_mode(void)
{
@@ -53,7 +58,7 @@ int tablet_get_mode(void)
static inline void print_tablet_mode(void)
{
- CPRINTS("%s mode", tablet_mode_names[tablet_mode]);
+ CPRINTS("%s mode", tablet_mode_names[tablet_get_mode()]);
}
static void notify_tablet_mode_change(void)