Skip to content

Commit e5ada3f

Browse files
rfvirgilbroonie
authored andcommitted
ASoC: cs42l42: Fix mono playback
I2S always has two LRCLK phases and both CH1 and CH2 of the RX must be enabled (corresponding to the low and high phases of LRCLK.) The selection of the valid data channels is done by setting the DAC CHA_SEL and CHB_SEL. CHA_SEL is always the first (left) channel, CHB_SEL depends on the number of active channels. Previously for mono ASP CH2 was not enabled, the result was playing mono data would not produce any audio output. Signed-off-by: Richard Fitzgerald <[email protected]> Fixes: 621d65f ("ASoC: cs42l42: Provide finer control on playback path") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 3a5d89a commit e5ada3f

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

sound/soc/codecs/cs42l42.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,8 +460,8 @@ static const struct snd_soc_dapm_widget cs42l42_dapm_widgets[] = {
460460
SND_SOC_DAPM_OUTPUT("HP"),
461461
SND_SOC_DAPM_DAC("DAC", NULL, CS42L42_PWR_CTL1, CS42L42_HP_PDN_SHIFT, 1),
462462
SND_SOC_DAPM_MIXER("MIXER", CS42L42_PWR_CTL1, CS42L42_MIXER_PDN_SHIFT, 1, NULL, 0),
463-
SND_SOC_DAPM_AIF_IN("SDIN1", NULL, 0, CS42L42_ASP_RX_DAI0_EN, CS42L42_ASP_RX0_CH1_SHIFT, 0),
464-
SND_SOC_DAPM_AIF_IN("SDIN2", NULL, 1, CS42L42_ASP_RX_DAI0_EN, CS42L42_ASP_RX0_CH2_SHIFT, 0),
463+
SND_SOC_DAPM_AIF_IN("SDIN1", NULL, 0, SND_SOC_NOPM, 0, 0),
464+
SND_SOC_DAPM_AIF_IN("SDIN2", NULL, 1, SND_SOC_NOPM, 0, 0),
465465

466466
/* Playback Requirements */
467467
SND_SOC_DAPM_SUPPLY("ASP DAI0", CS42L42_PWR_CTL1, CS42L42_ASP_DAI_PDN_SHIFT, 1, NULL, 0),
@@ -866,6 +866,17 @@ static int cs42l42_pcm_hw_params(struct snd_pcm_substream *substream,
866866
snd_soc_component_update_bits(component, CS42L42_ASP_RX_DAI0_CH2_AP_RES,
867867
CS42L42_ASP_RX_CH_AP_MASK |
868868
CS42L42_ASP_RX_CH_RES_MASK, val);
869+
870+
/* Channel B comes from the last active channel */
871+
snd_soc_component_update_bits(component, CS42L42_SP_RX_CH_SEL,
872+
CS42L42_SP_RX_CHB_SEL_MASK,
873+
(channels - 1) << CS42L42_SP_RX_CHB_SEL_SHIFT);
874+
875+
/* Both LRCLK slots must be enabled */
876+
snd_soc_component_update_bits(component, CS42L42_ASP_RX_DAI0_EN,
877+
CS42L42_ASP_RX0_CH_EN_MASK,
878+
BIT(CS42L42_ASP_RX0_CH1_SHIFT) |
879+
BIT(CS42L42_ASP_RX0_CH2_SHIFT));
869880
break;
870881
default:
871882
break;

sound/soc/codecs/cs42l42.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,8 @@
653653

654654
/* Page 0x25 Audio Port Registers */
655655
#define CS42L42_SP_RX_CH_SEL (CS42L42_PAGE_25 + 0x01)
656+
#define CS42L42_SP_RX_CHB_SEL_SHIFT 2
657+
#define CS42L42_SP_RX_CHB_SEL_MASK (3 << CS42L42_SP_RX_CHB_SEL_SHIFT)
656658

657659
#define CS42L42_SP_RX_ISOC_CTL (CS42L42_PAGE_25 + 0x02)
658660
#define CS42L42_SP_RX_RSYNC_SHIFT 6

0 commit comments

Comments
 (0)