diff options
author | Philip Chen <philipchen@google.com> | 2019-08-15 18:24:22 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-09-19 03:47:09 +0000 |
commit | 0beadf2ffd8b23e15d1e7c14de8719d0f45c9519 (patch) | |
tree | 9b531ef5087e3935542560a4bc9b7cc379c3e843 /common/tablet_mode.c | |
parent | 16d2b24ac05f7a5654bddcf9cb61f0f6684d1806 (diff) | |
download | chrome-ec-0beadf2ffd8b23e15d1e7c14de8719d0f45c9519.tar.gz |
tablet_mode: Renaming for GMR sensor
GMR sensors can be used to
(1) detect clamshell/tablet mode
(2) detect lid open/closed
But hall sensors can only do (2).
Therefore the naming related to "hall sensor" for tablet mode
application is incorrect.
This patch performs the following renaming to better reflect the reality:
config:
CONFIG_HALL_SENSOR -> CONFIG_GMR_TABLET_MODE
CONFIG_HALL_SENSOR_CUSTOM -> CONFIG_GMR_TABLET_MODE_CUSTOM
CONFIG_DPTF_MOTION_LID_NO_HALL_SENSOR ->
CONFIG_DPTF_MOTION_LID_NO_GMR_SENSOR
GPIO:
HALL_SENSOR_GPIO_L -> GMR_TABLET_MODE_GPIO_L
functions:
hall_sensor_disable() -> gmr_tablet_switch_disable()
hall_sensor_isr() -> gmr_tablet_switch_isr()
hall_sensor_int() -> gmr_tablet_switch_init()
variable:
hall_sensor_at_360 -> gmr_sensor_at_360
BUG=b:139378190
BRANCH=none
TEST=make buildall
Change-Id: I28393d056ddd128d8ffafc16a1f9fefee5455ccc
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1757275
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Commit-Queue: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Diffstat (limited to 'common/tablet_mode.c')
-rw-r--r-- | common/tablet_mode.c | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/common/tablet_mode.c b/common/tablet_mode.c index 5da4db7821..b74dc5fc49 100644 --- a/common/tablet_mode.c +++ b/common/tablet_mode.c @@ -19,8 +19,8 @@ static int tablet_mode = -1; static int forced_tablet_mode = -1; -/* 1: hall sensor is reporting 360 degrees. */ -static int hall_sensor_at_360; +/* 1: GMR sensor is reporting 360 degrees. */ +static int gmr_sensor_at_360; /* * 1: all calls to tablet_set_mode are ignored and tablet_mode if forced to 0 @@ -45,8 +45,9 @@ void tablet_set_mode(int mode) return; } - if (hall_sensor_at_360 && !mode) { - CPRINTS("Ignoring tablet mode exit while hall sensor active."); + if (gmr_sensor_at_360 && !mode) { + CPRINTS("Ignoring tablet mode exit while gmr sensor " + "reports 360-degree tablet mode."); return; } @@ -86,18 +87,18 @@ void tablet_disable(void) } /* This ifdef can be removed once we clean up past projects which do own init */ -#ifdef CONFIG_HALL_SENSOR -#ifndef HALL_SENSOR_GPIO_L -#error HALL_SENSOR_GPIO_L must be defined +#ifdef CONFIG_GMR_TABLET_MODE +#ifndef GMR_TABLET_MODE_GPIO_L +#error GMR_TABLET_MODE_GPIO_L must be defined #endif -#ifdef CONFIG_DPTF_MOTION_LID_NO_HALL_SENSOR +#ifdef CONFIG_DPTF_MOTION_LID_NO_GMR_SENSOR #error The board has GMR sensor #endif -static void hall_sensor_interrupt_debounce(void) +static void gmr_tablet_switch_interrupt_debounce(void) { - hall_sensor_at_360 = IS_ENABLED(CONFIG_HALL_SENSOR_CUSTOM) + gmr_sensor_at_360 = IS_ENABLED(CONFIG_GMR_TABLET_MODE_CUSTOM) ? board_sensor_at_360() - : !gpio_get_level(HALL_SENSOR_GPIO_L); + : !gpio_get_level(GMR_TABLET_MODE_GPIO_L); /* * DPTF table is updated only when the board enters/exits completely @@ -106,7 +107,7 @@ static void hall_sensor_interrupt_debounce(void) * 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 ? + acpi_dptf_set_profile_num(gmr_sensor_at_360 ? DPTF_PROFILE_FLIPPED_360_MODE : DPTF_PROFILE_CLAMSHELL); } @@ -123,43 +124,43 @@ static void hall_sensor_interrupt_debounce(void) * driver to clear it when lid goes into laptop zone. */ - if (!IS_ENABLED(CONFIG_LID_ANGLE) || hall_sensor_at_360) - tablet_set_mode(hall_sensor_at_360); + if (!IS_ENABLED(CONFIG_LID_ANGLE) || gmr_sensor_at_360) + tablet_set_mode(gmr_sensor_at_360); - if (IS_ENABLED(CONFIG_LID_ANGLE_UPDATE) && hall_sensor_at_360) + if (IS_ENABLED(CONFIG_LID_ANGLE_UPDATE) && gmr_sensor_at_360) lid_angle_peripheral_enable(0); } -DECLARE_DEFERRED(hall_sensor_interrupt_debounce); +DECLARE_DEFERRED(gmr_tablet_switch_interrupt_debounce); -/* Debounce time for hall sensor interrupt */ -#define HALL_SENSOR_DEBOUNCE_US (30 * MSEC) +/* Debounce time for gmr sensor tablet mode interrupt */ +#define GMR_SENSOR_DEBOUNCE_US (30 * MSEC) -void hall_sensor_isr(enum gpio_signal signal) +void gmr_tablet_switch_isr(enum gpio_signal signal) { - hook_call_deferred(&hall_sensor_interrupt_debounce_data, - HALL_SENSOR_DEBOUNCE_US); + hook_call_deferred(&gmr_tablet_switch_interrupt_debounce_data, + GMR_SENSOR_DEBOUNCE_US); } -static void hall_sensor_init(void) +static void gmr_tablet_switch_init(void) { /* If this sub-system was disabled before initializing, honor that. */ if (disabled) return; - gpio_enable_interrupt(HALL_SENSOR_GPIO_L); + gpio_enable_interrupt(GMR_TABLET_MODE_GPIO_L); /* * Ensure tablet mode is initialized according to the hardware state * so that the cached state reflects reality. */ - hall_sensor_interrupt_debounce(); + gmr_tablet_switch_interrupt_debounce(); } -DECLARE_HOOK(HOOK_INIT, hall_sensor_init, HOOK_PRIO_DEFAULT); +DECLARE_HOOK(HOOK_INIT, gmr_tablet_switch_init, HOOK_PRIO_DEFAULT); -void hall_sensor_disable(void) +void gmr_tablet_switch_disable(void) { - gpio_disable_interrupt(HALL_SENSOR_GPIO_L); + gpio_disable_interrupt(GMR_TABLET_MODE_GPIO_L); /* Cancel any pending debounce calls */ - hook_call_deferred(&hall_sensor_interrupt_debounce_data, -1); + hook_call_deferred(&gmr_tablet_switch_interrupt_debounce_data, -1); tablet_disable(); } #endif |