Lines Matching +full:nxp +full:- +full:imx
1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright 2019 NXP
4 * Author: Daniel Baluta <daniel.baluta@nxp.com>
9 #include <linux/firmware/imx/dsp.h>
17 * imx_dsp_ring_doorbell - triggers an interrupt on the other side (DSP)
22 * Returns non-negative value for success, negative value for error
30 return -EINVAL; in imx_dsp_ring_doorbell()
32 dsp_chan = &ipc->chans[idx]; in imx_dsp_ring_doorbell()
33 ret = mbox_send_message(dsp_chan->ch, NULL); in imx_dsp_ring_doorbell()
42 * imx_dsp_handle_rx - rx callback used by imx mailbox
54 if (chan->idx == 0) { in imx_dsp_handle_rx()
55 chan->ipc->ops->handle_reply(chan->ipc); in imx_dsp_handle_rx()
57 chan->ipc->ops->handle_request(chan->ipc); in imx_dsp_handle_rx()
58 imx_dsp_ring_doorbell(chan->ipc, 1); in imx_dsp_handle_rx()
67 return ERR_PTR(-EINVAL); in imx_dsp_request_channel()
69 dsp_chan = &dsp_ipc->chans[idx]; in imx_dsp_request_channel()
70 dsp_chan->ch = mbox_request_channel_byname(&dsp_chan->cl, dsp_chan->name); in imx_dsp_request_channel()
71 return dsp_chan->ch; in imx_dsp_request_channel()
82 dsp_chan = &dsp_ipc->chans[idx]; in imx_dsp_free_channel()
83 mbox_free_channel(dsp_chan->ch); in imx_dsp_free_channel()
89 struct device *dev = dsp_ipc->dev; in imx_dsp_setup_channels()
100 chan_name = kasprintf(GFP_KERNEL, "rxdb%d", i - 2); in imx_dsp_setup_channels()
103 return -ENOMEM; in imx_dsp_setup_channels()
105 dsp_chan = &dsp_ipc->chans[i]; in imx_dsp_setup_channels()
106 dsp_chan->name = chan_name; in imx_dsp_setup_channels()
107 cl = &dsp_chan->cl; in imx_dsp_setup_channels()
108 cl->dev = dev; in imx_dsp_setup_channels()
109 cl->tx_block = false; in imx_dsp_setup_channels()
110 cl->knows_txdone = true; in imx_dsp_setup_channels()
111 cl->rx_callback = imx_dsp_handle_rx; in imx_dsp_setup_channels()
113 dsp_chan->ipc = dsp_ipc; in imx_dsp_setup_channels()
114 dsp_chan->idx = i % 2; in imx_dsp_setup_channels()
115 dsp_chan->ch = mbox_request_channel_byname(cl, chan_name); in imx_dsp_setup_channels()
116 if (IS_ERR(dsp_chan->ch)) { in imx_dsp_setup_channels()
117 ret = PTR_ERR(dsp_chan->ch); in imx_dsp_setup_channels()
118 if (ret != -EPROBE_DEFER) in imx_dsp_setup_channels()
121 kfree(dsp_chan->name); 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()
180 .name = "imx-dsp",
187 MODULE_AUTHOR("Daniel Baluta <daniel.baluta@nxp.com>");
188 MODULE_DESCRIPTION("IMX DSP IPC protocol driver");