Unverified Commit 4c4ed5e0 authored by Valerio Setti's avatar Valerio Setti Committed by Mark Brown
Browse files

ASoC: meson: aiu-encoder-i2s: fix bit clock polarity



According to I2S specs audio data is sampled on the rising edge of the
clock and it can change on the falling one. When operating in normal mode
this SoC behaves the opposite so a clock polarity inversion is required
in this case.

This was tested on an OdroidC2 (Amlogic S905 SoC) board.

Signed-off-by: default avatarValerio Setti <vsetti@baylibre.com>
Reviewed-by: default avatarJerome Brunet <jbrunet@baylibre.com>
Tested-by: default avatarJerome Brunet <jbrunet@baylibre.com>
Link: https://patch.msgid.link/20251007-fix-i2s-polarity-v1-1-86704d9cda10@baylibre.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent aaab61de
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -236,8 +236,12 @@ static int aiu_encoder_i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
	    inv == SND_SOC_DAIFMT_IB_IF)
		val |= AIU_CLK_CTRL_LRCLK_INVERT;

	if (inv == SND_SOC_DAIFMT_IB_NF ||
	    inv == SND_SOC_DAIFMT_IB_IF)
	/*
	 * The SoC changes data on the rising edge of the bitclock
	 * so an inversion of the bitclock is required in normal mode
	 */
	if (inv == SND_SOC_DAIFMT_NB_NF ||
	    inv == SND_SOC_DAIFMT_NB_IF)
		val |= AIU_CLK_CTRL_AOCLK_INVERT;

	/* Signal skew */
@@ -328,4 +332,3 @@ const struct snd_soc_dai_ops aiu_encoder_i2s_dai_ops = {
	.startup	= aiu_encoder_i2s_startup,
	.shutdown	= aiu_encoder_i2s_shutdown,
};