diff mbox series

ASoC: tegra: Fix clock DAI format on Tegra210

Message ID 1655280277-4701-1-git-send-email-spujar@nvidia.com
State Accepted
Commit 5983a8a4a4dc13b5f192212a5e744eb303cd65c2
Headers show
Series ASoC: tegra: Fix clock DAI format on Tegra210 | expand

Commit Message

Sameer Pujar June 15, 2022, 8:04 a.m. UTC
I2S reset failures are seen on Tegra210 and later platforms. This indicates
absence of I2S bit clock, which is required to perform the reset operation.
Following failures are seen with I2S based tests on Tegra210 and later:

  tegra210-i2s 2901100.i2s: timeout: failed to reset I2S for playback
  tegra210-i2s 2901100.i2s: ASoC: PRE_PMU: I2S2 RX event failed: -110
  tegra210-i2s 2901100.i2s: timeout: failed to reset I2S for capture
  tegra210-i2s 2901100.i2s: ASoC: PRE_PMU: I2S2 TX event failed: -110

The commit d92ad6633fa7 ("ASoC: tegra: Update to use set_fmt_new callback")
regressed I2S functionality on Tegra platforms. Basically it flipped clock
provider and consumer DAI formats. This configures Tegra I2S in consumer
mode by default now and there is none to provide bit clock during loopback
tests. The external codec based tests also fail because both Tegra I2S and
codec I2S get configured in consumer mode.

ASoC core flips the DAI format before calling set_fmt() for CPU DAIs. This
is negated in above commit. Fix this by swapping SND_SOC_DAIFMT_BC_FC and
SND_SOC_DAIFMT_BP_FP switch cases.

Fixes: d92ad6633fa7 ("ASoC: tegra: Update to use set_fmt_new callback")
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Cc: Charles Keepax <ckeepax@opensource.cirrus.com>
---
 sound/soc/tegra/tegra210_i2s.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Mark Brown June 15, 2022, 1:54 p.m. UTC | #1
On Wed, 15 Jun 2022 13:34:37 +0530, Sameer Pujar wrote:
> I2S reset failures are seen on Tegra210 and later platforms. This indicates
> absence of I2S bit clock, which is required to perform the reset operation.
> Following failures are seen with I2S based tests on Tegra210 and later:
> 
>   tegra210-i2s 2901100.i2s: timeout: failed to reset I2S for playback
>   tegra210-i2s 2901100.i2s: ASoC: PRE_PMU: I2S2 RX event failed: -110
>   tegra210-i2s 2901100.i2s: timeout: failed to reset I2S for capture
>   tegra210-i2s 2901100.i2s: ASoC: PRE_PMU: I2S2 TX event failed: -110
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: tegra: Fix clock DAI format on Tegra210
      commit: 5983a8a4a4dc13b5f192212a5e744eb303cd65c2

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
Charles Keepax June 16, 2022, 10:30 a.m. UTC | #2
On Wed, Jun 15, 2022 at 01:34:37PM +0530, Sameer Pujar wrote:
> I2S reset failures are seen on Tegra210 and later platforms. This indicates
> absence of I2S bit clock, which is required to perform the reset operation.
> Following failures are seen with I2S based tests on Tegra210 and later:
> 
>   tegra210-i2s 2901100.i2s: timeout: failed to reset I2S for playback
>   tegra210-i2s 2901100.i2s: ASoC: PRE_PMU: I2S2 RX event failed: -110
>   tegra210-i2s 2901100.i2s: timeout: failed to reset I2S for capture
>   tegra210-i2s 2901100.i2s: ASoC: PRE_PMU: I2S2 TX event failed: -110
> 
> The commit d92ad6633fa7 ("ASoC: tegra: Update to use set_fmt_new callback")
> regressed I2S functionality on Tegra platforms. Basically it flipped clock
> provider and consumer DAI formats. This configures Tegra I2S in consumer
> mode by default now and there is none to provide bit clock during loopback
> tests. The external codec based tests also fail because both Tegra I2S and
> codec I2S get configured in consumer mode.
> 
> ASoC core flips the DAI format before calling set_fmt() for CPU DAIs. This
> is negated in above commit. Fix this by swapping SND_SOC_DAIFMT_BC_FC and
> SND_SOC_DAIFMT_BP_FP switch cases.
> 
> Fixes: d92ad6633fa7 ("ASoC: tegra: Update to use set_fmt_new callback")
> Signed-off-by: Sameer Pujar <spujar@nvidia.com>
> Cc: Charles Keepax <ckeepax@opensource.cirrus.com>
> ---

Ah.... I see what has happened there. As this device is one of
the few CPU side components defining non_legacy_dai_naming whilst
processing the DAI links the core would have been flipping the
format for this driver as it would have mistaken it for a CODEC
to CODEC link, so unlike the other CPU side components the flags
shouldn't have been inverted when I converted this driver.

Apologies for missing this whilst doing the updates, and thank
you for fixing. I will check if there are any other cases of this
that need to be hit.

A bit late but for what it is worth:

Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles
diff mbox series

Patch

diff --git a/sound/soc/tegra/tegra210_i2s.c b/sound/soc/tegra/tegra210_i2s.c
index a289458..01c76ba 100644
--- a/sound/soc/tegra/tegra210_i2s.c
+++ b/sound/soc/tegra/tegra210_i2s.c
@@ -215,10 +215,10 @@  static int tegra210_i2s_set_fmt(struct snd_soc_dai *dai,
 
 	mask = I2S_CTRL_MASTER_EN_MASK;
 	switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) {
-	case SND_SOC_DAIFMT_BP_FP:
+	case SND_SOC_DAIFMT_BC_FC:
 		val = 0;
 		break;
-	case SND_SOC_DAIFMT_BC_FC:
+	case SND_SOC_DAIFMT_BP_FP:
 		val = I2S_CTRL_MASTER_EN;
 		break;
 	default: