[<prev] [next>] [day] [month] [year] [list]
Message-ID: <YZ4TGvtwO5ySCEkT@google.com>
Date: Wed, 24 Nov 2021 18:25:30 +0800
From: Tzung-Bi Shih <tzungbi@...gle.com>
To: "allen-kh.cheng" <allen-kh.cheng@...iatek.com>
Cc: Jassi Brar <jassisinghbrar@...il.com>,
Rob Herring <robh+dt@...nel.org>,
Matthias Brugger <matthias.bgg@...il.com>,
Linux-ALSA <alsa-devel@...a-project.org>,
cujomalainey@...gle.com,
Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>,
Liam Girdwood <lgirdwood@...il.com>,
Ranjani Sridharan <ranjani.sridharan@...ux.intel.com>,
Kai Vehmanen <kai.vehmanen@...ux.intel.com>,
Daniel Baluta <daniel.baluta@....com>,
Mark Brown <broonie@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Project_Global_Chrome_Upstream_Group@...iatek.com,
linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org,
sound-open-firmware@...a-project.org
Subject: Re: [PATCH v3 3/3] firmware: mediatek: add adsp ipc protocol
interface
On Wed, Nov 24, 2021 at 04:45:14PM +0800, allen-kh.cheng wrote:
> drivers/firmware/Kconfig | 1 +
> drivers/firmware/Makefile | 1 +
> drivers/firmware/mediatek/Kconfig | 10 ++
> drivers/firmware/mediatek/Makefile | 2 +
> drivers/firmware/mediatek/mtk-adsp-ipc.c | 130 ++++++++++++++++++
> .../linux/firmware/mediatek/mtk-adsp-ipc.h | 72 ++++++++++
> 6 files changed, 216 insertions(+)
> create mode 100644 drivers/firmware/mediatek/Kconfig
> create mode 100644 drivers/firmware/mediatek/Makefile
> create mode 100644 drivers/firmware/mediatek/mtk-adsp-ipc.c
> create mode 100644 include/linux/firmware/mediatek/mtk-adsp-ipc.h
The patch should move before the 2nd patch in the series as the 2nd patch uses mtk-adsp-ipc.h.
> diff --git a/drivers/firmware/mediatek/mtk-adsp-ipc.c b/drivers/firmware/mediatek/mtk-adsp-ipc.c
[...]
> +int adsp_ipc_send(struct mtk_adsp_ipc *ipc, unsigned int idx, uint32_t op)
> +{
> + struct mtk_adsp_chan *dsp_chan = &ipc->chans[idx];
> + struct adsp_mbox_ch_info *ch_info = dsp_chan->ch->con_priv;
> + int ret;
> +
> + if (idx >= MTK_ADSP_MBOX_NUM)
> + return -EINVAL;
If idx >= MTK_ADSP_MBOX_NUM, the invalid memory access has occurred at beginning of the function.
> +static int mtk_adsp_ipc_probe(struct platform_device *pdev)
> +{
[...]
> + device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent);
Why does it need to call device_set_of_node_from_dev()?
> + for (i = 0; i < MTK_ADSP_MBOX_NUM; i++) {
> + chan_name = kasprintf(GFP_KERNEL, "mbox%d", i);
> + if (!chan_name)
> + return -ENOMEM;
> +
> + dsp_chan = &dsp_ipc->chans[i];
> + cl = &dsp_chan->cl;
> + cl->dev = dev->parent;
> + cl->tx_block = false;
> + cl->knows_txdone = false;
> + cl->tx_prepare = NULL;
> + cl->rx_callback = adsp_ipc_recv;
> +
> + dsp_chan->ipc = dsp_ipc;
> + dsp_chan->idx = i;
> + dsp_chan->ch = mbox_request_channel_byname(cl, chan_name);
> + if (IS_ERR(dsp_chan->ch)) {
> + ret = PTR_ERR(dsp_chan->ch);
> + if (ret != -EPROBE_DEFER)
> + dev_err(dev, "Failed to request mbox chan %d ret %d\n",
> + i, ret);
If ret == -EPROBE_DEFER, wouldn't it need to return -EPROBE_DEFER? It doesn't retry later if -EPROBE_DEFER.
Powered by blists - more mailing lists