]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
ASoC: SOF: Prepare ipc_msg_data to be used with compress API
authorDaniel Baluta <daniel.baluta@nxp.com>
Tue, 17 Jan 2023 12:25:30 +0000 (14:25 +0200)
committerMark Brown <broonie@kernel.org>
Tue, 17 Jan 2023 13:37:51 +0000 (13:37 +0000)
Make second parameter of ipc_msg_data generic
in order to be able to support compressed streams.

This patch doesn't hold any functional change.

With this case we can use ipc_msg_data, to retrieve information from
DSP for both PCM/Compress API.

Reviewed-by: Paul Olaru <paul.olaru@nxp.com>
Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Link: https://lore.kernel.org/r/20230117122533.201708-2-daniel.baluta@oss.nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/amd/acp-ipc.c
sound/soc/sof/amd/acp.h
sound/soc/sof/intel/hda-ipc.c
sound/soc/sof/intel/hda.h
sound/soc/sof/ipc3.c
sound/soc/sof/mediatek/mt8186/mt8186.c
sound/soc/sof/mediatek/mt8195/mt8195.c
sound/soc/sof/ops.h
sound/soc/sof/sof-priv.h
sound/soc/sof/stream-ipc.c

index 5a02753c46104de293f042d13e320dcf61dcd4e8..1f614eff2a68455b42081c404fa0eec3c556da75 100644 (file)
@@ -200,14 +200,15 @@ irqreturn_t acp_sof_ipc_irq_thread(int irq, void *context)
 }
 EXPORT_SYMBOL_NS(acp_sof_ipc_irq_thread, SND_SOC_SOF_AMD_COMMON);
 
-int acp_sof_ipc_msg_data(struct snd_sof_dev *sdev, struct snd_pcm_substream *substream,
+int acp_sof_ipc_msg_data(struct snd_sof_dev *sdev, struct snd_sof_pcm_stream *sps,
                         void *p, size_t sz)
 {
        unsigned int offset = sdev->dsp_box.offset;
 
-       if (!substream || !sdev->stream_box.size) {
+       if (!sps || !sdev->stream_box.size) {
                acp_mailbox_read(sdev, offset, p, sz);
        } else {
+               struct snd_pcm_substream *substream = sps->substream;
                struct acp_dsp_stream *stream = substream->runtime->private_data;
 
                if (!stream)
index 4314094a97fd7796b0752e17bd27ff57a095e9ab..d8cc2a92f1c0683587a224c3a0353e410b3a9c94 100644 (file)
@@ -12,6 +12,7 @@
 #define __SOF_AMD_ACP_H
 
 #include "../sof-priv.h"
+#include "../sof-audio.h"
 
 #define ACP_MAX_STREAM 8
 
@@ -211,7 +212,7 @@ int acp_dsp_block_read(struct snd_sof_dev *sdev, enum snd_sof_fw_blk_type blk_ty
 
 /* IPC callbacks */
 irqreturn_t acp_sof_ipc_irq_thread(int irq, void *context);
-int acp_sof_ipc_msg_data(struct snd_sof_dev *sdev, struct snd_pcm_substream *substream,
+int acp_sof_ipc_msg_data(struct snd_sof_dev *sdev, struct snd_sof_pcm_stream *sps,
                         void *p, size_t sz);
 int acp_set_stream_data_offset(struct snd_sof_dev *sdev,
                               struct snd_pcm_substream *substream,
index a7c454e03952867f36d48eb0f7ad9d65a96abc70..5705279d0707570b43bc91be03ba0ac771bd6fdf 100644 (file)
@@ -361,12 +361,13 @@ int hda_dsp_ipc_get_window_offset(struct snd_sof_dev *sdev, u32 id)
 }
 
 int hda_ipc_msg_data(struct snd_sof_dev *sdev,
-                    struct snd_pcm_substream *substream,
+                    struct snd_sof_pcm_stream *sps,
                     void *p, size_t sz)
 {
-       if (!substream || !sdev->stream_box.size) {
+       if (!sps || !sdev->stream_box.size) {
                sof_mailbox_read(sdev, sdev->dsp_box.offset, p, sz);
        } else {
+               struct snd_pcm_substream *substream = sps->substream;
                struct hdac_stream *hstream = substream->runtime->private_data;
                struct sof_intel_hda_stream *hda_stream;
 
index caccaf8fba9c0a5e58b5d6140ac9df2f30424298..e6f1ff5913322b17c7d8f4cbb293f79050e2b85b 100644 (file)
@@ -656,7 +656,7 @@ int hda_dsp_stream_spib_config(struct snd_sof_dev *sdev,
                               int enable, u32 size);
 
 int hda_ipc_msg_data(struct snd_sof_dev *sdev,
-                    struct snd_pcm_substream *substream,
+                    struct snd_sof_pcm_stream *sps,
                     void *p, size_t sz);
 int hda_set_stream_data_offset(struct snd_sof_dev *sdev,
                               struct snd_pcm_substream *substream,
index 1fef4dcc093683b736e8401f9052b6eab6d4d41d..8e936353c1c0146c41f8df48a0caa1f21fdc990e 100644 (file)
@@ -847,7 +847,7 @@ static void ipc3_period_elapsed(struct snd_sof_dev *sdev, u32 msg_id)
        }
 
        stream = &spcm->stream[direction];
-       ret = snd_sof_ipc_msg_data(sdev, stream->substream, &posn, sizeof(posn));
+       ret = snd_sof_ipc_msg_data(sdev, stream, &posn, sizeof(posn));
        if (ret < 0) {
                dev_warn(sdev->dev, "failed to read stream position: %d\n", ret);
                return;
@@ -882,7 +882,7 @@ static void ipc3_xrun(struct snd_sof_dev *sdev, u32 msg_id)
        }
 
        stream = &spcm->stream[direction];
-       ret = snd_sof_ipc_msg_data(sdev, stream->substream, &posn, sizeof(posn));
+       ret = snd_sof_ipc_msg_data(sdev, stream, &posn, sizeof(posn));
        if (ret < 0) {
                dev_warn(sdev->dev, "failed to read overrun position: %d\n", ret);
                return;
index dbea604ebc040a490f0a4d985d21e0e95f3a4b1f..597cb4476acb4183b3ab6c98c69ac953b6eaa7f0 100644 (file)
@@ -494,7 +494,7 @@ static snd_pcm_uframes_t mt8186_pcm_pointer(struct snd_sof_dev *sdev,
        }
 
        stream = &spcm->stream[substream->stream];
-       ret = snd_sof_ipc_msg_data(sdev, stream->substream, &posn, sizeof(posn));
+       ret = snd_sof_ipc_msg_data(sdev, stream, &posn, sizeof(posn));
        if (ret < 0) {
                dev_warn(sdev->dev, "failed to read stream position: %d\n", ret);
                return 0;
index 5b04fec9c9c9a4d7f0c309a2a36646eddc345f9e..42bae574c87ab22d131ab30f56d56d6e4e94ba6f 100644 (file)
@@ -520,7 +520,7 @@ static snd_pcm_uframes_t mt8195_pcm_pointer(struct snd_sof_dev *sdev,
        }
 
        stream = &spcm->stream[substream->stream];
-       ret = snd_sof_ipc_msg_data(sdev, stream->substream, &posn, sizeof(posn));
+       ret = snd_sof_ipc_msg_data(sdev, stream, &posn, sizeof(posn));
        if (ret < 0) {
                dev_warn(sdev->dev, "failed to read stream position: %d\n", ret);
                return 0;
index c527522505650e5b548741d9cb1777634e830d19..db92cd3384679b782bc97d961777cc3fe56e2163 100644 (file)
@@ -472,10 +472,10 @@ static inline int snd_sof_load_firmware(struct snd_sof_dev *sdev)
 
 /* host DSP message data */
 static inline int snd_sof_ipc_msg_data(struct snd_sof_dev *sdev,
-                                      struct snd_pcm_substream *substream,
+                                      struct snd_sof_pcm_stream *sps,
                                       void *p, size_t sz)
 {
-       return sof_ops(sdev)->ipc_msg_data(sdev, substream, p, sz);
+       return sof_ops(sdev)->ipc_msg_data(sdev, sps, p, sz);
 }
 /* host side configuration of the stream's data offset in stream mailbox area */
 static inline int
index 752bf46c7bc968a86c5450a78ab4089f7514c031..39b015c59168090b5d9762bfbcac46adfa3c7883 100644 (file)
@@ -20,6 +20,8 @@
 #include <uapi/sound/sof/fw.h>
 #include <sound/sof/ext_manifest.h>
 
+struct snd_sof_pcm_stream;
+
 /* Flag definitions used in sof_core_debug (sof_debug module parameter) */
 #define SOF_DBG_ENABLE_TRACE   BIT(0)
 #define SOF_DBG_RETAIN_CTX     BIT(1)  /* prevent DSP D3 on FW exception */
@@ -247,7 +249,7 @@ struct snd_sof_dsp_ops {
 
        /* host read DSP stream data */
        int (*ipc_msg_data)(struct snd_sof_dev *sdev,
-                           struct snd_pcm_substream *substream,
+                           struct snd_sof_pcm_stream *sps,
                            void *p, size_t sz); /* mandatory */
 
        /* host side configuration of the stream's data offset in stream mailbox area */
@@ -761,7 +763,7 @@ int sof_block_read(struct snd_sof_dev *sdev, enum snd_sof_fw_blk_type blk_type,
                   u32 offset, void *dest, size_t size);
 
 int sof_ipc_msg_data(struct snd_sof_dev *sdev,
-                    struct snd_pcm_substream *substream,
+                    struct snd_sof_pcm_stream *sps,
                     void *p, size_t sz);
 int sof_set_stream_data_offset(struct snd_sof_dev *sdev,
                               struct snd_pcm_substream *substream,
index 5f1ceeea893a539e4f60a9872e766b005e6a8006..13e44501d44200ae8e2d7971f5ae4072acff79ef 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "ops.h"
 #include "sof-priv.h"
+#include "sof-audio.h"
 
 struct sof_stream {
        size_t posn_offset;
@@ -26,12 +27,13 @@ struct sof_stream {
 
 /* Mailbox-based Generic IPC implementation */
 int sof_ipc_msg_data(struct snd_sof_dev *sdev,
-                    struct snd_pcm_substream *substream,
+                    struct snd_sof_pcm_stream *sps,
                     void *p, size_t sz)
 {
-       if (!substream || !sdev->stream_box.size) {
+       if (!sps || !sdev->stream_box.size) {
                snd_sof_dsp_mailbox_read(sdev, sdev->dsp_box.offset, p, sz);
        } else {
+               struct snd_pcm_substream *substream = sps->substream;
                struct sof_stream *stream = substream->runtime->private_data;
 
                /* The stream might already be closed */