OpenCloudOS-Kernel/sound/soc/sunxi
Matteo Martelli b9bb963436 ASoC: sunxi: sun4i-i2s: fix LRCLK polarity in i2s mode
[ Upstream commit 3e83957e8dd7433a69116780d9bad217b00913ea ]

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: dd657eae81 ("ASoC: sun4i-i2s: Fix the LRCK polarity")
Fixes: 73adf87b7a ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-09-12 11:11:44 +02:00
..
Kconfig ASoC: sunxi: Add Allwinner H6 Digital MIC driver 2022-09-19 17:52:47 +01:00
Makefile ASoC: sunxi: Add Allwinner H6 Digital MIC driver 2022-09-19 17:52:47 +01:00
sun4i-codec.c ASoC: sunxi: merge DAI call back functions into ops 2023-08-14 13:10:17 +01:00
sun4i-i2s.c ASoC: sunxi: sun4i-i2s: fix LRCLK polarity in i2s mode 2024-09-12 11:11:44 +02:00
sun4i-spdif.c ASoC: sunxi: sun4i-spdif: Add support for Allwinner H616 2024-03-01 13:34:51 +01:00
sun8i-adda-pr-regmap.c ASoC: sun8i-codec-analog: split regmap code into separate driver 2018-10-17 11:10:59 +01:00
sun8i-adda-pr-regmap.h ASoC: sun8i-codec-analog: split regmap code into separate driver 2018-10-17 11:10:59 +01:00
sun8i-codec-analog.c ASoC: sun8i-codec-analog: use devm_platform_ioremap_resource() to simplify code 2019-07-31 12:09:02 +01:00
sun8i-codec.c ASoC: sunxi: sun8i-codec: Convert to platform remove callback returning void 2023-03-20 13:09:10 +00:00
sun50i-codec-analog.c ASoC: sun50i-codec-analog: Add support for internal bias 2022-06-27 13:18:04 +01:00
sun50i-dmic.c ASoC: sunxi: merge DAI call back functions into ops 2023-08-14 13:10:17 +01:00