Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d353a618 authored by Richard Fitzgerald's avatar Richard Fitzgerald Committed by Greg Kroah-Hartman
Browse files

ASoC: cs42l42: Fix LRCLK frame start edge



[ Upstream commit 0c2f2ad4f16a58879463d0979a54293f8f296d6f ]

An I2S frame starts on the falling edge of LRCLK so ASP_STP must
be 0.

At the same time, move other format settings in the same register
from cs42l42_pll_config() to cs42l42_set_dai_fmt() where you'd
expect to find them, and merge into a single write.

Signed-off-by: default avatarRichard Fitzgerald <rf@opensource.cirrus.com>
Fixes: 2c394ca7 ("ASoC: Add support for CS42L42 codec")
Link: https://lore.kernel.org/r/20210805161111.10410-2-rf@opensource.cirrus.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent b0364520
Loading
Loading
Loading
Loading
+12 −9
Original line number Diff line number Diff line
@@ -658,15 +658,6 @@ static int cs42l42_pll_config(struct snd_soc_component *component)
					CS42L42_FSYNC_PULSE_WIDTH_MASK,
					CS42L42_FRAC1_VAL(fsync - 1) <<
					CS42L42_FSYNC_PULSE_WIDTH_SHIFT);
			snd_soc_component_update_bits(component,
					CS42L42_ASP_FRM_CFG,
					CS42L42_ASP_5050_MASK,
					CS42L42_ASP_5050_MASK);
			/* Set the frame delay to 1.0 SCLK clocks */
			snd_soc_component_update_bits(component, CS42L42_ASP_FRM_CFG,
					CS42L42_ASP_FSD_MASK,
					CS42L42_ASP_FSD_1_0 <<
					CS42L42_ASP_FSD_SHIFT);
			/* Set the sample rates (96k or lower) */
			snd_soc_component_update_bits(component, CS42L42_FS_RATE_EN,
					CS42L42_FS_EN_MASK,
@@ -762,6 +753,18 @@ static int cs42l42_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
	/* interface format */
	switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
	case SND_SOC_DAIFMT_I2S:
		/*
		 * 5050 mode, frame starts on falling edge of LRCLK,
		 * frame delayed by 1.0 SCLKs
		 */
		snd_soc_component_update_bits(component,
					      CS42L42_ASP_FRM_CFG,
					      CS42L42_ASP_STP_MASK |
					      CS42L42_ASP_5050_MASK |
					      CS42L42_ASP_FSD_MASK,
					      CS42L42_ASP_5050_MASK |
					      (CS42L42_ASP_FSD_1_0 <<
						CS42L42_ASP_FSD_SHIFT));
		break;
	default:
		return -EINVAL;