summaryrefslogtreecommitdiff
path: root/sound/soc/sof/pcm.c
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>2022-03-10 07:27:12 +0300
committerMark Brown <broonie@kernel.org>2022-03-11 16:41:01 +0300
commit31f60a0c943d6a7e84b06686b1ed86ddadf484fa (patch)
tree025aba74c848fb54223cbbe07a6c93790d267047 /sound/soc/sof/pcm.c
parentd7bc6ddef016d851cb0ff97ae16ac98d5f3c85ee (diff)
downloadlinux-31f60a0c943d6a7e84b06686b1ed86ddadf484fa.tar.xz
ASoC: SOF: Make pcm_hw_params snd_sof_dsp_ops callback IPC neutral
Do not send IPC structure directly via pcm_hw_params to make it IPC agnostic. A new struct is created to retrieve the needed platform parameters and if there is a need it can be extended with new options. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com> Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://lore.kernel.org/r/20220310042720.976809-3-ranjani.sridharan@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sof/pcm.c')
-rw-r--r--sound/soc/sof/pcm.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/sound/soc/sof/pcm.c b/sound/soc/sof/pcm.c
index 4628bc642fda..0c595d94dfce 100644
--- a/sound/soc/sof/pcm.c
+++ b/sound/soc/sof/pcm.c
@@ -162,6 +162,8 @@ static int sof_pcm_hw_params(struct snd_soc_component *component,
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(component);
+ struct snd_sof_platform_stream_params platform_params = { 0 };
+ struct sof_ipc_fw_version *v = &sdev->fw_ready.version;
struct snd_sof_pcm *spcm;
struct sof_ipc_pcm_params pcm;
struct sof_ipc_pcm_params_reply ipc_params_reply;
@@ -242,12 +244,29 @@ static int sof_pcm_hw_params(struct snd_soc_component *component,
ret = snd_sof_pcm_platform_hw_params(sdev,
substream,
params,
- &pcm.params);
+ &platform_params);
if (ret < 0) {
dev_err(component->dev, "error: platform hw params failed\n");
return ret;
}
+ /* Update the IPC message with information from the platform */
+ pcm.params.stream_tag = platform_params.stream_tag;
+
+ if (platform_params.use_phy_address)
+ pcm.params.buffer.phy_addr = platform_params.phy_addr;
+
+ if (platform_params.no_ipc_position) {
+ /* For older ABIs set host_period_bytes to zero to inform
+ * FW we don't want position updates. Newer versions use
+ * no_stream_position for this purpose.
+ */
+ if (v->abi_version < SOF_ABI_VER(3, 10, 0))
+ pcm.params.host_period_bytes = 0;
+ else
+ pcm.params.no_stream_position = 1;
+ }
+
dev_dbg(component->dev, "stream_tag %d", pcm.params.stream_tag);
/* if this is a repeated hw_params without hw_free, skip setting up widgets */