From: Daniel Baluta <[email protected]>
This patchseries adds new helpers in order to reduce code duplication
and prepare for compress audio support with SOF.
Bud Liviu-Alexandru (1):
ASoC: SOF: Make Intel IPC stream ops generic
Daniel Baluta (3):
ASoC: SOF: Introduce snd_sof_mailbox_read / snd_sof_mailbox_write
callbacks
ASoC: SOF: imx: Use newly introduced generic IPC stream ops
ASoC: SOF: Introduce fragment elapsed notification API
sound/soc/sof/Kconfig | 4 ++
sound/soc/sof/Makefile | 3 +-
sound/soc/sof/compress.c | 51 +++++++++++++++++++
sound/soc/sof/imx/Kconfig | 2 +
sound/soc/sof/imx/imx8.c | 39 +++++++-------
sound/soc/sof/imx/imx8m.c | 26 ++++------
sound/soc/sof/intel/Makefile | 3 --
sound/soc/sof/intel/apl.c | 4 ++
sound/soc/sof/intel/bdw.c | 12 +++--
sound/soc/sof/intel/byt.c | 24 ++++++---
sound/soc/sof/intel/cnl.c | 4 ++
sound/soc/sof/intel/icl.c | 4 ++
sound/soc/sof/intel/pci-tng.c | 12 +++--
sound/soc/sof/intel/tgl.c | 4 ++
sound/soc/sof/ipc.c | 6 ++-
sound/soc/sof/ops.h | 15 ++++++
sound/soc/sof/pcm.c | 7 ++-
sound/soc/sof/sof-audio.h | 11 +++-
sound/soc/sof/sof-priv.h | 28 ++++++----
.../sof/{intel/intel-ipc.c => stream-ipc.c} | 50 +++++++++---------
sound/soc/sof/topology.c | 6 ++-
21 files changed, 218 insertions(+), 97 deletions(-)
create mode 100644 sound/soc/sof/compress.c
rename sound/soc/sof/{intel/intel-ipc.c => stream-ipc.c} (58%)
--
2.27.0
From: Bud Liviu-Alexandru <[email protected]>
This operations should be generic as there is nothing Intel
specific. This works well for NXP i.MX8 stream IPC ops.
We start by moving sof/intel/intel-ipc.c into sof/stream-ipc.c and
rename the functions to be generic.
Notice that we use newly introduced snd_sof_dsp_mailbox_read
instead of sof_mailbox_read, to make sure that we are not
bound to existing MMIO memory access, and we allow platform
to implement their own memory access routines.
Signed-off-by: Daniel Baluta <[email protected]>
Signed-off-by: Bud Liviu-Alexandru <[email protected]>
Reviewed-by: Pierre-Louis Bossart <[email protected]>
Reviewed-by: Daniel Baluta <[email protected]>
Reviewed-by: Péter Ujfalusi <[email protected]>
---
sound/soc/sof/Makefile | 2 +-
sound/soc/sof/intel/Makefile | 3 --
sound/soc/sof/intel/bdw.c | 8 +--
sound/soc/sof/intel/byt.c | 16 +++---
sound/soc/sof/intel/pci-tng.c | 8 +--
sound/soc/sof/sof-priv.h | 20 ++++----
.../sof/{intel/intel-ipc.c => stream-ipc.c} | 50 +++++++++----------
7 files changed, 52 insertions(+), 55 deletions(-)
rename sound/soc/sof/{intel/intel-ipc.c => stream-ipc.c} (58%)
diff --git a/sound/soc/sof/Makefile b/sound/soc/sof/Makefile
index bdea0faac117..c5b97c66a9f1 100644
--- a/sound/soc/sof/Makefile
+++ b/sound/soc/sof/Makefile
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
snd-sof-objs := core.o ops.o loader.o ipc.o pcm.o pm.o debug.o topology.o\
- control.o trace.o utils.o sof-audio.o
+ control.o trace.o utils.o sof-audio.o stream-ipc.o
snd-sof-$(CONFIG_SND_SOC_SOF_DEBUG_PROBES) += sof-probes.o
diff --git a/sound/soc/sof/intel/Makefile b/sound/soc/sof/intel/Makefile
index 9635dd47a17d..1f473d4d8416 100644
--- a/sound/soc/sof/intel/Makefile
+++ b/sound/soc/sof/intel/Makefile
@@ -3,8 +3,6 @@
snd-sof-acpi-intel-byt-objs := byt.o
snd-sof-acpi-intel-bdw-objs := bdw.o
-snd-sof-intel-ipc-objs := intel-ipc.o
-
snd-sof-intel-hda-common-objs := hda.o hda-loader.o hda-stream.o hda-trace.o \
hda-dsp.o hda-ipc.o hda-ctrl.o hda-pcm.o \
hda-dai.o hda-bus.o \
@@ -18,7 +16,6 @@ snd-sof-intel-atom-objs := atom.o
obj-$(CONFIG_SND_SOC_SOF_INTEL_ATOM_HIFI_EP) += snd-sof-intel-atom.o
obj-$(CONFIG_SND_SOC_SOF_BAYTRAIL) += snd-sof-acpi-intel-byt.o
obj-$(CONFIG_SND_SOC_SOF_BROADWELL) += snd-sof-acpi-intel-bdw.o
-obj-$(CONFIG_SND_SOC_SOF_INTEL_HIFI_EP_IPC) += snd-sof-intel-ipc.o
obj-$(CONFIG_SND_SOC_SOF_HDA_COMMON) += snd-sof-intel-hda-common.o
obj-$(CONFIG_SND_SOC_SOF_HDA) += snd-sof-intel-hda.o
diff --git a/sound/soc/sof/intel/bdw.c b/sound/soc/sof/intel/bdw.c
index 9c06b92fcb5e..2c09a523288e 100644
--- a/sound/soc/sof/intel/bdw.c
+++ b/sound/soc/sof/intel/bdw.c
@@ -626,8 +626,8 @@ static const struct snd_sof_dsp_ops sof_bdw_ops = {
.get_mailbox_offset = bdw_get_mailbox_offset,
.get_window_offset = bdw_get_window_offset,
- .ipc_msg_data = intel_ipc_msg_data,
- .ipc_pcm_params = intel_ipc_pcm_params,
+ .ipc_msg_data = sof_ipc_msg_data,
+ .ipc_pcm_params = sof_ipc_pcm_params,
/* machine driver */
.machine_select = bdw_machine_select,
@@ -642,8 +642,8 @@ static const struct snd_sof_dsp_ops sof_bdw_ops = {
.debugfs_add_region_item = snd_sof_debugfs_add_region_item_iomem,
/* stream callbacks */
- .pcm_open = intel_pcm_open,
- .pcm_close = intel_pcm_close,
+ .pcm_open = sof_stream_pcm_open,
+ .pcm_close = sof_stream_pcm_close,
/* Module loading */
.load_module = snd_sof_parse_module_memcpy,
diff --git a/sound/soc/sof/intel/byt.c b/sound/soc/sof/intel/byt.c
index 8c500a83babc..e2fa08f1ae74 100644
--- a/sound/soc/sof/intel/byt.c
+++ b/sound/soc/sof/intel/byt.c
@@ -240,8 +240,8 @@ static const struct snd_sof_dsp_ops sof_byt_ops = {
.get_mailbox_offset = atom_get_mailbox_offset,
.get_window_offset = atom_get_window_offset,
- .ipc_msg_data = intel_ipc_msg_data,
- .ipc_pcm_params = intel_ipc_pcm_params,
+ .ipc_msg_data = sof_ipc_msg_data,
+ .ipc_pcm_params = sof_ipc_pcm_params,
/* machine driver */
.machine_select = atom_machine_select,
@@ -256,8 +256,8 @@ static const struct snd_sof_dsp_ops sof_byt_ops = {
.debugfs_add_region_item = snd_sof_debugfs_add_region_item_iomem,
/* stream callbacks */
- .pcm_open = intel_pcm_open,
- .pcm_close = intel_pcm_close,
+ .pcm_open = sof_stream_pcm_open,
+ .pcm_close = sof_stream_pcm_close,
/* module loading */
.load_module = snd_sof_parse_module_memcpy,
@@ -322,8 +322,8 @@ static const struct snd_sof_dsp_ops sof_cht_ops = {
.get_mailbox_offset = atom_get_mailbox_offset,
.get_window_offset = atom_get_window_offset,
- .ipc_msg_data = intel_ipc_msg_data,
- .ipc_pcm_params = intel_ipc_pcm_params,
+ .ipc_msg_data = sof_ipc_msg_data,
+ .ipc_pcm_params = sof_ipc_pcm_params,
/* machine driver */
.machine_select = atom_machine_select,
@@ -338,8 +338,8 @@ static const struct snd_sof_dsp_ops sof_cht_ops = {
.debugfs_add_region_item = snd_sof_debugfs_add_region_item_iomem,
/* stream callbacks */
- .pcm_open = intel_pcm_open,
- .pcm_close = intel_pcm_close,
+ .pcm_open = sof_stream_pcm_open,
+ .pcm_close = sof_stream_pcm_close,
/* module loading */
.load_module = snd_sof_parse_module_memcpy,
diff --git a/sound/soc/sof/intel/pci-tng.c b/sound/soc/sof/intel/pci-tng.c
index 8042ac76ec15..18eb41b8a8f4 100644
--- a/sound/soc/sof/intel/pci-tng.c
+++ b/sound/soc/sof/intel/pci-tng.c
@@ -156,8 +156,8 @@ const struct snd_sof_dsp_ops sof_tng_ops = {
.get_mailbox_offset = atom_get_mailbox_offset,
.get_window_offset = atom_get_window_offset,
- .ipc_msg_data = intel_ipc_msg_data,
- .ipc_pcm_params = intel_ipc_pcm_params,
+ .ipc_msg_data = sof_ipc_msg_data,
+ .ipc_pcm_params = sof_ipc_pcm_params,
/* machine driver */
.machine_select = atom_machine_select,
@@ -172,8 +172,8 @@ const struct snd_sof_dsp_ops sof_tng_ops = {
.debugfs_add_region_item = snd_sof_debugfs_add_region_item_iomem,
/* stream callbacks */
- .pcm_open = intel_pcm_open,
- .pcm_close = intel_pcm_close,
+ .pcm_open = sof_stream_pcm_open,
+ .pcm_close = sof_stream_pcm_close,
/* module loading */
.load_module = snd_sof_parse_module_memcpy,
diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h
index 388e71bcacf8..3927015c8a96 100644
--- a/sound/soc/sof/sof-priv.h
+++ b/sound/soc/sof/sof-priv.h
@@ -576,17 +576,17 @@ int sof_block_read(struct snd_sof_dev *sdev, enum snd_sof_fw_blk_type blk_type,
int sof_fw_ready(struct snd_sof_dev *sdev, u32 msg_id);
-int intel_ipc_msg_data(struct snd_sof_dev *sdev,
+int sof_ipc_msg_data(struct snd_sof_dev *sdev,
+ struct snd_pcm_substream *substream,
+ void *p, size_t sz);
+int sof_ipc_pcm_params(struct snd_sof_dev *sdev,
struct snd_pcm_substream *substream,
- void *p, size_t sz);
-int intel_ipc_pcm_params(struct snd_sof_dev *sdev,
- struct snd_pcm_substream *substream,
- const struct sof_ipc_pcm_params_reply *reply);
-
-int intel_pcm_open(struct snd_sof_dev *sdev,
- struct snd_pcm_substream *substream);
-int intel_pcm_close(struct snd_sof_dev *sdev,
- struct snd_pcm_substream *substream);
+ const struct sof_ipc_pcm_params_reply *reply);
+
+int sof_stream_pcm_open(struct snd_sof_dev *sdev,
+ struct snd_pcm_substream *substream);
+int sof_stream_pcm_close(struct snd_sof_dev *sdev,
+ struct snd_pcm_substream *substream);
int sof_machine_check(struct snd_sof_dev *sdev);
diff --git a/sound/soc/sof/intel/intel-ipc.c b/sound/soc/sof/stream-ipc.c
similarity index 58%
rename from sound/soc/sof/intel/intel-ipc.c
rename to sound/soc/sof/stream-ipc.c
index df37187c8427..15a55851faeb 100644
--- a/sound/soc/sof/intel/intel-ipc.c
+++ b/sound/soc/sof/stream-ipc.c
@@ -7,7 +7,7 @@
//
// Authors: Guennadi Liakhovetski <[email protected]>
-/* Intel-specific SOF IPC code */
+/* Generic SOF IPC code */
#include <linux/device.h>
#include <linux/export.h>
@@ -17,39 +17,39 @@
#include <sound/pcm.h>
#include <sound/sof/stream.h>
-#include "../ops.h"
-#include "../sof-priv.h"
+#include "ops.h"
+#include "sof-priv.h"
-struct intel_stream {
+struct sof_stream {
size_t posn_offset;
};
-/* Mailbox-based Intel IPC implementation */
-int intel_ipc_msg_data(struct snd_sof_dev *sdev,
- struct snd_pcm_substream *substream,
- void *p, size_t sz)
+/* Mailbox-based Generic IPC implementation */
+int sof_ipc_msg_data(struct snd_sof_dev *sdev,
+ struct snd_pcm_substream *substream,
+ void *p, size_t sz)
{
if (!substream || !sdev->stream_box.size) {
- sof_mailbox_read(sdev, sdev->dsp_box.offset, p, sz);
+ snd_sof_dsp_mailbox_read(sdev, sdev->dsp_box.offset, p, sz);
} else {
- struct intel_stream *stream = substream->runtime->private_data;
+ struct sof_stream *stream = substream->runtime->private_data;
/* The stream might already be closed */
if (!stream)
return -ESTRPIPE;
- sof_mailbox_read(sdev, stream->posn_offset, p, sz);
+ snd_sof_dsp_mailbox_read(sdev, stream->posn_offset, p, sz);
}
return 0;
}
-EXPORT_SYMBOL_NS(intel_ipc_msg_data, SND_SOC_SOF_INTEL_HIFI_EP_IPC);
+EXPORT_SYMBOL(sof_ipc_msg_data);
-int intel_ipc_pcm_params(struct snd_sof_dev *sdev,
- struct snd_pcm_substream *substream,
- const struct sof_ipc_pcm_params_reply *reply)
+int sof_ipc_pcm_params(struct snd_sof_dev *sdev,
+ struct snd_pcm_substream *substream,
+ const struct sof_ipc_pcm_params_reply *reply)
{
- struct intel_stream *stream = substream->runtime->private_data;
+ struct sof_stream *stream = substream->runtime->private_data;
size_t posn_offset = reply->posn_offset;
/* check if offset is overflow or it is not aligned */
@@ -64,12 +64,12 @@ int intel_ipc_pcm_params(struct snd_sof_dev *sdev,
return 0;
}
-EXPORT_SYMBOL_NS(intel_ipc_pcm_params, SND_SOC_SOF_INTEL_HIFI_EP_IPC);
+EXPORT_SYMBOL(sof_ipc_pcm_params);
-int intel_pcm_open(struct snd_sof_dev *sdev,
- struct snd_pcm_substream *substream)
+int sof_stream_pcm_open(struct snd_sof_dev *sdev,
+ struct snd_pcm_substream *substream)
{
- struct intel_stream *stream = kmalloc(sizeof(*stream), GFP_KERNEL);
+ struct sof_stream *stream = kmalloc(sizeof(*stream), GFP_KERNEL);
if (!stream)
return -ENOMEM;
@@ -86,18 +86,18 @@ int intel_pcm_open(struct snd_sof_dev *sdev,
return 0;
}
-EXPORT_SYMBOL_NS(intel_pcm_open, SND_SOC_SOF_INTEL_HIFI_EP_IPC);
+EXPORT_SYMBOL(sof_stream_pcm_open);
-int intel_pcm_close(struct snd_sof_dev *sdev,
- struct snd_pcm_substream *substream)
+int sof_stream_pcm_close(struct snd_sof_dev *sdev,
+ struct snd_pcm_substream *substream)
{
- struct intel_stream *stream = substream->runtime->private_data;
+ struct sof_stream *stream = substream->runtime->private_data;
substream->runtime->private_data = NULL;
kfree(stream);
return 0;
}
-EXPORT_SYMBOL_NS(intel_pcm_close, SND_SOC_SOF_INTEL_HIFI_EP_IPC);
+EXPORT_SYMBOL(sof_stream_pcm_close);
MODULE_LICENSE("Dual BSD/GPL");
--
2.27.0
On Mon, 4 Oct 2021 18:21:43 +0300, Daniel Baluta wrote:
> From: Daniel Baluta <[email protected]>
>
> This patchseries adds new helpers in order to reduce code duplication
> and prepare for compress audio support with SOF.
>
> Bud Liviu-Alexandru (1):
> ASoC: SOF: Make Intel IPC stream ops generic
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/4] ASoC: SOF: Introduce snd_sof_mailbox_read / snd_sof_mailbox_write callbacks
commit: f71f59dd450813684d838e0c1d6602186b7d2d8f
[2/4] ASoC: SOF: Make Intel IPC stream ops generic
commit: 97e22cbd0dc318f1cedb3546d2047403506bdc2d
[3/4] ASoC: SOF: imx: Use newly introduced generic IPC stream ops
commit: 40834190aa81270c52104fa9c82a1cae4bd1d359
[4/4] ASoC: SOF: Introduce fragment elapsed notification API
commit: 858f7a5c45cacbf9965c4735330ee34baa0728f4
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark