summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Hill <ecgh@chromium.org>2019-03-13 15:57:58 -0600
committerchrome-bot <chrome-bot@chromium.org>2019-03-14 20:53:48 -0700
commit63c9ede6e62aa9f6ebe6a2d7dd1245b70f00c8a1 (patch)
tree1898c93e988de3dcf19f3221bccdcc4ee8cc65ef
parent4a9170c8c4c4f7e82d48ba3d0a328c96a1882fd3 (diff)
downloadchrome-ec-63c9ede6e62aa9f6ebe6a2d7dd1245b70f00c8a1.tar.gz
tablet_mode: Set EC_HOST_EVENT_MODE_CHANGE in tablet_set_mode()
Move setting of EC_HOST_EVENT_MODE_CHANGE out of dptf.c so it works on devices that don't use DPTF. BUG=b:124132058 BRANCH=grunt TEST=evtest shows tablet mode events Change-Id: Ie880dfb49838e9f564f755cb18872c9832a3aa91 Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1524621 Reviewed-by: Furquan Shaikh <furquan@chromium.org>
-rw-r--r--common/dptf.c13
-rw-r--r--common/tablet_mode.c9
2 files changed, 9 insertions, 13 deletions
diff --git a/common/dptf.c b/common/dptf.c
index a391732905..23e597bec9 100644
--- a/common/dptf.c
+++ b/common/dptf.c
@@ -103,19 +103,6 @@ void dptf_set_temp_threshold(int sensor_id, int temp, int idx, int enable)
}
}
-#ifdef CONFIG_TABLET_MODE
-/*
- * When tablet mode changes, send an event to ACPI to retrieve
- * tablet mode value and send an event to the kernel.
- */
-static void dptf_tablet_mode_changed(void)
-{
- host_set_single_event(EC_HOST_EVENT_MODE_CHANGE);
-}
-DECLARE_HOOK(HOOK_TABLET_MODE_CHANGE, dptf_tablet_mode_changed,
- HOOK_PRIO_DEFAULT);
-#endif
-
/*****************************************************************************/
/* EC-specific thermal controls */
diff --git a/common/tablet_mode.c b/common/tablet_mode.c
index e9667dfbcc..da2de38ad3 100644
--- a/common/tablet_mode.c
+++ b/common/tablet_mode.c
@@ -6,6 +6,7 @@
#include "console.h"
#include "gpio.h"
#include "hooks.h"
+#include "host_command.h"
#include "lid_angle.h"
#include "tablet_mode.h"
#include "timer.h"
@@ -36,6 +37,14 @@ void tablet_set_mode(int mode)
tablet_mode = mode;
CPRINTS("tablet mode %sabled", mode ? "en" : "dis");
hook_notify(HOOK_TABLET_MODE_CHANGE);
+
+ /*
+ * When tablet mode changes, send an event to ACPI to retrieve
+ * tablet mode value and send an event to the kernel.
+ */
+#ifdef CONFIG_HOSTCMD_EVENTS
+ host_set_single_event(EC_HOST_EVENT_MODE_CHANGE);
+#endif
}
/* This ifdef can be removed once we clean up past projects which do own init */