Skip to contentSkip to conversation

Add VPU support for RK3128

PATCH Applied Alex Bee 4 participants 13 messages May 23, 2024 – Aug 28, 2024

Subsystems (4)
lore
Share & tools
lore

Alex Bee

author
#0 lore raw

cover Add VPU support for RK3128

Similar to most Rockchip SoCs RK312x have hantro G1 based decoder and a hantro H1 based encoder with attached iommu.

The existing drivers can be used as-is.

Fluster scores:
- FFmpeg:
- H.264: 127/135
- VP8: 59/61
- GStreamer:
- H.264: 129/135
- VP8: 59/61

Alex Bee (3):
dt-bindings: media: rockchip,vpu: Document RK3128 compatible
soc: rockchip: grf: Set RK3128's vpu main clock
ARM: dts: rockchip: Add vpu nodes for RK3128

 .../bindings/media/rockchip-vpu.yaml          |  4 +++-
 arch/arm/boot/dts/rockchip/rk3128.dtsi        | 24 +++++++++++++++++++
 drivers/soc/rockchip/grf.c                    |  2 ++
 3 files changed, 29 insertions(+), 1 deletion(-)
Signature · 1 line
2.45.0
author
#1 lore raw

PATCH 1/3 dt-bindings: media: rockchip,vpu: Document RK3128 compatible

The integration for this SoC is similar to RK3066/RK3188.

Document it's compatible.

---
 Documentation/devicetree/bindings/media/rockchip-vpu.yaml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/media/rockchip-vpu.yaml +3 -1
index c57e1f488895..d1b47b14ca57 100644
@@ -26,7 +26,9 @@ properties:
           - rockchip,rk3568-vpu
           - rockchip,rk3588-av1-vpu
       - items:
-          - const: rockchip,rk3188-vpu
+          - enum:
+              - rockchip,rk3128-vpu
+              - rockchip,rk3188-vpu
           - const: rockchip,rk3066-vpu
       - items:
           - const: rockchip,rk3228-vpu
Signature · 1 line
2.45.0
maintainer Reviewed-by on v1 1/3
#3 lore raw

Re: [PATCH 1/3] dt-bindings: media: rockchip,vpu: Document RK3128 compatible

In reply to Alex Bee

Am Donnerstag, 23. Mai 2024, 20:56:31 CEST schrieb Alex Bee:

Quoted 5 lines

The integration for this SoC is similar to RK3066/RK3188.

Document it's compatible.

Media people, can you apply this patch alone from the series?

Thanks
Heiko

Quoted 20 lines
---
 Documentation/devicetree/bindings/media/rockchip-vpu.yaml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/media/rockchip-vpu.yaml +3 -1
index c57e1f488895..d1b47b14ca57 100644
@@ -26,7 +26,9 @@ properties:
           - rockchip,rk3568-vpu
           - rockchip,rk3588-av1-vpu
       - items:
-          - const: rockchip,rk3188-vpu
+          - enum:
+              - rockchip,rk3128-vpu
+              - rockchip,rk3188-vpu
           - const: rockchip,rk3066-vpu
       - items:
           - const: rockchip,rk3228-vpu
#4 lore raw

Re: [PATCH 1/3] dt-bindings: media: rockchip,vpu: Document RK3128 compatible

Hey Heiko,

Quoted 10 lines · Heiko Stübner

Am Donnerstag, 23. Mai 2024, 20:56:31 CEST schrieb Alex Bee:

Quoted 5 lines

The integration for this SoC is similar to RK3066/RK3188.

Document it's compatible.

Media people, can you apply this patch alone from the series?

Yes, will do got this on my list already :).

Quoted 3 lines

Thanks
Heiko

Regards,
Sebastian

Quoted 26 lines
Quoted 21 lines
---
 Documentation/devicetree/bindings/media/rockchip-vpu.yaml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/media/rockchip-vpu.yaml +3 -1
index c57e1f488895..d1b47b14ca57 100644
@@ -26,7 +26,9 @@ properties:
           - rockchip,rk3568-vpu
           - rockchip,rk3588-av1-vpu
       - items:
-          - const: rockchip,rk3188-vpu
+          - enum:
+              - rockchip,rk3128-vpu
+              - rockchip,rk3188-vpu
           - const: rockchip,rk3066-vpu
       - items:
           - const: rockchip,rk3228-vpu
author
#5 lore raw

Re: [PATCH 1/3] dt-bindings: media: rockchip,vpu: Document RK3128 compatible

Hi,

Am 28.05.24 um 10:37 schrieb Sebastian Fricke:

Quoted 8 lines

Hey Heiko,

Quoted 5 lines · Heiko Stübner

Am Donnerstag, 23. Mai 2024, 20:56:31 CEST schrieb Alex Bee:

Quoted 4 lines

The integration for this SoC is similar to RK3066/RK3188.

Document it's compatible.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Media people, can you apply this patch alone from the series?

Yes, will do got this on my list already :).

is there anything holding you back from applying this? It's really only the bindings which go though the media tree (i.e. this patch) and it has been acked and reviewed some weeks ago. It'd be great if we could add the vpu to the SoC DT before 6.11 merge window opens but the addition depends on the compatible to be documented. Please let me know if there's anything left to do for me.

Alex

Quoted 33 lines
Quoted 3 lines

Thanks
Heiko

Regards,
Sebastian

Quoted 26 lines
Quoted 21 lines

---
 Documentation/devicetree/bindings/media/rockchip-vpu.yaml | 4 +++-

 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/media/rockchip-vpu.yaml +0 -0
index c57e1f488895..d1b47b14ca57 100644
@@ -26,7 +26,9 @@ properties:

           - rockchip,rk3568-vpu
           - rockchip,rk3588-av1-vpu
       - items:
-          - const: rockchip,rk3188-vpu
+          - enum:
+              - rockchip,rk3128-vpu
+              - rockchip,rk3188-vpu
           - const: rockchip,rk3066-vpu
       - items:
           - const: rockchip,rk3228-vpu

maintainer
#6 lore raw

Re: [PATCH 1/3] dt-bindings: media: rockchip,vpu: Document RK3128 compatible

In reply to Sebastian Fricke

Hey,

Am Dienstag, 28. Mai 2024, 10:37:47 CEST schrieb Sebastian Fricke:

Quoted 6 lines · Heiko Stübner
Quoted 5 lines

Am Donnerstag, 23. Mai 2024, 20:56:31 CEST schrieb Alex Bee:

Quoted 4 lines

The integration for this SoC is similar to RK3066/RK3188.

Document it's compatible.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Media people, can you apply this patch alone from the series?

Yes, will do got this on my list already :).

as I'm going through my list of "waiting for ..." patches, is this still on the radar?

As far as I can tell, it didn't make it into 6.11-rc1, but 6.12 would be nice :-)

Thanks a lot
Heiko

Quoted 26 lines
Quoted 25 lines
Quoted 20 lines
---
 Documentation/devicetree/bindings/media/rockchip-vpu.yaml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/media/rockchip-vpu.yaml +3 -1
index c57e1f488895..d1b47b14ca57 100644
@@ -26,7 +26,9 @@ properties:
           - rockchip,rk3568-vpu
           - rockchip,rk3588-av1-vpu
       - items:
-          - const: rockchip,rk3188-vpu
+          - enum:
+              - rockchip,rk3128-vpu
+              - rockchip,rk3188-vpu
           - const: rockchip,rk3066-vpu
       - items:
           - const: rockchip,rk3228-vpu
author
#7 lore raw

PATCH 2/3 soc: rockchip: grf: Set RK3128's vpu main clock

In reply to Alex Bee

RK3128 has a setting in GRF which selects whether the vpu attached iommu uses the AXI clock of the decoder (vdpu) or the encoder (vepu). The default is vepu but some part of the vendor firmware sets it to vdpu.

In order to be independent on whether any of those vendor firmware blobs is used to boot the SoC reset "vpu main clock" setting to it's default value.

---
 drivers/soc/rockchip/grf.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/soc/rockchip/grf.c +2 -0
index 5fd62046b28a..df64de3d3040 100644
@@ -41,9 +41,11 @@ static const struct rockchip_grf_info rk3036_grf __initconst = {
 };
 
 #define RK3128_GRF_SOC_CON0		0x140
+#define RK3128_GRF_SOC_CON1		0x144
 
 static const struct rockchip_grf_value rk3128_defaults[] __initconst = {
 	{ "jtag switching", RK3128_GRF_SOC_CON0, HIWORD_UPDATE(0, 1, 8) },
+	{ "vpu main clock", RK3128_GRF_SOC_CON1, HIWORD_UPDATE(0, 1, 10) },
 };
 
 static const struct rockchip_grf_info rk3128_grf __initconst = {
Signature · 1 line
2.45.0
author
#8 lore raw

PATCH 3/3 ARM: dts: rockchip: Add vpu nodes for RK3128

In reply to Alex Bee

Add nodes for the vpu and it's attached iommu which are both part of the RK3128_PD_VIDEO powerdomain.

---
 arch/arm/boot/dts/rockchip/rk3128.dtsi | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
arch/arm/boot/dts/rockchip/rk3128.dtsi +24 -0
index fb98873fd94e..c11f55677841 100644
@@ -252,6 +252,30 @@ power-domain@RK3128_PD_GPU {
 		};
 	};
 
+	vpu: video-codec@10106000 {
+		compatible = "rockchip,rk3128-vpu", "rockchip,rk3066-vpu";
+		reg = <0x10106000 0x800>;
+		interrupts = <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>,
+			     <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
+		interrupt-names = "vepu", "vdpu";
+		clocks = <&cru ACLK_VDPU>, <&cru HCLK_VDPU>,
+			 <&cru ACLK_VEPU>, <&cru HCLK_VEPU>;
+		clock-names = "aclk_vdpu", "hclk_vdpu",
+			      "aclk_vepu", "hclk_vepu";
+		iommus = <&vpu_mmu>;
+		power-domains = <&power RK3128_PD_VIDEO>;
+	};
+
+	vpu_mmu: iommu@10106800 {
+		compatible = "rockchip,iommu";
+		reg = <0x10106800 0x100>;
+		interrupts = <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&cru ACLK_VEPU>, <&cru HCLK_VDPU>;
+		clock-names = "aclk", "iface";
+		power-domains = <&power RK3128_PD_VIDEO>;
+		#iommu-cells = <0>;
+	};
+
 	vop: vop@1010e000 {
 		compatible = "rockchip,rk3126-vop";
 		reg = <0x1010e000 0x300>;
Signature · 1 line
2.45.0
maintainer Applied
#9 lore raw

Re: (subset) [PATCH 0/3] Add VPU support for RK3128

In reply to Alex Bee
Quoted 13 lines · Alex Bee

Similar to most Rockchip SoCs RK312x have hantro G1 based decoder and a hantro H1 based encoder with attached iommu.

The existing drivers can be used as-is.

Fluster scores:
- FFmpeg:
- H.264: 127/135
- VP8: 59/61
- GStreamer:
- H.264: 129/135
- VP8: 59/61

Quoted 1 line

[...]

Applied, thanks!

[2/3] soc: rockchip: grf: Set RK3128's vpu main clock

      commit: b465223129f951d110e633a305085bd8430d7df0

Best regards,

Signature · 1 line
Heiko Stuebner <[email protected]>
author
#10 lore raw

Re: (subset) [PATCH 0/3] Add VPU support for RK3128

Hi Heiko

Am 28.05.24 um 17:09 schrieb Heiko Stuebner:

Quoted 14 lines · Alex Bee
Quoted 13 lines

Similar to most Rockchip SoCs RK312x have hantro G1 based decoder and a hantro H1 based encoder with attached iommu.

The existing drivers can be used as-is.

Fluster scores:
- FFmpeg:
- H.264: 127/135
- VP8: 59/61
- GStreamer:
- H.264: 129/135
- VP8: 59/61

Quoted 5 lines
Quoted 1 line

[...]

Applied, thanks!

[2/3] soc: rockchip: grf: Set RK3128's vpu main clock

       commit: b465223129f951d110e633a305085bd8430d7df0

I just noticed this patch didn't make it in 6.11-rc1. While it's not really important for this patch as the media mainainters didn't manage to apply the vpu bindings patch for 6.11 anyways, it looks like all commits of your v6.11-armsoc/drivers aren't merged. I still haven't fully understand how the SoC tree *really* works, but I couldn't find a PR for this branch [0].

Alex

[0]
https://patchwork.kernel.org/project/linux-soc/list/?submitter=24481&state=*

Quoted 1 line

Best regards,

maintainer
#11 lore raw

Re: (subset) [PATCH 0/3] Add VPU support for RK3128

Am Sonntag, 4. August 2024, 18:42:13 CEST schrieb Alex Bee:

Quoted 20 lines

Hi Heiko

Am 28.05.24 um 17:09 schrieb Heiko Stuebner:

Quoted 17 lines · Alex Bee
Quoted 13 lines

Similar to most Rockchip SoCs RK312x have hantro G1 based decoder and a hantro H1 based encoder with attached iommu.

The existing drivers can be used as-is.

Fluster scores:
- FFmpeg:
- H.264: 127/135
- VP8: 59/61
- GStreamer:
- H.264: 129/135
- VP8: 59/61

Quoted 1 line

[...]

Applied, thanks!

Quoted 7 lines
Quoted 2 lines

[2/3] soc: rockchip: grf: Set RK3128's vpu main clock

       commit: b465223129f951d110e633a305085bd8430d7df0

I just noticed this patch didn't make it in 6.11-rc1. While it's not really important for this patch as the media mainainters didn't manage to apply the vpu bindings patch for 6.11 anyways, it looks like all commits of your v6.11-armsoc/drivers aren't merged. I still haven't fully understand how the SoC tree *really* works, but I couldn't find a PR for this branch [0].

That was me actually forgetting that branch :-( .

With the rk3128 vpu-binding getting merged today, I just moved that onwards to 6.12 too. I guess this time I shouln't forget ;-)

Heiko

maintainer Applied
#12 lore raw

Re: (subset) [PATCH 0/3] Add VPU support for RK3128

In reply to Alex Bee
Quoted 13 lines · Alex Bee

Similar to most Rockchip SoCs RK312x have hantro G1 based decoder and a hantro H1 based encoder with attached iommu.

The existing drivers can be used as-is.

Fluster scores:
- FFmpeg:
- H.264: 127/135
- VP8: 59/61
- GStreamer:
- H.264: 129/135
- VP8: 59/61

Quoted 1 line

[...]

Applied, thanks!

[3/3] ARM: dts: rockchip: Add vpu nodes for RK3128

      commit: fc5aa1ba77c78c17d2c1ddb94e7aca3f4f32efcf

Best regards,

Signature · 1 line
Heiko Stuebner <[email protected]>