summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Chen <philipchen@google.com>2019-08-09 15:10:24 -0700
committerCommit Bot <commit-bot@chromium.org>2019-09-07 00:48:56 +0000
commit7544159f1074e43fa8268de8738ae249f4ff0c6f (patch)
tree08186515236a929605b247b204df9f207b04b978
parenta213ebd7017c120cd19b4fd510a0ff829786617e (diff)
downloadchrome-ec-7544159f1074e43fa8268de8738ae249f4ff0c6f.tar.gz
tablet_mode: Update DPTF profile number in hall_sensor_isr
For the boards with GMR sensors, if we want to support mode-aware DPTF profiles, we can update DPTF profile number when the common TABLET_MODE ISR (a.k.a. hall_sensor_isr) is called, so we don't need a board-specific ISR to handle this operation. BUG=b:139168228 BRANCH=none TEST=buildall Change-Id: Icdb526c0e5e5ba9626f19a0de9332c0d06e8b0a7 Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1747061 Reviewed-by: Furquan Shaikh <furquan@chromium.org> Commit-Queue: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org>
-rw-r--r--common/tablet_mode.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/common/tablet_mode.c b/common/tablet_mode.c
index efd2252b97..7773ba84d6 100644
--- a/common/tablet_mode.c
+++ b/common/tablet_mode.c
@@ -3,6 +3,7 @@
* found in the LICENSE file.
*/
+#include "acpi.h"
#include "console.h"
#include "gpio.h"
#include "hooks.h"
@@ -70,6 +71,9 @@ void tablet_disable(void)
#ifndef HALL_SENSOR_GPIO_L
#error HALL_SENSOR_GPIO_L must be defined
#endif
+#ifdef CONFIG_DPTF_MOTION_LID_NO_HALL_SENSOR
+#error The board has GMR sensor
+#endif
static void hall_sensor_interrupt_debounce(void)
{
hall_sensor_at_360 = IS_ENABLED(CONFIG_HALL_SENSOR_CUSTOM)
@@ -77,6 +81,17 @@ static void hall_sensor_interrupt_debounce(void)
: !gpio_get_level(HALL_SENSOR_GPIO_L);
/*
+ * DPTF table is updated only when the board enters/exits completely
+ * flipped tablet mode. If the board has no GMR sensor, we determine
+ * if the board is in completely-flipped tablet mode by lid angle
+ * calculation and update DPTF table when lid angle > 300 degrees.
+ */
+ if (IS_ENABLED(CONFIG_HOSTCMD_X86) && IS_ENABLED(CONFIG_DPTF)) {
+ acpi_dptf_set_profile_num(hall_sensor_at_360 ?
+ DPTF_PROFILE_FLIPPED_360_MODE :
+ DPTF_PROFILE_CLAMSHELL);
+ }
+ /*
* 1. Peripherals are disabled only when lid reaches 360 position (It's
* probably already disabled by motion_sense task). We deliberately do
* not enable peripherals when the lid is leaving 360 position. Instead,