mbox series

[v2,0/9] ASoC: add Renesas MSIOF sound driver

Message ID 87h62vh5mj.wl-kuninori.morimoto.gx@renesas.com
Headers show
Series ASoC: add Renesas MSIOF sound driver | expand

Message

Kuninori Morimoto April 11, 2025, 1:03 a.m. UTC
Hi Mark, Rob, Krzysztof
Cc Geert

Renesas MSIOF can work as both SPI and I2S.
Current Linux supports MSIOF-SPI. This patch-set adds new MSIOF-I2S.

Because it is using same HW-IP, we want to share same compatible for both
MSIOF-SPI/I2S case. MSIOF-I2S (Sound) will use Audio-Graph-Card/Card2 which
uses Of-Graph, but  MSIOF-SPI is not use Of-Graph.
So, this patch-set assumes it was used as MSIOF-I2S if DT is using Of-Graph,
otherwise, it is MSIOF-SPI (This assumption will works if SPI *never*
use Of-Graph in the future).

Link: https://lore.kernel.org/r/875xjeb0wu.wl-kuninori.morimoto.gx@renesas.com

v1 -> v2
	- Merge I2S DT bindings into SPI DT
	- add "dt-bindings: " in Subject ([1/9])
	- use dev instead of pdev->dev ([2/9])
	- use __free() ([3/9])
	- Add Geert's Reviewed-by ([3/9])
	- Tidyup top NOTE ([6/9])
	- Remove unused defines ([6/9])
	- remove "probed" ([6/9])
	- remove MODULE_ALIAS([6/9])
	- rename "spi" to "serial-engine" ([7/9])
	- add MSIOF on defconfig ([9/9])

Kuninori Morimoto (9):
  dt-bindings: renesas,sh-msiof: Add MSIOF I2S Sound support
  spi: sh-msiof: use dev in sh_msiof_spi_probe()
  spi: sh-msiof: ignore driver probing if it was MSIOF Sound
  ASoC: renesas: rsnd: allow to use ADG only
  ASoC: renesas: rsnd: enable to use "adg" clock
  ASoC: renesas: add MSIOF sound support
  arm64: dts: renesas: r8a779g0: tidyup MSIOF node name
  arm64: dts: renesas: sparrow hawk: Add MSIOF Sound support
  arm64: defconfig: add Renesas MSIOF sound support

 .../bindings/spi/renesas,sh-msiof.yaml        |  23 +-
 arch/arm64/boot/dts/renesas/r8a779g0.dtsi     |  12 +-
 .../dts/renesas/r8a779g3-sparrow-hawk.dts     |  98 +++
 arch/arm64/configs/defconfig                  |   1 +
 drivers/spi/spi-sh-msiof.c                    |  42 +-
 sound/soc/renesas/Kconfig                     |   7 +
 sound/soc/renesas/rcar/Makefile               |   3 +
 sound/soc/renesas/rcar/adg.c                  |  44 +-
 sound/soc/renesas/rcar/core.c                 |   7 +-
 sound/soc/renesas/rcar/msiof.c                | 566 ++++++++++++++++++
 10 files changed, 761 insertions(+), 42 deletions(-)
 create mode 100644 sound/soc/renesas/rcar/msiof.c

Comments

Rob Herring April 11, 2025, 7:41 p.m. UTC | #1
On Fri, Apr 11, 2025 at 01:03:27AM +0000, Kuninori Morimoto wrote:
> Renesas MSIOF (Clock-Synchronized Serial Interface with FIFO) can work as
> both SPI and I2S. MSIOF-I2S will use Audio Graph Card/Card2 driver which
> uses Of-Graph in DT.
> 
> MSIOF-SPI/I2S are using same DT compatible properties.
> MSIOF-I2S         uses Of-Graph for Audio-Graph-Card/Card2,
> MSIOF-SPI doesn't use  Of-Graph.
> 
> Adds schema for MSIOF-I2S (= Sound).
> Because MSIOF is no longer SPI specific device, remove spi specific schema
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  .../bindings/spi/renesas,sh-msiof.yaml        | 23 +++++++++++++------
>  1 file changed, 16 insertions(+), 7 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/spi/renesas,sh-msiof.yaml b/Documentation/devicetree/bindings/spi/renesas,sh-msiof.yaml
> index 49649fc3f95a..9f73120e97c1 100644
> --- a/Documentation/devicetree/bindings/spi/renesas,sh-msiof.yaml
> +++ b/Documentation/devicetree/bindings/spi/renesas,sh-msiof.yaml
> @@ -4,14 +4,11 @@
>  $id: http://devicetree.org/schemas/spi/renesas,sh-msiof.yaml#
>  $schema: http://devicetree.org/meta-schemas/core.yaml#
>  
> -title: Renesas MSIOF SPI controller
> +title: Renesas MSIOF SPI / I2S controller
>  
>  maintainers:
>    - Geert Uytterhoeven <geert+renesas@glider.be>
>  
> -allOf:
> -  - $ref: spi-controller.yaml#

if:
  properties:
    $nodename:
      pattern: '^spi@'
then:
  $ref: spi-controller.yaml#

Or just always use 'spi' node name even if used for i2s.

> -
>  properties:
>    compatible:
>      oneOf:
> @@ -70,6 +67,12 @@ properties:
>            - description: CPU registers
>            - description: DMA engine registers
>  
> +  "#address-cells":
> +    enum: [0, 1]
> +
> +  "#size-cells":
> +    const: 0
> +

Then drop these.

>    interrupts:
>      maxItems: 1
>  
> @@ -146,14 +149,20 @@ properties:
>      $ref: /schemas/types.yaml#/definitions/uint32
>      default: 64
>  
> +  # for MSIOF-I2S
> +  port:
> +    $ref: ../sound/audio-graph-port.yaml#/definitions/port-base
> +    unevaluatedProperties: false
> +    patternProperties:
> +      "^endpoint(@[0-9a-f]+)?":
> +        $ref: audio-graph-port.yaml#/definitions/endpoint-base

The correct way is:

port:
  $ref: audio-graph-port.yaml#
  unevaluatedProperties: false

> +
>  required:
>    - compatible
>    - reg
>    - interrupts
>    - clocks
>    - power-domains
> -  - '#address-cells'
> -  - '#size-cells'
>  
>  if:
>    not:
> @@ -173,7 +182,7 @@ examples:
>      #include <dt-bindings/interrupt-controller/arm-gic.h>
>      #include <dt-bindings/power/r8a7791-sysc.h>
>  
> -    msiof0: spi@e6e20000 {
> +    msiof0: serial-engine@e6e20000 {
>          compatible = "renesas,msiof-r8a7791", "renesas,rcar-gen2-msiof";
>          reg = <0xe6e20000 0x0064>;
>          interrupts = <GIC_SPI 156 IRQ_TYPE_LEVEL_HIGH>;
> -- 
> 2.43.0
>
Kuninori Morimoto April 14, 2025, 12:44 a.m. UTC | #2
Hi Rob

> > Renesas MSIOF (Clock-Synchronized Serial Interface with FIFO) can work as
> > both SPI and I2S. MSIOF-I2S will use Audio Graph Card/Card2 driver which
> > uses Of-Graph in DT.
> > 
> > MSIOF-SPI/I2S are using same DT compatible properties.
> > MSIOF-I2S         uses Of-Graph for Audio-Graph-Card/Card2,
> > MSIOF-SPI doesn't use  Of-Graph.
> > 
> > Adds schema for MSIOF-I2S (= Sound).
> > Because MSIOF is no longer SPI specific device, remove spi specific schema
> > 
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > ---
(snip)
> if:
>   properties:
>     $nodename:
>       pattern: '^spi@'
> then:
>   $ref: spi-controller.yaml#
> 
> Or just always use 'spi' node name even if used for i2s.
(snip)
> > +  "#address-cells":
> > +    enum: [0, 1]
> > +
> > +  "#size-cells":
> > +    const: 0
> > +
> 
> Then drop these.
(snip)
> > +  # for MSIOF-I2S
> > +  port:
> > +    $ref: ../sound/audio-graph-port.yaml#/definitions/port-base
> > +    unevaluatedProperties: false
> > +    patternProperties:
> > +      "^endpoint(@[0-9a-f]+)?":
> > +        $ref: audio-graph-port.yaml#/definitions/endpoint-base
> 
> The correct way is:
> 
> port:
>   $ref: audio-graph-port.yaml#
>   unevaluatedProperties: false

Thanks. will fix in v3

Best regards
---
Kuninori Morimoto