summaryrefslogtreecommitdiff
path: root/board/nami/board.c
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2018-04-23 13:39:21 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-05-09 14:40:07 -0700
commit50ba7ef146aea95baa5ac74d6ac0ccf140568a6d (patch)
tree2ed55809c825fc3c1c14fb1cdea6372ddaf363ed /board/nami/board.c
parent4461fb7ab7c5d264126040d6588866ed43dde9ed (diff)
downloadchrome-ec-50ba7ef146aea95baa5ac74d6ac0ccf140568a6d.tar.gz
Nami: Use lid angle to detect tablet mode for Vayne & Nami
This patch refactors motion_lid so that EC can decide to use lid angles to set tablet mode at run time. Then, it implements board_is_lid_angle_tablet_mode to enable the feature for Nami and Vayne. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b:77298177 BRANCH=none TEST=Verify on Nami. Change-Id: Ib717911a16fe031aa6c6ede731e6aa722d32d022 Reviewed-on: https://chromium-review.googlesource.com/1024914 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'board/nami/board.c')
-rw-r--r--board/nami/board.c32
1 files changed, 13 insertions, 19 deletions
diff --git a/board/nami/board.c b/board/nami/board.c
index 3752815a59..53e4575de3 100644
--- a/board/nami/board.c
+++ b/board/nami/board.c
@@ -65,6 +65,8 @@
#define USB_PD_PORT_PS8751 0
#define USB_PD_PORT_ANX7447 1
+static uint32_t oem = PROJECT_NAMI;
+
static void tcpc_alert_event(enum gpio_signal signal)
{
if ((signal == GPIO_USB_C0_PD_INT_ODL) &&
@@ -661,23 +663,6 @@ static void board_chipset_suspend(void)
}
DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
-static void board_set_motion_sensor_count(void)
-{
- /* There are two possible sensor configurations.
- * Vayne/Sona/Pantheon/Akali are without ALS sensor
- * Nami is with ALS sensor
- * Use the oem id to different them.
- */
- uint32_t oem_id;
-
- if (cbi_get_oem_id(&oem_id) == EC_SUCCESS) {
- if (oem_id == PROJECT_VAYNE || oem_id == PROJECT_SONA
- || oem_id == PROJECT_PANTHEON
- || oem_id == PROJECT_AKALI)
- motion_sensor_count = ARRAY_SIZE(motion_sensors) - 1;
- }
-}
-
/* Initialize board. */
static void board_init(void)
{
@@ -686,6 +671,9 @@ static void board_init(void)
if (cbi_get_board_version(&version) == EC_SUCCESS)
CPRINTS("Board Version: 0x%04x", version);
+ if (cbi_get_oem_id(&oem))
+ CPRINTS("OEM: 0x%x", oem);
+
/*
* This enables pull-down on F_DIO1 (SPI MISO), and F_DIO0 (SPI MOSI),
* whenever the EC is not doing SPI flash transactions. This avoids
@@ -711,8 +699,9 @@ static void board_init(void)
/* Enable Gyro interrupt for BMI160 */
gpio_enable_interrupt(GPIO_ACCELGYRO3_INT_L);
- /* Update motion_sensor_count */
- board_set_motion_sensor_count();
+ /* Only Nami has an ALS sensor. */
+ if (oem != PROJECT_NAMI)
+ motion_sensor_count = ARRAY_SIZE(motion_sensors) - 1;
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
@@ -736,3 +725,8 @@ struct keyboard_scan_config keyscan_config = {
},
};
+int board_is_lid_angle_tablet_mode(void)
+{
+ /* Boards with no GMR sensor use lid angles to detect tablet mode. */
+ return oem == PROJECT_NAMI || oem == PROJECT_VAYNE;
+}