summaryrefslogtreecommitdiff
path: root/zephyr/test/drivers/src/stubs.c
diff options
context:
space:
mode:
authorAbe Levkoy <alevkoy@chromium.org>2021-11-21 12:32:19 -0700
committerCommit Bot <commit-bot@chromium.org>2021-11-22 19:59:14 +0000
commit62fb2d16161f66d1d2a3bd6cf394af9d0e2d0eb0 (patch)
tree47b045ac1fce066c273f2c5d8ff89b5087a76887 /zephyr/test/drivers/src/stubs.c
parent0b293e2fd74ea5aeccafcd310c077791e68af5e2 (diff)
downloadchrome-ec-62fb2d16161f66d1d2a3bd6cf394af9d0e2d0eb0.tar.gz
zephyr test: Use interrupt GPIO for SYV682x
Set and clear the ALERT_L signal in the SYV682x emulator based on the state of underlying conditions. Test the driver by just setting the underlying conditions instead of calling the ISR from within the test. Define the interrupt signal in the device tree and enable interrupts from it in the test. BUG=b:190519131 TEST=zmake configure --test zephyr/test/drivers BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: Idc8b957fe53ce78bd8236e4af6b005636498ada2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3288914 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'zephyr/test/drivers/src/stubs.c')
-rw-r--r--zephyr/test/drivers/src/stubs.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/zephyr/test/drivers/src/stubs.c b/zephyr/test/drivers/src/stubs.c
index 68aab8ba12..00c7322b42 100644
--- a/zephyr/test/drivers/src/stubs.c
+++ b/zephyr/test/drivers/src/stubs.c
@@ -307,6 +307,17 @@ void tcpc_alert_event(enum gpio_signal signal)
schedule_deferred_pd_interrupt(port);
}
+void ppc_alert(enum gpio_signal signal)
+{
+ switch (signal) {
+ case GPIO_USB_C1_PPC_INT_ODL:
+ syv682x_interrupt(USBC_PORT_C1);
+ break;
+ default:
+ return;
+ }
+}
+
/* TODO: This code should really be generic, and run based on something in
* the dts.
*/
@@ -328,5 +339,8 @@ static void usbc_interrupt_init(void)
gpio_set_level(GPIO_USB_C1_TCPC_RST_L, 0);
msleep(PS8XXX_RESET_DELAY_MS);
gpio_set_level(GPIO_USB_C1_TCPC_RST_L, 1);
+
+ /* Enable PPC interrupts. */
+ gpio_enable_interrupt(GPIO_USB_C1_PPC_INT_ODL);
}
DECLARE_HOOK(HOOK_INIT, usbc_interrupt_init, HOOK_PRIO_INIT_I2C + 1);