]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ASoC: soc-compress: use function to clear symmetric params
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Thu, 19 Feb 2026 04:53:52 +0000 (04:53 +0000)
committerMark Brown <broonie@kernel.org>
Sun, 22 Feb 2026 23:52:21 +0000 (23:52 +0000)
Current soc-compress.c clears symmetric_rate, but it clears rate only,
not clear other symmetric_channels/sample_bits.

static int soc_compr_clean(...)
{
...
if (!snd_soc_dai_active(cpu_dai))
=> cpu_dai->symmetric_rate = 0;

if (!snd_soc_dai_active(codec_dai))
=> codec_dai->symmetric_rate = 0;
...
};

This feature was added when v3.7 kernel [1], and there was only
symmetric_rate, no symmetric_channels/sample_bits in that timing.

symmetric_channels/sample_bits were added in v3.14 [2],
but I guess it didn't notice that soc-compress.c is updating symmetric_xxx.

We are clearing symmetry_xxx by soc_pcm_set_dai_params(), but is soc-pcm.c
local function. Makes it global function and clear symmetry_xxx by it.

[1] commit 1245b7005de02 ("ASoC: add compress stream support")
[2] commit 3635bf09a89cf ("ASoC: soc-pcm: add symmetry for channels and
   sample bits")

Fixes: 3635bf09a89c ("ASoC: soc-pcm: add symmetry for channels and sample bits")
Cc: Nicolin Chen <b42378@freescale.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://patch.msgid.link/87ms15e3kv.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc.h
sound/soc/soc-compress.c
sound/soc/soc-pcm.c

index 7d8376c8e1bededf7f5a3cb478b6f1f966c99da5..1e0b7cd8d956e7eb7fd1a906a5916a991c8ac205 100644 (file)
@@ -1412,6 +1412,9 @@ struct snd_soc_dai *snd_soc_find_dai(
 struct snd_soc_dai *snd_soc_find_dai_with_mutex(
        const struct snd_soc_dai_link_component *dlc);
 
+void soc_pcm_set_dai_params(struct snd_soc_dai *dai,
+                           struct snd_pcm_hw_params *params);
+
 #include <sound/soc-dai.h>
 
 static inline
index 7b81dffc6a935ac5ad2a56dc15e372c670d6fd7e..b8402802ae7848ce1ccd96053f54d7f1eec99cb1 100644 (file)
@@ -69,10 +69,10 @@ static int soc_compr_clean(struct snd_compr_stream *cstream, int rollback)
        snd_soc_dai_digital_mute(codec_dai, 1, stream);
 
        if (!snd_soc_dai_active(cpu_dai))
-               cpu_dai->symmetric_rate = 0;
+               soc_pcm_set_dai_params(cpu_dai, NULL);
 
        if (!snd_soc_dai_active(codec_dai))
-               codec_dai->symmetric_rate = 0;
+               soc_pcm_set_dai_params(codec_dai, NULL);
 
        snd_soc_link_compr_shutdown(cstream, rollback);
 
index afa9fad4457f2c98d3928078729ab9ff48d7f88c..9b12eedb77c331e2afb2c29db808824d5e16c493 100644 (file)
@@ -423,8 +423,8 @@ void dpcm_dapm_stream_event(struct snd_soc_pcm_runtime *fe, int dir, int event)
        snd_soc_dapm_stream_event(fe, dir, event);
 }
 
-static void soc_pcm_set_dai_params(struct snd_soc_dai *dai,
-                                  struct snd_pcm_hw_params *params)
+void soc_pcm_set_dai_params(struct snd_soc_dai *dai,
+                           struct snd_pcm_hw_params *params)
 {
        if (params) {
                dai->symmetric_rate        = params_rate(params);