Commit dc96528b authored by Charles Keepax's avatar Charles Keepax Committed by Mark Brown

ASoC: cs42l43: Don't enable bias sense during type detect

Alas on some headsets the bias sense can cause problems with the
type detection. It can occasionally be falsely triggered by the type
detect itself and as the clamp is applied when this happens, it will
cause a headset to be incorrectly identified as headphones. As
such it should be disabled whilst running type detect. This does
mean a jack removal during type detect will cause a larger click
but that is unfortunately unavoidable.

Fixes: 1e4ce0d5 ("ASoC: cs42l43: Move headset bias sense enable earlier in process")
Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
Link: https://msgid.link/r/20231211160019.2034442-1-ckeepax@opensource.cirrus.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 02a914ed
......@@ -237,7 +237,7 @@ int cs42l43_set_jack(struct snd_soc_component *component,
return ret;
}
static void cs42l43_start_hs_bias(struct cs42l43_codec *priv, bool force_high)
static void cs42l43_start_hs_bias(struct cs42l43_codec *priv, bool type_detect)
{
struct cs42l43 *cs42l43 = priv->core;
unsigned int val = 0x3 << CS42L43_HSBIAS_MODE_SHIFT;
......@@ -247,16 +247,17 @@ static void cs42l43_start_hs_bias(struct cs42l43_codec *priv, bool force_high)
regmap_update_bits(cs42l43->regmap, CS42L43_HS2,
CS42L43_HS_CLAMP_DISABLE_MASK, CS42L43_HS_CLAMP_DISABLE_MASK);
if (!force_high && priv->bias_low)
val = 0x2 << CS42L43_HSBIAS_MODE_SHIFT;
if (priv->bias_sense_ua) {
regmap_update_bits(cs42l43->regmap,
CS42L43_HS_BIAS_SENSE_AND_CLAMP_AUTOCONTROL,
CS42L43_HSBIAS_SENSE_EN_MASK |
CS42L43_AUTO_HSBIAS_CLAMP_EN_MASK,
CS42L43_HSBIAS_SENSE_EN_MASK |
CS42L43_AUTO_HSBIAS_CLAMP_EN_MASK);
if (!type_detect) {
if (priv->bias_low)
val = 0x2 << CS42L43_HSBIAS_MODE_SHIFT;
if (priv->bias_sense_ua)
regmap_update_bits(cs42l43->regmap,
CS42L43_HS_BIAS_SENSE_AND_CLAMP_AUTOCONTROL,
CS42L43_HSBIAS_SENSE_EN_MASK |
CS42L43_AUTO_HSBIAS_CLAMP_EN_MASK,
CS42L43_HSBIAS_SENSE_EN_MASK |
CS42L43_AUTO_HSBIAS_CLAMP_EN_MASK);
}
regmap_update_bits(cs42l43->regmap, CS42L43_MIC_DETECT_CONTROL_1,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment