• Matteo Martelli's avatar
    ASoC: sunxi: sun4i-i2s: fix LRCLK polarity in i2s mode · 3e83957e
    Matteo Martelli authored
    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: dd657eae ("ASoC: sun4i-i2s: Fix the LRCK polarity")
    Fixes: 73adf87b ("ASoC: sun4i-i2s: Add support for H6 I2S")
    Signed-off-by: default avatarMatteo Martelli <matteomartelli3@gmail.com>
    Link: https://patch.msgid.link/20240801-asoc-fix-sun4i-i2s-v2-1-a8e4e9daa363@gmail.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
    3e83957e
sun4i-i2s.c 45.8 KB