linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] ASoC: dt-bindings: nau8821: Add delay control for ADC
@ 2024-04-12 10:35 Seven Lee
  2024-04-12 10:35 ` [PATCH 2/3] ASoC: " Seven Lee
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Seven Lee @ 2024-04-12 10:35 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, alsa-devel, devicetree, linux-sound,
	krzysztof.kozlowski+dt, linux-kernel, robh+dt, conor+dt, perex,
	tiwai, YHCHuang, KCHSU0, CTLIN0, SJLIN0, wtli, scott6986,
	supercraig0719, dardar923, edson.drosdeck, u.kleine-koenig

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 <wtli@nuvoton.com>
---
 .../devicetree/bindings/sound/nuvoton,nau8821.yaml        | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml b/Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml
index 054b53954ac3..a726c5a9b067 100644
--- a/Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml
+++ b/Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml
@@ -103,6 +103,13 @@ 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.
+        The default value is 125 and range between 125 to 500 ms.
+    minimum: 125
+    maximum: 500
+    default: 125
+
   '#sound-dai-cells':
     const: 0
 
@@ -136,6 +143,7 @@ examples:
             nuvoton,jack-eject-debounce = <0>;
             nuvoton,dmic-clk-threshold = <3072000>;
             nuvoton,dmic-slew-rate = <0>;
+            nuvoton,nuvoton,adc-delay-ms = <125>;
             #sound-dai-cells = <0>;
         };
     };
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] ASoC: nau8821: Add delay control for ADC
  2024-04-12 10:35 [PATCH 1/3] ASoC: dt-bindings: nau8821: Add delay control for ADC Seven Lee
@ 2024-04-12 10:35 ` Seven Lee
  2024-04-12 10:35 ` [PATCH 3/3] ASoC: nau8821: Remove redundant ADC controls Seven Lee
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Seven Lee @ 2024-04-12 10:35 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, alsa-devel, devicetree, linux-sound,
	krzysztof.kozlowski+dt, linux-kernel, robh+dt, conor+dt, perex,
	tiwai, YHCHuang, KCHSU0, CTLIN0, SJLIN0, wtli, scott6986,
	supercraig0719, dardar923, edson.drosdeck, u.kleine-koenig

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 <wtli@nuvoton.com>
---
 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] ASoC: nau8821: Remove redundant ADC controls
  2024-04-12 10:35 [PATCH 1/3] ASoC: dt-bindings: nau8821: Add delay control for ADC Seven Lee
  2024-04-12 10:35 ` [PATCH 2/3] ASoC: " Seven Lee
@ 2024-04-12 10:35 ` Seven Lee
  2024-04-12 11:17 ` [PATCH 1/3] ASoC: dt-bindings: nau8821: Add delay control for ADC Rob Herring
  2024-04-12 15:52 ` Rob Herring
  3 siblings, 0 replies; 6+ messages in thread
From: Seven Lee @ 2024-04-12 10:35 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, alsa-devel, devicetree, linux-sound,
	krzysztof.kozlowski+dt, linux-kernel, robh+dt, conor+dt, perex,
	tiwai, YHCHuang, KCHSU0, CTLIN0, SJLIN0, wtli, scott6986,
	supercraig0719, dardar923, edson.drosdeck, u.kleine-koenig

Remove redundant left/right adc channel enable controls.

Signed-off-by: Seven Lee <wtli@nuvoton.com>
---
 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3] ASoC: dt-bindings: nau8821: Add delay control for ADC
  2024-04-12 10:35 [PATCH 1/3] ASoC: dt-bindings: nau8821: Add delay control for ADC Seven Lee
  2024-04-12 10:35 ` [PATCH 2/3] ASoC: " Seven Lee
  2024-04-12 10:35 ` [PATCH 3/3] ASoC: nau8821: Remove redundant ADC controls Seven Lee
@ 2024-04-12 11:17 ` Rob Herring
  2024-04-12 15:52 ` Rob Herring
  3 siblings, 0 replies; 6+ messages in thread
From: Rob Herring @ 2024-04-12 11:17 UTC (permalink / raw)
  To: Seven Lee
  Cc: linux-kernel, robh+dt, broonie, linux-sound, dardar923,
	devicetree, CTLIN0, lgirdwood, krzysztof.kozlowski+dt, KCHSU0,
	perex, SJLIN0, scott6986, alsa-devel, edson.drosdeck, YHCHuang,
	conor+dt, u.kleine-koenig, supercraig0719, tiwai


On Fri, 12 Apr 2024 18:35:52 +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 <wtli@nuvoton.com>
> ---
>  .../devicetree/bindings/sound/nuvoton,nau8821.yaml        | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/nuvoton,nau8821.example.dtb: codec@1b: Unevaluated properties are not allowed ('nuvoton,nuvoton,adc-delay-ms' was unexpected)
	from schema $id: http://devicetree.org/schemas/sound/nuvoton,nau8821.yaml#

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20240412103554.3487290-1-wtli@nuvoton.com

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3] ASoC: dt-bindings: nau8821: Add delay control for ADC
  2024-04-12 10:35 [PATCH 1/3] ASoC: dt-bindings: nau8821: Add delay control for ADC Seven Lee
                   ` (2 preceding siblings ...)
  2024-04-12 11:17 ` [PATCH 1/3] ASoC: dt-bindings: nau8821: Add delay control for ADC Rob Herring
@ 2024-04-12 15:52 ` Rob Herring
  2024-04-15  2:32   ` WTLI
  3 siblings, 1 reply; 6+ messages in thread
From: Rob Herring @ 2024-04-12 15:52 UTC (permalink / raw)
  To: Seven Lee
  Cc: broonie, lgirdwood, alsa-devel, devicetree, linux-sound,
	krzysztof.kozlowski+dt, linux-kernel, conor+dt, perex, tiwai,
	YHCHuang, KCHSU0, CTLIN0, SJLIN0, scott6986, supercraig0719,
	dardar923, edson.drosdeck, u.kleine-koenig

On Fri, Apr 12, 2024 at 06:35:52PM +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 <wtli@nuvoton.com>
> ---
>  .../devicetree/bindings/sound/nuvoton,nau8821.yaml        | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml b/Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml
> index 054b53954ac3..a726c5a9b067 100644
> --- a/Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml
> +++ b/Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml
> @@ -103,6 +103,13 @@ 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.
> +        The default value is 125 and range between 125 to 500 ms.

No need to state constraints in prose.

> +    minimum: 125
> +    maximum: 500
> +    default: 125
> +
>    '#sound-dai-cells':
>      const: 0
>  
> @@ -136,6 +143,7 @@ examples:
>              nuvoton,jack-eject-debounce = <0>;
>              nuvoton,dmic-clk-threshold = <3072000>;
>              nuvoton,dmic-slew-rate = <0>;
> +            nuvoton,nuvoton,adc-delay-ms = <125>;
>              #sound-dai-cells = <0>;
>          };
>      };
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3] ASoC: dt-bindings: nau8821: Add delay control for ADC
  2024-04-12 15:52 ` Rob Herring
@ 2024-04-15  2:32   ` WTLI
  0 siblings, 0 replies; 6+ messages in thread
From: WTLI @ 2024-04-15  2:32 UTC (permalink / raw)
  To: Rob Herring
  Cc: broonie, lgirdwood, alsa-devel, devicetree, linux-sound,
	krzysztof.kozlowski+dt, linux-kernel, conor+dt, perex, tiwai,
	YHCHuang, KCHSU0, CTLIN0, SJLIN0, scott6986, supercraig0719,
	dardar923, edson.drosdeck, u.kleine-koenig


Rob Herring 於 4/12/2024 11:52 PM 寫道:
> CAUTION - External Email: Do not click links or open attachments unless you acknowledge the sender and content.
>
>
> On Fri, Apr 12, 2024 at 06:35:52PM +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 <wtli@nuvoton.com>
>> ---
>>   .../devicetree/bindings/sound/nuvoton,nau8821.yaml        | 8 ++++++++
>>   1 file changed, 8 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml b/Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml
>> index 054b53954ac3..a726c5a9b067 100644
>> --- a/Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml
>> +++ b/Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml
>> @@ -103,6 +103,13 @@ 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.
>> +        The default value is 125 and range between 125 to 500 ms.
> No need to state constraints in prose.

okay, I will fix it.

>
>> +    minimum: 125
>> +    maximum: 500
>> +    default: 125
>> +
>>     '#sound-dai-cells':
>>       const: 0
>>
>> @@ -136,6 +143,7 @@ examples:
>>               nuvoton,jack-eject-debounce = <0>;
>>               nuvoton,dmic-clk-threshold = <3072000>;
>>               nuvoton,dmic-slew-rate = <0>;
>> +            nuvoton,nuvoton,adc-delay-ms = <125>;
>>               #sound-dai-cells = <0>;
>>           };
>>       };
>> --
>> 2.25.1
>>
________________________________
________________________________
 The privileged confidential information contained in this email is intended for use only by the addressees as indicated by the original sender of this email. If you are not the addressee indicated in this email or are not responsible for delivery of the email to such a person, please kindly reply to the sender indicating this fact and delete all copies of it from your computer and network server immediately. Your cooperation is highly appreciated. It is advised that any unauthorized use of confidential information of Nuvoton is strictly prohibited; and any information in this email irrelevant to the official business of Nuvoton shall be deemed as neither given nor endorsed by Nuvoton.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-04-15  2:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-12 10:35 [PATCH 1/3] ASoC: dt-bindings: nau8821: Add delay control for ADC Seven Lee
2024-04-12 10:35 ` [PATCH 2/3] ASoC: " Seven Lee
2024-04-12 10:35 ` [PATCH 3/3] ASoC: nau8821: Remove redundant ADC controls Seven Lee
2024-04-12 11:17 ` [PATCH 1/3] ASoC: dt-bindings: nau8821: Add delay control for ADC Rob Herring
2024-04-12 15:52 ` Rob Herring
2024-04-15  2:32   ` WTLI

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).