Commit 976001b1 authored by Richard Fitzgerald's avatar Richard Fitzgerald Committed by Mark Brown

ASoC: cs42l42: Remove redundant writes to DETECT_MODE

There are multiple places where DETECT_MODE is included in a register
write, but in every case it is written as 0. Removing these redundant
writes makes the code less cluttered and also makes it obvious that
DETECT_MODE is never changed.

A single initialization to 0 is added to cs42l42_setup_hs_type_detect().
Signed-off-by: default avatarRichard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211116163901.45390-2-rf@opensource.cirrus.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 7548a391
...@@ -1270,10 +1270,8 @@ static void cs42l42_process_hs_type_detect(struct cs42l42_private *cs42l42) ...@@ -1270,10 +1270,8 @@ static void cs42l42_process_hs_type_detect(struct cs42l42_private *cs42l42)
/* Turn on level detect circuitry */ /* Turn on level detect circuitry */
regmap_update_bits(cs42l42->regmap, regmap_update_bits(cs42l42->regmap,
CS42L42_MISC_DET_CTL, CS42L42_MISC_DET_CTL,
CS42L42_DETECT_MODE_MASK |
CS42L42_HSBIAS_CTL_MASK | CS42L42_HSBIAS_CTL_MASK |
CS42L42_PDN_MIC_LVL_DET_MASK, CS42L42_PDN_MIC_LVL_DET_MASK,
(0 << CS42L42_DETECT_MODE_SHIFT) |
(3 << CS42L42_HSBIAS_CTL_SHIFT) | (3 << CS42L42_HSBIAS_CTL_SHIFT) |
(0 << CS42L42_PDN_MIC_LVL_DET_SHIFT)); (0 << CS42L42_PDN_MIC_LVL_DET_SHIFT));
...@@ -1300,10 +1298,8 @@ static void cs42l42_process_hs_type_detect(struct cs42l42_private *cs42l42) ...@@ -1300,10 +1298,8 @@ static void cs42l42_process_hs_type_detect(struct cs42l42_private *cs42l42)
/* Make sure button detect and HS bias circuits are off */ /* Make sure button detect and HS bias circuits are off */
regmap_update_bits(cs42l42->regmap, regmap_update_bits(cs42l42->regmap,
CS42L42_MISC_DET_CTL, CS42L42_MISC_DET_CTL,
CS42L42_DETECT_MODE_MASK |
CS42L42_HSBIAS_CTL_MASK | CS42L42_HSBIAS_CTL_MASK |
CS42L42_PDN_MIC_LVL_DET_MASK, CS42L42_PDN_MIC_LVL_DET_MASK,
(0 << CS42L42_DETECT_MODE_SHIFT) |
(1 << CS42L42_HSBIAS_CTL_SHIFT) | (1 << CS42L42_HSBIAS_CTL_SHIFT) |
(1 << CS42L42_PDN_MIC_LVL_DET_SHIFT)); (1 << CS42L42_PDN_MIC_LVL_DET_SHIFT));
} }
...@@ -1351,10 +1347,8 @@ static void cs42l42_init_hs_type_detect(struct cs42l42_private *cs42l42) ...@@ -1351,10 +1347,8 @@ static void cs42l42_init_hs_type_detect(struct cs42l42_private *cs42l42)
/* Make sure button detect and HS bias circuits are off */ /* Make sure button detect and HS bias circuits are off */
regmap_update_bits(cs42l42->regmap, regmap_update_bits(cs42l42->regmap,
CS42L42_MISC_DET_CTL, CS42L42_MISC_DET_CTL,
CS42L42_DETECT_MODE_MASK |
CS42L42_HSBIAS_CTL_MASK | CS42L42_HSBIAS_CTL_MASK |
CS42L42_PDN_MIC_LVL_DET_MASK, CS42L42_PDN_MIC_LVL_DET_MASK,
(0 << CS42L42_DETECT_MODE_SHIFT) |
(1 << CS42L42_HSBIAS_CTL_SHIFT) | (1 << CS42L42_HSBIAS_CTL_SHIFT) |
(1 << CS42L42_PDN_MIC_LVL_DET_SHIFT)); (1 << CS42L42_PDN_MIC_LVL_DET_SHIFT));
...@@ -1398,10 +1392,8 @@ static void cs42l42_init_hs_type_detect(struct cs42l42_private *cs42l42) ...@@ -1398,10 +1392,8 @@ static void cs42l42_init_hs_type_detect(struct cs42l42_private *cs42l42)
/* Power up HS bias to 2.7V */ /* Power up HS bias to 2.7V */
regmap_update_bits(cs42l42->regmap, regmap_update_bits(cs42l42->regmap,
CS42L42_MISC_DET_CTL, CS42L42_MISC_DET_CTL,
CS42L42_DETECT_MODE_MASK |
CS42L42_HSBIAS_CTL_MASK | CS42L42_HSBIAS_CTL_MASK |
CS42L42_PDN_MIC_LVL_DET_MASK, CS42L42_PDN_MIC_LVL_DET_MASK,
(0 << CS42L42_DETECT_MODE_SHIFT) |
(3 << CS42L42_HSBIAS_CTL_SHIFT) | (3 << CS42L42_HSBIAS_CTL_SHIFT) |
(1 << CS42L42_PDN_MIC_LVL_DET_SHIFT)); (1 << CS42L42_PDN_MIC_LVL_DET_SHIFT));
...@@ -1448,10 +1440,8 @@ static void cs42l42_cancel_hs_type_detect(struct cs42l42_private *cs42l42) ...@@ -1448,10 +1440,8 @@ static void cs42l42_cancel_hs_type_detect(struct cs42l42_private *cs42l42)
/* Ground HS bias */ /* Ground HS bias */
regmap_update_bits(cs42l42->regmap, regmap_update_bits(cs42l42->regmap,
CS42L42_MISC_DET_CTL, CS42L42_MISC_DET_CTL,
CS42L42_DETECT_MODE_MASK |
CS42L42_HSBIAS_CTL_MASK | CS42L42_HSBIAS_CTL_MASK |
CS42L42_PDN_MIC_LVL_DET_MASK, CS42L42_PDN_MIC_LVL_DET_MASK,
(0 << CS42L42_DETECT_MODE_SHIFT) |
(1 << CS42L42_HSBIAS_CTL_SHIFT) | (1 << CS42L42_HSBIAS_CTL_SHIFT) |
(1 << CS42L42_PDN_MIC_LVL_DET_SHIFT)); (1 << CS42L42_PDN_MIC_LVL_DET_SHIFT));
...@@ -1829,6 +1819,9 @@ static void cs42l42_setup_hs_type_detect(struct cs42l42_private *cs42l42) ...@@ -1829,6 +1819,9 @@ static void cs42l42_setup_hs_type_detect(struct cs42l42_private *cs42l42)
cs42l42->hs_type = CS42L42_PLUG_INVALID; cs42l42->hs_type = CS42L42_PLUG_INVALID;
regmap_update_bits(cs42l42->regmap, CS42L42_MISC_DET_CTL,
CS42L42_DETECT_MODE_MASK, 0);
/* Latch analog controls to VP power domain */ /* Latch analog controls to VP power domain */
regmap_update_bits(cs42l42->regmap, CS42L42_MIC_DET_CTL1, regmap_update_bits(cs42l42->regmap, CS42L42_MIC_DET_CTL1,
CS42L42_LATCH_TO_VP_MASK | CS42L42_LATCH_TO_VP_MASK |
......
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