Skip to content

Commit 0c2f2ad

Browse files
rfvirgilbroonie
authored andcommitted
ASoC: cs42l42: Fix LRCLK frame start edge
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: Richard Fitzgerald <[email protected]> Fixes: 2c394ca ("ASoC: Add support for CS42L42 codec") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent f1040e8 commit 0c2f2ad

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

sound/soc/codecs/cs42l42.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -667,15 +667,6 @@ static int cs42l42_pll_config(struct snd_soc_component *component)
667667
CS42L42_FSYNC_PULSE_WIDTH_MASK,
668668
CS42L42_FRAC1_VAL(fsync - 1) <<
669669
CS42L42_FSYNC_PULSE_WIDTH_SHIFT);
670-
snd_soc_component_update_bits(component,
671-
CS42L42_ASP_FRM_CFG,
672-
CS42L42_ASP_5050_MASK,
673-
CS42L42_ASP_5050_MASK);
674-
/* Set the frame delay to 1.0 SCLK clocks */
675-
snd_soc_component_update_bits(component, CS42L42_ASP_FRM_CFG,
676-
CS42L42_ASP_FSD_MASK,
677-
CS42L42_ASP_FSD_1_0 <<
678-
CS42L42_ASP_FSD_SHIFT);
679670
/* Set the sample rates (96k or lower) */
680671
snd_soc_component_update_bits(component, CS42L42_FS_RATE_EN,
681672
CS42L42_FS_EN_MASK,
@@ -775,6 +766,18 @@ static int cs42l42_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
775766
/* interface format */
776767
switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
777768
case SND_SOC_DAIFMT_I2S:
769+
/*
770+
* 5050 mode, frame starts on falling edge of LRCLK,
771+
* frame delayed by 1.0 SCLKs
772+
*/
773+
snd_soc_component_update_bits(component,
774+
CS42L42_ASP_FRM_CFG,
775+
CS42L42_ASP_STP_MASK |
776+
CS42L42_ASP_5050_MASK |
777+
CS42L42_ASP_FSD_MASK,
778+
CS42L42_ASP_5050_MASK |
779+
(CS42L42_ASP_FSD_1_0 <<
780+
CS42L42_ASP_FSD_SHIFT));
778781
break;
779782
default:
780783
return -EINVAL;

0 commit comments

Comments
 (0)