aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2024-04-22 09:56:15 +0900
committerMark Brown <broonie@kernel.org>2024-04-22 09:56:15 +0900
commitbd74e9c31f0d1880ff4482f1a7ce33a006d870ed (patch)
tree39c0d02b59d00968a2d94bbd174fb811d59dcb26
parentASoC: Intel: avs: Switch to acpi-nhlt (diff)
parentASoC: nau8821: Remove redundant ADC controls (diff)
downloadwireguard-linux-bd74e9c31f0d1880ff4482f1a7ce33a006d870ed.tar.xz
wireguard-linux-bd74e9c31f0d1880ff4482f1a7ce33a006d870ed.zip
ASoC: nau8821: Add delay control for ADC
Merge series from Seven Lee <wtli@nuvoton.com>: Change the original fixed delay to the assignment from the property. It will make it more flexible to different platforms to avoid pop noise at the beginning of recording.
-rw-r--r--Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml7
-rw-r--r--sound/soc/codecs/nau8821.c19
-rw-r--r--sound/soc/codecs/nau8821.h1
3 files changed, 17 insertions, 10 deletions
diff --git a/Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml b/Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml
index 054b53954ac3..9f44168efb3e 100644
--- a/Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml
+++ b/Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml
@@ -103,6 +103,12 @@ properties:
just limited to the left adc for design demand.
type: boolean
+ nuvoton,adc-delay-ms:
+ description: Delay (in ms) to make input path stable and avoid pop noise.
+ minimum: 125
+ maximum: 500
+ default: 125
+
'#sound-dai-cells':
const: 0
@@ -136,6 +142,7 @@ examples:
nuvoton,jack-eject-debounce = <0>;
nuvoton,dmic-clk-threshold = <3072000>;
nuvoton,dmic-slew-rate = <0>;
+ nuvoton,adc-delay-ms = <125>;
#sound-dai-cells = <0>;
};
};
diff --git a/sound/soc/codecs/nau8821.c b/sound/soc/codecs/nau8821.c
index 012e347e6391..6818bbd1d3c7 100644
--- a/sound/soc/codecs/nau8821.c
+++ b/sound/soc/codecs/nau8821.c
@@ -511,13 +511,9 @@ static int nau8821_left_adc_event(struct snd_soc_dapm_widget *w,
switch (event) {
case SND_SOC_DAPM_POST_PMU:
- msleep(125);
- regmap_update_bits(nau8821->regmap, NAU8821_R01_ENA_CTRL,
- NAU8821_EN_ADCL, NAU8821_EN_ADCL);
+ msleep(nau8821->adc_delay);
break;
case SND_SOC_DAPM_POST_PMD:
- regmap_update_bits(nau8821->regmap,
- NAU8821_R01_ENA_CTRL, NAU8821_EN_ADCL, 0);
break;
default:
return -EINVAL;
@@ -535,13 +531,9 @@ static int nau8821_right_adc_event(struct snd_soc_dapm_widget *w,
switch (event) {
case SND_SOC_DAPM_POST_PMU:
- msleep(125);
- regmap_update_bits(nau8821->regmap, NAU8821_R01_ENA_CTRL,
- NAU8821_EN_ADCR, NAU8821_EN_ADCR);
+ msleep(nau8821->adc_delay);
break;
case SND_SOC_DAPM_POST_PMD:
- regmap_update_bits(nau8821->regmap,
- NAU8821_R01_ENA_CTRL, NAU8821_EN_ADCR, 0);
break;
default:
return -EINVAL;
@@ -1697,6 +1689,7 @@ static void nau8821_print_device_properties(struct nau8821 *nau8821)
dev_dbg(dev, "dmic-clk-threshold: %d\n",
nau8821->dmic_clk_threshold);
dev_dbg(dev, "key_enable: %d\n", nau8821->key_enable);
+ dev_dbg(dev, "adc-delay-ms: %d\n", nau8821->adc_delay);
}
static int nau8821_read_device_properties(struct device *dev,
@@ -1742,6 +1735,12 @@ static int nau8821_read_device_properties(struct device *dev,
&nau8821->dmic_slew_rate);
if (ret)
nau8821->dmic_slew_rate = 0;
+ ret = device_property_read_u32(dev, "nuvoton,adc-delay-ms",
+ &nau8821->adc_delay);
+ if (ret)
+ nau8821->adc_delay = 125;
+ if (nau8821->adc_delay < 125 || nau8821->adc_delay > 500)
+ dev_warn(dev, "Please set the suitable delay time!\n");
return 0;
}
diff --git a/sound/soc/codecs/nau8821.h b/sound/soc/codecs/nau8821.h
index 62eaad130b2e..f0935ffafcbe 100644
--- a/sound/soc/codecs/nau8821.h
+++ b/sound/soc/codecs/nau8821.h
@@ -577,6 +577,7 @@ struct nau8821 {
int dmic_clk_threshold;
int dmic_slew_rate;
int key_enable;
+ int adc_delay;
};
int nau8821_enable_jack_detect(struct snd_soc_component *component,