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 <andyross@google.com>
This commit is contained in:
Andy Ross 2024-11-24 09:13:37 -08:00 committed by Benjamin Cabé
commit da35377256

View file

@ -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,