Skip to contentSkip to conversation

Add DMIC slew rate controls

PATCH In review Seven Lee 3 participants 5 messages Nov 7, 2023 – Nov 13, 2023

Subsystems (3)
lore
Share & tools
lore

Seven Lee

author
#0 lore raw

v4 cover Add DMIC slew rate controls

Determine DMIC slew rate via property setup.

Change:
V3 -> V4:
- add "maximum: 7" description.

V2 -> V3:
- Update description of DMIC slew rate and remove "selection" key words from property name
- Corrected variable name of DMIC slew rate from c file

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

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

 .../devicetree/bindings/sound/nuvoton,nau8821.yaml       | 9 +++++++++
 sound/soc/codecs/nau8821.c                               | 7 +++++++
 sound/soc/codecs/nau8821.h                               | 3 +++
 3 files changed, 19 insertions(+)
Signature · 1 line
2.25.1
author
#1 lore raw

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

Add input with DMIC slew rate controls.

---
 .../devicetree/bindings/sound/nuvoton,nau8821.yaml       | 9 +++++++++
 1 file changed, 9 insertions(+)
Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml +9 -0
index 3e54abd4ca74..3380b6aa9542 100644
@@ -89,6 +89,14 @@ properties:
     $ref: /schemas/types.yaml#/definitions/uint32
     default: 3072000
 
+  nuvoton,dmic-slew-rate:
+    description: The range 0 to 7 represents the speed of DMIC slew rate.
+        The lowest value 0 means the slowest rate and the highest value
+        7 means the fastest 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 +135,7 @@ examples:
             nuvoton,jack-insert-debounce = <7>;
             nuvoton,jack-eject-debounce = <0>;
             nuvoton,dmic-clk-threshold = <3072000>;
+            nuvoton,dmic-slew-rate= <0>;
             #sound-dai-cells = <0>;
         };
     };
Signature · 1 line
2.25.1
Acked-by on v4 1/2
#2 lore raw

Re: [PATCH v4 1/2] ASoC: dt-bindings: nau8821: Add DMIC slew rate.

Quoted 3 lines · Seven Lee

Add input with DMIC slew rate controls.

Thanks,
Conor.

Quoted 34 lines
---
 .../devicetree/bindings/sound/nuvoton,nau8821.yaml       | 9 +++++++++
 1 file changed, 9 insertions(+)
Documentation/devicetree/bindings/sound/nuvoton,nau8821.yaml +9 -0
index 3e54abd4ca74..3380b6aa9542 100644
@@ -89,6 +89,14 @@ properties:
     $ref: /schemas/types.yaml#/definitions/uint32
     default: 3072000
 
+  nuvoton,dmic-slew-rate:
+    description: The range 0 to 7 represents the speed of DMIC slew rate.
+        The lowest value 0 means the slowest rate and the highest value
+        7 means the fastest 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 +135,7 @@ examples:
             nuvoton,jack-insert-debounce = <7>;
             nuvoton,jack-eject-debounce = <0>;
             nuvoton,dmic-clk-threshold = <3072000>;
+            nuvoton,dmic-slew-rate= <0>;
             #sound-dai-cells = <0>;
         };
     };
Signature · 1 line
2.25.1
author
#3 lore raw

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

In reply to Seven Lee

The patch supports DMIC clock slew rate controls.

---
 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..012e347e6391 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",
+		&nau8821->dmic_slew_rate);
+	if (ret)
+		nau8821->dmic_slew_rate = 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 <<
+		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..62eaad130b2e 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;
 	int key_enable;
 };
 
Signature · 1 line
2.25.1
maintainer
#4 lore raw
In reply to Seven Lee
Quoted 6 lines · Seven Lee

Determine DMIC slew rate via property setup.

Change:
V3 -> V4:
- add "maximum: 7" description.

Quoted 6 lines

V2 -> V3:
- Update description of DMIC slew rate and remove "selection" key words from property name
- Corrected variable name of DMIC slew rate from c file

[...]

Applied to

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

Thanks!

[1/2] ASoC: dt-bindings: nau8821: Add DMIC slew rate.

      commit: 1fb1a7c4a6328aff97eeca513fe7239099c13016
[2/2] ASoC: nau8821: Add slew rate controls.
      commit: 91d1a18b6381abd7a0137449fe345924072e4a32

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