* [PATCH v2 0/2] Fix redundant PLLA update
@ 2023-09-07 15:02 Sameer Pujar
2023-09-07 15:02 ` [PATCH v2 1/2] ASoC: soc-utils: Export snd_soc_dai_is_dummy() symbol Sameer Pujar
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Sameer Pujar @ 2023-09-07 15:02 UTC (permalink / raw)
To: broonie, lgirdwood, perex, tiwai
Cc: thierry.reding, jonathanh, spujar, alsa-devel, linux-kernel,
linux-tegra
This small series fixes redundant PLLA updates that happen for
each DAI link in the audio path. This helps to resolve DMIC clock
issue seen on Jetson TX2 platform.
Sameer Pujar (2):
ASoC: soc-utils: Export snd_soc_dai_is_dummy() symbol
ASoC: tegra: Fix redundant PLLA and PLLA_OUT0 updates
sound/soc/soc-utils.c | 1 +
sound/soc/tegra/tegra_audio_graph_card.c | 30 ++++++++++++++----------
2 files changed, 18 insertions(+), 13 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 1/2] ASoC: soc-utils: Export snd_soc_dai_is_dummy() symbol
2023-09-07 15:02 [PATCH v2 0/2] Fix redundant PLLA update Sameer Pujar
@ 2023-09-07 15:02 ` Sameer Pujar
2023-09-07 15:02 ` [PATCH v2 2/2] ASoC: tegra: Fix redundant PLLA and PLLA_OUT0 updates Sameer Pujar
2023-09-12 0:01 ` [PATCH v2 0/2] Fix redundant PLLA update Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Sameer Pujar @ 2023-09-07 15:02 UTC (permalink / raw)
To: broonie, lgirdwood, perex, tiwai
Cc: thierry.reding, jonathanh, spujar, alsa-devel, linux-kernel,
linux-tegra
Export symbol snd_soc_dai_is_dummy() for usage outside core driver
modules. This is required by Tegra ASoC machine driver.
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
---
sound/soc/soc-utils.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sound/soc/soc-utils.c b/sound/soc/soc-utils.c
index 11607c5f5d5a..9c746e4edef7 100644
--- a/sound/soc/soc-utils.c
+++ b/sound/soc/soc-utils.c
@@ -217,6 +217,7 @@ int snd_soc_dai_is_dummy(struct snd_soc_dai *dai)
return 1;
return 0;
}
+EXPORT_SYMBOL_GPL(snd_soc_dai_is_dummy);
int snd_soc_component_is_dummy(struct snd_soc_component *component)
{
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 2/2] ASoC: tegra: Fix redundant PLLA and PLLA_OUT0 updates
2023-09-07 15:02 [PATCH v2 0/2] Fix redundant PLLA update Sameer Pujar
2023-09-07 15:02 ` [PATCH v2 1/2] ASoC: soc-utils: Export snd_soc_dai_is_dummy() symbol Sameer Pujar
@ 2023-09-07 15:02 ` Sameer Pujar
2023-09-12 0:01 ` [PATCH v2 0/2] Fix redundant PLLA update Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Sameer Pujar @ 2023-09-07 15:02 UTC (permalink / raw)
To: broonie, lgirdwood, perex, tiwai
Cc: thierry.reding, jonathanh, spujar, alsa-devel, linux-kernel,
linux-tegra, stable
Tegra audio graph card has many DAI links which connects internal
AHUB modules and external audio codecs. Since these are DPCM links,
hw_params() call in the machine driver happens for each connected
BE link and PLLA is updated every time. This is not really needed
for all links as only I/O link DAIs derive respective clocks from
PLLA_OUT0 and thus from PLLA. Hence add checks to limit the clock
updates to DAIs over I/O links.
This found to be fixing a DMIC clock discrepancy which is suspected
to happen because of back to back quick PLLA and PLLA_OUT0 rate
updates. This was observed on Jetson TX2 platform where DMIC clock
ended up with unexpected value.
Fixes: 202e2f774543 ("ASoC: tegra: Add audio graph based card driver")
Cc: stable@vger.kernel.org
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
---
sound/soc/tegra/tegra_audio_graph_card.c | 30 ++++++++++++++----------
1 file changed, 17 insertions(+), 13 deletions(-)
diff --git a/sound/soc/tegra/tegra_audio_graph_card.c b/sound/soc/tegra/tegra_audio_graph_card.c
index 1f2c5018bf5a..4737e776d383 100644
--- a/sound/soc/tegra/tegra_audio_graph_card.c
+++ b/sound/soc/tegra/tegra_audio_graph_card.c
@@ -10,6 +10,7 @@
#include <linux/platform_device.h>
#include <sound/graph_card.h>
#include <sound/pcm_params.h>
+#include <sound/soc-dai.h>
#define MAX_PLLA_OUT0_DIV 128
@@ -44,6 +45,21 @@ struct tegra_audio_cdata {
unsigned int plla_out0_rates[NUM_RATE_TYPE];
};
+static bool need_clk_update(struct snd_soc_dai *dai)
+{
+ if (snd_soc_dai_is_dummy(dai) ||
+ !dai->driver->ops ||
+ !dai->driver->name)
+ return false;
+
+ if (strstr(dai->driver->name, "I2S") ||
+ strstr(dai->driver->name, "DMIC") ||
+ strstr(dai->driver->name, "DSPK"))
+ return true;
+
+ return false;
+}
+
/* Setup PLL clock as per the given sample rate */
static int tegra_audio_graph_update_pll(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
@@ -140,19 +156,7 @@ static int tegra_audio_graph_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
int err;
- /*
- * This gets called for each DAI link (FE or BE) when DPCM is used.
- * We may not want to update PLLA rate for each call. So PLLA update
- * must be restricted to external I/O links (I2S, DMIC or DSPK) since
- * they actually depend on it. I/O modules update their clocks in
- * hw_param() of their respective component driver and PLLA rate
- * update here helps them to derive appropriate rates.
- *
- * TODO: When more HW accelerators get added (like sample rate
- * converter, volume gain controller etc., which don't really
- * depend on PLLA) we need a better way to filter here.
- */
- if (cpu_dai->driver->ops && rtd->dai_link->no_pcm) {
+ if (need_clk_update(cpu_dai)) {
err = tegra_audio_graph_update_pll(substream, params);
if (err)
return err;
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 0/2] Fix redundant PLLA update
2023-09-07 15:02 [PATCH v2 0/2] Fix redundant PLLA update Sameer Pujar
2023-09-07 15:02 ` [PATCH v2 1/2] ASoC: soc-utils: Export snd_soc_dai_is_dummy() symbol Sameer Pujar
2023-09-07 15:02 ` [PATCH v2 2/2] ASoC: tegra: Fix redundant PLLA and PLLA_OUT0 updates Sameer Pujar
@ 2023-09-12 0:01 ` Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2023-09-12 0:01 UTC (permalink / raw)
To: lgirdwood, perex, tiwai, Sameer Pujar
Cc: thierry.reding, jonathanh, alsa-devel, linux-kernel, linux-tegra
On Thu, 07 Sep 2023 20:32:23 +0530, Sameer Pujar wrote:
> This small series fixes redundant PLLA updates that happen for
> each DAI link in the audio path. This helps to resolve DMIC clock
> issue seen on Jetson TX2 platform.
>
> Sameer Pujar (2):
> ASoC: soc-utils: Export snd_soc_dai_is_dummy() symbol
> ASoC: tegra: Fix redundant PLLA and PLLA_OUT0 updates
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/2] ASoC: soc-utils: Export snd_soc_dai_is_dummy() symbol
commit: f101583fa9f8c3f372d4feb61d67da0ccbf4d9a5
[2/2] ASoC: tegra: Fix redundant PLLA and PLLA_OUT0 updates
commit: e765886249c533e1bb5cbc3cd741bad677417312
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-09-12 2:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-07 15:02 [PATCH v2 0/2] Fix redundant PLLA update Sameer Pujar
2023-09-07 15:02 ` [PATCH v2 1/2] ASoC: soc-utils: Export snd_soc_dai_is_dummy() symbol Sameer Pujar
2023-09-07 15:02 ` [PATCH v2 2/2] ASoC: tegra: Fix redundant PLLA and PLLA_OUT0 updates Sameer Pujar
2023-09-12 0:01 ` [PATCH v2 0/2] Fix redundant PLLA update Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).