soundwire: intel_ace2x: Send PDI stream number during prepare
authorRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Wed, 16 Oct 2024 03:29:09 +0000 (11:29 +0800)
committerMark Brown <broonie@kernel.org>
Thu, 17 Oct 2024 11:11:19 +0000 (12:11 +0100)
In the case of a prepare callback after an xrun or when the PCM is
restarted after a call to snd_pcm_drain/snd_pcm_drop, avoid
reprogramming the SHIM registers but send the PDI stream number so that
the link DMA data can be set. This is needed for the case that the DMA
data is cleared when the PCM is stopped and restarted without being
closed.

Link: https://github.com/thesofproject/sof/issues/9502
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Acked-by: Vinod Koul <vkoul@kernel.org>
All: stable@vger.kernel.org # 6.10.x 6.11.x
Link: https://patch.msgid.link/20241016032910.14601-4-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/soundwire/intel_ace2x.c

index fff312c6968dd37c06369b2bd0d49eba0b05f804..4f3dd70d6a1a78fff6679fb5ac1c6599627d8c93 100644 (file)
@@ -376,11 +376,12 @@ static int intel_hw_params(struct snd_pcm_substream *substream,
 static int intel_prepare(struct snd_pcm_substream *substream,
                         struct snd_soc_dai *dai)
 {
+       struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
        struct sdw_cdns *cdns = snd_soc_dai_get_drvdata(dai);
        struct sdw_intel *sdw = cdns_to_intel(cdns);
        struct sdw_cdns_dai_runtime *dai_runtime;
+       struct snd_pcm_hw_params *hw_params;
        int ch, dir;
-       int ret = 0;
 
        dai_runtime = cdns->dai_runtime_array[dai->id];
        if (!dai_runtime) {
@@ -389,12 +390,8 @@ static int intel_prepare(struct snd_pcm_substream *substream,
                return -EIO;
        }
 
+       hw_params = &rtd->dpcm[substream->stream].hw_params;
        if (dai_runtime->suspended) {
-               struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
-               struct snd_pcm_hw_params *hw_params;
-
-               hw_params = &rtd->dpcm[substream->stream].hw_params;
-
                dai_runtime->suspended = false;
 
                /*
@@ -415,15 +412,11 @@ static int intel_prepare(struct snd_pcm_substream *substream,
                /* the SHIM will be configured in the callback functions */
 
                sdw_cdns_config_stream(cdns, ch, dir, dai_runtime->pdi);
-
-               /* Inform DSP about PDI stream number */
-               ret = intel_params_stream(sdw, substream, dai,
-                                         hw_params,
-                                         sdw->instance,
-                                         dai_runtime->pdi->intel_alh_id);
        }
 
-       return ret;
+       /* Inform DSP about PDI stream number */
+       return intel_params_stream(sdw, substream, dai, hw_params, sdw->instance,
+                                  dai_runtime->pdi->intel_alh_id);
 }
 
 static int