* [PATCH v2 0/3] Improve pop performance of cs42l43 input path
@ 2026-11-03 14:18 Charles Keepax
2026-11-03 14:18 ` [PATCH v2 1/3] ASoC: cs42l43: Improve analogue mic pop performance Charles Keepax
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Charles Keepax @ 2026-11-03 14:18 UTC (permalink / raw)
To: broonie; +Cc: lgirdwood, linux-sound, linux-kernel, patches
Some rework to improve the pop noises associated with bring up of both
the analogue and the digital input paths on cs42l43. As part of that
there is also a little refactoring of the DAPM mic event handler to
switch over to look tables rather than switch statements.
Changes since v1:
- Added static const to decim_info arrays
- Corrected order of a couple registers in the decim_info array
- Added missing dapm lock around affected controls from new workaround
Charles Keepax (3):
ASoC: cs42l43: Improve analogue mic pop performance
ASoC: cs42l43: Factor out decimator startup data to an array
ASoC: cs42l43: Improve pop performance of the input power up
sound/soc/codecs/cs42l43.c | 219 +++++++++++++++++++++----------------
sound/soc/codecs/cs42l43.h | 3 +-
2 files changed, 127 insertions(+), 95 deletions(-)
--
2.47.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/3] ASoC: cs42l43: Improve analogue mic pop performance
2026-11-03 14:18 [PATCH v2 0/3] Improve pop performance of cs42l43 input path Charles Keepax
@ 2026-11-03 14:18 ` Charles Keepax
2026-11-03 14:18 ` [PATCH v2 2/3] ASoC: cs42l43: Factor out decimator startup data to an array Charles Keepax
2026-11-03 14:18 ` [PATCH v2 3/3] ASoC: cs42l43: Improve pop performance of the input power up Charles Keepax
2 siblings, 0 replies; 6+ messages in thread
From: Charles Keepax @ 2026-11-03 14:18 UTC (permalink / raw)
To: broonie; +Cc: lgirdwood, linux-sound, linux-kernel, patches
Enable the quick charge feature of the micbias to ensure the bias is
more likely to be up to voltage before the recording starts. This
greatly improves the startup pop of the analogue microphones.
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
No changes since v1.
sound/soc/codecs/cs42l43.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sound/soc/codecs/cs42l43.c b/sound/soc/codecs/cs42l43.c
index b6238f89c789c..90c83bb33d69b 100644
--- a/sound/soc/codecs/cs42l43.c
+++ b/sound/soc/codecs/cs42l43.c
@@ -2822,6 +2822,10 @@ static int cs42l43_codec_probe(struct platform_device *pdev)
if (ret)
goto err_pm;
+ // Enable quick charge to improve analogue microphone startup
+ regmap_update_bits(cs42l43->regmap, CS42L43_ADC_B_CTRL1, 0x20, 0x20);
+ regmap_update_bits(cs42l43->regmap, CS42L43_ADC_B_CTRL2, 0x20, 0x20);
+
for (i = 0; i < ARRAY_SIZE(cs42l43_irqs); i++) {
ret = cs42l43_request_irq(priv, cs42l43_irqs[i].name,
cs42l43_irqs[i].irq,
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/3] ASoC: cs42l43: Factor out decimator startup data to an array
2026-11-03 14:18 [PATCH v2 0/3] Improve pop performance of cs42l43 input path Charles Keepax
2026-11-03 14:18 ` [PATCH v2 1/3] ASoC: cs42l43: Improve analogue mic pop performance Charles Keepax
@ 2026-11-03 14:18 ` Charles Keepax
2026-11-03 14:18 ` [PATCH v2 3/3] ASoC: cs42l43: Improve pop performance of the input power up Charles Keepax
2 siblings, 0 replies; 6+ messages in thread
From: Charles Keepax @ 2026-11-03 14:18 UTC (permalink / raw)
To: broonie; +Cc: lgirdwood, linux-sound, linux-kernel, patches
Rather than large switches factor out an array with all the data
necessary for the decimator startup. This makes the code slightly more
readable and prepares for some incoming improvements.
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
Changes since v1:
- Added static const to decim_info arrays
sound/soc/codecs/cs42l43.c | 150 +++++++++++++++++--------------------
1 file changed, 68 insertions(+), 82 deletions(-)
diff --git a/sound/soc/codecs/cs42l43.c b/sound/soc/codecs/cs42l43.c
index 90c83bb33d69b..8fccddf7a1b22 100644
--- a/sound/soc/codecs/cs42l43.c
+++ b/sound/soc/codecs/cs42l43.c
@@ -1736,97 +1736,82 @@ static int cs42l43_hp_ev(struct snd_soc_dapm_widget *w,
return 0;
}
+struct decim_info {
+ unsigned int vreg;
+ unsigned int vmask;
+};
+
+static const struct decim_info cs42l43_decim_info[] = {
+ {
+ .vreg = CS42L43_DECIM_VOL_CTRL_CH1_CH2,
+ .vmask = CS42L43_DECIM1_VD_RAMP_MASK | CS42L43_DECIM1_MUTE_MASK,
+ },
+ {
+ .vreg = CS42L43_DECIM_VOL_CTRL_CH1_CH2,
+ .vmask = CS42L43_DECIM2_VD_RAMP_MASK | CS42L43_DECIM2_MUTE_MASK,
+ },
+ {
+ .vreg = CS42L43_DECIM_VOL_CTRL_CH1_CH2,
+ .vmask = CS42L43_DECIM1_VD_RAMP_MASK | CS42L43_DECIM1_MUTE_MASK,
+ },
+ {
+ .vreg = CS42L43_DECIM_VOL_CTRL_CH1_CH2,
+ .vmask = CS42L43_DECIM2_VD_RAMP_MASK | CS42L43_DECIM2_MUTE_MASK,
+ },
+ {
+ .vreg = CS42L43_DECIM_VOL_CTRL_CH3_CH4,
+ .vmask = CS42L43_DECIM3_VD_RAMP_MASK | CS42L43_DECIM3_MUTE_MASK,
+ },
+ {
+ .vreg = CS42L43_DECIM_VOL_CTRL_CH3_CH4,
+ .vmask = CS42L43_DECIM4_VD_RAMP_MASK | CS42L43_DECIM4_MUTE_MASK,
+ }
+};
+
+static const struct decim_info cs42l43b_decim_info[] = {
+ {
+ .vreg = CS42L43B_DECIM_VOL_CTRL_CH1_CH2,
+ .vmask = CS42L43_DECIM1_VD_RAMP_MASK | CS42L43_DECIM1_MUTE_MASK,
+ },
+ {
+ .vreg = CS42L43B_DECIM_VOL_CTRL_CH1_CH2,
+ .vmask = CS42L43_DECIM2_VD_RAMP_MASK | CS42L43_DECIM2_MUTE_MASK,
+ },
+ {
+ .vreg = CS42L43B_DECIM_VOL_CTRL_CH3_CH4,
+ .vmask = CS42L43_DECIM3_VD_RAMP_MASK | CS42L43_DECIM3_MUTE_MASK,
+ },
+ {
+ .vreg = CS42L43B_DECIM_VOL_CTRL_CH3_CH4,
+ .vmask = CS42L43_DECIM4_VD_RAMP_MASK | CS42L43_DECIM4_MUTE_MASK,
+ },
+ {
+ .vreg = CS42L43B_DECIM_VOL_CTRL_CH5_CH6,
+ .vmask = CS42L43B_DECIM5_PATH1_VOL_FALL_RATE_MASK | CS42L43B_DECIM5_MUTE_MASK,
+ },
+ {
+ .vreg = CS42L43B_DECIM_VOL_CTRL_CH5_CH6,
+ .vmask = CS42L43B_DECIM6_PATH1_VOL_FALL_RATE_MASK | CS42L43B_DECIM6_MUTE_MASK,
+ }
+};
+
static int cs42l43_mic_ev(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
struct cs42l43_codec *priv = snd_soc_component_get_drvdata(component);
+ const struct decim_info *info = &cs42l43_decim_info[w->shift];
struct cs42l43 *cs42l43 = priv->core;
- unsigned int reg, ramp, mute;
- unsigned int *val;
+ unsigned int vval = CS42L43_DECIM1_MUTE_MASK | CS42L43_DECIM2_MUTE_MASK;
int ret;
- if (cs42l43->variant_id == CS42L43_DEVID_VAL) {
- switch (w->shift) {
- case CS42L43_ADC1_EN_SHIFT:
- case CS42L43_PDM1_DIN_L_EN_SHIFT:
- reg = CS42L43_DECIM_VOL_CTRL_CH1_CH2;
- ramp = CS42L43_DECIM1_VD_RAMP_MASK;
- mute = CS42L43_DECIM1_MUTE_MASK;
- val = &priv->decim_cache[0];
- break;
- case CS42L43_ADC2_EN_SHIFT:
- case CS42L43_PDM1_DIN_R_EN_SHIFT:
- reg = CS42L43_DECIM_VOL_CTRL_CH1_CH2;
- ramp = CS42L43_DECIM2_VD_RAMP_MASK;
- mute = CS42L43_DECIM2_MUTE_MASK;
- val = &priv->decim_cache[1];
- break;
- case CS42L43_PDM2_DIN_L_EN_SHIFT:
- reg = CS42L43_DECIM_VOL_CTRL_CH3_CH4;
- ramp = CS42L43_DECIM3_VD_RAMP_MASK;
- mute = CS42L43_DECIM3_MUTE_MASK;
- val = &priv->decim_cache[2];
- break;
- case CS42L43_PDM2_DIN_R_EN_SHIFT:
- reg = CS42L43_DECIM_VOL_CTRL_CH3_CH4;
- ramp = CS42L43_DECIM4_VD_RAMP_MASK;
- mute = CS42L43_DECIM4_MUTE_MASK;
- val = &priv->decim_cache[3];
- break;
- default:
- dev_err(priv->dev, "Invalid microphone shift: %d\n", w->shift);
- return -EINVAL;
- }
- } else if (cs42l43->variant_id == CS42L43B_DEVID_VAL) {
- switch (w->shift) {
- case CS42L43_ADC1_EN_SHIFT:
- reg = CS42L43B_DECIM_VOL_CTRL_CH1_CH2;
- ramp = CS42L43_DECIM1_VD_RAMP_MASK;
- mute = CS42L43_DECIM1_MUTE_MASK;
- val = &priv->decim_cache[0];
- break;
- case CS42L43_ADC2_EN_SHIFT:
- reg = CS42L43B_DECIM_VOL_CTRL_CH1_CH2;
- ramp = CS42L43_DECIM2_VD_RAMP_MASK;
- mute = CS42L43_DECIM2_MUTE_MASK;
- val = &priv->decim_cache[1];
- break;
- case CS42L43_PDM1_DIN_L_EN_SHIFT:
- reg = CS42L43B_DECIM_VOL_CTRL_CH3_CH4;
- ramp = CS42L43_DECIM3_VD_RAMP_MASK;
- mute = CS42L43_DECIM3_MUTE_MASK;
- val = &priv->decim_cache[2];
- break;
- case CS42L43_PDM1_DIN_R_EN_SHIFT:
- reg = CS42L43B_DECIM_VOL_CTRL_CH3_CH4;
- ramp = CS42L43_DECIM4_VD_RAMP_MASK;
- mute = CS42L43_DECIM4_MUTE_MASK;
- val = &priv->decim_cache[3];
- break;
- case CS42L43_PDM2_DIN_L_EN_SHIFT:
- reg = CS42L43B_DECIM_VOL_CTRL_CH5_CH6;
- ramp = CS42L43B_DECIM5_PATH1_VOL_FALL_RATE_MASK;
- mute = CS42L43B_DECIM5_MUTE_MASK;
- val = &priv->decim_cache[4];
- break;
- case CS42L43_PDM2_DIN_R_EN_SHIFT:
- reg = CS42L43B_DECIM_VOL_CTRL_CH5_CH6;
- ramp = CS42L43B_DECIM6_PATH1_VOL_FALL_RATE_MASK;
- mute = CS42L43B_DECIM6_MUTE_MASK;
- val = &priv->decim_cache[5];
- break;
- default:
- dev_err(priv->dev, "Invalid microphone shift: %d\n", w->shift);
- return -EINVAL;
- }
- } else {
- return -EINVAL;
- }
+ if (cs42l43->variant_id == CS42L43B_DEVID_VAL)
+ info = &cs42l43b_decim_info[w->shift];
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
- ret = regmap_read(cs42l43->regmap, reg, val);
+ ret = regmap_read(cs42l43->regmap, info->vreg,
+ &priv->decim_cache[w->shift]);
if (ret) {
dev_err(priv->dev,
"Failed to cache decimator settings: %d\n",
@@ -1834,10 +1819,11 @@ static int cs42l43_mic_ev(struct snd_soc_dapm_widget *w,
return ret;
}
- regmap_update_bits(cs42l43->regmap, reg, mute | ramp, mute);
+ regmap_update_bits(cs42l43->regmap, info->vreg, info->vmask, vval);
break;
case SND_SOC_DAPM_POST_PMU:
- regmap_update_bits(cs42l43->regmap, reg, mute | ramp, *val);
+ regmap_update_bits(cs42l43->regmap, info->vreg, info->vmask,
+ priv->decim_cache[w->shift]);
break;
default:
break;
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 3/3] ASoC: cs42l43: Improve pop performance of the input power up
2026-11-03 14:18 [PATCH v2 0/3] Improve pop performance of cs42l43 input path Charles Keepax
2026-11-03 14:18 ` [PATCH v2 1/3] ASoC: cs42l43: Improve analogue mic pop performance Charles Keepax
2026-11-03 14:18 ` [PATCH v2 2/3] ASoC: cs42l43: Factor out decimator startup data to an array Charles Keepax
@ 2026-11-03 14:18 ` Charles Keepax
2026-11-03 14:39 ` sashiko-bot
2 siblings, 1 reply; 6+ messages in thread
From: Charles Keepax @ 2026-11-03 14:18 UTC (permalink / raw)
To: broonie; +Cc: lgirdwood, linux-sound, linux-kernel, patches
cs42l43's decimator is particularly susceptible to discontinuities
during startup. To help reduce the pop noises adjust the high
pass filter settings whilst powering up the microphones and add
a sizable delay to let that filter settle, then restore the user
settings.
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
Changes since v1:
- Added DAPM lock to affected control handlers
- Corrected order on new registers in the decim_info array
sound/soc/codecs/cs42l43.c | 69 ++++++++++++++++++++++++++++++--------
sound/soc/codecs/cs42l43.h | 3 +-
2 files changed, 57 insertions(+), 15 deletions(-)
diff --git a/sound/soc/codecs/cs42l43.c b/sound/soc/codecs/cs42l43.c
index 8fccddf7a1b22..43758f790cb0f 100644
--- a/sound/soc/codecs/cs42l43.c
+++ b/sound/soc/codecs/cs42l43.c
@@ -1345,19 +1345,27 @@ static const struct snd_kcontrol_new cs42l43_controls[] = {
SOC_ENUM("Decimator 3 WNF Corner Frequency", cs42l43_dec3_wnf_corner),
SOC_ENUM("Decimator 4 WNF Corner Frequency", cs42l43_dec4_wnf_corner),
- SOC_SINGLE("Decimator 1 HPF Switch", CS42L43_DECIM_HPF_WNF_CTRL1,
- CS42L43_DECIM_HPF_EN_SHIFT, 1, 0),
- SOC_SINGLE("Decimator 2 HPF Switch", CS42L43_DECIM_HPF_WNF_CTRL2,
- CS42L43_DECIM_HPF_EN_SHIFT, 1, 0),
- SOC_SINGLE("Decimator 3 HPF Switch", CS42L43_DECIM_HPF_WNF_CTRL3,
- CS42L43_DECIM_HPF_EN_SHIFT, 1, 0),
- SOC_SINGLE("Decimator 4 HPF Switch", CS42L43_DECIM_HPF_WNF_CTRL4,
- CS42L43_DECIM_HPF_EN_SHIFT, 1, 0),
+ SOC_SINGLE_EXT("Decimator 1 HPF Switch", CS42L43_DECIM_HPF_WNF_CTRL1,
+ CS42L43_DECIM_HPF_EN_SHIFT, 1, 0,
+ cs42l43_dapm_get_volsw, cs42l43_dapm_put_volsw),
+ SOC_SINGLE_EXT("Decimator 2 HPF Switch", CS42L43_DECIM_HPF_WNF_CTRL2,
+ CS42L43_DECIM_HPF_EN_SHIFT, 1, 0,
+ cs42l43_dapm_get_volsw, cs42l43_dapm_put_volsw),
+ SOC_SINGLE_EXT("Decimator 3 HPF Switch", CS42L43_DECIM_HPF_WNF_CTRL3,
+ CS42L43_DECIM_HPF_EN_SHIFT, 1, 0,
+ cs42l43_dapm_get_volsw, cs42l43_dapm_put_volsw),
+ SOC_SINGLE_EXT("Decimator 4 HPF Switch", CS42L43_DECIM_HPF_WNF_CTRL4,
+ CS42L43_DECIM_HPF_EN_SHIFT, 1, 0,
+ cs42l43_dapm_get_volsw, cs42l43_dapm_put_volsw),
- SOC_ENUM("Decimator 1 HPF Corner Frequency", cs42l43_dec1_hpf_corner),
- SOC_ENUM("Decimator 2 HPF Corner Frequency", cs42l43_dec2_hpf_corner),
- SOC_ENUM("Decimator 3 HPF Corner Frequency", cs42l43_dec3_hpf_corner),
- SOC_ENUM("Decimator 4 HPF Corner Frequency", cs42l43_dec4_hpf_corner),
+ SOC_ENUM_EXT("Decimator 1 HPF Corner Frequency", cs42l43_dec1_hpf_corner,
+ cs42l43_dapm_get_enum, cs42l43_dapm_put_enum),
+ SOC_ENUM_EXT("Decimator 2 HPF Corner Frequency", cs42l43_dec2_hpf_corner,
+ cs42l43_dapm_get_enum, cs42l43_dapm_put_enum),
+ SOC_ENUM_EXT("Decimator 3 HPF Corner Frequency", cs42l43_dec3_hpf_corner,
+ cs42l43_dapm_get_enum, cs42l43_dapm_put_enum),
+ SOC_ENUM_EXT("Decimator 4 HPF Corner Frequency", cs42l43_dec4_hpf_corner,
+ cs42l43_dapm_get_enum, cs42l43_dapm_put_enum),
SOC_DOUBLE_R_EXT("Speaker Digital Switch",
CS42L43_INTP_VOLUME_CTRL1, CS42L43_INTP_VOLUME_CTRL2,
@@ -1737,32 +1745,39 @@ static int cs42l43_hp_ev(struct snd_soc_dapm_widget *w,
}
struct decim_info {
+ unsigned int freg;
unsigned int vreg;
unsigned int vmask;
};
static const struct decim_info cs42l43_decim_info[] = {
{
+ .freg = CS42L43_DECIM_HPF_WNF_CTRL1,
.vreg = CS42L43_DECIM_VOL_CTRL_CH1_CH2,
.vmask = CS42L43_DECIM1_VD_RAMP_MASK | CS42L43_DECIM1_MUTE_MASK,
},
{
+ .freg = CS42L43_DECIM_HPF_WNF_CTRL2,
.vreg = CS42L43_DECIM_VOL_CTRL_CH1_CH2,
.vmask = CS42L43_DECIM2_VD_RAMP_MASK | CS42L43_DECIM2_MUTE_MASK,
},
{
+ .freg = CS42L43_DECIM_HPF_WNF_CTRL1,
.vreg = CS42L43_DECIM_VOL_CTRL_CH1_CH2,
.vmask = CS42L43_DECIM1_VD_RAMP_MASK | CS42L43_DECIM1_MUTE_MASK,
},
{
+ .freg = CS42L43_DECIM_HPF_WNF_CTRL2,
.vreg = CS42L43_DECIM_VOL_CTRL_CH1_CH2,
.vmask = CS42L43_DECIM2_VD_RAMP_MASK | CS42L43_DECIM2_MUTE_MASK,
},
{
+ .freg = CS42L43_DECIM_HPF_WNF_CTRL3,
.vreg = CS42L43_DECIM_VOL_CTRL_CH3_CH4,
.vmask = CS42L43_DECIM3_VD_RAMP_MASK | CS42L43_DECIM3_MUTE_MASK,
},
{
+ .freg = CS42L43_DECIM_HPF_WNF_CTRL4,
.vreg = CS42L43_DECIM_VOL_CTRL_CH3_CH4,
.vmask = CS42L43_DECIM4_VD_RAMP_MASK | CS42L43_DECIM4_MUTE_MASK,
}
@@ -1770,26 +1785,32 @@ static const struct decim_info cs42l43_decim_info[] = {
static const struct decim_info cs42l43b_decim_info[] = {
{
+ .freg = CS42L43_DECIM_HPF_WNF_CTRL1,
.vreg = CS42L43B_DECIM_VOL_CTRL_CH1_CH2,
.vmask = CS42L43_DECIM1_VD_RAMP_MASK | CS42L43_DECIM1_MUTE_MASK,
},
{
+ .freg = CS42L43_DECIM_HPF_WNF_CTRL2,
.vreg = CS42L43B_DECIM_VOL_CTRL_CH1_CH2,
.vmask = CS42L43_DECIM2_VD_RAMP_MASK | CS42L43_DECIM2_MUTE_MASK,
},
{
+ .freg = CS42L43_DECIM_HPF_WNF_CTRL3,
.vreg = CS42L43B_DECIM_VOL_CTRL_CH3_CH4,
.vmask = CS42L43_DECIM3_VD_RAMP_MASK | CS42L43_DECIM3_MUTE_MASK,
},
{
+ .freg = CS42L43_DECIM_HPF_WNF_CTRL4,
.vreg = CS42L43B_DECIM_VOL_CTRL_CH3_CH4,
.vmask = CS42L43_DECIM4_VD_RAMP_MASK | CS42L43_DECIM4_MUTE_MASK,
},
{
+ .freg = CS42L43B_DECIM_HPF_WNF_CTRL5,
.vreg = CS42L43B_DECIM_VOL_CTRL_CH5_CH6,
.vmask = CS42L43B_DECIM5_PATH1_VOL_FALL_RATE_MASK | CS42L43B_DECIM5_MUTE_MASK,
},
{
+ .freg = CS42L43B_DECIM_HPF_WNF_CTRL6,
.vreg = CS42L43B_DECIM_VOL_CTRL_CH5_CH6,
.vmask = CS42L43B_DECIM6_PATH1_VOL_FALL_RATE_MASK | CS42L43B_DECIM6_MUTE_MASK,
}
@@ -1802,6 +1823,8 @@ static int cs42l43_mic_ev(struct snd_soc_dapm_widget *w,
struct cs42l43_codec *priv = snd_soc_component_get_drvdata(component);
const struct decim_info *info = &cs42l43_decim_info[w->shift];
struct cs42l43 *cs42l43 = priv->core;
+ unsigned int fmask = CS42L43_DECIM_HPF_EN_MASK | CS42L43_DECIM_HPF_CF_MASK;
+ unsigned int fval = CS42L43_DECIM_HPF_EN_MASK | 3 << CS42L43_DECIM_HPF_CF_SHIFT;
unsigned int vval = CS42L43_DECIM1_MUTE_MASK | CS42L43_DECIM2_MUTE_MASK;
int ret;
@@ -1810,8 +1833,10 @@ static int cs42l43_mic_ev(struct snd_soc_dapm_widget *w,
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
+ priv->decim_pre_pmu = true;
+
ret = regmap_read(cs42l43->regmap, info->vreg,
- &priv->decim_cache[w->shift]);
+ &priv->decim_cache[w->shift][0]);
if (ret) {
dev_err(priv->dev,
"Failed to cache decimator settings: %d\n",
@@ -1819,11 +1844,27 @@ static int cs42l43_mic_ev(struct snd_soc_dapm_widget *w,
return ret;
}
+ ret = regmap_read(cs42l43->regmap, info->freg,
+ &priv->decim_cache[w->shift][1]);
+ if (ret) {
+ dev_err(priv->dev,
+ "Failed to cache decimator filter settings: %d\n", ret);
+ return ret;
+ }
+
regmap_update_bits(cs42l43->regmap, info->vreg, info->vmask, vval);
+ regmap_update_bits(cs42l43->regmap, info->freg, fmask, fval);
break;
case SND_SOC_DAPM_POST_PMU:
+ if (priv->decim_pre_pmu) {
+ msleep(150);
+ priv->decim_pre_pmu = false;
+ }
+
+ regmap_update_bits(cs42l43->regmap, info->freg, fmask,
+ priv->decim_cache[w->shift][1]);
regmap_update_bits(cs42l43->regmap, info->vreg, info->vmask,
- priv->decim_cache[w->shift]);
+ priv->decim_cache[w->shift][0]);
break;
default:
break;
diff --git a/sound/soc/codecs/cs42l43.h b/sound/soc/codecs/cs42l43.h
index fd50feb26ae99..2dc8d530a1fc0 100644
--- a/sound/soc/codecs/cs42l43.h
+++ b/sound/soc/codecs/cs42l43.h
@@ -61,7 +61,8 @@ struct cs42l43_codec {
unsigned int refclk_freq;
struct completion pll_ready;
- unsigned int decim_cache[6];
+ bool decim_pre_pmu;
+ unsigned int decim_cache[6][2];
unsigned int adc_ena;
unsigned int hp_ena;
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 3/3] ASoC: cs42l43: Improve pop performance of the input power up
2026-11-03 14:18 ` [PATCH v2 3/3] ASoC: cs42l43: Improve pop performance of the input power up Charles Keepax
@ 2026-11-03 14:39 ` sashiko-bot
2026-11-03 14:49 ` Charles Keepax
0 siblings, 1 reply; 6+ messages in thread
From: sashiko-bot @ 2026-11-03 14:39 UTC (permalink / raw)
To: Charles Keepax; +Cc: linux-sound
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] ASoC: cs42l43: missing DAPM lock on Decimator 5 and 6 HPF controls
--
commit 8cf1c31ea6b0941fdadc51d4efe5a6f1e81ead1b
Author: Charles Keepax <ckeepax@opensource.cirrus.com>
ASoC: cs42l43: Improve pop performance of the input power up
This commit adjusts the decimator high pass filter settings and adds a 150ms
settling delay during microphone power up to reduce startup pop noises, while
converting the Decimator 1..4 HPF controls to take the DAPM lock.
> diff --git a/sound/soc/codecs/cs42l43.c b/sound/soc/codecs/cs42l43.c
> index 8fccddf7a1b22..43758f790cb0f 100644
> --- a/sound/soc/codecs/cs42l43.c
> +++ b/sound/soc/codecs/cs42l43.c
> @@ -1345,19 +1345,27 @@ static const struct snd_kcontrol_new cs42l43_controls[] = {
> SOC_ENUM("Decimator 3 WNF Corner Frequency", cs42l43_dec3_wnf_corner),
> SOC_ENUM("Decimator 4 WNF Corner Frequency", cs42l43_dec4_wnf_corner),
>
> - SOC_SINGLE("Decimator 1 HPF Switch", CS42L43_DECIM_HPF_WNF_CTRL1,
> - CS42L43_DECIM_HPF_EN_SHIFT, 1, 0),
> - SOC_SINGLE("Decimator 2 HPF Switch", CS42L43_DECIM_HPF_WNF_CTRL2,
> - CS42L43_DECIM_HPF_EN_SHIFT, 1, 0),
> - SOC_SINGLE("Decimator 3 HPF Switch", CS42L43_DECIM_HPF_WNF_CTRL3,
> - CS42L43_DECIM_HPF_EN_SHIFT, 1, 0),
> - SOC_SINGLE("Decimator 4 HPF Switch", CS42L43_DECIM_HPF_WNF_CTRL4,
> - CS42L43_DECIM_HPF_EN_SHIFT, 1, 0),
> + SOC_SINGLE_EXT("Decimator 1 HPF Switch", CS42L43_DECIM_HPF_WNF_CTRL1,
> + CS42L43_DECIM_HPF_EN_SHIFT, 1, 0,
> + cs42l43_dapm_get_volsw, cs42l43_dapm_put_volsw),
> + SOC_SINGLE_EXT("Decimator 2 HPF Switch", CS42L43_DECIM_HPF_WNF_CTRL2,
> + CS42L43_DECIM_HPF_EN_SHIFT, 1, 0,
> + cs42l43_dapm_get_volsw, cs42l43_dapm_put_volsw),
> + SOC_SINGLE_EXT("Decimator 3 HPF Switch", CS42L43_DECIM_HPF_WNF_CTRL3,
> + CS42L43_DECIM_HPF_EN_SHIFT, 1, 0,
> + cs42l43_dapm_get_volsw, cs42l43_dapm_put_volsw),
> + SOC_SINGLE_EXT("Decimator 4 HPF Switch", CS42L43_DECIM_HPF_WNF_CTRL4,
> + CS42L43_DECIM_HPF_EN_SHIFT, 1, 0,
> + cs42l43_dapm_get_volsw, cs42l43_dapm_put_volsw),
>
> - SOC_ENUM("Decimator 1 HPF Corner Frequency", cs42l43_dec1_hpf_corner),
> - SOC_ENUM("Decimator 2 HPF Corner Frequency", cs42l43_dec2_hpf_corner),
> - SOC_ENUM("Decimator 3 HPF Corner Frequency", cs42l43_dec3_hpf_corner),
> - SOC_ENUM("Decimator 4 HPF Corner Frequency", cs42l43_dec4_hpf_corner),
> + SOC_ENUM_EXT("Decimator 1 HPF Corner Frequency", cs42l43_dec1_hpf_corner,
> + cs42l43_dapm_get_enum, cs42l43_dapm_put_enum),
> + SOC_ENUM_EXT("Decimator 2 HPF Corner Frequency", cs42l43_dec2_hpf_corner,
> + cs42l43_dapm_get_enum, cs42l43_dapm_put_enum),
> + SOC_ENUM_EXT("Decimator 3 HPF Corner Frequency", cs42l43_dec3_hpf_corner,
> + cs42l43_dapm_get_enum, cs42l43_dapm_put_enum),
> + SOC_ENUM_EXT("Decimator 4 HPF Corner Frequency", cs42l43_dec4_hpf_corner,
> + cs42l43_dapm_get_enum, cs42l43_dapm_put_enum),
[ ... ]
> @@ -1770,26 +1785,32 @@ static const struct decim_info cs42l43_decim_info[] = {
>
> static const struct decim_info cs42l43b_decim_info[] = {
> {
> + .freg = CS42L43_DECIM_HPF_WNF_CTRL1,
> .vreg = CS42L43B_DECIM_VOL_CTRL_CH1_CH2,
> .vmask = CS42L43_DECIM1_VD_RAMP_MASK | CS42L43_DECIM1_MUTE_MASK,
> },
> {
> + .freg = CS42L43_DECIM_HPF_WNF_CTRL2,
> .vreg = CS42L43B_DECIM_VOL_CTRL_CH1_CH2,
> .vmask = CS42L43_DECIM2_VD_RAMP_MASK | CS42L43_DECIM2_MUTE_MASK,
> },
> {
> + .freg = CS42L43_DECIM_HPF_WNF_CTRL3,
> .vreg = CS42L43B_DECIM_VOL_CTRL_CH3_CH4,
> .vmask = CS42L43_DECIM3_VD_RAMP_MASK | CS42L43_DECIM3_MUTE_MASK,
> },
> {
> + .freg = CS42L43_DECIM_HPF_WNF_CTRL4,
> .vreg = CS42L43B_DECIM_VOL_CTRL_CH3_CH4,
> .vmask = CS42L43_DECIM4_VD_RAMP_MASK | CS42L43_DECIM4_MUTE_MASK,
> },
> {
> + .freg = CS42L43B_DECIM_HPF_WNF_CTRL5,
> .vreg = CS42L43B_DECIM_VOL_CTRL_CH5_CH6,
> .vmask = CS42L43B_DECIM5_PATH1_VOL_FALL_RATE_MASK | CS42L43B_DECIM5_MUTE_MASK,
> },
> {
> + .freg = CS42L43B_DECIM_HPF_WNF_CTRL6,
> .vreg = CS42L43B_DECIM_VOL_CTRL_CH5_CH6,
> .vmask = CS42L43B_DECIM6_PATH1_VOL_FALL_RATE_MASK | CS42L43B_DECIM6_MUTE_MASK,
> }
[Severity: Medium]
As reported by Sashiko on v1 [1], cs42l43b_decim_info[] adds
CS42L43B_DECIM_HPF_WNF_CTRL5 and CS42L43B_DECIM_HPF_WNF_CTRL6 so that
cs42l43_mic_ev() caches, temporarily overrides, and restores them across the
150ms settle delay during PDM2L and PDM2R startup.
While the Decimator 1..4 HPF controls in cs42l43_controls[] were updated to
use the DAPM-locked helpers, the Decimator 5 and 6 HPF controls in
cs42l43_b_controls[] still use plain SOC_SINGLE and SOC_ENUM:
sound/soc/codecs/cs42l43.c:cs42l43_b_controls[] {
...
SOC_SINGLE("Decimator 5 HPF Switch", CS42L43B_DECIM_HPF_WNF_CTRL5,
CS42L43_DECIM_HPF_EN_SHIFT, 1, 0),
SOC_SINGLE("Decimator 6 HPF Switch", CS42L43B_DECIM_HPF_WNF_CTRL6,
CS42L43_DECIM_HPF_EN_SHIFT, 1, 0),
SOC_ENUM("Decimator 5 HPF Corner Frequency", cs42l43b_dec5_hpf_corner),
SOC_ENUM("Decimator 6 HPF Corner Frequency", cs42l43b_dec6_hpf_corner),
};
If userspace reads or writes the Decimator 5 or 6 HPF controls on CS42L43B
while PDM2L or PDM2R is powering up in cs42l43_mic_ev(), can it read back the
temporary startup filter settings or have a concurrent write overwritten when
SND_SOC_DAPM_POST_PMU restores priv->decim_cache[w->shift][1]?
Should the Decimator 5 and 6 HPF Switch and Corner Frequency controls in
cs42l43_b_controls[] also be converted to SOC_SINGLE_EXT and SOC_ENUM_EXT with
cs42l43_dapm_get_volsw, cs42l43_dapm_put_volsw, cs42l43_dapm_get_enum, and
cs42l43_dapm_put_enum?
[1] https://lore.kernel.org/r/sashiko-outbox-193741@kernel.org
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261103141857.672537-1-ckeepax@opensource.cirrus.com?part=3
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 3/3] ASoC: cs42l43: Improve pop performance of the input power up
2026-11-03 14:39 ` sashiko-bot
@ 2026-11-03 14:49 ` Charles Keepax
0 siblings, 0 replies; 6+ messages in thread
From: Charles Keepax @ 2026-11-03 14:49 UTC (permalink / raw)
To: linux-sound, broonie
On Tue, Nov 03, 2026 at 02:39:52PM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] ASoC: cs42l43: missing DAPM lock on Decimator 5 and 6 HPF controls
Sorry, foolish miss on my part, will do a v3, either later today
or tomorrow.
Thanks,
Charles
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-11-03 14:50 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-03 14:18 [PATCH v2 0/3] Improve pop performance of cs42l43 input path Charles Keepax
2026-11-03 14:18 ` [PATCH v2 1/3] ASoC: cs42l43: Improve analogue mic pop performance Charles Keepax
2026-11-03 14:18 ` [PATCH v2 2/3] ASoC: cs42l43: Factor out decimator startup data to an array Charles Keepax
2026-11-03 14:18 ` [PATCH v2 3/3] ASoC: cs42l43: Improve pop performance of the input power up Charles Keepax
2026-11-03 14:39 ` sashiko-bot
2026-11-03 14:49 ` Charles Keepax
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.