Skip to contentSkip to conversation

ASoC: dt-bindings: nau8821: Add DMIC slew rate selection

PATCH Superseded Seven Lee 2 participants 4 messages Oct 23, 2023 – Oct 24, 2023

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Seven Lee

author
#0 lore raw

PATCH 1/2 ASoC: dt-bindings: nau8821: Add DMIC slew rate selection

Add input with DMIC slew rate selection

---
 .../devicetree/bindings/sound/nuvoton,nau8821.yaml         | 7 +++++++
 1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml +7 -0
index 3e54abd4ca74..5f7f2eed4834 100644
@@ -89,6 +89,12 @@ properties:
     $ref: /schemas/types.yaml#/definitions/uint32
     default: 3072000
 
+  nuvoton,dmic-slew-rate-selection:
+    description: number from 0 to 7 that sets DMIC slew rate.
+    $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 +133,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>;
         };
     };
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH 2/2 ASoC: nau8821: Add slew rate controls.

The patch supports DMIC clock slew rate selection.

---
 sound/soc/codecs/nau8821.c | 7 +++++++
 sound/soc/codecs/nau8821.h | 3 +++
 2 files changed, 10 insertions(+)
sound/soc/codecs/nau8821.c +7 -0
index 6e1b6b26298a..d8190e8a431f 100644
@@ -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);
sound/soc/codecs/nau8821.h +3 -0
index 00a888ed07ce..480f605d5d50 100644
@@ -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;
 };
 
Signature · 1 line
2.25.1
#2 lore raw
In reply to Seven Lee

Hey,

Quoted 12 lines · Seven Lee

Add input with DMIC slew rate selection

---
 .../devicetree/bindings/sound/nuvoton,nau8821.yaml         | 7 +++++++
 1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml +0 -0
index 3e54abd4ca74..5f7f2eed4834 100644

Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml properties: · line 96

Quoted 8 lines
Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml +5 -0
@@ -89,6 +89,12 @@ properties:
     $ref: /schemas/types.yaml#/definitions/uint32
     default: 3072000
 
+  nuvoton,dmic-slew-rate-selection:
+    description: number from 0 to 7 that sets DMIC slew rate.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    maximum: 7
+    default: 0

I'd much rather this was an enum of possible values in $unit, than what appears to be values you want to write to a register.

Cheers,
Conor.

Quoted 15 lines
Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml +2 -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 +133,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>;
         };
     };
Signature · 1 line
2.25.1
author
#3 lore raw

On 10/24/2023 12:55 AM, Conor Dooley wrote:

Hey,

On Mon, Oct 23, 2023 at 10:15:36AM +0800, Seven Lee wrote:

Add input with DMIC slew rate selection

---
.../devicetree/bindings/sound/nuvoton,nau8821.yaml | 7 +++++++

1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml +5 -0
index 3e54abd4ca74..5f7f2eed4834 100644
@@ -89,6 +89,12 @@ properties:
    $ref: /schemas/types.yaml#/definitions/uint32
    default: 3072000
 
+  nuvoton,dmic-slew-rate-selection:
+    description: number from 0 to 7 that sets DMIC slew rate.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    maximum: 7
+    default: 0
 
 
 

I'd much rather this was an enum of possible values in $unit, than what appears to be values you want to write to a register.

Cheers,
Conor.

okay, I will change it to enum description.

+
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 +133,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

________________________________
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.