ASoC: cs42l42: Remove redundant code
Merge series from Richard Fitzgerald <rf@opensource.cirrus.com>: Cleanups and code clarifications for the cs42l42 driver.
This commit is contained in:
commit
63eb462623
@ -734,10 +734,6 @@ static int cs42l42_pll_config(struct snd_soc_component *component)
|
||||
CS42L42_PLL_DIVOUT_MASK,
|
||||
(pll_ratio_table[i].pll_divout * pll_ratio_table[i].n)
|
||||
<< CS42L42_PLL_DIVOUT_SHIFT);
|
||||
if (pll_ratio_table[i].n != 1)
|
||||
cs42l42->pll_divout = pll_ratio_table[i].pll_divout;
|
||||
else
|
||||
cs42l42->pll_divout = 0;
|
||||
snd_soc_component_update_bits(component,
|
||||
CS42L42_PLL_CAL_RATIO,
|
||||
CS42L42_PLL_CAL_RATIO_MASK,
|
||||
@ -1004,12 +1000,13 @@ static int cs42l42_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
|
||||
snd_soc_component_update_bits(component, CS42L42_PLL_CTL1,
|
||||
CS42L42_PLL_START_MASK, 1);
|
||||
|
||||
if (cs42l42->pll_divout) {
|
||||
if (pll_ratio_table[cs42l42->pll_config].n > 1) {
|
||||
usleep_range(CS42L42_PLL_DIVOUT_TIME_US,
|
||||
CS42L42_PLL_DIVOUT_TIME_US * 2);
|
||||
regval = pll_ratio_table[cs42l42->pll_config].pll_divout;
|
||||
snd_soc_component_update_bits(component, CS42L42_PLL_CTL3,
|
||||
CS42L42_PLL_DIVOUT_MASK,
|
||||
cs42l42->pll_divout <<
|
||||
regval <<
|
||||
CS42L42_PLL_DIVOUT_SHIFT);
|
||||
}
|
||||
|
||||
@ -1270,10 +1267,8 @@ static void cs42l42_process_hs_type_detect(struct cs42l42_private *cs42l42)
|
||||
/* Turn on level detect circuitry */
|
||||
regmap_update_bits(cs42l42->regmap,
|
||||
CS42L42_MISC_DET_CTL,
|
||||
CS42L42_DETECT_MODE_MASK |
|
||||
CS42L42_HSBIAS_CTL_MASK |
|
||||
CS42L42_PDN_MIC_LVL_DET_MASK,
|
||||
(0 << CS42L42_DETECT_MODE_SHIFT) |
|
||||
(3 << CS42L42_HSBIAS_CTL_SHIFT) |
|
||||
(0 << CS42L42_PDN_MIC_LVL_DET_SHIFT));
|
||||
|
||||
@ -1300,10 +1295,8 @@ static void cs42l42_process_hs_type_detect(struct cs42l42_private *cs42l42)
|
||||
/* Make sure button detect and HS bias circuits are off */
|
||||
regmap_update_bits(cs42l42->regmap,
|
||||
CS42L42_MISC_DET_CTL,
|
||||
CS42L42_DETECT_MODE_MASK |
|
||||
CS42L42_HSBIAS_CTL_MASK |
|
||||
CS42L42_PDN_MIC_LVL_DET_MASK,
|
||||
(0 << CS42L42_DETECT_MODE_SHIFT) |
|
||||
(1 << CS42L42_HSBIAS_CTL_SHIFT) |
|
||||
(1 << CS42L42_PDN_MIC_LVL_DET_SHIFT));
|
||||
}
|
||||
@ -1324,12 +1317,8 @@ static void cs42l42_process_hs_type_detect(struct cs42l42_private *cs42l42)
|
||||
/* Unmask tip sense interrupts */
|
||||
regmap_update_bits(cs42l42->regmap,
|
||||
CS42L42_TSRS_PLUG_INT_MASK,
|
||||
CS42L42_RS_PLUG_MASK |
|
||||
CS42L42_RS_UNPLUG_MASK |
|
||||
CS42L42_TS_PLUG_MASK |
|
||||
CS42L42_TS_UNPLUG_MASK,
|
||||
(1 << CS42L42_RS_PLUG_SHIFT) |
|
||||
(1 << CS42L42_RS_UNPLUG_SHIFT) |
|
||||
(0 << CS42L42_TS_PLUG_SHIFT) |
|
||||
(0 << CS42L42_TS_UNPLUG_SHIFT));
|
||||
}
|
||||
@ -1339,22 +1328,16 @@ static void cs42l42_init_hs_type_detect(struct cs42l42_private *cs42l42)
|
||||
/* Mask tip sense interrupts */
|
||||
regmap_update_bits(cs42l42->regmap,
|
||||
CS42L42_TSRS_PLUG_INT_MASK,
|
||||
CS42L42_RS_PLUG_MASK |
|
||||
CS42L42_RS_UNPLUG_MASK |
|
||||
CS42L42_TS_PLUG_MASK |
|
||||
CS42L42_TS_UNPLUG_MASK,
|
||||
(1 << CS42L42_RS_PLUG_SHIFT) |
|
||||
(1 << CS42L42_RS_UNPLUG_SHIFT) |
|
||||
(1 << CS42L42_TS_PLUG_SHIFT) |
|
||||
(1 << CS42L42_TS_UNPLUG_SHIFT));
|
||||
|
||||
/* Make sure button detect and HS bias circuits are off */
|
||||
regmap_update_bits(cs42l42->regmap,
|
||||
CS42L42_MISC_DET_CTL,
|
||||
CS42L42_DETECT_MODE_MASK |
|
||||
CS42L42_HSBIAS_CTL_MASK |
|
||||
CS42L42_PDN_MIC_LVL_DET_MASK,
|
||||
(0 << CS42L42_DETECT_MODE_SHIFT) |
|
||||
(1 << CS42L42_HSBIAS_CTL_SHIFT) |
|
||||
(1 << CS42L42_PDN_MIC_LVL_DET_SHIFT));
|
||||
|
||||
@ -1398,10 +1381,8 @@ static void cs42l42_init_hs_type_detect(struct cs42l42_private *cs42l42)
|
||||
/* Power up HS bias to 2.7V */
|
||||
regmap_update_bits(cs42l42->regmap,
|
||||
CS42L42_MISC_DET_CTL,
|
||||
CS42L42_DETECT_MODE_MASK |
|
||||
CS42L42_HSBIAS_CTL_MASK |
|
||||
CS42L42_PDN_MIC_LVL_DET_MASK,
|
||||
(0 << CS42L42_DETECT_MODE_SHIFT) |
|
||||
(3 << CS42L42_HSBIAS_CTL_SHIFT) |
|
||||
(1 << CS42L42_PDN_MIC_LVL_DET_SHIFT));
|
||||
|
||||
@ -1448,10 +1429,8 @@ static void cs42l42_cancel_hs_type_detect(struct cs42l42_private *cs42l42)
|
||||
/* Ground HS bias */
|
||||
regmap_update_bits(cs42l42->regmap,
|
||||
CS42L42_MISC_DET_CTL,
|
||||
CS42L42_DETECT_MODE_MASK |
|
||||
CS42L42_HSBIAS_CTL_MASK |
|
||||
CS42L42_PDN_MIC_LVL_DET_MASK,
|
||||
(0 << CS42L42_DETECT_MODE_SHIFT) |
|
||||
(1 << CS42L42_HSBIAS_CTL_SHIFT) |
|
||||
(1 << CS42L42_PDN_MIC_LVL_DET_SHIFT));
|
||||
|
||||
@ -1675,18 +1654,8 @@ static irqreturn_t cs42l42_irq_thread(int irq, void *data)
|
||||
cs42l42->plug_state = CS42L42_TS_UNPLUG;
|
||||
cs42l42_cancel_hs_type_detect(cs42l42);
|
||||
|
||||
switch (cs42l42->hs_type) {
|
||||
case CS42L42_PLUG_CTIA:
|
||||
case CS42L42_PLUG_OMTP:
|
||||
snd_soc_jack_report(cs42l42->jack, 0, SND_JACK_HEADSET);
|
||||
break;
|
||||
case CS42L42_PLUG_HEADPHONE:
|
||||
snd_soc_jack_report(cs42l42->jack, 0, SND_JACK_HEADPHONE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
snd_soc_jack_report(cs42l42->jack, 0,
|
||||
SND_JACK_HEADSET |
|
||||
SND_JACK_BTN_0 | SND_JACK_BTN_1 |
|
||||
SND_JACK_BTN_2 | SND_JACK_BTN_3);
|
||||
|
||||
@ -1829,6 +1798,9 @@ static void cs42l42_setup_hs_type_detect(struct cs42l42_private *cs42l42)
|
||||
|
||||
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 */
|
||||
regmap_update_bits(cs42l42->regmap, CS42L42_MIC_DET_CTL1,
|
||||
CS42L42_LATCH_TO_VP_MASK |
|
||||
|
@ -845,7 +845,6 @@ struct cs42l42_private {
|
||||
int bclk;
|
||||
u32 sclk;
|
||||
u32 srate;
|
||||
u8 pll_divout;
|
||||
u8 plug_state;
|
||||
u8 hs_type;
|
||||
u8 ts_inv;
|
||||
|
Loading…
Reference in New Issue
Block a user