ASoC: SOF: pcm: Move period/buffer configuration print after platform open
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Thu, 6 Feb 2025 09:28:26 +0000 (11:28 +0200)
committerMark Brown <broonie@kernel.org>
Thu, 6 Feb 2025 11:25:42 +0000 (11:25 +0000)
The platform specific pcm_open call via snd_sof_pcm_platform_open() can
modify the initial buffer configuration via constraints.

Move the prints as last step in the sof_pcm_open() function to reflect the
final setup.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://patch.msgid.link/20250206092828.7569-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/pcm.c

index 709baa1b0bd6e05fee9228b68198becfeb200e22..d09be241e95e059548247c7df0004cfa0a7c13c0 100644 (file)
@@ -536,15 +536,6 @@ static int sof_pcm_open(struct snd_soc_component *component,
         */
        runtime->hw.buffer_bytes_max = le32_to_cpu(caps->buffer_size_max);
 
-       dev_dbg(component->dev, "period min %zd max %zd bytes\n",
-               runtime->hw.period_bytes_min,
-               runtime->hw.period_bytes_max);
-       dev_dbg(component->dev, "period count %d max %d\n",
-               runtime->hw.periods_min,
-               runtime->hw.periods_max);
-       dev_dbg(component->dev, "buffer max %zd bytes\n",
-               runtime->hw.buffer_bytes_max);
-
        /* set wait time - TODO: come from topology */
        substream->wait_time = 500;
 
@@ -554,10 +545,21 @@ static int sof_pcm_open(struct snd_soc_component *component,
        spcm->prepared[substream->stream] = false;
 
        ret = snd_sof_pcm_platform_open(sdev, substream);
-       if (ret < 0)
+       if (ret < 0) {
                dev_err(component->dev, "error: pcm open failed %d\n", ret);
+               return ret;
+       }
 
-       return ret;
+       dev_dbg(component->dev, "period bytes min %zd, max %zd\n",
+               runtime->hw.period_bytes_min,
+               runtime->hw.period_bytes_max);
+       dev_dbg(component->dev, "period count min %d, max %d\n",
+               runtime->hw.periods_min,
+               runtime->hw.periods_max);
+       dev_dbg(component->dev, "buffer bytes max %zd\n",
+               runtime->hw.buffer_bytes_max);
+
+       return 0;
 }
 
 static int sof_pcm_close(struct snd_soc_component *component,