ASoC: SOF: Prepare set_stream_data_offset for compress API
authorDaniel Baluta <daniel.baluta@nxp.com>
Tue, 17 Jan 2023 12:25:31 +0000 (14:25 +0200)
committerMark Brown <broonie@kernel.org>
Tue, 17 Jan 2023 13:37:52 +0000 (13:37 +0000)
Make second parameter of set_stream_data_offset generic
in order to be used for both PCM and compress streams.

Current patch doesn't introduce any functional change,
just prepare the code for compress support.

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-3-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-pcm.c
sound/soc/sof/ops.h
sound/soc/sof/sof-priv.h
sound/soc/sof/stream-ipc.c

index 1f614eff2a68455b42081c404fa0eec3c556da75..4e0c48a361599fdf1f8e74ba06fd043da91566d2 100644 (file)
@@ -222,9 +222,10 @@ int acp_sof_ipc_msg_data(struct snd_sof_dev *sdev, struct snd_sof_pcm_stream *sp
 EXPORT_SYMBOL_NS(acp_sof_ipc_msg_data, SND_SOC_SOF_AMD_COMMON);
 
 int acp_set_stream_data_offset(struct snd_sof_dev *sdev,
-                              struct snd_pcm_substream *substream,
+                              struct snd_sof_pcm_stream *sps,
                               size_t posn_offset)
 {
+       struct snd_pcm_substream *substream = sps->substream;
        struct acp_dsp_stream *stream = substream->runtime->private_data;
 
        /* check for unaligned offset or overflow */
index d8cc2a92f1c0683587a224c3a0353e410b3a9c94..39165ebf684b68e6f9a37a46b12d1b4e59dfd1c7 100644 (file)
@@ -215,7 +215,7 @@ irqreturn_t acp_sof_ipc_irq_thread(int irq, void *context);
 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,
+                              struct snd_sof_pcm_stream *sps,
                               size_t posn_offset);
 int acp_sof_ipc_send_msg(struct snd_sof_dev *sdev,
                         struct snd_sof_ipc_msg *msg);
index 5705279d0707570b43bc91be03ba0ac771bd6fdf..d7e16e6b6f52c43c025ea0fd08452379669eb10f 100644 (file)
@@ -386,9 +386,10 @@ int hda_ipc_msg_data(struct snd_sof_dev *sdev,
 }
 
 int hda_set_stream_data_offset(struct snd_sof_dev *sdev,
-                              struct snd_pcm_substream *substream,
+                              struct snd_sof_pcm_stream *sps,
                               size_t posn_offset)
 {
+       struct snd_pcm_substream *substream = sps->substream;
        struct hdac_stream *hstream = substream->runtime->private_data;
        struct sof_intel_hda_stream *hda_stream;
 
index e6f1ff5913322b17c7d8f4cbb293f79050e2b85b..b3080b82ca253f1e64576720182c4ad19b0670d6 100644 (file)
@@ -659,7 +659,7 @@ int hda_ipc_msg_data(struct snd_sof_dev *sdev,
                     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,
+                              struct snd_sof_pcm_stream *sps,
                               size_t posn_offset);
 
 /*
index f10bfc9bd5cb41b61b20cf01ebb3b4d4c104d382..b29d93e0d2164bd0501272917f8df960390e885d 100644 (file)
@@ -129,7 +129,8 @@ static int sof_ipc3_pcm_hw_params(struct snd_soc_component *component,
                return ret;
        }
 
-       ret = snd_sof_set_stream_data_offset(sdev, substream, ipc_params_reply.posn_offset);
+       ret = snd_sof_set_stream_data_offset(sdev, &spcm->stream[substream->stream],
+                                            ipc_params_reply.posn_offset);
        if (ret < 0) {
                dev_err(component->dev, "%s: invalid stream data offset for PCM %d\n",
                        __func__, spcm->pcm.pcm_id);
index db92cd3384679b782bc97d961777cc3fe56e2163..febe318b9427629ecc9c3d32acfc7fb1751694aa 100644 (file)
@@ -480,11 +480,11 @@ static inline int snd_sof_ipc_msg_data(struct snd_sof_dev *sdev,
 /* host side configuration of the stream's data offset in stream mailbox area */
 static inline int
 snd_sof_set_stream_data_offset(struct snd_sof_dev *sdev,
-                              struct snd_pcm_substream *substream,
+                              struct snd_sof_pcm_stream *sps,
                               size_t posn_offset)
 {
        if (sof_ops(sdev) && sof_ops(sdev)->set_stream_data_offset)
-               return sof_ops(sdev)->set_stream_data_offset(sdev, substream,
+               return sof_ops(sdev)->set_stream_data_offset(sdev, sps,
                                                             posn_offset);
 
        return 0;
index 39b015c59168090b5d9762bfbcac46adfa3c7883..95a6b301da497eccedf8845faf28909154de28d0 100644 (file)
@@ -254,7 +254,7 @@ struct snd_sof_dsp_ops {
 
        /* host side configuration of the stream's data offset in stream mailbox area */
        int (*set_stream_data_offset)(struct snd_sof_dev *sdev,
-                                     struct snd_pcm_substream *substream,
+                                     struct snd_sof_pcm_stream *sps,
                                      size_t posn_offset); /* optional */
 
        /* pre/post firmware run */
@@ -766,7 +766,7 @@ int sof_ipc_msg_data(struct snd_sof_dev *sdev,
                     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,
+                              struct snd_sof_pcm_stream *sps,
                               size_t posn_offset);
 
 int sof_stream_pcm_open(struct snd_sof_dev *sdev,
index 13e44501d44200ae8e2d7971f5ae4072acff79ef..872a49550672c49def37831ab1077a08d343c850 100644 (file)
@@ -48,9 +48,10 @@ int sof_ipc_msg_data(struct snd_sof_dev *sdev,
 EXPORT_SYMBOL(sof_ipc_msg_data);
 
 int sof_set_stream_data_offset(struct snd_sof_dev *sdev,
-                              struct snd_pcm_substream *substream,
+                              struct snd_sof_pcm_stream *sps,
                               size_t posn_offset)
 {
+       struct snd_pcm_substream *substream = sps->substream;
        struct sof_stream *stream = substream->runtime->private_data;
 
        /* check if offset is overflow or it is not aligned */