summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJett Rink <jettrink@chromium.org>2019-05-06 10:33:11 -0600
committerchrome-bot <chrome-bot@chromium.org>2019-05-28 21:11:21 -0700
commite11d78dcf4ca4ecfe6ceecad0b892fd4993cb67c (patch)
tree72a3ce27d0980e14d901b51f07d11f3e0082215a
parent325d65d3b08903e7bd3c70d14875cc1dfbf1686d (diff)
downloadchrome-ec-e11d78dcf4ca4ecfe6ceecad0b892fd4993cb67c.tar.gz
arcada_ish: hook up 360 hall sensor to ISR
Ensure that 360-degree-hall sensor is hooked up to the tablet mode ISR, which should in turn ignore any weird lid angle calculations when the hall sensor is active (i.e. lid is at 360 degrees) BRANCH=R75 BUG=b:131785573 TEST=arcada does not have spurious edges on the NB_MODE# signal when the lid is all the way open in 360 degree mode. Cq-Depend: chrome-internal:1329664 Change-Id: I1756bd909e5ecba7caa4565376f98f6d0dad6b06 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1597190 Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
-rw-r--r--board/arcada_ish/board.c11
-rw-r--r--board/arcada_ish/board.h3
-rw-r--r--board/arcada_ish/gpio.inc6
3 files changed, 17 insertions, 3 deletions
diff --git a/board/arcada_ish/board.c b/board/arcada_ish/board.c
index 8d3d13bb9c..725248a1b6 100644
--- a/board/arcada_ish/board.c
+++ b/board/arcada_ish/board.c
@@ -148,6 +148,17 @@ struct motion_sensor_t motion_sensors[] = {
const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
+int board_sensor_at_360(void)
+{
+ /*
+ * The 360 degree sensor is too sensitive and is active when the lid is
+ * closed at 0 degrees. Ignore the hall sensor when the lid close is
+ * also active.
+ */
+ return gpio_get_level(GPIO_LID_OPEN) &&
+ !gpio_get_level(HALL_SENSOR_GPIO_L);
+}
+
/* Initialize board. */
static void board_init(void)
{
diff --git a/board/arcada_ish/board.h b/board/arcada_ish/board.h
index 26592923fc..8101180b30 100644
--- a/board/arcada_ish/board.h
+++ b/board/arcada_ish/board.h
@@ -51,6 +51,9 @@
#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
#define CONFIG_TABLET_MODE
+#define CONFIG_HALL_SENSOR
+#define CONFIG_HALL_SENSOR_CUSTOM
+#define HALL_SENSOR_GPIO_L GPIO_TABLET_MODE_L
/* DMA paging between SRAM and DRAM */
#define CONFIG_DMA_PAGING
diff --git a/board/arcada_ish/gpio.inc b/board/arcada_ish/gpio.inc
index 96a309d042..91c25fe632 100644
--- a/board/arcada_ish/gpio.inc
+++ b/board/arcada_ish/gpio.inc
@@ -6,10 +6,10 @@
*/
GPIO_INT(ACCEL_GYRO_INT_L, PIN(0), GPIO_INT_FALLING, lsm6dsm_interrupt)
-GPIO_INT(LID_OPEN, PIN(5), GPIO_INT_BOTH, lid_interrupt) /* LID_CL_NB_L */
+GPIO_INT(LID_OPEN, PIN(5), GPIO_INT_BOTH, lid_interrupt) /* LID_CL_NB_L */
+GPIO_INT(TABLET_MODE_L, PIN(6), GPIO_INT_BOTH, hall_sensor_isr) /* LID_CL_TAB_L */
-GPIO(NB_MODE_L, PIN(4), GPIO_OUT_LOW)
-GPIO(LID_CL_TAB_L, PIN(6), GPIO_INPUT)
+GPIO(NB_MODE_L, PIN(4), GPIO_OUT_LOW)
/*
* We don't have a ENTERING_RW signal wired to the cr50 but common code needs