]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
ASoC: nau8825: Add delay control for input path
authorDavid Lin <CTLIN0@nuvoton.com>
Fri, 14 Apr 2023 10:39:44 +0000 (18:39 +0800)
committerMark Brown <broonie@kernel.org>
Fri, 14 Apr 2023 11:58:30 +0000 (12:58 +0100)
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>
sound/soc/codecs/nau8825.c
sound/soc/codecs/nau8825.h

index 4bffa9c20f2bcfefc8cebfe826d4cfead1a922e4..c4389f5fe603f9556df2a02778fefe367c5f0d8b 100644 (file)
@@ -919,7 +919,7 @@ static int nau8825_adc_event(struct snd_soc_dapm_widget *w,
 
        switch (event) {
        case SND_SOC_DAPM_POST_PMU:
-               msleep(125);
+               msleep(nau8825->adc_delay);
                regmap_update_bits(nau8825->regmap, NAU8825_REG_ENA_CTRL,
                        NAU8825_ENABLE_ADC, NAU8825_ENABLE_ADC);
                break;
@@ -2752,6 +2752,7 @@ static void nau8825_print_device_properties(struct nau8825 *nau8825)
        dev_dbg(dev, "crosstalk-enable:     %d\n",
                        nau8825->xtalk_enable);
        dev_dbg(dev, "adcout-drive-strong:  %d\n", nau8825->adcout_ds);
+       dev_dbg(dev, "adc-delay-ms:         %d\n", nau8825->adc_delay);
 }
 
 static int nau8825_read_device_properties(struct device *dev,
@@ -2819,6 +2820,11 @@ static int nau8825_read_device_properties(struct device *dev,
        nau8825->xtalk_enable = device_property_read_bool(dev,
                "nuvoton,crosstalk-enable");
        nau8825->adcout_ds = device_property_read_bool(dev, "nuvoton,adcout-drive-strong");
+       ret = device_property_read_u32(dev, "nuvoton,adc-delay-ms", &nau8825->adc_delay);
+       if (ret)
+               nau8825->adc_delay = 125;
+       if (nau8825->adc_delay < 125 && nau8825->adc_delay > 500)
+               dev_warn(dev, "Please set the suitable delay time!\n");
 
        nau8825->mclk = devm_clk_get(dev, "mclk");
        if (PTR_ERR(nau8825->mclk) == -EPROBE_DEFER) {
index 0c3a446e0e1aed51aa1ad163b8031576d9b1e646..44b62bc3880f8c4abc7b308a65d1fbaaaca507eb 100644 (file)
@@ -517,6 +517,7 @@ struct nau8825 {
        int xtalk_enable;
        bool xtalk_baktab_initialized; /* True if initialized. */
        bool adcout_ds;
+       int adc_delay;
 };
 
 int nau8825_enable_jack_detect(struct snd_soc_component *component,