Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

David Lin and committed by
Mark Brown
fc0b096c c26c5921

+8 -1
+7 -1
sound/soc/codecs/nau8825.c
··· 919 919 920 920 switch (event) { 921 921 case SND_SOC_DAPM_POST_PMU: 922 - msleep(125); 922 + msleep(nau8825->adc_delay); 923 923 regmap_update_bits(nau8825->regmap, NAU8825_REG_ENA_CTRL, 924 924 NAU8825_ENABLE_ADC, NAU8825_ENABLE_ADC); 925 925 break; ··· 2752 2752 dev_dbg(dev, "crosstalk-enable: %d\n", 2753 2753 nau8825->xtalk_enable); 2754 2754 dev_dbg(dev, "adcout-drive-strong: %d\n", nau8825->adcout_ds); 2755 + dev_dbg(dev, "adc-delay-ms: %d\n", nau8825->adc_delay); 2755 2756 } 2756 2757 2757 2758 static int nau8825_read_device_properties(struct device *dev, ··· 2820 2819 nau8825->xtalk_enable = device_property_read_bool(dev, 2821 2820 "nuvoton,crosstalk-enable"); 2822 2821 nau8825->adcout_ds = device_property_read_bool(dev, "nuvoton,adcout-drive-strong"); 2822 + ret = device_property_read_u32(dev, "nuvoton,adc-delay-ms", &nau8825->adc_delay); 2823 + if (ret) 2824 + nau8825->adc_delay = 125; 2825 + if (nau8825->adc_delay < 125 && nau8825->adc_delay > 500) 2826 + dev_warn(dev, "Please set the suitable delay time!\n"); 2823 2827 2824 2828 nau8825->mclk = devm_clk_get(dev, "mclk"); 2825 2829 if (PTR_ERR(nau8825->mclk) == -EPROBE_DEFER) {
+1
sound/soc/codecs/nau8825.h
··· 517 517 int xtalk_enable; 518 518 bool xtalk_baktab_initialized; /* True if initialized. */ 519 519 bool adcout_ds; 520 + int adc_delay; 520 521 }; 521 522 522 523 int nau8825_enable_jack_detect(struct snd_soc_component *component,