From 6ec228aa4ec095a22637dbd54d9efcb556cdc976 Mon Sep 17 00:00:00 2001 From: Sheetal Date: Wed, 16 Jul 2025 11:00:30 +0000 Subject: [PATCH] ASoC: simple-card-utils: Ignore sysclk 0Hz request The simple-card-util driver sends 0Hz frequency requests during stream shutdown (change commit id 2458adb8f), which can request frequencies lower than FMON (Frequency Monitor) minimum allowed rate. For T264 AUD_MCLK, FMON sets minimum allowed clock frequency to 1.5MHz, but 0Hz requests trigger BPMP to use its minimum rate (clock parent rate / max clock divider) causing FMON fault logs: verify_rate_range: FMON_AUD_MCLK: rate 383999 below min 1500000 fmon_update_config: FMON_AUD_MCLK: detected fault 0x80 Add ignore_zero_clk_rate_req flag to ignore these requests for Tegra clocks. Bug 5135928 Change-Id: I302bf1ad2f54e3b8308c999e5f021aafc1868250 Signed-off-by: Sheetal Reviewed-on: https://git-master.nvidia.com/r/c/3rdparty/canonical/linux-noble/+/3411615 GVS: buildbot_gerritrpt Reviewed-by: Mohan kumar Reviewed-by: Sameer Pujar --- include/sound/simple_card_utils.h | 1 + sound/soc/generic/simple-card-utils.c | 6 ++++-- sound/soc/tegra/tegra_audio_graph_card.c | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h index 09423742f2a2..a833057fdbf8 100644 --- a/include/sound/simple_card_utils.h +++ b/include/sound/simple_card_utils.h @@ -76,6 +76,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_clk_rate_req: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 e6af15625308..c48b7210d363 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -364,7 +364,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_clk_rate_req && props->mclk_fs && !dai->clk_fixed + && !snd_soc_dai_active(cpu_dai)) snd_soc_dai_set_sysclk(cpu_dai, 0, 0, SND_SOC_CLOCK_OUT); @@ -373,7 +374,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_clk_rate_req && props->mclk_fs && !dai->clk_fixed + && !snd_soc_dai_active(codec_dai)) snd_soc_dai_set_sysclk(codec_dai, 0, 0, SND_SOC_CLOCK_IN); diff --git a/sound/soc/tegra/tegra_audio_graph_card.c b/sound/soc/tegra/tegra_audio_graph_card.c index e814cd2b5551..efb0fb64ec3d 100644 --- a/sound/soc/tegra/tegra_audio_graph_card.c +++ b/sound/soc/tegra/tegra_audio_graph_card.c @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-only -// SPDX-FileCopyrightText: Copyright (c) 2020-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-FileCopyrightText: Copyright (c) 2020-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // tegra_audio_graph_card.c - Audio Graph based Tegra Machine Driver @@ -300,6 +300,7 @@ static int tegra_audio_graph_probe(struct platform_device *pdev) if (!of_property_read_bool(dev->of_node, "nvidia,ahub-c2c-links")) { card->component_chaining = 1; priv->simple.force_dpcm = 1; + priv->simple.ignore_zero_clk_rate_req = 1; } ret = devm_snd_soc_register_component(dev, &tegra_dummy_component,