[PATCH 1/2] ASoC: simple-card-utils: add ignore_zero_sysclk flag

Sheetal
2026-03-17T09:49:52Z

Commit 2458adb8f92a ("SoC: simple-card-utils: set 0Hz to
sysclk when shutdown") updated the simple-card-util driver to
send 0Hz frequency requests during stream shutdown, which can
request frequencies lower than a platform may support.

Add ignore_zero_sysclk flag to struct simple_util_priv to allow drivers
to ignore these 0Hz sysclk requests when they would result in a clock
frequency below the hardware's minimum allowed rate.

Signed-off-by: Sheetal <sheetal@nvidia.com>
---
include/sound/simple_card_utils.h | 1 +
sound/soc/generic/simple-card-utils.c | 6 ++++--
2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h
index 915e6ae5f68d..02ede92e8269 100644
--- a/include/sound/simple_card_utils.h
+++ b/include/sound/simple_card_utils.h
@@ -81,6 +81,7 @@ struct simple_util_priv {
const struct snd_soc_ops *ops;
unsigned int dpcm_selectable:1;
unsigned int force_dpcm:1;
+ unsigned int ignore_zero_sysclk:1;
};
#define simple_priv_to_card(priv) (&(priv)->snd_card)
#define simple_priv_to_props(priv, i) ((priv)->dai_props + (i))
diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
index 3115e1f37c0c..04ae242a51d0 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -383,7 +383,8 @@ void simple_util_shutdown(struct snd_pcm_substream *substream)
for_each_prop_dai_cpu(props, i, dai) {
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, i);

- if (props->mclk_fs && !dai->clk_fixed && !snd_soc_dai_active(cpu_dai))
+ if (!priv->ignore_zero_sysclk && props->mclk_fs &&
+ !dai->clk_fixed && !snd_soc_dai_active(cpu_dai))
snd_soc_dai_set_sysclk(cpu_dai, 0, 0, dai->clk_direction);

simple_clk_disable(dai);
@@ -391,7 +392,8 @@ void simple_util_shutdown(struct snd_pcm_substream *substream)
for_each_prop_dai_codec(props, i, dai) {
struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, i);

- if (props->mclk_fs && !dai->clk_fixed && !snd_soc_dai_active(codec_dai))
+ if (!priv->ignore_zero_sysclk && props->mclk_fs &&
+ !dai->clk_fixed && !snd_soc_dai_active(codec_dai))
snd_soc_dai_set_sysclk(codec_dai, 0, 0, dai->clk_direction);

simple_clk_disable(dai);
--
2.17.1