* [PATCH 2/2] ASoC: cs42l43: Fix headphone output by properly disabling HP clamp
@ 2026-01-12 3:13 Cole Leavitt
2026-01-12 13:02 ` Charles Keepax
0 siblings, 1 reply; 2+ messages in thread
From: Cole Leavitt @ 2026-01-12 3:13 UTC (permalink / raw)
To: linux-sound; +Cc: patches, rf, broonie, Cole Leavitt
The CS42L43 codec requires proper configuration of the headphone amplifier
clamp circuitry for audio output to work. Two issues were preventing
headphone audio:
1. The STEREO_MIC_CLAMP_CTRL register (0x100c4) requires both bit 0
(SMIC_HPAMP_CLAMP_DIS_FRC) AND bit 1 (SMIC_HPAMP_CLAMP_DIS_FRC_VAL)
to be set to properly disable the HP amp clamp. The driver was only
setting bit 0, which enables force mode but leaves the clamp enabled.
2. When switching to headphone or line-out mode via the Jack Override
control, the HS_CLAMP_DISABLE bit (bit 28) in the HS2 register must
be set to disable the headset clamp circuitry.
Without these fixes, the headphone amplifier output is clamped to ground
and no audio is heard despite correct DAPM routing.
Tested on Lenovo ThinkPad P16 Gen 3 with CS42L43 codec.
Signed-off-by: Cole Leavitt <cole@unwrap.rs>
---
sound/soc/codecs/cs42l43-jack.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/sound/soc/codecs/cs42l43-jack.c b/sound/soc/codecs/cs42l43-jack.c
index b719d6263..7d6a93eec 100644
--- a/sound/soc/codecs/cs42l43-jack.c
+++ b/sound/soc/codecs/cs42l43-jack.c
@@ -698,7 +698,7 @@ void cs42l43_clear_jack(struct cs42l43_codec *priv)
regmap_update_bits(cs42l43->regmap, CS42L43_STEREO_MIC_CTRL,
CS42L43_JACK_STEREO_CONFIG_MASK, 0);
regmap_update_bits(cs42l43->regmap, CS42L43_STEREO_MIC_CLAMP_CTRL,
- CS42L43_SMIC_HPAMP_CLAMP_DIS_FRC_MASK,
+ CS42L43_SMIC_HPAMP_CLAMP_DIS_FRC_MASK | CS42L43_SMIC_HPAMP_CLAMP_DIS_FRC_VAL_MASK,
CS42L43_SMIC_HPAMP_CLAMP_DIS_FRC_MASK);
regmap_update_bits(cs42l43->regmap, CS42L43_HS2,
CS42L43_HSDET_MODE_MASK | CS42L43_HSDET_MANUAL_MODE_MASK,
@@ -814,7 +814,7 @@ static const struct cs42l43_jack_override_mode {
CS42L43_HSBIAS_GNDREF_HS3_SEL_MASK |
CS42L43_HSBIAS_OUT_HS4_SEL_MASK |
CS42L43_HSGND_HS3_SEL_MASK,
- .clamp_ctrl = CS42L43_SMIC_HPAMP_CLAMP_DIS_FRC_MASK,
+ .clamp_ctrl = CS42L43_SMIC_HPAMP_CLAMP_DIS_FRC_MASK | CS42L43_SMIC_HPAMP_CLAMP_DIS_FRC_VAL_MASK,
.report = CS42L43_JACK_HEADSET,
},
[CS42L43_JACK_RAW_OMTP] = {
@@ -823,17 +823,17 @@ static const struct cs42l43_jack_override_mode {
CS42L43_HSBIAS_GNDREF_HS4_SEL_MASK |
CS42L43_HSBIAS_OUT_HS3_SEL_MASK |
CS42L43_HSGND_HS4_SEL_MASK,
- .clamp_ctrl = CS42L43_SMIC_HPAMP_CLAMP_DIS_FRC_MASK,
+ .clamp_ctrl = CS42L43_SMIC_HPAMP_CLAMP_DIS_FRC_MASK | CS42L43_SMIC_HPAMP_CLAMP_DIS_FRC_VAL_MASK,
.report = CS42L43_JACK_HEADSET,
},
[CS42L43_JACK_RAW_HEADPHONE] = {
.hsdet_mode = CS42L43_JACK_3_POLE_SWITCHES,
- .clamp_ctrl = CS42L43_SMIC_HPAMP_CLAMP_DIS_FRC_MASK,
+ .clamp_ctrl = CS42L43_SMIC_HPAMP_CLAMP_DIS_FRC_MASK | CS42L43_SMIC_HPAMP_CLAMP_DIS_FRC_VAL_MASK,
.report = CS42L43_JACK_HEADPHONE,
},
[CS42L43_JACK_RAW_LINE_OUT] = {
.hsdet_mode = CS42L43_JACK_3_POLE_SWITCHES,
- .clamp_ctrl = CS42L43_SMIC_HPAMP_CLAMP_DIS_FRC_MASK,
+ .clamp_ctrl = CS42L43_SMIC_HPAMP_CLAMP_DIS_FRC_MASK | CS42L43_SMIC_HPAMP_CLAMP_DIS_FRC_VAL_MASK,
.report = CS42L43_JACK_LINEOUT,
},
[CS42L43_JACK_RAW_LINE_IN] = {
@@ -849,7 +849,7 @@ static const struct cs42l43_jack_override_mode {
},
[CS42L43_JACK_RAW_OPTICAL] = {
.hsdet_mode = CS42L43_JACK_3_POLE_SWITCHES,
- .clamp_ctrl = CS42L43_SMIC_HPAMP_CLAMP_DIS_FRC_MASK,
+ .clamp_ctrl = CS42L43_SMIC_HPAMP_CLAMP_DIS_FRC_MASK | CS42L43_SMIC_HPAMP_CLAMP_DIS_FRC_VAL_MASK,
.report = CS42L43_JACK_OPTICAL,
},
};
@@ -927,7 +927,7 @@ int cs42l43_jack_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *u
CS42L43_JACK_STEREO_CONFIG_MASK,
cs42l43_jack_override_modes[override].mic_ctrl);
regmap_update_bits(cs42l43->regmap, CS42L43_STEREO_MIC_CLAMP_CTRL,
- CS42L43_SMIC_HPAMP_CLAMP_DIS_FRC_MASK,
+ CS42L43_SMIC_HPAMP_CLAMP_DIS_FRC_MASK | CS42L43_SMIC_HPAMP_CLAMP_DIS_FRC_VAL_MASK,
cs42l43_jack_override_modes[override].clamp_ctrl);
switch (override) {
@@ -947,6 +947,13 @@ int cs42l43_jack_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *u
case CS42L43_JACK_RAW_MICROPHONE:
cs42l43_start_hs_bias(priv, false);
break;
+ case CS42L43_JACK_RAW_HEADPHONE:
+ case CS42L43_JACK_RAW_LINE_OUT:
+ /* Disable HS clamp for headphone/line-out playback */
+ regmap_update_bits(cs42l43->regmap, CS42L43_HS2,
+ CS42L43_HS_CLAMP_DISABLE_MASK,
+ CS42L43_HS_CLAMP_DISABLE_MASK);
+ break;
default:
break;
}
--
2.52.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 2/2] ASoC: cs42l43: Fix headphone output by properly disabling HP clamp
2026-01-12 3:13 [PATCH 2/2] ASoC: cs42l43: Fix headphone output by properly disabling HP clamp Cole Leavitt
@ 2026-01-12 13:02 ` Charles Keepax
0 siblings, 0 replies; 2+ messages in thread
From: Charles Keepax @ 2026-01-12 13:02 UTC (permalink / raw)
To: Cole Leavitt; +Cc: linux-sound, patches, rf, broonie
On Sun, Jan 11, 2026 at 08:13:43PM -0700, Cole Leavitt wrote:
> The CS42L43 codec requires proper configuration of the headphone amplifier
> clamp circuitry for audio output to work. Two issues were preventing
> headphone audio:
>
> 1. The STEREO_MIC_CLAMP_CTRL register (0x100c4) requires both bit 0
> (SMIC_HPAMP_CLAMP_DIS_FRC) AND bit 1 (SMIC_HPAMP_CLAMP_DIS_FRC_VAL)
> to be set to properly disable the HP amp clamp. The driver was only
> setting bit 0, which enables force mode but leaves the clamp enabled.
This bit isn't a general clamp it moves the clamp under control
of the stereo mic logic. The normal playback paths should
override these settings when brought up.
> 2. When switching to headphone or line-out mode via the Jack Override
> control, the HS_CLAMP_DISABLE bit (bit 28) in the HS2 register must
> be set to disable the headset clamp circuitry.
This clamps pins 3/4 to ground (gnd/mic), not the signal pins, as
such the clamp should be active for both headphone and line-out
cases.
> Without these fixes, the headphone amplifier output is clamped to ground
> and no audio is heard despite correct DAPM routing.
Are you really having no sound without this patch and sound with
this patch? Could you confirm that is the case, making sure
reverting this one change is the difference between your two
tests. Could you also describe a little more about how you get
into the failing state? Is it a simple case of plug in headphones
no sound? cs42l43 is a pretty well tested device it seems unlikely
something is fundamentally wrong with the clamping.
Thanks,
Charles
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-01-12 13:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-12 3:13 [PATCH 2/2] ASoC: cs42l43: Fix headphone output by properly disabling HP clamp Cole Leavitt
2026-01-12 13:02 ` Charles Keepax
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox