linux-stable/sound/soc/sunxi
Matteo Martelli 527663015f ASoC: sunxi: sun4i-i2s: fix LRCLK polarity in i2s mode
[ Upstream commit 3e83957e8d ]

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:13:11 +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: Explicitly include correct DT includes 2023-10-09 13:13:56 +01:00
sun4i-i2s.c ASoC: sunxi: sun4i-i2s: fix LRCLK polarity in i2s mode 2024-09-12 11:13:11 +02:00
sun4i-spdif.c ASoC: sunxi: sun4i-spdif: Add support for Allwinner H616 2024-01-29 16:55:18 +00: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: Explicitly include correct DT includes 2023-10-09 13:13:56 +01:00
sun8i-codec.c ASoC: sun8i-codec: Fix build with CONFIG_SND_JACK_INPUT_DEV disabled 2024-03-27 15:57:34 +00:00
sun50i-codec-analog.c ASoC: sun8i-codec: Implement jack and accessory detection 2024-03-25 00:32:32 +00:00
sun50i-dmic.c ASoC: sunxi: Use snd_soc_substream_to_rtd() for accessing private_data 2024-05-06 23:59:56 +09:00