diff mbox series

[v2,2/3] arm64: dts: rockchip: Add SPDIF nodes to RK3588(s) device trees

Message ID 20250108-rk3588-h96-max-v58-v2-2-522301b905d6@gmail.com (mailing list archive)
State New
Headers show
Series arm64: dts: rockchip: Add H96 Max V58 (RK3588 based TV box) | expand

Commit Message

Alexey Charkov Jan. 8, 2025, 9:09 a.m. UTC
RK3588s has four SPDIF transmitters, and the full RK3588 has six.
They are fully compatible to RK3568 ones. Add respective nodes
to .dtsi files.

Adapted from vendor sources at [1] and [2], respectively

[1] https://github.com/rockchip-linux/kernel/blob/develop-5.10/arch/arm64/boot/dts/rockchip/rk3588s.dtsi
[2] https://github.com/rockchip-linux/kernel/blob/develop-5.10/arch/arm64/boot/dts/rockchip/rk3588.dtsi

Signed-off-by: Alexey Charkov <alchark@gmail.com>
---
 arch/arm64/boot/dts/rockchip/rk3588-base.dtsi  | 64 ++++++++++++++++++++++++++
 arch/arm64/boot/dts/rockchip/rk3588-extra.dtsi | 30 ++++++++++++
 2 files changed, 94 insertions(+)

Comments

Heiko Stübner Jan. 8, 2025, 10:01 a.m. UTC | #1
Hi Alexey,

Am Mittwoch, 8. Januar 2025, 10:09:07 CET schrieb Alexey Charkov:
> RK3588s has four SPDIF transmitters, and the full RK3588 has six.
> They are fully compatible to RK3568 ones. Add respective nodes
> to .dtsi files.

While it may seem that way, we still want soc-specific compatibles,
to future-proof this.

I.e. going the the
	compatible = "rockchip,rk3588-spdif", "rockchip,rk3568-spdif";
way, so that now things can just match against the rk3568, but if some
fault emerges later on the code can be fixed with the DT staying just
compatible.

The spdif also has an example already for all the spdif variants that are
compatible to the rk3066 [3], so it'd need another "items" block for things
being compatible with the rk3568.


Heiko


[3] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/Documentation/devicetree/bindings/sound/rockchip-spdif.yaml

> Adapted from vendor sources at [1] and [2], respectively
> 
> [1] https://github.com/rockchip-linux/kernel/blob/develop-5.10/arch/arm64/boot/dts/rockchip/rk3588s.dtsi
> [2] https://github.com/rockchip-linux/kernel/blob/develop-5.10/arch/arm64/boot/dts/rockchip/rk3588.dtsi
> 
> Signed-off-by: Alexey Charkov <alchark@gmail.com>
> ---
>  arch/arm64/boot/dts/rockchip/rk3588-base.dtsi  | 64 ++++++++++++++++++++++++++
>  arch/arm64/boot/dts/rockchip/rk3588-extra.dtsi | 30 ++++++++++++
>  2 files changed, 94 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
> index 8cfa30837ce72581d0b513a8274ab0177eb5ae15..ff0c9191737b34979a408067df1a664dbe87395f 100644
> --- a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
> +++ b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
> @@ -1318,6 +1318,21 @@ vop_mmu: iommu@fdd97e00 {
>  		status = "disabled";
>  	};
>  
> +	spdif_tx2: spdif-tx@fddb0000 {
> +		compatible = "rockchip,rk3568-spdif";
> +		reg = <0x0 0xfddb0000 0x0 0x1000>;
> +		assigned-clock-parents = <&cru PLL_AUPLL>;
> +		assigned-clocks = <&cru CLK_SPDIF2_DP0_SRC>;
> +		clock-names = "mclk", "hclk";
> +		clocks = <&cru MCLK_SPDIF2>, <&cru HCLK_SPDIF2_DP0>;
> +		dma-names = "tx";
> +		dmas = <&dmac1 6>;
> +		interrupts = <GIC_SPI 195 IRQ_TYPE_LEVEL_HIGH 0>;
> +		power-domains = <&power RK3588_PD_VO0>;
> +		#sound-dai-cells = <0>;
> +		status = "disabled";
> +	};
> +
>  	i2s4_8ch: i2s@fddc0000 {
>  		compatible = "rockchip,rk3588-i2s-tdm";
>  		reg = <0x0 0xfddc0000 0x0 0x1000>;
> @@ -1335,6 +1350,21 @@ i2s4_8ch: i2s@fddc0000 {
>  		status = "disabled";
>  	};
>  
> +	spdif_tx3: spdif-tx@fdde0000 {
> +		compatible = "rockchip,rk3568-spdif";
> +		reg = <0x0 0xfdde0000 0x0 0x1000>;
> +		assigned-clock-parents = <&cru PLL_AUPLL>;
> +		assigned-clocks = <&cru CLK_SPDIF3_SRC>;
> +		clock-names = "mclk", "hclk";
> +		clocks = <&cru MCLK_SPDIF3>, <&cru HCLK_SPDIF3>;
> +		dma-names = "tx";
> +		dmas = <&dmac1 7>;
> +		interrupts = <GIC_SPI 196 IRQ_TYPE_LEVEL_HIGH 0>;
> +		power-domains = <&power RK3588_PD_VO1>;
> +		#sound-dai-cells = <0>;
> +		status = "disabled";
> +	};
> +
>  	i2s5_8ch: i2s@fddf0000 {
>  		compatible = "rockchip,rk3588-i2s-tdm";
>  		reg = <0x0 0xfddf0000 0x0 0x1000>;
> @@ -2016,6 +2046,40 @@ &i2s3_sdi
>  		status = "disabled";
>  	};
>  
> +	spdif_tx0: spdif-tx@fe4e0000 {
> +		compatible = "rockchip,rk3568-spdif";
> +		reg = <0x0 0xfe4e0000 0x0 0x1000>;
> +		assigned-clock-parents = <&cru PLL_AUPLL>;
> +		assigned-clocks = <&cru CLK_SPDIF0_SRC>;
> +		clock-names = "mclk", "hclk";
> +		clocks = <&cru MCLK_SPDIF0>, <&cru HCLK_SPDIF0>;
> +		dma-names = "tx";
> +		dmas = <&dmac0 5>;
> +		interrupts = <GIC_SPI 193 IRQ_TYPE_LEVEL_HIGH 0>;
> +		pinctrl-0 = <&spdif0m0_tx>;
> +		pinctrl-names = "default";
> +		power-domains = <&power RK3588_PD_AUDIO>;
> +		#sound-dai-cells = <0>;
> +		status = "disabled";
> +	};
> +
> +	spdif_tx1: spdif-tx@fe4f0000 {
> +		compatible = "rockchip,rk3568-spdif";
> +		reg = <0x0 0xfe4f0000 0x0 0x1000>;
> +		assigned-clock-parents = <&cru PLL_AUPLL>;
> +		assigned-clocks = <&cru CLK_SPDIF1_SRC>;
> +		clock-names = "mclk", "hclk";
> +		clocks = <&cru MCLK_SPDIF1>, <&cru HCLK_SPDIF1>;
> +		dma-names = "tx";
> +		dmas = <&dmac1 5>;
> +		interrupts = <GIC_SPI 194 IRQ_TYPE_LEVEL_HIGH 0>;
> +		pinctrl-0 = <&spdif1m0_tx>;
> +		pinctrl-names = "default";
> +		power-domains = <&power RK3588_PD_AUDIO>;
> +		#sound-dai-cells = <0>;
> +		status = "disabled";
> +	};
> +
>  	gic: interrupt-controller@fe600000 {
>  		compatible = "arm,gic-v3";
>  		reg = <0x0 0xfe600000 0 0x10000>, /* GICD */
> diff --git a/arch/arm64/boot/dts/rockchip/rk3588-extra.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-extra.dtsi
> index 4a950907ea6f51c1d4123d52b73b726226db37bc..ba1bcd12c558847680aaaa2377d6d0a84fdaa1db 100644
> --- a/arch/arm64/boot/dts/rockchip/rk3588-extra.dtsi
> +++ b/arch/arm64/boot/dts/rockchip/rk3588-extra.dtsi
> @@ -67,6 +67,21 @@ u2phy1_otg: otg-port {
>  		};
>  	};
>  
> +	spdif_tx5: spdif-tx@fddb8000 {
> +		compatible = "rockchip,rk3568-spdif";
> +		reg = <0x0 0xfddb8000 0x0 0x1000>;
> +		assigned-clock-parents = <&cru PLL_AUPLL>;
> +		assigned-clocks = <&cru CLK_SPDIF5_DP1_SRC>;
> +		clock-names = "mclk", "hclk";
> +		clocks = <&cru MCLK_SPDIF5>, <&cru HCLK_SPDIF5_DP1>;
> +		dma-names = "tx";
> +		dmas = <&dmac1 22>;
> +		interrupts = <GIC_SPI 198 IRQ_TYPE_LEVEL_HIGH 0>;
> +		power-domains = <&power RK3588_PD_VO0>;
> +		#sound-dai-cells = <0>;
> +		status = "disabled";
> +	};
> +
>  	i2s8_8ch: i2s@fddc8000 {
>  		compatible = "rockchip,rk3588-i2s-tdm";
>  		reg = <0x0 0xfddc8000 0x0 0x1000>;
> @@ -84,6 +99,21 @@ i2s8_8ch: i2s@fddc8000 {
>  		status = "disabled";
>  	};
>  
> +	spdif_tx4: spdif-tx@fdde8000 {
> +		compatible = "rockchip,rk3568-spdif";
> +		reg = <0x0 0xfdde8000 0x0 0x1000>;
> +		assigned-clock-parents = <&cru PLL_AUPLL>;
> +		assigned-clocks = <&cru CLK_SPDIF4_SRC>;
> +		clock-names = "mclk", "hclk";
> +		clocks = <&cru MCLK_SPDIF4>, <&cru HCLK_SPDIF4>;
> +		dma-names = "tx";
> +		dmas = <&dmac1 8>;
> +		interrupts = <GIC_SPI 197 IRQ_TYPE_LEVEL_HIGH 0>;
> +		power-domains = <&power RK3588_PD_VO1>;
> +		#sound-dai-cells = <0>;
> +		status = "disabled";
> +	};
> +
>  	i2s6_8ch: i2s@fddf4000 {
>  		compatible = "rockchip,rk3588-i2s-tdm";
>  		reg = <0x0 0xfddf4000 0x0 0x1000>;
> 
>
Alexey Charkov Jan. 8, 2025, 3:30 p.m. UTC | #2
On Wed, Jan 8, 2025 at 2:01 PM Heiko Stübner <heiko@sntech.de> wrote:
>
> Hi Alexey,
>
> Am Mittwoch, 8. Januar 2025, 10:09:07 CET schrieb Alexey Charkov:
> > RK3588s has four SPDIF transmitters, and the full RK3588 has six.
> > They are fully compatible to RK3568 ones. Add respective nodes
> > to .dtsi files.
>
> While it may seem that way, we still want soc-specific compatibles,
> to future-proof this.
>
> I.e. going the the
>         compatible = "rockchip,rk3588-spdif", "rockchip,rk3568-spdif";
> way, so that now things can just match against the rk3568, but if some
> fault emerges later on the code can be fixed with the DT staying just
> compatible.
>
> The spdif also has an example already for all the spdif variants that are
> compatible to the rk3066 [3], so it'd need another "items" block for things
> being compatible with the rk3568.

Hmm, if we are to believe the driver ([4], [5]), they are all the same
as the good old RK3366, which in turn is software compatible to the
good old RK3066. Same seems to apply to RK3576, given that its current
.dtsi just references the "rockchip,rk3568-spdif" compatible.

Does it mean that the binding needs to be restructured so that the
required fallback compatible ("rockchip,rk3066-spdif") applies to all
variants? Or shall the existing ones be left alone, and just RK3588
and RK3576 added inside that "items" block?

Thanks a lot,
Alexey

[4] https://github.com/rockchip-linux/kernel/blob/develop-5.10/sound/soc/rockchip/rockchip_spdif.c
[5] https://github.com/torvalds/linux/blob/master/sound/soc/rockchip/rockchip_spdif.c
Heiko Stübner Jan. 8, 2025, 10:28 p.m. UTC | #3
Hi Alexey,

Am Mittwoch, 8. Januar 2025, 16:30:35 CET schrieb Alexey Charkov:
> On Wed, Jan 8, 2025 at 2:01 PM Heiko Stübner <heiko@sntech.de> wrote:
> >
> > Hi Alexey,
> >
> > Am Mittwoch, 8. Januar 2025, 10:09:07 CET schrieb Alexey Charkov:
> > > RK3588s has four SPDIF transmitters, and the full RK3588 has six.
> > > They are fully compatible to RK3568 ones. Add respective nodes
> > > to .dtsi files.
> >
> > While it may seem that way, we still want soc-specific compatibles,
> > to future-proof this.
> >
> > I.e. going the the
> >         compatible = "rockchip,rk3588-spdif", "rockchip,rk3568-spdif";
> > way, so that now things can just match against the rk3568, but if some
> > fault emerges later on the code can be fixed with the DT staying just
> > compatible.
> >
> > The spdif also has an example already for all the spdif variants that are
> > compatible to the rk3066 [3], so it'd need another "items" block for things
> > being compatible with the rk3568.
> 
> Hmm, if we are to believe the driver ([4], [5]), they are all the same
> as the good old RK3366, which in turn is software compatible to the
> good old RK3066. Same seems to apply to RK3576, given that its current
> .dtsi just references the "rockchip,rk3568-spdif" compatible.

I was for a short while afraid that something slipped into mainline :-)
But I guess that "rockchip,rk3568-spdif" compatible on the rk3576 is
only used in the vendor-kernel.


> Does it mean that the binding needs to be restructured so that the
> required fallback compatible ("rockchip,rk3066-spdif") applies to all
> variants? Or shall the existing ones be left alone, and just RK3588
> and RK3576 added inside that "items" block?

I noticed that the spdif binding has had an interestings growth over
the years, with some socs being outliers.

I wouldn't change the whole binding, especially as that then touches
established stuff.

The question would be weather to add the rk3588 + rk3576 to the
existing enum marking them as compatible with the rk3066, or create
a separate items block and just saying the rk3588-spdif is compatible with
the rk3568 one, like:

[...]
      - const: rockchip,rk3568-spdif
      - items:
          - enum:
              - rockchip,rk3128-spdif
              - rockchip,rk3188-spdif
              - rockchip,rk3288-spdif
              - rockchip,rk3308-spdif
          - const: rockchip,rk3066-spdif
      - items:
          - enum:
              - rockchip,rk3576-spdif
              - rockchip,rk3588-spdif
          - const: rockchip,rk3568-spdif
[...]

With the RK3066 being released in 2012, part of me is amazed that that
block survived that long, on the other hand going with the above snippet
somehow feels saver ;-) .


Heiko

> [4] https://github.com/rockchip-linux/kernel/blob/develop-5.10/sound/soc/rockchip/rockchip_spdif.c
> [5] https://github.com/torvalds/linux/blob/master/sound/soc/rockchip/rockchip_spdif.c
>
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
index 8cfa30837ce72581d0b513a8274ab0177eb5ae15..ff0c9191737b34979a408067df1a664dbe87395f 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
@@ -1318,6 +1318,21 @@  vop_mmu: iommu@fdd97e00 {
 		status = "disabled";
 	};
 
+	spdif_tx2: spdif-tx@fddb0000 {
+		compatible = "rockchip,rk3568-spdif";
+		reg = <0x0 0xfddb0000 0x0 0x1000>;
+		assigned-clock-parents = <&cru PLL_AUPLL>;
+		assigned-clocks = <&cru CLK_SPDIF2_DP0_SRC>;
+		clock-names = "mclk", "hclk";
+		clocks = <&cru MCLK_SPDIF2>, <&cru HCLK_SPDIF2_DP0>;
+		dma-names = "tx";
+		dmas = <&dmac1 6>;
+		interrupts = <GIC_SPI 195 IRQ_TYPE_LEVEL_HIGH 0>;
+		power-domains = <&power RK3588_PD_VO0>;
+		#sound-dai-cells = <0>;
+		status = "disabled";
+	};
+
 	i2s4_8ch: i2s@fddc0000 {
 		compatible = "rockchip,rk3588-i2s-tdm";
 		reg = <0x0 0xfddc0000 0x0 0x1000>;
@@ -1335,6 +1350,21 @@  i2s4_8ch: i2s@fddc0000 {
 		status = "disabled";
 	};
 
+	spdif_tx3: spdif-tx@fdde0000 {
+		compatible = "rockchip,rk3568-spdif";
+		reg = <0x0 0xfdde0000 0x0 0x1000>;
+		assigned-clock-parents = <&cru PLL_AUPLL>;
+		assigned-clocks = <&cru CLK_SPDIF3_SRC>;
+		clock-names = "mclk", "hclk";
+		clocks = <&cru MCLK_SPDIF3>, <&cru HCLK_SPDIF3>;
+		dma-names = "tx";
+		dmas = <&dmac1 7>;
+		interrupts = <GIC_SPI 196 IRQ_TYPE_LEVEL_HIGH 0>;
+		power-domains = <&power RK3588_PD_VO1>;
+		#sound-dai-cells = <0>;
+		status = "disabled";
+	};
+
 	i2s5_8ch: i2s@fddf0000 {
 		compatible = "rockchip,rk3588-i2s-tdm";
 		reg = <0x0 0xfddf0000 0x0 0x1000>;
@@ -2016,6 +2046,40 @@  &i2s3_sdi
 		status = "disabled";
 	};
 
+	spdif_tx0: spdif-tx@fe4e0000 {
+		compatible = "rockchip,rk3568-spdif";
+		reg = <0x0 0xfe4e0000 0x0 0x1000>;
+		assigned-clock-parents = <&cru PLL_AUPLL>;
+		assigned-clocks = <&cru CLK_SPDIF0_SRC>;
+		clock-names = "mclk", "hclk";
+		clocks = <&cru MCLK_SPDIF0>, <&cru HCLK_SPDIF0>;
+		dma-names = "tx";
+		dmas = <&dmac0 5>;
+		interrupts = <GIC_SPI 193 IRQ_TYPE_LEVEL_HIGH 0>;
+		pinctrl-0 = <&spdif0m0_tx>;
+		pinctrl-names = "default";
+		power-domains = <&power RK3588_PD_AUDIO>;
+		#sound-dai-cells = <0>;
+		status = "disabled";
+	};
+
+	spdif_tx1: spdif-tx@fe4f0000 {
+		compatible = "rockchip,rk3568-spdif";
+		reg = <0x0 0xfe4f0000 0x0 0x1000>;
+		assigned-clock-parents = <&cru PLL_AUPLL>;
+		assigned-clocks = <&cru CLK_SPDIF1_SRC>;
+		clock-names = "mclk", "hclk";
+		clocks = <&cru MCLK_SPDIF1>, <&cru HCLK_SPDIF1>;
+		dma-names = "tx";
+		dmas = <&dmac1 5>;
+		interrupts = <GIC_SPI 194 IRQ_TYPE_LEVEL_HIGH 0>;
+		pinctrl-0 = <&spdif1m0_tx>;
+		pinctrl-names = "default";
+		power-domains = <&power RK3588_PD_AUDIO>;
+		#sound-dai-cells = <0>;
+		status = "disabled";
+	};
+
 	gic: interrupt-controller@fe600000 {
 		compatible = "arm,gic-v3";
 		reg = <0x0 0xfe600000 0 0x10000>, /* GICD */
diff --git a/arch/arm64/boot/dts/rockchip/rk3588-extra.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-extra.dtsi
index 4a950907ea6f51c1d4123d52b73b726226db37bc..ba1bcd12c558847680aaaa2377d6d0a84fdaa1db 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588-extra.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3588-extra.dtsi
@@ -67,6 +67,21 @@  u2phy1_otg: otg-port {
 		};
 	};
 
+	spdif_tx5: spdif-tx@fddb8000 {
+		compatible = "rockchip,rk3568-spdif";
+		reg = <0x0 0xfddb8000 0x0 0x1000>;
+		assigned-clock-parents = <&cru PLL_AUPLL>;
+		assigned-clocks = <&cru CLK_SPDIF5_DP1_SRC>;
+		clock-names = "mclk", "hclk";
+		clocks = <&cru MCLK_SPDIF5>, <&cru HCLK_SPDIF5_DP1>;
+		dma-names = "tx";
+		dmas = <&dmac1 22>;
+		interrupts = <GIC_SPI 198 IRQ_TYPE_LEVEL_HIGH 0>;
+		power-domains = <&power RK3588_PD_VO0>;
+		#sound-dai-cells = <0>;
+		status = "disabled";
+	};
+
 	i2s8_8ch: i2s@fddc8000 {
 		compatible = "rockchip,rk3588-i2s-tdm";
 		reg = <0x0 0xfddc8000 0x0 0x1000>;
@@ -84,6 +99,21 @@  i2s8_8ch: i2s@fddc8000 {
 		status = "disabled";
 	};
 
+	spdif_tx4: spdif-tx@fdde8000 {
+		compatible = "rockchip,rk3568-spdif";
+		reg = <0x0 0xfdde8000 0x0 0x1000>;
+		assigned-clock-parents = <&cru PLL_AUPLL>;
+		assigned-clocks = <&cru CLK_SPDIF4_SRC>;
+		clock-names = "mclk", "hclk";
+		clocks = <&cru MCLK_SPDIF4>, <&cru HCLK_SPDIF4>;
+		dma-names = "tx";
+		dmas = <&dmac1 8>;
+		interrupts = <GIC_SPI 197 IRQ_TYPE_LEVEL_HIGH 0>;
+		power-domains = <&power RK3588_PD_VO1>;
+		#sound-dai-cells = <0>;
+		status = "disabled";
+	};
+
 	i2s6_8ch: i2s@fddf4000 {
 		compatible = "rockchip,rk3588-i2s-tdm";
 		reg = <0x0 0xfddf4000 0x0 0x1000>;