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
On Tue, Mar 17, 2026 at 09:49:09AM +0000, Sheetal wrote:
> 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.
If the driver simply can't tolerate disabling the sysclk it seems like
it would be easier to just have the driver directly ignore attempts to
do so rather than adding this flag which the driver has to set only to
get it passed in?
Hi
> > 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.
>
> If the driver simply can't tolerate disabling the sysclk it seems like
> it would be easier to just have the driver directly ignore attempts to
> do so rather than adding this flag which the driver has to set only to
> get it passed in?
Agree.
I think this commit can help you ?
1e1a2ef95b571825ca9c0113f6bef51e9cec98b0
("ASoC: da7213: Avoid setting PLL when closing audio stream")
Thank you for your help !!
Best regards
---
Kuninori Morimoto
On 18-03-2026 04:32, Kuninori Morimoto wrote:
> External email: Use caution opening links or attachments
>
>
> Hi
>
>>> 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.
>>
>> If the driver simply can't tolerate disabling the sysclk it seems like
>> it would be easier to just have the driver directly ignore attempts to
>> do so rather than adding this flag which the driver has to set only to
>> get it passed in?
>
> Agree.
> I think this commit can help you ?
>
> 1e1a2ef95b571825ca9c0113f6bef51e9cec98b0
> ("ASoC: da7213: Avoid setting PLL when closing audio stream")
>
> Thank you for your help !!
Thank you for the feedback and the da7213 reference.
The concern with the per-codec approach is that this affects any codec
with a set_dai_sysclk that forwards the frequency to clk_set_rate().
Since any codec can be connected to Tegra platforms, and MCLK is
provided by the SoC to external codecs, when clk_set_rate(..., 0)
reaches the BPMP firmware, it raises a fault for rates below the
hardware minimum. Fixing this per-codec would require individual patches
for each.
>
> Best regards
> ---
> Kuninori Morimoto
On Wed, Mar 18, 2026 at 02:36:42PM +0530, Sheetal . wrote:
> On 18-03-2026 04:32, Kuninori Morimoto wrote:
> > > If the driver simply can't tolerate disabling the sysclk it seems like
> > > it would be easier to just have the driver directly ignore attempts to
> > > do so rather than adding this flag which the driver has to set only to
> > > get it passed in?
> > Agree.
> > I think this commit can help you ?
> > 1e1a2ef95b571825ca9c0113f6bef51e9cec98b0
> > ("ASoC: da7213: Avoid setting PLL when closing audio stream")
> Thank you for the feedback and the da7213 reference.
> The concern with the per-codec approach is that this affects any codec with
> a set_dai_sysclk that forwards the frequency to clk_set_rate(). Since any
> codec can be connected to Tegra platforms, and MCLK is provided by the SoC
> to external codecs, when clk_set_rate(..., 0) reaches the BPMP firmware, it
> raises a fault for rates below the hardware minimum. Fixing this per-codec
> would require individual patches for each.
Since in the clock API clk_get_rate() maps onto clk_disable() those
drivers ought to be fixed anyway - perhaps we need some helpers for this
since it does look like we have some issues here. Either the driver
should ignore the disable (possibly due to already refcounting the use
of the clock and disabling/enabling without machine driver help) or it
should translate a rate of 0 to a disable.
On 18-03-2026 17:26, Mark Brown wrote:
> On Wed, Mar 18, 2026 at 02:36:42PM +0530, Sheetal . wrote:
>> On 18-03-2026 04:32, Kuninori Morimoto wrote:
>
>>>> If the driver simply can't tolerate disabling the sysclk it seems like
>>>> it would be easier to just have the driver directly ignore attempts to
>>>> do so rather than adding this flag which the driver has to set only to
>>>> get it passed in?
>
>>> Agree.
>>> I think this commit can help you ?
>
>>> 1e1a2ef95b571825ca9c0113f6bef51e9cec98b0
>>> ("ASoC: da7213: Avoid setting PLL when closing audio stream")
>
>> Thank you for the feedback and the da7213 reference.
>
>> The concern with the per-codec approach is that this affects any codec with
>> a set_dai_sysclk that forwards the frequency to clk_set_rate(). Since any
>> codec can be connected to Tegra platforms, and MCLK is provided by the SoC
>> to external codecs, when clk_set_rate(..., 0) reaches the BPMP firmware, it
>> raises a fault for rates below the hardware minimum. Fixing this per-codec
>> would require individual patches for each.
>
> Since in the clock API clk_get_rate() maps onto clk_disable() those
> drivers ought to be fixed anyway - perhaps we need some helpers for this
> since it does look like we have some issues here. Either the driver
> should ignore the disable (possibly due to already refcounting the use
> of the clock and disabling/enabling without machine driver help) or it
> should translate a rate of 0 to a disable.
Since this needs to be handled in the codec driver, I will start with
separate patch to fix in RT5640 codec. Adding Realtek codec maintainer
for visibility.
© 2016 - 2026 Red Hat, Inc.