]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ASoC: sunxi: sun4i-i2s: fix LRCLK polarity in i2s mode
authorMatteo Martelli <matteomartelli3@gmail.com>
Thu, 1 Aug 2024 12:07:19 +0000 (14:07 +0200)
committerMark Brown <broonie@kernel.org>
Thu, 29 Aug 2024 14:57:07 +0000 (15:57 +0100)
commit3e83957e8dd7433a69116780d9bad217b00913ea
tree7a92b19a27561f68fd9bfec5b9bef72321d75714
parent283844c35529300c8e10f7a263e35e3c5d3580ac
ASoC: sunxi: sun4i-i2s: fix LRCLK polarity in i2s mode

This fixes the LRCLK polarity for sun8i-h3 and sun50i-h6 in i2s mode
which was wrongly inverted.

The LRCLK was being set in reversed logic compared to the DAI format:
inverted LRCLK for SND_SOC_DAIFMT_IB_NF and SND_SOC_DAIFMT_NB_NF; normal
LRCLK for SND_SOC_DAIFMT_IB_IF and SND_SOC_DAIFMT_NB_IF. Such reversed
logic applies properly for DSP_A, DSP_B, LEFT_J and RIGHT_J modes but
not for I2S mode, for which the LRCLK signal results reversed to what
expected on the bus. The issue is due to a misinterpretation of the
LRCLK polarity bit of the H3 and H6 i2s controllers. Such bit in this
case does not mean "0 => normal" or "1 => inverted" according to the
expected bus operation, but it means "0 => frame starts on low edge" and
"1 => frame starts on high edge" (from the User Manuals).

This commit fixes the LRCLK polarity by setting the LRCLK polarity bit
according to the selected bus mode and renames the LRCLK polarity bit
definition to avoid further confusion.

Fixes: dd657eae8164 ("ASoC: sun4i-i2s: Fix the LRCK polarity")
Fixes: 73adf87b7a58 ("ASoC: sun4i-i2s: Add support for H6 I2S")
Signed-off-by: Matteo Martelli <matteomartelli3@gmail.com>
Link: https://patch.msgid.link/20240801-asoc-fix-sun4i-i2s-v2-1-a8e4e9daa363@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sunxi/sun4i-i2s.c