All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Add DMIC slew rate select
@ 2023-10-27  8:21 Seven Lee
  2023-10-27  8:21 ` [PATCH v2 1/2] ASoC: dt-bindings: nau8821: Add DMIC slew rate selection Seven Lee
  2023-10-27  8:21 ` [PATCH v2 2/2] ASoC: nau8821: Add slew rate controls Seven Lee
  0 siblings, 2 replies; 6+ messages in thread
From: Seven Lee @ 2023-10-27  8:21 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, alsa-devel, devicetree, linux-kernel, robh+dt,
	conor+dt, YHCHuang, KCHSU0, CTLIN0, SJLIN0, scott6986,
	supercraig0719, dardar923, wtli

Determine DMIC slew rate via property setup. 

Change:
V1 -> V2:
  - Corrected description of DMIC slew rate. 

Seven Lee (2):
  ASoC: dt-bindings: nau8821: Add DMIC slew rate selection
  ASoC: nau8821: Add slew rate controls.

 .../devicetree/bindings/sound/nuvoton,nau8821.yaml        | 8 ++++++++
 sound/soc/codecs/nau8821.c                                | 7 +++++++
 sound/soc/codecs/nau8821.h                                | 3 +++
 3 files changed, 18 insertions(+)

-- 
2.25.1


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

* [PATCH v2 1/2] ASoC: dt-bindings: nau8821: Add DMIC slew rate selection
  2023-10-27  8:21 [PATCH v2 0/2] Add DMIC slew rate select Seven Lee
@ 2023-10-27  8:21 ` Seven Lee
  2023-10-27 14:11   ` Conor Dooley
  2023-10-27  8:21 ` [PATCH v2 2/2] ASoC: nau8821: Add slew rate controls Seven Lee
  1 sibling, 1 reply; 6+ messages in thread
From: Seven Lee @ 2023-10-27  8:21 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, alsa-devel, devicetree, linux-kernel, robh+dt,
	conor+dt, YHCHuang, KCHSU0, CTLIN0, SJLIN0, scott6986,
	supercraig0719, dardar923, wtli

Add input with DMIC slew rate selection

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 3e54abd4ca74..01028b7ff85c 100644
--- a/Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml
+++ b/Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml
@@ -89,6 +89,13 @@ properties:
     $ref: /schemas/types.yaml#/definitions/uint32
     default: 3072000
 
+  nuvoton,dmic-slew-rate-selection:
+    description: the number from 0 to 7 that sets the DMIC slew rate.
+        The unit is mV/ns. 0 is the slowest, and 7 is the fastest.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    maximum: 7
+    default: 0
+
   nuvoton,left-input-single-end:
     description: Enable left input with single-ended settings if set.
         For the headset mic application, the single-ended control is
@@ -127,6 +134,7 @@ examples:
             nuvoton,jack-insert-debounce = <7>;
             nuvoton,jack-eject-debounce = <0>;
             nuvoton,dmic-clk-threshold = <3072000>;
+            nuvoton,dmic-slew-rate-selection= <0>;
             #sound-dai-cells = <0>;
         };
     };
-- 
2.25.1


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

* [PATCH v2 2/2] ASoC: nau8821: Add slew rate controls.
  2023-10-27  8:21 [PATCH v2 0/2] Add DMIC slew rate select Seven Lee
  2023-10-27  8:21 ` [PATCH v2 1/2] ASoC: dt-bindings: nau8821: Add DMIC slew rate selection Seven Lee
@ 2023-10-27  8:21 ` Seven Lee
  1 sibling, 0 replies; 6+ messages in thread
From: Seven Lee @ 2023-10-27  8:21 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, alsa-devel, devicetree, linux-kernel, robh+dt,
	conor+dt, YHCHuang, KCHSU0, CTLIN0, SJLIN0, scott6986,
	supercraig0719, dardar923, wtli

The patch supports DMIC clock slew rate selection.

Signed-off-by: Seven Lee <wtli@nuvoton.com>
---
 sound/soc/codecs/nau8821.c | 7 +++++++
 sound/soc/codecs/nau8821.h | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/sound/soc/codecs/nau8821.c b/sound/soc/codecs/nau8821.c
index 6e1b6b26298a..d8190e8a431f 100644
--- a/sound/soc/codecs/nau8821.c
+++ b/sound/soc/codecs/nau8821.c
@@ -1738,6 +1738,10 @@ static int nau8821_read_device_properties(struct device *dev,
 		&nau8821->dmic_clk_threshold);
 	if (ret)
 		nau8821->dmic_clk_threshold = 3072000;
+	ret = device_property_read_u32(dev, "nuvoton,dmic-slew-rate-selection",
+		&nau8821->dmic_slew_rate_sel);
+	if (ret)
+		nau8821->dmic_slew_rate_sel = 0;
 
 	return 0;
 }
@@ -1797,6 +1801,9 @@ static void nau8821_init_regs(struct nau8821 *nau8821)
 		NAU8821_ADC_SYNC_DOWN_MASK, NAU8821_ADC_SYNC_DOWN_64);
 	regmap_update_bits(regmap, NAU8821_R2C_DAC_CTRL1,
 		NAU8821_DAC_OVERSAMPLE_MASK, NAU8821_DAC_OVERSAMPLE_64);
+	regmap_update_bits(regmap, NAU8821_R13_DMIC_CTRL,
+		NAU8821_DMIC_SLEW_MASK, nau8821->dmic_slew_rate_sel <<
+		NAU8821_DMIC_SLEW_SFT);
 	if (nau8821->left_input_single_end) {
 		regmap_update_bits(regmap, NAU8821_R6B_PGA_MUTE,
 			NAU8821_MUTE_MICNL_EN, NAU8821_MUTE_MICNL_EN);
diff --git a/sound/soc/codecs/nau8821.h b/sound/soc/codecs/nau8821.h
index 00a888ed07ce..480f605d5d50 100644
--- a/sound/soc/codecs/nau8821.h
+++ b/sound/soc/codecs/nau8821.h
@@ -236,6 +236,8 @@
 #define NAU8821_DMIC_SRC_MASK	(0x3 << NAU8821_DMIC_SRC_SFT)
 #define NAU8821_CLK_DMIC_SRC	(0x2 << NAU8821_DMIC_SRC_SFT)
 #define NAU8821_DMIC_EN_SFT	0
+#define NAU8821_DMIC_SLEW_SFT  8
+#define NAU8821_DMIC_SLEW_MASK (0x7 << NAU8821_DMIC_SLEW_SFT)
 
 /* GPIO12_CTRL (0x1a) */
 #define NAU8821_JKDET_PULL_UP	(0x1 << 11) /* 0 - pull down, 1 - pull up */
@@ -573,6 +575,7 @@ struct nau8821 {
 	int jack_eject_debounce;
 	int fs;
 	int dmic_clk_threshold;
+	int dmic_slew_rate_sel;
 	int key_enable;
 };
 
-- 
2.25.1


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

* Re: [PATCH v2 1/2] ASoC: dt-bindings: nau8821: Add DMIC slew rate selection
  2023-10-27  8:21 ` [PATCH v2 1/2] ASoC: dt-bindings: nau8821: Add DMIC slew rate selection Seven Lee
@ 2023-10-27 14:11   ` Conor Dooley
  2023-10-27 21:35       ` Rob Herring
  0 siblings, 1 reply; 6+ messages in thread
From: Conor Dooley @ 2023-10-27 14:11 UTC (permalink / raw)
  To: Seven Lee
  Cc: broonie, lgirdwood, alsa-devel, devicetree, linux-kernel, robh+dt,
	conor+dt, YHCHuang, KCHSU0, CTLIN0, SJLIN0, scott6986,
	supercraig0719, dardar923

[-- Attachment #1: Type: text/plain, Size: 1885 bytes --]

Hey,

On Fri, Oct 27, 2023 at 04:21:43PM +0800, Seven Lee wrote:
> Add input with DMIC slew rate selection
> 
> 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 3e54abd4ca74..01028b7ff85c 100644
> --- a/Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml
> +++ b/Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml
> @@ -89,6 +89,13 @@ properties:
>      $ref: /schemas/types.yaml#/definitions/uint32
>      default: 3072000
>  
> +  nuvoton,dmic-slew-rate-selection:
> +    description: the number from 0 to 7 that sets the DMIC slew rate.
> +        The unit is mV/ns. 0 is the slowest, and 7 is the fastest.
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    maximum: 7
> +    default: 0

I meant make the property in terms of the unit, so
nuvoton,dmic-slew-rate-volt-per-sec (or similar, Rob would likely know
better how he likes the unit suffix for a more complex unit like this
one) and then make it an enum with possible values corresponding to
the real values that putting 0, 1, 2, 3 etc into the register produces.

Cheers,
Conor.

> +
>    nuvoton,left-input-single-end:
>      description: Enable left input with single-ended settings if set.
>          For the headset mic application, the single-ended control is
> @@ -127,6 +134,7 @@ examples:
>              nuvoton,jack-insert-debounce = <7>;
>              nuvoton,jack-eject-debounce = <0>;
>              nuvoton,dmic-clk-threshold = <3072000>;
> +            nuvoton,dmic-slew-rate-selection= <0>;
>              #sound-dai-cells = <0>;
>          };
>      };
> -- 
> 2.25.1
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH v2 1/2] ASoC: dt-bindings: nau8821: Add DMIC slew rate selection
  2023-10-27 14:11   ` Conor Dooley
@ 2023-10-27 21:35       ` Rob Herring
  0 siblings, 0 replies; 6+ messages in thread
From: Rob Herring @ 2023-10-27 21:35 UTC (permalink / raw)
  To: Conor Dooley
  Cc: Seven Lee, broonie, lgirdwood, alsa-devel, devicetree,
	linux-kernel, conor+dt, YHCHuang, KCHSU0, CTLIN0, SJLIN0,
	scott6986, supercraig0719, dardar923

On Fri, Oct 27, 2023 at 03:11:35PM +0100, Conor Dooley wrote:
> Hey,
> 
> On Fri, Oct 27, 2023 at 04:21:43PM +0800, Seven Lee wrote:
> > Add input with DMIC slew rate selection
> > 
> > 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 3e54abd4ca74..01028b7ff85c 100644
> > --- a/Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml
> > +++ b/Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml
> > @@ -89,6 +89,13 @@ properties:
> >      $ref: /schemas/types.yaml#/definitions/uint32
> >      default: 3072000
> >  
> > +  nuvoton,dmic-slew-rate-selection:
> > +    description: the number from 0 to 7 that sets the DMIC slew rate.
> > +        The unit is mV/ns. 0 is the slowest, and 7 is the fastest.
> > +    $ref: /schemas/types.yaml#/definitions/uint32
> > +    maximum: 7
> > +    default: 0
> 
> I meant make the property in terms of the unit, so
> nuvoton,dmic-slew-rate-volt-per-sec (or similar, Rob would likely know
> better how he likes the unit suffix for a more complex unit like this
> one) and then make it an enum with possible values corresponding to
> the real values that putting 0, 1, 2, 3 etc into the register produces.

>From what I've seen, you often don't know what units the h/w settings 
correspond to. Often it's just fast, medium, slow or something. And 
here, 0 doesn't make sense if the units really are mV/ns. 

So I'd just drop '-selection' and be done with it. (And clear up the 
units part).

> 
> Cheers,
> Conor.
> 
> > +
> >    nuvoton,left-input-single-end:
> >      description: Enable left input with single-ended settings if set.
> >          For the headset mic application, the single-ended control is
> > @@ -127,6 +134,7 @@ examples:
> >              nuvoton,jack-insert-debounce = <7>;
> >              nuvoton,jack-eject-debounce = <0>;
> >              nuvoton,dmic-clk-threshold = <3072000>;
> > +            nuvoton,dmic-slew-rate-selection= <0>;
> >              #sound-dai-cells = <0>;
> >          };
> >      };
> > -- 
> > 2.25.1
> > 



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

* Re: [PATCH v2 1/2] ASoC: dt-bindings: nau8821: Add DMIC slew rate selection
@ 2023-10-27 21:35       ` Rob Herring
  0 siblings, 0 replies; 6+ messages in thread
From: Rob Herring @ 2023-10-27 21:35 UTC (permalink / raw)
  To: Conor Dooley
  Cc: Seven Lee, broonie, lgirdwood, alsa-devel, devicetree,
	linux-kernel, conor+dt, YHCHuang, KCHSU0, CTLIN0, SJLIN0,
	scott6986, supercraig0719, dardar923

On Fri, Oct 27, 2023 at 03:11:35PM +0100, Conor Dooley wrote:
> Hey,
> 
> On Fri, Oct 27, 2023 at 04:21:43PM +0800, Seven Lee wrote:
> > Add input with DMIC slew rate selection
> > 
> > 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 3e54abd4ca74..01028b7ff85c 100644
> > --- a/Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml
> > +++ b/Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml
> > @@ -89,6 +89,13 @@ properties:
> >      $ref: /schemas/types.yaml#/definitions/uint32
> >      default: 3072000
> >  
> > +  nuvoton,dmic-slew-rate-selection:
> > +    description: the number from 0 to 7 that sets the DMIC slew rate.
> > +        The unit is mV/ns. 0 is the slowest, and 7 is the fastest.
> > +    $ref: /schemas/types.yaml#/definitions/uint32
> > +    maximum: 7
> > +    default: 0
> 
> I meant make the property in terms of the unit, so
> nuvoton,dmic-slew-rate-volt-per-sec (or similar, Rob would likely know
> better how he likes the unit suffix for a more complex unit like this
> one) and then make it an enum with possible values corresponding to
> the real values that putting 0, 1, 2, 3 etc into the register produces.

From what I've seen, you often don't know what units the h/w settings 
correspond to. Often it's just fast, medium, slow or something. And 
here, 0 doesn't make sense if the units really are mV/ns. 

So I'd just drop '-selection' and be done with it. (And clear up the 
units part).

> 
> Cheers,
> Conor.
> 
> > +
> >    nuvoton,left-input-single-end:
> >      description: Enable left input with single-ended settings if set.
> >          For the headset mic application, the single-ended control is
> > @@ -127,6 +134,7 @@ examples:
> >              nuvoton,jack-insert-debounce = <7>;
> >              nuvoton,jack-eject-debounce = <0>;
> >              nuvoton,dmic-clk-threshold = <3072000>;
> > +            nuvoton,dmic-slew-rate-selection= <0>;
> >              #sound-dai-cells = <0>;
> >          };
> >      };
> > -- 
> > 2.25.1
> > 



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

end of thread, other threads:[~2023-10-27 21:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-27  8:21 [PATCH v2 0/2] Add DMIC slew rate select Seven Lee
2023-10-27  8:21 ` [PATCH v2 1/2] ASoC: dt-bindings: nau8821: Add DMIC slew rate selection Seven Lee
2023-10-27 14:11   ` Conor Dooley
2023-10-27 21:35     ` Rob Herring
2023-10-27 21:35       ` Rob Herring
2023-10-27  8:21 ` [PATCH v2 2/2] ASoC: nau8821: Add slew rate controls Seven Lee

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.