Lines Matching +full:ipc +full:-
1 // SPDX-License-Identifier: GPL-2.0
4 * Author: Allen-KH Cheng <allen-[email protected]>
7 #include <linux/firmware/mediatek/mtk-adsp-ipc.h>
17 * mtk_adsp_ipc_send - send ipc cmd to MTK ADSP
19 * @ipc: ADSP IPC handle
21 * @msg: IPC cmd (reply or request)
26 int mtk_adsp_ipc_send(struct mtk_adsp_ipc *ipc, unsigned int idx, uint32_t msg) in mtk_adsp_ipc_send() argument
32 return -EINVAL; in mtk_adsp_ipc_send()
34 adsp_chan = &ipc->chans[idx]; in mtk_adsp_ipc_send()
35 ret = mbox_send_message(adsp_chan->ch, &msg); in mtk_adsp_ipc_send()
44 * mtk_adsp_ipc_recv - recv callback used by MTK ADSP mailbox
49 * Users of ADSP IPC will need to privde handle_reply and handle_request
55 struct device *dev = c->dev; in mtk_adsp_ipc_recv()
57 switch (chan->idx) { in mtk_adsp_ipc_recv()
59 chan->ipc->ops->handle_reply(chan->ipc); in mtk_adsp_ipc_recv()
62 chan->ipc->ops->handle_request(chan->ipc); in mtk_adsp_ipc_recv()
65 dev_err(dev, "wrong mbox chan %d\n", chan->idx); in mtk_adsp_ipc_recv()
72 struct device *dev = &pdev->dev; in mtk_adsp_ipc_probe()
79 device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent); in mtk_adsp_ipc_probe()
83 return -ENOMEM; in mtk_adsp_ipc_probe()
86 adsp_chan = &adsp_ipc->chans[i]; in mtk_adsp_ipc_probe()
87 cl = &adsp_chan->cl; in mtk_adsp_ipc_probe()
88 cl->dev = dev->parent; in mtk_adsp_ipc_probe()
89 cl->tx_block = false; in mtk_adsp_ipc_probe()
90 cl->knows_txdone = false; in mtk_adsp_ipc_probe()
91 cl->tx_prepare = NULL; in mtk_adsp_ipc_probe()
92 cl->rx_callback = mtk_adsp_ipc_recv; in mtk_adsp_ipc_probe()
94 adsp_chan->ipc = adsp_ipc; in mtk_adsp_ipc_probe()
95 adsp_chan->idx = i; in mtk_adsp_ipc_probe()
96 adsp_chan->ch = mbox_request_channel_byname(cl, adsp_mbox_ch_names[i]); in mtk_adsp_ipc_probe()
97 if (IS_ERR(adsp_chan->ch)) { in mtk_adsp_ipc_probe()
98 ret = dev_err_probe(dev, PTR_ERR(adsp_chan->ch), in mtk_adsp_ipc_probe()
103 adsp_chan = &adsp_ipc->chans[j]; in mtk_adsp_ipc_probe()
104 mbox_free_channel(adsp_chan->ch); in mtk_adsp_ipc_probe()
111 adsp_ipc->dev = dev; in mtk_adsp_ipc_probe()
113 dev_dbg(dev, "MTK ADSP IPC initialized\n"); in mtk_adsp_ipc_probe()
120 struct mtk_adsp_ipc *adsp_ipc = dev_get_drvdata(&pdev->dev); in mtk_adsp_ipc_remove()
125 adsp_chan = &adsp_ipc->chans[i]; in mtk_adsp_ipc_remove()
126 mbox_free_channel(adsp_chan->ch); in mtk_adsp_ipc_remove()
132 .name = "mtk-adsp-ipc",
139 MODULE_AUTHOR("Allen-KH Cheng <allen-[email protected]>");
140 MODULE_DESCRIPTION("MTK ADSP IPC Driver");