summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael5 Chen1 <michael5_chen1@pegatron.corp-partner.google.com>2021-12-07 18:15:53 +0800
committerCommit Bot <commit-bot@chromium.org>2021-12-08 03:51:21 +0000
commitba2512fce12a15282a8120e1ddbf566383c251e6 (patch)
treeccafaa9b8a4e12057737706a1993b4d09d173de9
parent4c170fe6c0299023884a063ffbdc7e54cc515743 (diff)
downloadchrome-ec-ba2512fce12a15282a8120e1ddbf566383c251e6.tar.gz
AmptonE: Add motion sensor interrupt process
Add motion interrupt process for icm42607 BUG=b:206526996 BRANCH=firmware-octopus-11297.B TEST=manual 1. watch ectool motionsense 2. watch ectool motionsense lid_angle Signed-off-by: Michael5 Chen1 <michael5_chen1@pegatron.corp-partner.google.com> Change-Id: I5875ca2a5391a3762eddfa9d2de0266737b6fe6e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3319989 Reviewed-by: Henry Sun <henrysun@google.com> Reviewed-by: Diana Z <dzigterman@chromium.org>
-rw-r--r--board/ampton/board.c8
-rw-r--r--board/ampton/board.h2
-rw-r--r--board/ampton/gpio.inc2
3 files changed, 11 insertions, 1 deletions
diff --git a/board/ampton/board.c b/board/ampton/board.c
index 9b62a8dd02..588cc72485 100644
--- a/board/ampton/board.c
+++ b/board/ampton/board.c
@@ -371,6 +371,14 @@ static int board_with_sensor_icm42607(void)
return sku_id == 57;
}
+void motion_interrupt(enum gpio_signal signal)
+{
+ if (board_with_sensor_icm42607())
+ icm42607_interrupt(signal);
+ else
+ bmi160_interrupt(signal);
+}
+
static void board_update_sensor_config_from_sku(void)
{
if (board_is_convertible()) {
diff --git a/board/ampton/board.h b/board/ampton/board.h
index f1b33b14de..059756cd41 100644
--- a/board/ampton/board.h
+++ b/board/ampton/board.h
@@ -105,6 +105,8 @@ enum battery_type {
BATTERY_TYPE_COUNT,
};
+void motion_interrupt(enum gpio_signal signal);
+
#endif /* !__ASSEMBLER__ */
#endif /* __CROS_EC_BOARD_H */
diff --git a/board/ampton/gpio.inc b/board/ampton/gpio.inc
index 8b0a433842..854a28655d 100644
--- a/board/ampton/gpio.inc
+++ b/board/ampton/gpio.inc
@@ -41,7 +41,7 @@ GPIO_INT(ESPI_RESET_L, PIN(D, 2), GPIO_INT_FALLING | GPIO_SEL_1P8V, espi_reset
GPIO_INT(TABLET_MODE_L, PIN(H, 4), GPIO_INT_BOTH, gmr_tablet_switch_isr)
GPIO_INT(EC_VOLDN_BTN_ODL, PIN(D, 6), GPIO_INT_BOTH, button_interrupt)
GPIO_INT(EC_VOLUP_BTN_ODL, PIN(D, 5), GPIO_INT_BOTH, button_interrupt)
-GPIO_INT(BASE_SIXAXIS_INT_L, PIN(J, 2), GPIO_INT_FALLING | GPIO_SEL_1P8V, bmi160_interrupt)
+GPIO_INT(BASE_SIXAXIS_INT_L, PIN(J, 2), GPIO_INT_FALLING | GPIO_SEL_1P8V, motion_interrupt)
GPIO(LID_ACCEL_INT_L, PIN(J, 3), GPIO_INPUT | GPIO_SEL_1P8V)
GPIO(PCH_PLTRST_L, PIN(E, 3), GPIO_INPUT) /* PLT_RST_L: Platform Reset from SoC */