Lines Matching +full:ipc +full:-

1 // SPDX-License-Identifier: GPL-2.0+
6 * Implementation of the DSP IPC interface (host side)
18 * imx_dsp_ring_doorbell - triggers an interrupt on the other side (DSP)
20 * @dsp: DSP IPC handle
23 * Returns non-negative value for success, negative value for error
25 int imx_dsp_ring_doorbell(struct imx_dsp_ipc *ipc, unsigned int idx) in imx_dsp_ring_doorbell() argument
31 return -EINVAL; in imx_dsp_ring_doorbell()
33 dsp_chan = &ipc->chans[idx]; in imx_dsp_ring_doorbell()
34 ret = mbox_send_message(dsp_chan->ch, NULL); in imx_dsp_ring_doorbell()
43 * imx_dsp_handle_rx - rx callback used by imx mailbox
48 * Users of DSP IPC will need to privde handle_reply and handle_request
55 if (chan->idx == 0) { in imx_dsp_handle_rx()
56 chan->ipc->ops->handle_reply(chan->ipc); in imx_dsp_handle_rx()
58 chan->ipc->ops->handle_request(chan->ipc); in imx_dsp_handle_rx()
59 imx_dsp_ring_doorbell(chan->ipc, 1); in imx_dsp_handle_rx()
68 return ERR_PTR(-EINVAL); in imx_dsp_request_channel()
70 dsp_chan = &dsp_ipc->chans[idx]; in imx_dsp_request_channel()
71 dsp_chan->ch = mbox_request_channel_byname(&dsp_chan->cl, dsp_chan->name); in imx_dsp_request_channel()
72 return dsp_chan->ch; in imx_dsp_request_channel()
83 dsp_chan = &dsp_ipc->chans[idx]; in imx_dsp_free_channel()
84 mbox_free_channel(dsp_chan->ch); in imx_dsp_free_channel()
90 struct device *dev = dsp_ipc->dev; in imx_dsp_setup_channels()
101 chan_name = kasprintf(GFP_KERNEL, "rxdb%d", i - 2); in imx_dsp_setup_channels()
104 return -ENOMEM; in imx_dsp_setup_channels()
106 dsp_chan = &dsp_ipc->chans[i]; in imx_dsp_setup_channels()
107 dsp_chan->name = chan_name; in imx_dsp_setup_channels()
108 cl = &dsp_chan->cl; in imx_dsp_setup_channels()
109 cl->dev = dev; in imx_dsp_setup_channels()
110 cl->tx_block = false; in imx_dsp_setup_channels()
111 cl->knows_txdone = true; in imx_dsp_setup_channels()
112 cl->rx_callback = imx_dsp_handle_rx; in imx_dsp_setup_channels()
114 dsp_chan->ipc = dsp_ipc; in imx_dsp_setup_channels()
115 dsp_chan->idx = i % 2; in imx_dsp_setup_channels()
116 dsp_chan->ch = mbox_request_channel_byname(cl, chan_name); in imx_dsp_setup_channels()
117 if (IS_ERR(dsp_chan->ch)) { in imx_dsp_setup_channels()
118 ret = PTR_ERR(dsp_chan->ch); in imx_dsp_setup_channels()
119 if (ret != -EPROBE_DEFER) in imx_dsp_setup_channels()
131 dsp_chan = &dsp_ipc->chans[j]; in imx_dsp_setup_channels()
132 mbox_free_channel(dsp_chan->ch); in imx_dsp_setup_channels()
133 kfree(dsp_chan->name); in imx_dsp_setup_channels()
141 struct device *dev = &pdev->dev; in imx_dsp_probe()
145 device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent); in imx_dsp_probe()
149 return -ENOMEM; in imx_dsp_probe()
151 dsp_ipc->dev = dev; in imx_dsp_probe()
158 dev_info(dev, "NXP i.MX DSP IPC initialized\n"); in imx_dsp_probe()
169 dsp_ipc = dev_get_drvdata(&pdev->dev); in imx_dsp_remove()
172 dsp_chan = &dsp_ipc->chans[i]; in imx_dsp_remove()
173 mbox_free_channel(dsp_chan->ch); in imx_dsp_remove()
174 kfree(dsp_chan->name); in imx_dsp_remove()
182 .name = "imx-dsp",
190 MODULE_DESCRIPTION("IMX DSP IPC protocol driver");