Skip to content

Commit 4c4ed5e

Browse files
valeriosettibroonie
authored andcommitted
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: Valerio Setti <vsetti@baylibre.com> Reviewed-by: Jerome Brunet <jbrunet@baylibre.com> Tested-by: Jerome Brunet <jbrunet@baylibre.com> Link: https://patch.msgid.link/20251007-fix-i2s-polarity-v1-1-86704d9cda10@baylibre.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent aaab61d commit 4c4ed5e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

sound/soc/meson/aiu-encoder-i2s.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,12 @@ static int aiu_encoder_i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
236236
inv == SND_SOC_DAIFMT_IB_IF)
237237
val |= AIU_CLK_CTRL_LRCLK_INVERT;
238238

239-
if (inv == SND_SOC_DAIFMT_IB_NF ||
240-
inv == SND_SOC_DAIFMT_IB_IF)
239+
/*
240+
* The SoC changes data on the rising edge of the bitclock
241+
* so an inversion of the bitclock is required in normal mode
242+
*/
243+
if (inv == SND_SOC_DAIFMT_NB_NF ||
244+
inv == SND_SOC_DAIFMT_NB_IF)
241245
val |= AIU_CLK_CTRL_AOCLK_INVERT;
242246

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

0 commit comments

Comments
 (0)