Skip to content

Commit fc0b096

Browse files
David Linbroonie
authored andcommitted
ASoC: nau8825: Add delay control for input path
Change the original fixed delay to the assignment from property. It will make more flexible to different platforms for avoiding pop noise at the beginning of recording. Signed-off-by: David Lin <CTLIN0@nuvoton.com> Link: https://lore.kernel.org/r/20230414103941.39566-2-CTLIN0@nuvoton.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent c26c592 commit fc0b096

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

sound/soc/codecs/nau8825.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ static int nau8825_adc_event(struct snd_soc_dapm_widget *w,
919919

920920
switch (event) {
921921
case SND_SOC_DAPM_POST_PMU:
922-
msleep(125);
922+
msleep(nau8825->adc_delay);
923923
regmap_update_bits(nau8825->regmap, NAU8825_REG_ENA_CTRL,
924924
NAU8825_ENABLE_ADC, NAU8825_ENABLE_ADC);
925925
break;
@@ -2752,6 +2752,7 @@ static void nau8825_print_device_properties(struct nau8825 *nau8825)
27522752
dev_dbg(dev, "crosstalk-enable: %d\n",
27532753
nau8825->xtalk_enable);
27542754
dev_dbg(dev, "adcout-drive-strong: %d\n", nau8825->adcout_ds);
2755+
dev_dbg(dev, "adc-delay-ms: %d\n", nau8825->adc_delay);
27552756
}
27562757

27572758
static int nau8825_read_device_properties(struct device *dev,
@@ -2819,6 +2820,11 @@ static int nau8825_read_device_properties(struct device *dev,
28192820
nau8825->xtalk_enable = device_property_read_bool(dev,
28202821
"nuvoton,crosstalk-enable");
28212822
nau8825->adcout_ds = device_property_read_bool(dev, "nuvoton,adcout-drive-strong");
2823+
ret = device_property_read_u32(dev, "nuvoton,adc-delay-ms", &nau8825->adc_delay);
2824+
if (ret)
2825+
nau8825->adc_delay = 125;
2826+
if (nau8825->adc_delay < 125 && nau8825->adc_delay > 500)
2827+
dev_warn(dev, "Please set the suitable delay time!\n");
28222828

28232829
nau8825->mclk = devm_clk_get(dev, "mclk");
28242830
if (PTR_ERR(nau8825->mclk) == -EPROBE_DEFER) {

sound/soc/codecs/nau8825.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,7 @@ struct nau8825 {
517517
int xtalk_enable;
518518
bool xtalk_baktab_initialized; /* True if initialized. */
519519
bool adcout_ds;
520+
int adc_delay;
520521
};
521522

522523
int nau8825_enable_jack_detect(struct snd_soc_component *component,

0 commit comments

Comments
 (0)