summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>2022-04-05 10:27:03 -0700
committerMark Brown <broonie@kernel.org>2022-04-11 19:17:57 +0100
commit045bc49bc9572f883db1a0740cb36bf6eeb206db (patch)
treeb1ff72be00cfe16b141f9175ebccf13a850a1640 /sound
parentdefad9d2e2703b040c3a001978c09c75970357f0 (diff)
ASoC: SOF: ipc: Use the get_reply ops in snd_sof_ipc_get_reply()
Use the get_reply ops to allow IPC dependent handling of the reply message. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://lore.kernel.org/r/20220405172708.122168-11-ranjani.sridharan@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/sof/ipc.c50
1 files changed, 2 insertions, 48 deletions
diff --git a/sound/soc/sof/ipc.c b/sound/soc/sof/ipc.c
index d11c5e6e57fb..39ec4361048a 100644
--- a/sound/soc/sof/ipc.c
+++ b/sound/soc/sof/ipc.c
@@ -443,63 +443,17 @@ EXPORT_SYMBOL(sof_ipc_tx_message_no_pm);
/* Generic helper function to retrieve the reply */
void snd_sof_ipc_get_reply(struct snd_sof_dev *sdev)
{
- struct snd_sof_ipc_msg *msg = sdev->msg;
- struct sof_ipc_reply *reply;
- int ret = 0;
-
/*
* Sometimes, there is unexpected reply ipc arriving. The reply
* ipc belongs to none of the ipcs sent from driver.
* In this case, the driver must ignore the ipc.
*/
- if (!msg) {
+ if (!sdev->msg) {
dev_warn(sdev->dev, "unexpected ipc interrupt raised!\n");
return;
}
- /* get the generic reply */
- reply = msg->reply_data;
- snd_sof_dsp_mailbox_read(sdev, sdev->host_box.offset, reply, sizeof(*reply));
-
- if (reply->error < 0) {
- ret = reply->error;
- } else if (!reply->hdr.size) {
- /* Reply should always be >= sizeof(struct sof_ipc_reply) */
- if (msg->reply_size)
- dev_err(sdev->dev,
- "empty reply received, expected %zu bytes\n",
- msg->reply_size);
- else
- dev_err(sdev->dev, "empty reply received\n");
-
- ret = -EINVAL;
- } else if (msg->reply_size > 0) {
- if (reply->hdr.size == msg->reply_size) {
- ret = 0;
- } else if (reply->hdr.size < msg->reply_size) {
- dev_dbg(sdev->dev,
- "reply size (%u) is less than expected (%zu)\n",
- reply->hdr.size, msg->reply_size);
-
- msg->reply_size = reply->hdr.size;
- ret = 0;
- } else {
- dev_err(sdev->dev,
- "reply size (%u) exceeds the buffer size (%zu)\n",
- reply->hdr.size, msg->reply_size);
- ret = -EINVAL;
- }
-
- /*
- * get the full message if reply->hdr.size <= msg->reply_size
- * and the reply->hdr.size > sizeof(struct sof_ipc_reply)
- */
- if (!ret && msg->reply_size > sizeof(*reply))
- snd_sof_dsp_mailbox_read(sdev, sdev->host_box.offset,
- msg->reply_data, msg->reply_size);
- }
-
- msg->reply_error = ret;
+ sdev->msg->reply_error = sdev->ipc->ops->get_reply(sdev);
}
EXPORT_SYMBOL(snd_sof_ipc_get_reply);