2024-04-15 07:07:41

by Seven Lee

[permalink] [raw]
Subject: [PATCH v2 0/3] ASoC: nau8821: Add delay control for ADC

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.

Change:
V1 -> V2:
- Revise adc-delay-ms properties description.
- Fix examples of bugs found by bots.

Seven Lee (3):
ASoC: dt-bindings: nau8821: Add delay control for ADC
ASoC: nau8821: Add delay control for ADC
ASoC: nau8821: Remove redundant ADC controls

.../bindings/sound/nuvoton,nau8821.yaml | 7 +++++++
sound/soc/codecs/nau8821.c | 19 +++++++++----------
sound/soc/codecs/nau8821.h | 1 +
3 files changed, 17 insertions(+), 10 deletions(-)

--
2.25.1



2024-04-15 07:07:45

by Seven Lee

[permalink] [raw]
Subject: [PATCH v2 2/3] ASoC: nau8821: Add delay control for ADC

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.

Signed-off-by: Seven Lee <[email protected]>
---
sound/soc/codecs/nau8821.c | 11 +++++++++--
sound/soc/codecs/nau8821.h | 1 +
2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/nau8821.c b/sound/soc/codecs/nau8821.c
index 012e347e6391..fec669e00a10 100644
--- a/sound/soc/codecs/nau8821.c
+++ b/sound/soc/codecs/nau8821.c
@@ -511,7 +511,7 @@ static int nau8821_left_adc_event(struct snd_soc_dapm_widget *w,

switch (event) {
case SND_SOC_DAPM_POST_PMU:
- msleep(125);
+ msleep(nau8821->adc_delay);
regmap_update_bits(nau8821->regmap, NAU8821_R01_ENA_CTRL,
NAU8821_EN_ADCL, NAU8821_EN_ADCL);
break;
@@ -535,7 +535,7 @@ static int nau8821_right_adc_event(struct snd_soc_dapm_widget *w,

switch (event) {
case SND_SOC_DAPM_POST_PMU:
- msleep(125);
+ msleep(nau8821->adc_delay);
regmap_update_bits(nau8821->regmap, NAU8821_R01_ENA_CTRL,
NAU8821_EN_ADCR, NAU8821_EN_ADCR);
break;
@@ -1697,6 +1697,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 +1743,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,
--
2.25.1


2024-04-15 07:07:45

by Seven Lee

[permalink] [raw]
Subject: [PATCH v2 1/3] ASoC: dt-bindings: nau8821: Add delay control for ADC

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.

Signed-off-by: Seven Lee <[email protected]>
---
.../devicetree/bindings/sound/nuvoton,nau8821.yaml | 7 +++++++
1 file changed, 7 insertions(+)

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>;
};
};
--
2.25.1


2024-04-15 07:16:51

by Seven Lee

[permalink] [raw]
Subject: [PATCH v2 3/3] ASoC: nau8821: Remove redundant ADC controls

Remove redundant left/right adc channel enable controls.

Signed-off-by: Seven Lee <[email protected]>
---
sound/soc/codecs/nau8821.c | 8 --------
1 file changed, 8 deletions(-)

diff --git a/sound/soc/codecs/nau8821.c b/sound/soc/codecs/nau8821.c
index fec669e00a10..6818bbd1d3c7 100644
--- a/sound/soc/codecs/nau8821.c
+++ b/sound/soc/codecs/nau8821.c
@@ -512,12 +512,8 @@ static int nau8821_left_adc_event(struct snd_soc_dapm_widget *w,
switch (event) {
case SND_SOC_DAPM_POST_PMU:
msleep(nau8821->adc_delay);
- regmap_update_bits(nau8821->regmap, NAU8821_R01_ENA_CTRL,
- NAU8821_EN_ADCL, NAU8821_EN_ADCL);
break;
case SND_SOC_DAPM_POST_PMD:
- regmap_update_bits(nau8821->regmap,
- NAU8821_R01_ENA_CTRL, NAU8821_EN_ADCL, 0);
break;
default:
return -EINVAL;
@@ -536,12 +532,8 @@ static int nau8821_right_adc_event(struct snd_soc_dapm_widget *w,
switch (event) {
case SND_SOC_DAPM_POST_PMU:
msleep(nau8821->adc_delay);
- regmap_update_bits(nau8821->regmap, NAU8821_R01_ENA_CTRL,
- NAU8821_EN_ADCR, NAU8821_EN_ADCR);
break;
case SND_SOC_DAPM_POST_PMD:
- regmap_update_bits(nau8821->regmap,
- NAU8821_R01_ENA_CTRL, NAU8821_EN_ADCR, 0);
break;
default:
return -EINVAL;
--
2.25.1


2024-04-17 18:05:39

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH v2 1/3] ASoC: dt-bindings: nau8821: Add delay control for ADC


On Mon, 15 Apr 2024 15:06:47 +0800, Seven Lee wrote:
> 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.
>
> Signed-off-by: Seven Lee <[email protected]>
> ---
> .../devicetree/bindings/sound/nuvoton,nau8821.yaml | 7 +++++++
> 1 file changed, 7 insertions(+)
>

Reviewed-by: Rob Herring (Arm) <[email protected]>


2024-04-22 08:10:22

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH v2 0/3] ASoC: nau8821: Add delay control for ADC

On Mon, 15 Apr 2024 15:06:46 +0800, Seven Lee wrote:
> 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.
>
> Change:
> V1 -> V2:
> - Revise adc-delay-ms properties description.
> - Fix examples of bugs found by bots.
>
> [...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/3] ASoC: dt-bindings: nau8821: Add delay control for ADC
commit: 467d2528d64e8fcf784850ac94f665efae2af149
[2/3] ASoC: nau8821: Add delay control for ADC
commit: bd74e9c31f0d1880ff4482f1a7ce33a006d870ed
[3/3] ASoC: nau8821: Remove redundant ADC controls
commit: ad8ba241bc93536a2c8af150b237c5be8fafe942

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark