mirror of
https://github.com/torvalds/linux.git
synced 2024-11-15 00:21:59 +00:00
ASoC: nau8825: Add pre-charge actions for input
Adding pre-charge actions to make FEPGA power stable faster. It improve the recording quality at the beginning. Thus, it is also meaningfully to decrease the final adc delay time. Signed-off-by: David Lin <CTLIN0@nuvoton.com> Link: https://lore.kernel.org/r/20230523083303.98436-1-CTLIN0@nuvoton.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
1d4a84632b
commit
f9d790c578
@ -911,6 +911,32 @@ static bool nau8825_volatile_reg(struct device *dev, unsigned int reg)
|
||||
}
|
||||
}
|
||||
|
||||
static int nau8825_fepga_event(struct snd_soc_dapm_widget *w,
|
||||
struct snd_kcontrol *kcontrol, int event)
|
||||
{
|
||||
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
|
||||
struct nau8825 *nau8825 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
switch (event) {
|
||||
case SND_SOC_DAPM_POST_PMU:
|
||||
regmap_update_bits(nau8825->regmap, NAU8825_REG_FEPGA,
|
||||
NAU8825_ACDC_CTRL_MASK,
|
||||
NAU8825_ACDC_VREF_MICP | NAU8825_ACDC_VREF_MICN);
|
||||
regmap_update_bits(nau8825->regmap, NAU8825_REG_BOOST,
|
||||
NAU8825_DISCHRG_EN, NAU8825_DISCHRG_EN);
|
||||
msleep(40);
|
||||
regmap_update_bits(nau8825->regmap, NAU8825_REG_BOOST,
|
||||
NAU8825_DISCHRG_EN, 0);
|
||||
regmap_update_bits(nau8825->regmap, NAU8825_REG_FEPGA,
|
||||
NAU8825_ACDC_CTRL_MASK, 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int nau8825_adc_event(struct snd_soc_dapm_widget *w,
|
||||
struct snd_kcontrol *kcontrol, int event)
|
||||
{
|
||||
@ -1127,8 +1153,8 @@ static const struct snd_soc_dapm_widget nau8825_dapm_widgets[] = {
|
||||
SND_SOC_DAPM_INPUT("MIC"),
|
||||
SND_SOC_DAPM_MICBIAS("MICBIAS", NAU8825_REG_MIC_BIAS, 8, 0),
|
||||
|
||||
SND_SOC_DAPM_PGA("Frontend PGA", NAU8825_REG_POWER_UP_CONTROL, 14, 0,
|
||||
NULL, 0),
|
||||
SND_SOC_DAPM_PGA_E("Frontend PGA", NAU8825_REG_POWER_UP_CONTROL, 14, 0,
|
||||
NULL, 0, nau8825_fepga_event, SND_SOC_DAPM_POST_PMU),
|
||||
|
||||
SND_SOC_DAPM_ADC_E("ADC", NULL, SND_SOC_NOPM, 0, 0,
|
||||
nau8825_adc_event, SND_SOC_DAPM_POST_PMU |
|
||||
|
@ -442,10 +442,17 @@
|
||||
/* BOOST (0x76) */
|
||||
#define NAU8825_PRECHARGE_DIS (1 << 13)
|
||||
#define NAU8825_GLOBAL_BIAS_EN (1 << 12)
|
||||
#define NAU8825_DISCHRG_EN (1 << 11)
|
||||
#define NAU8825_HP_BOOST_DIS (1 << 9)
|
||||
#define NAU8825_HP_BOOST_G_DIS (1 << 8)
|
||||
#define NAU8825_SHORT_SHUTDOWN_EN (1 << 6)
|
||||
|
||||
/* FEPGA (0x77) */
|
||||
#define NAU8825_ACDC_CTRL_SFT 14
|
||||
#define NAU8825_ACDC_CTRL_MASK (0x3 << NAU8825_ACDC_CTRL_SFT)
|
||||
#define NAU8825_ACDC_VREF_MICP (0x1 << NAU8825_ACDC_CTRL_SFT)
|
||||
#define NAU8825_ACDC_VREF_MICN (0x2 << NAU8825_ACDC_CTRL_SFT)
|
||||
|
||||
/* POWER_UP_CONTROL (0x7f) */
|
||||
#define NAU8825_POWERUP_INTEGR_R (1 << 5)
|
||||
#define NAU8825_POWERUP_INTEGR_L (1 << 4)
|
||||
|
Loading…
Reference in New Issue
Block a user