Add PDM controller for StarFive JH8100 SoC
Subsystems (3)
v2 cover Add PDM controller for StarFive JH8100 SoC
The Pulse Density Modulation (PDM) controller is a digital PDM microphone interface controller and decoder that supports both mono/stereo PDM format, and a Inter-IC Sound (I2S) transmitter that outputs standard stereo audio data to another device. The PDM controller includes two PDM blocks, each PDM block can drive one bitstream sampling clock and two bitstream coming data (mono/stereo) with sampling clock rising and falling edge.
The first patch adds documentation to describe PDM controller bindings. And the second patch adds PDM driver for the StarFive JH8100 SoC. The DTS patch of PDM controller will be submitted after the patchs of JH8100 DTS are accepted.
Changes since v1:
- Changed the subject prefix of the bindings.
- Dropped the confused property in the bindings.
- Added the $ref to dai-common.
- Changed the kcontrol names and put it into ops.
- Added the reset when device resume.
- Modified two blocks into a whole PDM which supports up to 4 channels of recorder.
v1: https://lore.kernel.org/all/[email protected]/
Xingyu Wu (2):
ASoC: dt-bindings: Add PDM controller for the StarFive JH8100 SoC
ASoC: starfive: Add PDM controller support
.../bindings/sound/starfive,jh8100-pdm.yaml | 82 ++++ MAINTAINERS | 7 + sound/soc/starfive/Kconfig | 7 + sound/soc/starfive/Makefile | 1 + sound/soc/starfive/jh8100_pdm.c | 447 ++++++++++++++++++ 5 files changed, 544 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml create mode 100644 sound/soc/starfive/jh8100_pdm.c
Signature · 1 line
2.25.1
PATCH v2 1/2 ASoC: dt-bindings: Add PDM controller for the StarFive JH8100 SoC
Add bindings about the PDM controller for the StarFive JH8100 SoC.
--- .../bindings/sound/starfive,jh8100-pdm.yaml | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml
Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml new file +82 -0
@@ -0,0 +1,82 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/starfive,jh8100-pdm.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: StarFive JH8100 PDM controller + +description: | + The Pulse Density Modulation (PDM) controller is a digital PDM out + microphone interface controller and decoder that supports both up to 4 + channels, and an Inter-IC Sound (I2S) transmitter that outputs standard + stereo audio data to another device. The I2S transmitter can be + configured to operate either a master or a slave (default mode). The PDM + controller includes two PDM blocks, each PDM block can drive one + bitstream sampling clock and two bitstream coming data (mono/stereo) + with sampling clock rising and falling edge. + +maintainers: + - Xingyu Wu <[email protected]> + - Walker Chen <[email protected]> + +allOf: + - $ref: dai-common.yaml# + +properties: + compatible: + const: starfive,jh8100-pdm + + reg: + maxItems: 1 + + clocks: + items: + - description: DMIC output clock + - description: Main ICG clock + + clock-names: + items: + - const: dmic + - const: icg + + resets: + maxItems: 1 + + "#sound-dai-cells": + const: 0 + + starfive,syscon: + $ref: /schemas/types.yaml#/definitions/phandle-array + items: + - items: + - description: phandle to System Register Controller sys_syscon_ne node. + - description: PDM source enabled control offset of SYS_SYSCON_NE register. + - description: PDM source enabled control mask + description: + The phandle to System Register Controller syscon node and the PDM source + from I2S enabled control offset and mask of SYS_SYSCON_NE register. + +required: + - compatible + - reg + - clocks + - clock-names + - resets + - '#sound-dai-cells' + - starfive,syscon + +unevaluatedProperties: false + +examples: + - | + pdm@12250000 { + compatible = "starfive,jh8100-pdm"; + reg = <0x12250000 0x1000>; + clocks = <&syscrg_ne 142>, + <&syscrg_ne 171>; + clock-names = "dmic", "icg"; + resets = <&syscrg_ne 44>; + starfive,syscon = <&sys_syscon_ne 0xc 0xff>; + #sound-dai-cells = <0>; + };
Signature · 1 line
2.25.1
Re: [PATCH v2 1/2] ASoC: dt-bindings: Add PDM controller for the StarFive JH8100 SoC
Quoted 3 lines · Xingyu Wu
Add bindings about the PDM controller for the StarFive JH8100 SoC.
Signed-off-by Xingyu Wu <[email protected]>
If there is going to be resend/new version, three nits. Anyway:
...
Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml line 9
Quoted 4 lines
Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml new file +4
-0+ +title: StarFive JH8100 PDM controller + +description: |
Do not need '|' unless you need to preserve formatting.
Quoted 39 lines
Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml new file +39
-0+ The Pulse Density Modulation (PDM) controller is a digital PDM out + microphone interface controller and decoder that supports both up to 4 + channels, and an Inter-IC Sound (I2S) transmitter that outputs standard + stereo audio data to another device. The I2S transmitter can be + configured to operate either a master or a slave (default mode). The PDM + controller includes two PDM blocks, each PDM block can drive one + bitstream sampling clock and two bitstream coming data (mono/stereo) + with sampling clock rising and falling edge. + +maintainers: + - Xingyu Wu <[email protected]> + - Walker Chen <[email protected]> + +allOf: + - $ref: dai-common.yaml# + +properties: + compatible: + const: starfive,jh8100-pdm + + reg: + maxItems: 1 + + clocks: + items: + - description: DMIC output clock + - description: Main ICG clock + + clock-names: + items: + - const: dmic + - const: icg + + resets: + maxItems: 1 + + "#sound-dai-cells": + const: 0 +
Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml line 58
Quoted 10 lines
Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml new file +10
-0+ starfive,syscon: + $ref: /schemas/types.yaml#/definitions/phandle-array + items: + - items: + - description: phandle to System Register Controller sys_syscon_ne node. + - description: PDM source enabled control offset of SYS_SYSCON_NE register. + - description: PDM source enabled control mask + description: + The phandle to System Register Controller syscon node and the PDM source + from I2S enabled control offset and mask of SYS_SYSCON_NE register.
This description duplicates items. Drop redundant parts (there is really never a need to say phandle is a phandle because it cannot be anything else). Instead say what is it used for.
Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml line 66
Quoted 8 lines
Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml new file +8
-0+ +required: + - compatible + - reg + - clocks + - clock-names + - resets + - '#sound-dai-cells'
Use consistent quotes, either ' or "
Best regards,
Krzysztof
RE: [PATCH v2 1/2] ASoC: dt-bindings: Add PDM controller for the StarFive JH8100 SoC
Quoted 10 lines · Krzysztof Kozlowski
Quoted 3 lines · Xingyu Wu
Add bindings about the PDM controller for the StarFive JH8100 SoC.
Signed-off-by Xingyu Wu <[email protected]>If there is going to be resend/new version, three nits. Anyway:
Reviewed-by Krzysztof Kozlowski <[email protected]>
Thanks.
Quoted 8 lines
...
Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml line 9
Quoted 4 lines
Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml new file +4
-0+ +title: StarFive JH8100 PDM controller + +description: |Do not need '|' unless you need to preserve formatting.
Will drop.
Quoted 50 lines
Quoted 36 lines
Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml new file +35
-0+ The Pulse Density Modulation (PDM) controller is a digital PDM out + microphone interface controller and decoder that supports both up to + 4 channels, and an Inter-IC Sound (I2S) transmitter that outputs + standard stereo audio data to another device. The I2S transmitter + can be configured to operate either a master or a slave (default + mode). The PDM controller includes two PDM blocks, each PDM block + can drive one bitstream sampling clock and two bitstream coming + data (mono/stereo) with sampling clock rising and falling edge. + +maintainers: + - Xingyu Wu <[email protected]> + - Walker Chen <[email protected]> + +allOf: + - $ref: dai-common.yaml# + +properties: + compatible: + const: starfive,jh8100-pdm + + reg: + maxItems: 1 + + clocks: + items: + - description: DMIC output clock + - description: Main ICG clock + + clock-names: + items: + - const: dmic + - const: icg + + resets: + maxItems: 1Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml
Quoted 10 lines
Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml new file +10
-0+ + "#sound-dai-cells": + const: 0 + + starfive,syscon: + $ref: /schemas/types.yaml#/definitions/phandle-array + items: + - items: + - description: phandle to System Register Controller sys_syscon_ne node. + - description: PDM source enabled control offset of SYS_SYSCON_NEregister.
Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml
Quoted 3 lines
Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml new file +3
-0+ - description: PDM source enabled control mask + description: + The phandle to System Register Controller syscon node and the PDM
Quoted 6 lines
source
Quoted 1 line
+ from I2S enabled control offset and mask of
SYS_SYSCON_NEregister.This description duplicates items. Drop redundant parts (there is really never a need to say phandle is a phandle because it cannot be anything else). Instead say what is it used for.
Will fix.
Quoted 12 lines
Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml line 66
Quoted 10 lines
Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml new file +8
-0+ +required: + - compatible + - reg + - clocks + - clock-names + - resets + - '#sound-dai-cells'Use consistent quotes, either ' or "
Noted.
Best regards,
Xingyu Wu
RE: [PATCH v2 1/2] ASoC: dt-bindings: Add PDM controller for the StarFive JH8100 SoC
In reply to Krzysztof KozlowskiQuoted 10 lines · Krzysztof Kozlowski
Quoted 3 lines · Xingyu Wu
Add bindings about the PDM controller for the StarFive JH8100 SoC.
Signed-off-by Xingyu Wu <[email protected]>If there is going to be resend/new version, three nits. Anyway:
Reviewed-by Krzysztof Kozlowski <[email protected]>
I will fix it in next version. Thanks.
Quoted 8 lines
...
Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml line 9
Quoted 4 lines
Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml new file +4
-0+ +title: StarFive JH8100 PDM controller + +description: |Do not need '|' unless you need to preserve formatting.
Will drop.
Quoted 50 lines
Quoted 36 lines
Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml new file +35
-0+ The Pulse Density Modulation (PDM) controller is a digital PDM out + microphone interface controller and decoder that supports both up to + 4 channels, and an Inter-IC Sound (I2S) transmitter that outputs + standard stereo audio data to another device. The I2S transmitter + can be configured to operate either a master or a slave (default + mode). The PDM controller includes two PDM blocks, each PDM block + can drive one bitstream sampling clock and two bitstream coming + data (mono/stereo) with sampling clock rising and falling edge. + +maintainers: + - Xingyu Wu <[email protected]> + - Walker Chen <[email protected]> + +allOf: + - $ref: dai-common.yaml# + +properties: + compatible: + const: starfive,jh8100-pdm + + reg: + maxItems: 1 + + clocks: + items: + - description: DMIC output clock + - description: Main ICG clock + + clock-names: + items: + - const: dmic + - const: icg + + resets: + maxItems: 1Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml
Quoted 10 lines
Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml new file +10
-0+ + "#sound-dai-cells": + const: 0 + + starfive,syscon: + $ref: /schemas/types.yaml#/definitions/phandle-array + items: + - items: + - description: phandle to System Register Controller sys_syscon_ne node. + - description: PDM source enabled control offset of SYS_SYSCON_NEregister.
Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml
Quoted 3 lines
Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml new file +3
-0+ - description: PDM source enabled control mask + description: + The phandle to System Register Controller syscon node and the PDM
Quoted 6 lines
source
Quoted 1 line
+ from I2S enabled control offset and mask of
SYS_SYSCON_NEregister.This description duplicates items. Drop redundant parts (there is really never a need to say phandle is a phandle because it cannot be anything else). Instead say what is it used for.
Will fix.
Quoted 13 lines
Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml line 66
Quoted 10 lines
Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml new file +8
-0+ +required: + - compatible + - reg + - clocks + - clock-names + - resets + - '#sound-dai-cells'Use consistent quotes, either ' or "
Will fix.
Best regards,
Xingyu Wu
RE: [PATCH v2 1/2] ASoC: dt-bindings: Add PDM controller for the StarFive JH8100 SoC
Quoted 103 lines · Krzysztof Kozlowski
Quoted 10 lines · Xingyu Wu
Quoted 3 lines
Add bindings about the PDM controller for the StarFive JH8100 SoC.
Signed-off-by Xingyu Wu <[email protected]>If there is going to be resend/new version, three nits. Anyway:
Reviewed-by Krzysztof Kozlowski <[email protected]>I will fix it in next version. Thanks.
Quoted 8 lines
...
Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml line 9
Quoted 4 lines
Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml new file +4
-0+ +title: StarFive JH8100 PDM controller + +description: |Do not need '|' unless you need to preserve formatting.
Will drop.
Quoted 38 lines
Quoted 38 lines
Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml new file +37
-0+ The Pulse Density Modulation (PDM) controller is a digital PDM + out microphone interface controller and decoder that supports both + up to + 4 channels, and an Inter-IC Sound (I2S) transmitter that outputs + standard stereo audio data to another device. The I2S transmitter + can be configured to operate either a master or a slave (default + mode). The PDM controller includes two PDM blocks, each PDM block + can drive one bitstream sampling clock and two bitstream coming + data (mono/stereo) with sampling clock rising and falling edge. + +maintainers: + - Xingyu Wu <[email protected]> + - Walker Chen <[email protected]> + +allOf: + - $ref: dai-common.yaml# + +properties: + compatible: + const: starfive,jh8100-pdm + + reg: + maxItems: 1 + + clocks: + items: + - description: DMIC output clock + - description: Main ICG clock + + clock-names: + items: + - const: dmic + - const: icg + + resets: + maxItems: 1 +Quoted 8 lines
Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml
Quoted 8 lines
Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml new file +8
-0+ "#sound-dai-cells": + const: 0 + + starfive,syscon: + $ref: /schemas/types.yaml#/definitions/phandle-array + items: + - items: + - description: phandle to System Register Controller sys_syscon_nenode.
Quoted 7 lines
Quoted 2 lines
+ - description: PDM source enabled control offset of
+SYS_SYSCON_NEregister.
Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml
Quoted 4 lines
Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml new file +4
-0+ - description: PDM source enabled control mask + description: + The phandle to System Register Controller syscon node and the + PDMQuoted 6 lines
source
Quoted 1 line
+ from I2S enabled control offset and mask of
SYS_SYSCON_NEregister.This description duplicates items. Drop redundant parts (there is really never a need to say phandle is a phandle because it cannot be anything else). Instead say what is it used for.
Will fix.
Quoted 13 lines
Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml line 66
Quoted 10 lines
Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml new file +8
-0+ +required: + - compatible + - reg + - clocks + - clock-names + - resets + - '#sound-dai-cells'Use consistent quotes, either ' or "
Quoted 4 lines
Will fix.
Best regards,
Xingyu Wu
Sorry, it was resent. Forget that.
Thanks,
Xingyu Wu
PATCH v2 2/2 ASoC: starfive: Add PDM controller support
In reply to Xingyu WuAdd the driver of PDM controller for the StarFive JH8100 SoC.
The Pulse Density Modulation (PDM) controller is a digital PDM microphone interface controller and decoder that supports up to 4 channels. The PDM have two blocks and each block controls stereo audio data which is transferred to a Inter-IC Sound (I2S) recorder on the JH8100 SoC.
--- MAINTAINERS | 7 + sound/soc/starfive/Kconfig | 7 + sound/soc/starfive/Makefile | 1 + sound/soc/starfive/jh8100_pdm.c | 447 ++++++++++++++++++++++++++++++++ 4 files changed, 462 insertions(+) create mode 100644 sound/soc/starfive/jh8100_pdm.c
MAINTAINERS +7 -0
@@ -21079,6 +21079,13 @@ F: Documentation/devicetree/bindings/power/starfive* F: drivers/pmdomain/starfive/ F: include/dt-bindings/power/starfive,jh7110-pmu.h +STARFIVE JH8100 PDM DRIVER +M: Xingyu Wu <[email protected]> +M: Walker Chen <[email protected]> +S: Maintained +F: Documentation/devicetree/bindings/sound/starfive,jh8100-pdm.yaml +F: sound/soc/starfive/jh8100_pdm.c + STARFIVE SOC DRIVERS M: Conor Dooley <[email protected]> S: Maintained
sound/soc/starfive/Kconfig +7 -0
@@ -22,3 +22,10 @@ config SND_SOC_JH7110_TDM select SND_SOC_GENERIC_DMAENGINE_PCM help Say Y or M if you want to add support for StarFive TDM driver. + +config SND_SOC_JH8100_PDM + tristate "JH8100 PDM controller device driver" + depends on HAVE_CLK && SND_SOC_STARFIVE + select REGMAP_MMIO + help + Say Y or M if you want to add support for StarFive PDM driver.
sound/soc/starfive/Makefile +1 -0
@@ -1,3 +1,4 @@ # StarFive Platform Support obj-$(CONFIG_SND_SOC_JH7110_PWMDAC) += jh7110_pwmdac.o obj-$(CONFIG_SND_SOC_JH7110_TDM) += jh7110_tdm.o +obj-$(CONFIG_SND_SOC_JH8100_PDM) += jh8100_pdm.o
sound/soc/starfive/jh8100_pdm.c new file +447 -0
447 lines not on this page · raw message
Signature · 1 line
2.25.1
RE: [PATCH v2 2/2] ASoC: starfive: Add PDM controller support
Quoted 10 lines
Subject: [PATCH v2 2/2] ASoC: starfive: Add PDM controller support
Add the driver of PDM controller for the StarFive JH8100 SoC.
The Pulse Density Modulation (PDM) controller is a digital PDM microphone interface controller and decoder that supports up to
4 channels. The PDM have two blocks and each block controls stereo audio data which is transferred to a Inter-IC Sound (I2S) recorder on the JH8100 SoC.Signed-off-by Xingyu Wu <[email protected]>
Quoted 9 lines
--- MAINTAINERS | 7 + sound/soc/starfive/Kconfig | 7 + sound/soc/starfive/Makefile | 1 + sound/soc/starfive/jh8100_pdm.c | 447 ++++++++++++++++++++++++++++++++ 4 files changed, 462 insertions(+) create mode 100644 sound/soc/starfive/jh8100_pdm.c
Hi Mark,
Could you please help to review and give your comment about this PDM driver?
Thanks,
Xingyu Wu
Mark Brown
maintainerRe: [PATCH v2 2/2] ASoC: starfive: Add PDM controller support
Quoted 1 line · Xingyu Wu
Could you please help to review and give your comment about this PDM driver?
Please don't send content free pings and please allow a reasonable time for review. People get busy, go on holiday, attend conferences and so on so unless there is some reason for urgency (like critical bug fixes) please allow at least a couple of weeks for review. If there have been review comments then people may be waiting for those to be addressed.
Sending content free pings adds to the mail volume (if they are seen at all) which is often the problem and since they can't be reviewed directly if something has gone wrong you'll have to resend the patches anyway, so sending again is generally a better approach though there are some other maintainers who like them - if in doubt look at how patches for the subsystem are normally handled.
RE: [PATCH v2 2/2] ASoC: starfive: Add PDM controller support
Quoted 11 lines · Mark Brown
Quoted 1 line · Xingyu Wu
Could you please help to review and give your comment about this PDM driver?
Please don't send content free pings and please allow a reasonable time for review. People get busy, go on holiday, attend conferences and so on so unless there is some reason for urgency (like critical bug fixes) please allow at least a couple of weeks for review. If there have been review comments then people may be waiting for those to be addressed.
Quoted 6 lines
Sending content free pings adds to the mail volume (if they are seen at all) which is often the problem and since they can't be reviewed directly if something has gone wrong you'll have to resend the patches anyway, so sending again is generally a better approach though there are some other maintainers who like them - if in doubt look at how patches for the subsystem are normally handled.
Sorry, you can do it when you have free time. Don't mind.
Thanks,
Xingyu Wu