From da3537725651af318af49b6b23f275b57d652b87 Mon Sep 17 00:00:00 2001 From: Andy Ross Date: Sun, 24 Nov 2024 09:13:37 -0800 Subject: [PATCH] tests/boards/mtk_adsp: Handle protocol skew Recent kernel drivers for some devices have swapped the mailbox device used for replies. It used to be that all commands in either direction were sent on mbox0 and all replies on mbox1. Now mbox0 handles commands and replies for "DSP to Host" communication, and mbox1 is for "Host to DSP". Listen to both devices for our simple test. Signed-off-by: Andy Ross --- tests/boards/mtk_adsp/src/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/boards/mtk_adsp/src/main.c b/tests/boards/mtk_adsp/src/main.c index 95efbffd47c..c7e10489aa3 100644 --- a/tests/boards/mtk_adsp/src/main.c +++ b/tests/boards/mtk_adsp/src/main.c @@ -63,13 +63,11 @@ static bool mbox1_fired; static void mbox_fn(const struct device *mbox, void *arg) { - zassert_equal(mbox, MBOX1); zassert_equal(arg, NULL); mbox1_fired = true; k_sem_give(&mbox_sem); } - /* Test in/out interrupts from the host. This relies on a SOF driver * on the host, which has the behavior of "replying" with an interrupt * on mbox1 after receiving a "command" on mbox0 (you can also see it @@ -81,6 +79,8 @@ static void mbox_fn(const struct device *mbox, void *arg) */ ZTEST(mtk_adsp, mbox) { + /* Different SOCs transmit the replies on different devices! Just listen to both */ + mtk_adsp_mbox_set_handler(MBOX0, 1, mbox_fn, NULL); mtk_adsp_mbox_set_handler(MBOX1, 1, mbox_fn, NULL); /* First signal the host with a reply on the second channel,