Skip to contentSkip to conversation

Add Cadence I2S controller driver for the

PATCH Superseded Xingyu Wu 5 participants 17 messages Dec 21, 2023 – Dec 29, 2023

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Xingyu Wu

author
#0 lore raw

cover Add Cadence I2S controller driver for the

The Cadence I2S Controller implements a function of the multi-channel (up to 8-channel) bus. Each stereo channel combines functions of a transmitter and a receiver, and can switch freely between them. Each channel has independent gating, clock and interruption control. It also support some of these channels are used as playback and others can also be used as record in the same time.

Four I2S controllers are used on the StarFive JH8100 SoC. Two of the I2S controllers use two stereo channels, one of them use four channels, and one use eight. It had tested on the fpga with WM8960.

Xingyu Wu (2):
dt-bindings: ASoC: Add Cadence I2S controller for StarFive JH8100 SoC
ASoC: starfive: Add drivers of Cadence Multi-Channel I2S Controller

 .../bindings/sound/cdns,jh8100-i2s.yaml       | 100 +++
 MAINTAINERS                                   |   7 +
 sound/soc/starfive/Kconfig                    |  18 +
 sound/soc/starfive/Makefile                   |   4 +
 sound/soc/starfive/cdns-jh8100-i2s-pcm.c      | 262 +++++++
 sound/soc/starfive/cdns-jh8100-i2s.c          | 727 ++++++++++++++++++
 sound/soc/starfive/cdns-jh8100-i2s.h          | 171 ++++
 7 files changed, 1289 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml
 create mode 100644 sound/soc/starfive/cdns-jh8100-i2s-pcm.c
 create mode 100644 sound/soc/starfive/cdns-jh8100-i2s.c
 create mode 100644 sound/soc/starfive/cdns-jh8100-i2s.h
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH 1/2 dt-bindings: ASoC: Add Cadence I2S controller for StarFive JH8100 SoC

Add bindings for the Multi-Channel I2S controller of Cadence on the StarFive JH8100 SoC.

---
 .../bindings/sound/cdns,jh8100-i2s.yaml       | 100 ++++++++++++++++++
 1 file changed, 100 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml
Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml new file +100 -0
new file mode 100644
index 000000000000..5d95d9ab3e45
@@ -0,0 +1,100 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/cdns,jh8100-i2s.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Cadence multi-channel I2S controller for StarFive JH8100 SoC
+
+description: |
+  The Cadence I2S Controller implements a function of the multi-channel
+  (up to 8-channel) bus. It combines functions of a transmitter and a receiver.
+  It is used in the StarFive JH8100 SoC.
+
+maintainers:
+  - Xingyu Wu <[email protected]>
+  - Walker Chen <[email protected]>
+
+properties:
+  compatible:
+    const: starfive,jh8100-i2s
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    description: |
+      The interrupt line number for the I2S controller. Add this
+      parameter if the I2S controller that you are using does not
+      support DMA.
+    maxItems: 1
+
+  clocks:
+    items:
+      - description: Bit clock
+      - description: Main ICG clock
+      - description: Inner master clock
+
+  clock-names:
+    items:
+      - const: bclk
+      - const: icg
+      - const: mclk_inner
+
+  resets:
+    maxItems: 1
+
+  dmas:
+    items:
+      - description: TX DMA Channel
+      - description: RX DMA Channel
+    minItems: 1
+
+  dma-names:
+    items:
+      - const: tx
+      - const: rx
+    minItems: 1
+
+  cdns,i2s-max-channels:
+    description: |
+      Number of I2S max stereo channels supported by the hardware.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 1
+    maximum: 8
+
+  "#sound-dai-cells":
+    const: 0
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - resets
+
+oneOf:
+  - required:
+      - dmas
+      - dma-names
+  - required:
+      - interrupts
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    i2s@122b0000 {
+      compatible = "starfive,jh8100-i2s";
+      reg = <0x122b0000 0x1000>;
+      clocks = <&syscrg_ne 133>,
+               <&syscrg_ne 170>,
+               <&syscrg 50>;
+      clock-names = "bclk", "icg",
+                    "mclk_inner";
+      resets = <&syscrg_ne 43>;
+      dmas = <&dma 7>, <&dma 6>;
+      dma-names = "tx", "rx";
+      cdns,i2s-max-channels = <2>;
+      #sound-dai-cells = <0>;
+    };
Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH v1 1/2] dt-bindings: ASoC: Add Cadence I2S controller for StarFive JH8100 SoC

Xingyu, Mark,

Quoted 15 lines · Xingyu Wu

Add bindings for the Multi-Channel I2S controller of Cadence on the StarFive JH8100 SoC.

---
 .../bindings/sound/cdns,jh8100-i2s.yaml       | 100 ++++++++++++++++++
 1 file changed, 100 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml
Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml new file +0 -0
new file mode 100644
index 000000000000..5d95d9ab3e45

Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml line 4

Quoted 4 lines
Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml new file +4 -0
@@ -0,0 +1,100 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/cdns,jh8100-i2s.yaml#

Filename matching the compatible please.

Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml line 9

Quoted 5 lines
Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml new file +5 -0
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Cadence multi-channel I2S controller for StarFive JH8100 SoC
+
+description: |

You only need the | if there is formatting to preserve.

Quoted 10 lines
Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml new file +10 -0
+  The Cadence I2S Controller implements a function of the multi-channel
+  (up to 8-channel) bus. It combines functions of a transmitter and a receiver.
+  It is used in the StarFive JH8100 SoC.
+
+maintainers:
+  - Xingyu Wu <[email protected]>
+  - Walker Chen <[email protected]>
+
+properties:
+  compatible:

Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml line 29

Quoted 10 lines
Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml new file +10 -0
+    const: starfive,jh8100-i2s
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    description: |
+      The interrupt line number for the I2S controller. Add this
+      parameter if the I2S controller that you are using does not
+      support DMA.

You've got one i2s controller here, you should know if it supports DMA or not.

Quoted 25 lines
Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml new file +25 -0
+    maxItems: 1
+
+  clocks:
+    items:
+      - description: Bit clock
+      - description: Main ICG clock
+      - description: Inner master clock
+
+  clock-names:
+    items:
+      - const: bclk
+      - const: icg
+      - const: mclk_inner
+
+  resets:
+    maxItems: 1
+
+  dmas:
+    items:
+      - description: TX DMA Channel
+      - description: RX DMA Channel
+    minItems: 1
+
+  dma-names:
+    items:

Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml line 64

Quoted 10 lines
Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml new file +10 -0
+      - const: tx
+      - const: rx
+    minItems: 1
+
+  cdns,i2s-max-channels:
+    description: |
+      Number of I2S max stereo channels supported by the hardware.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 1
+    maximum: 8

Mark, is there no common property for this kind of thing? That said, there's one device here so the number is known at present. Another note, this property is not required, so it should have a default.

It's kinda hard to know with this binding - it is touted as being for a particular Cadence IP, and some aspects are pretty generic, but at the same time there's only one device here so it's hard to tell what is variable between implementations and what is not.
Are there no other implementations of this controller? Unless it is brand new, I find that hard to believe.

Cheers,
Conor.

Quoted 40 lines
Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml new file +36 -0
+
+  "#sound-dai-cells":
+    const: 0
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - resets
+
+oneOf:
+  - required:
+      - dmas
+      - dma-names
+  - required:
+      - interrupts
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    i2s@122b0000 {
+      compatible = "starfive,jh8100-i2s";
+      reg = <0x122b0000 0x1000>;
+      clocks = <&syscrg_ne 133>,
+               <&syscrg_ne 170>,
+               <&syscrg 50>;
+      clock-names = "bclk", "icg",
+                    "mclk_inner";
+      resets = <&syscrg_ne 43>;
+      dmas = <&dma 7>, <&dma 6>;
+      dma-names = "tx", "rx";
+      cdns,i2s-max-channels = <2>;
+      #sound-dai-cells = <0>;
+    };
Signature · 1 line
2.25.1
maintainer
#3 lore raw

Re: [PATCH v1 1/2] dt-bindings: ASoC: Add Cadence I2S controller for StarFive JH8100 SoC

Quoted 9 lines · Conor Dooley

Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml line 64

Quoted 6 lines · Xingyu Wu
Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml new file +6 -0
+  cdns,i2s-max-channels:
+    description: |
+      Number of I2S max stereo channels supported by the hardware.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 1
+    maximum: 8
Quoted 4 lines

Mark, is there no common property for this kind of thing? That said, there's one device here so the number is known at present. Another note, this property is not required, so it should have a default.

I wouldn't expect this to be a property in the first place, as currently presented this is specific to a single instance of the IP in a single SoC. In general this is something that is obvious from the compatible and doesn't need a property, it's only plausibly useful for Cadence and Designware which is a very short list of vendors.

author
#4 lore raw

Re: [PATCH v1 1/2] dt-bindings: ASoC: Add Cadence I2S controller for StarFive JH8100 SoC

Quoted 15 lines · Mark Brown
Quoted 9 lines · Conor Dooley

Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml line 64

Quoted 6 lines · Xingyu Wu
Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml new file +6 -0
+  cdns,i2s-max-channels:
+    description: |
+      Number of I2S max stereo channels supported by the hardware.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 1
+    maximum: 8
Quoted 4 lines

Mark, is there no common property for this kind of thing? That said, there's one device here so the number is known at present. Another note, this property is not required, so it should have a default.

Quoted 5 lines

I wouldn't expect this to be a property in the first place, as currently presented this is specific to a single instance of the IP in a single SoC. In general this is something that is obvious from the compatible and doesn't need a property, it's only plausibly useful for Cadence and Designware which is a very short list of vendors.

The Cadence I2S can support 8 channels. But on the JH8100 SoC, two instances of this just provide 4 channels to use, one just provides 2 channels, and the other one can provide 8 channels. Should I use the property name of 'jh8100,i2s-max-channels' instead for some special instances on the JH8100 SoC?

Best regards,
Xingyu Wu

maintainer
#5 lore raw

Re: [PATCH v1 1/2] dt-bindings: ASoC: Add Cadence I2S controller for StarFive JH8100 SoC

Quoted 5 lines · Xingyu Wu

The Cadence I2S can support 8 channels. But on the JH8100 SoC, two instances of this just provide 4 channels to use, one just provides 2 channels, and the other one can provide 8 channels. Should I use the property name of 'jh8100,i2s-max-channels' instead for some special instances on the JH8100 SoC?

No, your current name is fine if the binding is generic for all Cadence users. I do think it would be good to have a separate compatible for these two channel instances, if there's been one customisation there may well have been others.

Please fix your mail client to word wrap within paragraphs at something substantially less than 80 columns. Doing this makes your messages much easier to read and reply to.

author
#6 lore raw

Re: [PATCH v1 1/2] dt-bindings: ASoC: Add Cadence I2S controller for StarFive JH8100 SoC

Quoted 8 lines · Mark Brown
Quoted 5 lines · Xingyu Wu

The Cadence I2S can support 8 channels. But on the JH8100 SoC, two instances of this just provide 4 channels to use, one just provides 2 channels, and the other one can provide 8 channels. Should I use the property name of 'jh8100,i2s-max-channels' instead for some special instances on the JH8100 SoC?

Quoted 8 lines

No, your current name is fine if the binding is generic for all Cadence users. I do think it would be good to have a separate compatible for these two channel instances, if there's been one customisation there may well have been others.

Please fix your mail client to word wrap within paragraphs at something substantially less than 80 columns. Doing this makes your messages much easier to read and reply to.

Great, thank you for your support.

Best regards,
Xingyu Wu

author
#7 lore raw

Re: [PATCH v1 1/2] dt-bindings: ASoC: Add Cadence I2S controller for StarFive JH8100 SoC

In reply to Conor Dooley
Quoted 12 lines · Conor Dooley

Xingyu, Mark,

Quoted 9 lines · Xingyu Wu

Add bindings for the Multi-Channel I2S controller of Cadence on the StarFive JH8100 SoC.

---
 .../bindings/sound/cdns,jh8100-i2s.yaml       | 100 ++++++++++++++++++
 1 file changed, 100 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml
Quoted 12 lines

Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml line 4

Quoted 10 lines
Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml new file +4 -0
new file mode 100644
index 000000000000..5d95d9ab3e45
@@ -0,0 +1,100 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/cdns,jh8100-i2s.yaml#

Filename matching the compatible please.

Noted.

Quoted 8 lines

Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml line 9

Quoted 6 lines
Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml new file +5 -0
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Cadence multi-channel I2S controller for StarFive JH8100 SoC
+
+description: |

You only need the | if there is formatting to preserve.

Will drop.

Quoted 16 lines
Quoted 16 lines
Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml new file +15 -0
+  The Cadence I2S Controller implements a function of the multi-channel
+  (up to 8-channel) bus. It combines functions of a transmitter and a receiver.
+  It is used in the StarFive JH8100 SoC.
+
+maintainers:
+  - Xingyu Wu <[email protected]>
+  - Walker Chen <[email protected]>
+
+properties:
+  compatible:
+    const: starfive,jh8100-i2s
+
+  reg:
+    maxItems: 1
+
Quoted 8 lines

Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml line 29

Quoted 5 lines
Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml new file +5 -0
+  interrupts:
+    description: |
+      The interrupt line number for the I2S controller. Add this
+      parameter if the I2S controller that you are using does not
+      support DMA.

You've got one i2s controller here, you should know if it supports DMA or not.

The I2S already supports interrupt handler, but if the SoC supports DMA controller to be use, it can optionally use DMA.

Quoted 49 lines
Quoted 26 lines
Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml new file +25 -0
+    maxItems: 1
+
+  clocks:
+    items:
+      - description: Bit clock
+      - description: Main ICG clock
+      - description: Inner master clock
+
+  clock-names:
+    items:
+      - const: bclk
+      - const: icg
+      - const: mclk_inner
+
+  resets:
+    maxItems: 1
+
+  dmas:
+    items:
+      - description: TX DMA Channel
+      - description: RX DMA Channel
+    minItems: 1
+
+  dma-names:
+    items:

Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml line 64

Quoted 10 lines
Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml new file +10 -0
+      - const: tx
+      - const: rx
+    minItems: 1
+
+  cdns,i2s-max-channels:
+    description: |
+      Number of I2S max stereo channels supported by the hardware.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 1
+    maximum: 8

Mark, is there no common property for this kind of thing? That said, there's one device here so the number is known at present. Another note, this property is not required, so it should have a default.

It's kinda hard to know with this binding - it is touted as being for a particular Cadence IP, and some aspects are pretty generic, but at the same time there's only one device here so it's hard to tell what is variable between implementations and what is not.
Are there no other implementations of this controller? Unless it is brand new, I find that hard to believe.

Quoted 3 lines

Cheers,
Conor.

Sorry, It does not seem to be common property. The Cadence I2S supports 8 channels. There are four I2S controllers on the JH8100 SoC, and two of them just provide 4 channels to use, one of them just provide 2 channels. It seems to depend on the SoC.

Thanks,
Xingyu Wu

Quoted 40 lines
Quoted 40 lines
Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml new file +36 -0
+
+  "#sound-dai-cells":
+    const: 0
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - resets
+
+oneOf:
+  - required:
+      - dmas
+      - dma-names
+  - required:
+      - interrupts
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    i2s@122b0000 {
+      compatible = "starfive,jh8100-i2s";
+      reg = <0x122b0000 0x1000>;
+      clocks = <&syscrg_ne 133>,
+               <&syscrg_ne 170>,
+               <&syscrg 50>;
+      clock-names = "bclk", "icg",
+                    "mclk_inner";
+      resets = <&syscrg_ne 43>;
+      dmas = <&dma 7>, <&dma 6>;
+      dma-names = "tx", "rx";
+      cdns,i2s-max-channels = <2>;
+      #sound-dai-cells = <0>;
+    };
Signature · 1 line
2.25.1
#8 lore raw

Re: [PATCH v1 1/2] dt-bindings: ASoC: Add Cadence I2S controller for StarFive JH8100 SoC

In reply to Xingyu Wu

Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml line 59

Quoted 7 lines · Xingyu Wu
Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml new file +7 -0
+  dma-names:
+    items:
+      - const: tx
+      - const: rx
+    minItems: 1
+
+  cdns,i2s-max-channels:

Custom properties after generic, so after sound-dai-cells. The coding style now mentions this.

Quoted 14 lines
Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml new file +14 -0
+    description: |
+      Number of I2S max stereo channels supported by the hardware.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 1
+    maximum: 8
+
+  "#sound-dai-cells":
+    const: 0
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names

Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml line 83

Quoted 10 lines
Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml new file +10 -0
+  - resets
+
+oneOf:
+  - required:
+      - dmas
+      - dma-names
+  - required:
+      - interrupts
+
+unevaluatedProperties: false

This is not correct without allOf: which should point you to missing $ref to dai-common.

Best regards,
Krzysztof

author
#9 lore raw

Re: [PATCH v1 1/2] dt-bindings: ASoC: Add Cadence I2S controller for StarFive JH8100 SoC

Quoted 9 lines · Krzysztof Kozlowski

Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml line 59

Quoted 7 lines · Xingyu Wu
Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml new file +7 -0
+  dma-names:
+    items:
+      - const: tx
+      - const: rx
+    minItems: 1
+
+  cdns,i2s-max-channels:
Quoted 3 lines

Custom properties after generic, so after sound-dai-cells. The coding style now mentions this.

Noted.

Quoted 20 lines
Quoted 20 lines
Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml new file +19 -0
+    description: |
+      Number of I2S max stereo channels supported by the hardware.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 1
+    maximum: 8
+
+  "#sound-dai-cells":
+    const: 0
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - resets
+
+oneOf:
+  - required:
+      - dmas
Quoted 8 lines

Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml line 83

Quoted 5 lines
Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml new file +5 -0
+      - dma-names
+  - required:
+      - interrupts
+
+unevaluatedProperties: false

This is not correct without allOf: which should point you to missing $ref to dai-common.

Will fix.

Quoted 5 lines

Best regards,
Krzysztof

Thanks,
Xingyu Wu

author
#10 lore raw

PATCH 2/2 ASoC: starfive: Add drivers of Cadence Multi-Channel I2S Controller

In reply to Xingyu Wu

Add the drivers of Cadence Multi-Channel I2S Controller on the StarFive JH8100 SoC.

The Cadence I2S Controller implements a function of the multi-channel (up to 8-channel) bus. Each stereo channel combines functions of a transmitter and a receiver. Each channel has independent gating, clock and interruption control. It alos support some of these channels are used as playback and others can also be used as record in the same time.

---
 MAINTAINERS                              |   7 +
 sound/soc/starfive/Kconfig               |  18 +
 sound/soc/starfive/Makefile              |   4 +
 sound/soc/starfive/cdns-jh8100-i2s-pcm.c | 262 ++++++++
 sound/soc/starfive/cdns-jh8100-i2s.c     | 727 +++++++++++++++++++++++
 sound/soc/starfive/cdns-jh8100-i2s.h     | 171 ++++++
 6 files changed, 1189 insertions(+)
 create mode 100644 sound/soc/starfive/cdns-jh8100-i2s-pcm.c
 create mode 100644 sound/soc/starfive/cdns-jh8100-i2s.c
 create mode 100644 sound/soc/starfive/cdns-jh8100-i2s.h
MAINTAINERS +7 -0
index 9104430e148e..f920297e1594 100644
@@ -20658,6 +20658,13 @@ F:	Documentation/devicetree/bindings/power/starfive*
 F:	drivers/pmdomain/starfive/
 F:	include/dt-bindings/power/starfive,jh7110-pmu.h
 
+STARFIVE JH8100 CDNS I2S CONTROLLER DRIVER
+M:	Xingyu Wu <[email protected]>
+M:	Walker Chen <[email protected]>
+S:	Supported
+F:	Documentation/devicetree/bindings/sound/cdns,jh8100-i2s.yaml
+F:	sound/soc/starfive/cdns-jh8100-i2s*
+
 STARFIVE SOC DRIVERS
 M:	Conor Dooley <[email protected]>
 S:	Maintained
sound/soc/starfive/Kconfig +18 -0
index 279ac5c1d309..f2ee72e8536d 100644
@@ -22,3 +22,21 @@ 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_CADENCE_I2S
+        tristate "Cadence I2S Controller Device Driver for StarFive JH8100 SoC"
+	depends on HAVE_CLK && SND_SOC_STARFIVE
+        select SND_SOC_GENERIC_DMAENGINE_PCM
+        help
+         Say Y or M if you want to add support for I2S driver for the
+         StarFive JH8100 Cadence Multi-Channel I2S Controller device.
+
+
+config SND_SOC_JH8100_CADENCE_I2S_PCM
+        bool "PCM PIO extension for CDNS I2S driver on the StarFive JH8100 SoC"
+        depends on SND_SOC_JH8100_CADENCE_I2S
+        help
+         Say Y or N if you want to add a custom ALSA extension that registers
+         a PCM and uses PIO to transfer data.
+         This functionality is specially suited for I2S devices that don't have
+         DMA support.
sound/soc/starfive/Makefile +4 -0
index 9e958f70ef51..9f8fd0ad6187 100644
@@ -1,3 +1,7 @@
 # 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_CADENCE_I2S) += jh8100-i2s.o
+jh8100-i2s-y := cdns-jh8100-i2s.o
+jh8100-i2s-$(CONFIG_SND_SOC_JH8100_CADENCE_I2S_PCM) += cdns-jh8100-i2s-pcm.o
sound/soc/starfive/cdns-jh8100-i2s-pcm.c new file +262 -0

262 lines not on this page · raw message

sound/soc/starfive/cdns-jh8100-i2s.c new file +727 -0

727 lines not on this page · raw message

sound/soc/starfive/cdns-jh8100-i2s.h new file +171 -0

171 lines not on this page · raw message

Signature · 1 line
2.25.1
maintainer
#11 lore raw

Re: [PATCH v1 2/2] ASoC: starfive: Add drivers of Cadence Multi-Channel I2S Controller

Quoted 3 lines · Xingyu Wu
 sound/soc/starfive/cdns-jh8100-i2s-pcm.c | 262 ++++++++
 sound/soc/starfive/cdns-jh8100-i2s.c     | 727 +++++++++++++++++++++++
 sound/soc/starfive/cdns-jh8100-i2s.h     | 171 ++++++

If this is a Cadence IP why is the entire driver SoC specific?

author
#12 lore raw

Re: [PATCH v1 2/2] ASoC: starfive: Add drivers of Cadence Multi-Channel I2S Controller

Quoted 7 lines · Mark Brown
Quoted 3 lines · Xingyu Wu
 sound/soc/starfive/cdns-jh8100-i2s-pcm.c | 262 ++++++++
 sound/soc/starfive/cdns-jh8100-i2s.c     | 727 +++++++++++++++++++++++
 sound/soc/starfive/cdns-jh8100-i2s.h     | 171 ++++++

If this is a Cadence IP why is the entire driver SoC specific?

This a new driver about this Cadence I2S controller. Should I create a new folder and file like this:

sound/soc/cdns/cdns-i2s*

and I use different compatible to support other SoC like JH8100?

Best regards,
Xingyu Wu

maintainer
#13 lore raw

Re: [PATCH v1 2/2] ASoC: starfive: Add drivers of Cadence Multi-Channel I2S Controller

Quoted 7 lines · Xingyu Wu
Quoted 5 lines · Mark Brown
Quoted 3 lines · Xingyu Wu
 sound/soc/starfive/cdns-jh8100-i2s-pcm.c | 262 ++++++++
 sound/soc/starfive/cdns-jh8100-i2s.c     | 727 +++++++++++++++++++++++
 sound/soc/starfive/cdns-jh8100-i2s.h     | 171 ++++++
Quoted 7 lines
Quoted 1 line

If this is a Cadence IP why is the entire driver SoC specific?

This a new driver about this Cadence I2S controller. Should I create a new folder and file like this:

sound/soc/cdns/cdns-i2s*

and I use different compatible to support other SoC like JH8100?

Yes, that seems more what I'd expect - with a fallback compatible for things that don't need any special quirks.

author
#14 lore raw

Re: [PATCH v1 2/2] ASoC: starfive: Add drivers of Cadence Multi-Channel I2S Controller

Quoted 10 lines · Mark Brown
Quoted 8 lines · Xingyu Wu
Quoted 7 lines · Mark Brown
Quoted 3 lines · Xingyu Wu
 sound/soc/starfive/cdns-jh8100-i2s-pcm.c | 262 ++++++++
 sound/soc/starfive/cdns-jh8100-i2s.c     | 727 +++++++++++++++++++++++
 sound/soc/starfive/cdns-jh8100-i2s.h     | 171 ++++++

If this is a Cadence IP why is the entire driver SoC specific?

Quoted 8 lines
Quoted 5 lines

This a new driver about this Cadence I2S controller. Should I create a new folder and file like this:

sound/soc/cdns/cdns-i2s*

and I use different compatible to support other SoC like JH8100?

Yes, that seems more what I'd expect - with a fallback compatible for things that don't need any special quirks.

Okay, I will modify these in next version.

Thanks,
Xingyu Wu

#15 lore raw

Re: [PATCH v1 2/2] ASoC: starfive: Add drivers of Cadence Multi-Channel I2S Controller

In reply to Xingyu Wu
kernel test robot noticed the following build warnings:

Hi Xingyu,

kernel test robot noticed the following build warnings:

[auto build test WARNING on broonie-sound/for-next]
[also build test WARNING on robh/for-next linus/master v6.7-rc6 next-20231222] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Xingyu-Wu/dt-bindings-ASoC-Add-Cadence-I2S-controller-for-StarFive-JH8100-SoC/20231222-172628
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
patch link:    https://lore.kernel.org/r/20231221033223.73201-3-xingyu.wu%40starfivetech.com
patch subject: [PATCH v1 2/2] ASoC: starfive: Add drivers of Cadence Multi-Channel I2S Controller
config: parisc-allyesconfig (https://download.01.org/0day-ci/archive/20231223/[email protected]/config)
compiler: hppa-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231223/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

>> sound/soc/starfive/cdns-jh8100-i2s.c:519:12: warning: 'cdns_jh8100_i2s_runtime_resume' defined but not used [-Wunused-function]

519 | static int cdns_jh8100_i2s_runtime_resume(struct device *dev)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/cdns_jh8100_i2s_runtime_resume +519 sound/soc/starfive/cdns-jh8100-i2s.c

518

 > 519	static int cdns_jh8100_i2s_runtime_resume(struct device *dev)

520 {
521 struct cdns_jh8100_i2s_dev *i2s = dev_get_drvdata(dev);
522
523 return clk_prepare_enable(i2s->clks[1].clk); /* ICG clock */
524 }
525

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#16 lore raw

Re: [PATCH v1 2/2] ASoC: starfive: Add drivers of Cadence Multi-Channel I2S Controller

In reply to Xingyu Wu
kernel test robot noticed the following build warnings:

Hi Xingyu,

kernel test robot noticed the following build warnings:

[auto build test WARNING on broonie-sound/for-next]
[also build test WARNING on robh/for-next linus/master v6.7-rc6 next-20231222] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Xingyu-Wu/dt-bindings-ASoC-Add-Cadence-I2S-controller-for-StarFive-JH8100-SoC/20231222-172628
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
patch link:    https://lore.kernel.org/r/20231221033223.73201-3-xingyu.wu%40starfivetech.com
patch subject: [PATCH v1 2/2] ASoC: starfive: Add drivers of Cadence Multi-Channel I2S Controller
config: sparc64-randconfig-r071-20231223 (https://download.01.org/0day-ci/archive/20231223/[email protected]/config)
compiler: sparc64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231223/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

In file included from sound/soc/starfive/cdns-jh8100-i2s.c:18:

>> sound/soc/starfive/cdns-jh8100-i2s.h:163:6: warning: no previous prototype for 'cdns_jh8100_i2s_pcm_push_tx' [-Wmissing-prototypes]
     163 | void cdns_jh8100_i2s_pcm_push_tx(struct cdns_jh8100_i2s_dev *dev) { }
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>> sound/soc/starfive/cdns-jh8100-i2s.h:164:6: warning: no previous prototype for 'cdns_jh8100_i2s_pcm_pop_rx' [-Wmissing-prototypes]
     164 | void cdns_jh8100_i2s_pcm_pop_rx(struct cdns_jh8100_i2s_dev *dev) { }
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> sound/soc/starfive/cdns-jh8100-i2s.h:165:5: warning: no previous prototype for 'cdns_jh8100_i2s_pcm_register' [-Wmissing-prototypes]

165 | int cdns_jh8100_i2s_pcm_register(struct platform_device *pdev)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/cdns_jh8100_i2s_pcm_push_tx +163 sound/soc/starfive/cdns-jh8100-i2s.h

157
158 #if IS_ENABLED(CONFIG_SND_SOC_JH8100_CADENCE_I2S_PCM)
159 void cdns_jh8100_i2s_pcm_push_tx(struct cdns_jh8100_i2s_dev *dev);
160 void cdns_jh8100_i2s_pcm_pop_rx(struct cdns_jh8100_i2s_dev *dev);
161 int cdns_jh8100_i2s_pcm_register(struct platform_device *pdev);
162 #else

 > 163	void cdns_jh8100_i2s_pcm_push_tx(struct cdns_jh8100_i2s_dev *dev) { }
 > 164	void cdns_jh8100_i2s_pcm_pop_rx(struct cdns_jh8100_i2s_dev *dev) { }
 > 165	int cdns_jh8100_i2s_pcm_register(struct platform_device *pdev)

166 {
167 return -EINVAL;
168 }
169 #endif
170

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki