summaryrefslogtreecommitdiff
path: root/sound/soc/sof/ops.h
diff options
context:
space:
mode:
authorDaniel Baluta <daniel.baluta@nxp.com>2021-10-04 18:21:44 +0300
committerMark Brown <broonie@kernel.org>2021-10-07 18:57:53 +0300
commitf71f59dd450813684d838e0c1d6602186b7d2d8f (patch)
treeef8d0bc7642c5222480a21a88aab82182ba8a7db /sound/soc/sof/ops.h
parentdc1fad25bbd0698e8e61a0468e3920c5c29a803f (diff)
downloadlinux-f71f59dd450813684d838e0c1d6602186b7d2d8f.tar.xz
ASoC: SOF: Introduce snd_sof_mailbox_read / snd_sof_mailbox_write callbacks
We need to introduce snd_sof_mailbox_{read/write} in order to provide a generic way for mailbox access. These routines are optional, each platform can implement their own specific routines. So far, all platforms use mmapped I/O thus they can use custom made routines sof_mailbox_read / sof_mailbox_write that use MMIO. Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Signed-off-by: Bud Liviu-Alexandru <budliviu@gmail.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Link: https://lore.kernel.org/r/20211004152147.1268978-2-daniel.baluta@oss.nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sof/ops.h')
-rw-r--r--sound/soc/sof/ops.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/sound/soc/sof/ops.h b/sound/soc/sof/ops.h
index a93aa5b943b2..1a5cc8ad4aca 100644
--- a/sound/soc/sof/ops.h
+++ b/sound/soc/sof/ops.h
@@ -322,6 +322,21 @@ static inline int snd_sof_dsp_block_write(struct snd_sof_dev *sdev,
return sof_ops(sdev)->block_write(sdev, blk_type, offset, src, bytes);
}
+/* mailbox IO */
+static inline void snd_sof_dsp_mailbox_read(struct snd_sof_dev *sdev,
+ u32 offset, void *dest, size_t bytes)
+{
+ if (sof_ops(sdev)->mailbox_read)
+ sof_ops(sdev)->mailbox_read(sdev, offset, dest, bytes);
+}
+
+static inline void snd_sof_dsp_mailbox_write(struct snd_sof_dev *sdev,
+ u32 offset, void *src, size_t bytes)
+{
+ if (sof_ops(sdev)->mailbox_write)
+ sof_ops(sdev)->mailbox_write(sdev, offset, src, bytes);
+}
+
/* ipc */
static inline int snd_sof_dsp_send_msg(struct snd_sof_dev *sdev,
struct snd_sof_ipc_msg *msg)