ASoC: cs42l43: Correct handling of 3-pole jack load detection
Subsystems (3)
PATCH 1/1 ASoC: cs42l43: Correct handling of 3-pole jack load detection
The load detection process for 3-pole jacks requires slightly updated reference values to ensure an accurate result. Update the code to apply different tunings for the 3-pole and 4-pole cases. This also updates the thresholds overall so update the relevant comments to match.
--- sound/soc/codecs/cs42l43-jack.c | 37 +++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-)
sound/soc/codecs/cs42l43-jack.c +31 -6
@@ -496,7 +496,23 @@ void cs42l43_bias_sense_timeout(struct work_struct *work)pm_runtime_put_autosuspend (priv->dev); } -static void cs42l43_start_load_detect (struct cs42l43_codec *priv) +static const struct reg_sequence cs42l43_3pole_patch[] = { + {0x4000 ,0x00000055 }, + {0x4000 ,0x000000AA }, + {0x17420 ,0x8500F300 }, + {0x17424 ,0x36003E00 }, + {0x4000 ,0x00000000 }, +}; + +static const struct reg_sequence cs42l43_4pole_patch[] = { + {0x4000 ,0x00000055 }, + {0x4000 ,0x000000AA }, + {0x17420 ,0x7800E600 }, + {0x17424 ,0x36003800 }, + {0x4000 ,0x00000000 }, +}; + +static void cs42l43_start_load_detect (struct cs42l43_codec *priv,bool mic) {struct cs42l43 *cs42l43 = priv->core;
@@ -520,6 +536,15 @@ static void cs42l43_start_load_detect(struct cs42l43_codec *priv)dev_err (priv->dev,"Load detect HP power down timed out\n" ); } +if (mic) +regmap_multi_reg_write_bypassed (cs42l43->regmap, + cs42l43_4pole_patch, +ARRAY_SIZE (cs42l43_4pole_patch)); +else +regmap_multi_reg_write_bypassed (cs42l43->regmap, + cs42l43_3pole_patch, +ARRAY_SIZE (cs42l43_3pole_patch)); +regmap_update_bits (cs42l43->regmap,CS42L43_BLOCK_EN3 ,CS42L43_ADC1_EN_MASK |CS42L43_ADC2_EN_MASK ,0 );regmap_update_bits (cs42l43->regmap,CS42L43_DACCNFG2 ,CS42L43_HP_HPF_EN_MASK ,0 );
@@ -598,7 +623,7 @@ static int cs42l43_run_load_detect(struct cs42l43_codec *priv, bool mic)reinit_completion (&priv->load_detect); -cs42l43_start_load_detect (priv); +cs42l43_start_load_detect (priv, mic); time_left =wait_for_completion_timeout (&priv->load_detect,msecs_to_jiffies (CS42L43_LOAD_TIMEOUT_MS ));cs42l43_stop_load_detect (priv);
@@ -622,11 +647,11 @@ static int cs42l43_run_load_detect(struct cs42l43_codec *priv, bool mic) }switch (val &CS42L43_AMP3_RES_DET_MASK ) { -case 0x0 :// low impedance -case 0x1 :// high impedance +case 0x0 :// < 22 Ohm impedance +case 0x1 :// < 150 Ohm impedance +case 0x2 :// < 1000 Ohm impedance return CS42L43_JACK_HEADPHONE ; -case 0x2 :// lineout -case 0x3 :// Open circuit +case 0x3 :// > 1000 Ohm impedance return CS42L43_JACK_LINEOUT ;default :return -EINVAL ;
Signature · 1 line
2.47.3
Mark Brown
maintainerQuoted 8 lines · Charles Keepax
The load detection process for 3-pole jacks requires slightly updated reference values to ensure an accurate result. Update the code to apply different tunings for the 3-pole and 4-pole cases. This also updates the thresholds overall so update the relevant comments to match.
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: cs42l43: Correct handling of 3-pole jack load detection
commit: e77a4081d7e324dfa876a9560b2a78969446ba82
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark