Skip to contentSkip to conversation

Add Rockchip RGA V4l2 support

PATCH In review Jacob Chen 2 participants 8 messages Oct 11, 2017 – Oct 17, 2017

Subsystems (4)
lore
Share & tools
lore

Jacob Chen

author maintainer
#0 lore raw

v12 cover Add Rockchip RGA V4l2 support

change in V12:
- adding an entry to MAINTAINERS
- fix checkpatch

change in V11:
- fix compile warning

change in V10:
- move to rockchip/rga
- changes according to comments
- some style changes

change in V9:
- remove protduff things
- test with the latest v4l2-compliance

change in V8:
- remove protduff things

change in V6,V7:
- correct warning in checkpatch.pl

change in V5:
- v4l2-compliance: handle invalid pxielformat
- v4l2-compliance: add subscribe_event
- add colorspace support

change in V4:
- document the controls.
- change according to Hans's comments

change in V3:
- rename the controls.
- add pm_runtime support.
- enable node by default.
- correct spelling in documents.

change in V2:
- generalize the controls.
- map buffers (10-50 us) in every cmd-run rather than in buffer-import to avoid get_free_pages failed on actively used systems.
- remove status in dt-bindings examples.

Jacob Chen (5):
dt-bindings: Document the Rockchip RGA bindings rockchip/rga: v4l2 m2m support
MAINTAINERS: add entry for Rockchip RGA driver
ARM: dts: rockchip: add RGA device node for RK3288
arm64: dts: rockchip: add RGA device node for RK3399

 .../devicetree/bindings/media/rockchip-rga.txt     |   33 +
 MAINTAINERS                                        |    7 +
 arch/arm/boot/dts/rk3288.dtsi                      |   11 +
 arch/arm64/boot/dts/rockchip/rk3399.dtsi           |   11 +
 drivers/media/platform/Kconfig                     |   15 +
 drivers/media/platform/Makefile                    |    2 +
 drivers/media/platform/rockchip/rga/Makefile       |    3 +
 drivers/media/platform/rockchip/rga/rga-buf.c      |  154 +++
 drivers/media/platform/rockchip/rga/rga-hw.c       |  421 ++++++++
 drivers/media/platform/rockchip/rga/rga-hw.h       |  437 +++++++++
 drivers/media/platform/rockchip/rga/rga.c          | 1012 ++++++++++++++++++++
 drivers/media/platform/rockchip/rga/rga.h          |  125 +++
 12 files changed, 2231 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/rockchip-rga.txt
 create mode 100644 drivers/media/platform/rockchip/rga/Makefile
 create mode 100644 drivers/media/platform/rockchip/rga/rga-buf.c
 create mode 100644 drivers/media/platform/rockchip/rga/rga-hw.c
 create mode 100644 drivers/media/platform/rockchip/rga/rga-hw.h
 create mode 100644 drivers/media/platform/rockchip/rga/rga.c
 create mode 100644 drivers/media/platform/rockchip/rga/rga.h
Signature · 1 line
2.14.1
author maintainer
#1 lore raw

PATCH v12 1/5 dt-bindings: Document the Rockchip RGA bindings

Add DT bindings documentation for Rockchip RGA

---
 .../devicetree/bindings/media/rockchip-rga.txt     | 33 ++++++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/rockchip-rga.txt
Documentation/devicetree/bindings/media/rockchip-rga.txt new file +33 -0
new file mode 100644
index 000000000000..fd5276abfad6
@@ -0,0 +1,33 @@
+device-tree bindings for rockchip 2D raster graphic acceleration controller (RGA)
+
+RGA is a standalone 2D raster graphic acceleration unit. It accelerates 2D
+graphics operations, such as point/line drawing, image scaling, rotation,
+BitBLT, alpha blending and image blur/sharpness.
+
+Required properties:
+- compatible: value should be one of the following
+		"rockchip,rk3288-rga";
+		"rockchip,rk3399-rga";
+
+- interrupts: RGA interrupt specifier.
+
+- clocks: phandle to RGA sclk/hclk/aclk clocks
+
+- clock-names: should be "aclk", "hclk" and "sclk"
+
+- resets: Must contain an entry for each entry in reset-names.
+  See ../reset/reset.txt for details.
+- reset-names: should be "core", "axi" and "ahb"
+
+Example:
+SoC-specific DT entry:
+	rga: rga at ff680000 {
+		compatible = "rockchip,rk3399-rga";
+		reg = <0xff680000 0x10000>;
+		interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&cru ACLK_RGA>, <&cru HCLK_RGA>, <&cru SCLK_RGA_CORE>;
+		clock-names = "aclk", "hclk", "sclk";
+
+		resets = <&cru SRST_RGA_CORE>, <&cru SRST_A_RGA>, <&cru SRST_H_RGA>;
+		reset-names = "core, "axi", "ahb";
+	};
Signature · 1 line
2.14.1
author maintainer
#2 lore raw

PATCH v12 2/5 rockchip/rga: v4l2 m2m support

In reply to Jacob Chen

Rockchip RGA is a separate 2D raster graphic acceleration unit. It accelerates 2D graphics operations, such as point/line drawing, image scaling, rotation, BitBLT, alpha blending and image blur/sharpness

The driver supports various operations from the rendering pipeline.
- copy
- fast solid color fill
- rotation
- flip
- alpha blending

The code in rga-hw.c is used to configure regs according to operations The code in rga-buf.c is used to create private mmu table for RGA.

---
 drivers/media/platform/Kconfig                |   15 +
 drivers/media/platform/Makefile               |    2 +
 drivers/media/platform/rockchip/rga/Makefile  |    3 +
 drivers/media/platform/rockchip/rga/rga-buf.c |  154 ++++
 drivers/media/platform/rockchip/rga/rga-hw.c  |  421 ++++++++++
 drivers/media/platform/rockchip/rga/rga-hw.h  |  437 +++++++++++
 drivers/media/platform/rockchip/rga/rga.c     | 1012 +++++++++++++++++++++++++
 drivers/media/platform/rockchip/rga/rga.h     |  125 +++
 8 files changed, 2169 insertions(+)
 create mode 100644 drivers/media/platform/rockchip/rga/Makefile
 create mode 100644 drivers/media/platform/rockchip/rga/rga-buf.c
 create mode 100644 drivers/media/platform/rockchip/rga/rga-hw.c
 create mode 100644 drivers/media/platform/rockchip/rga/rga-hw.h
 create mode 100644 drivers/media/platform/rockchip/rga/rga.c
 create mode 100644 drivers/media/platform/rockchip/rga/rga.h
drivers/media/platform/Kconfig +15 -0
index 7e7cc49b8674..3c6074ece15a 100644
@@ -458,6 +458,21 @@ config VIDEO_RENESAS_VSP1
 	  To compile this driver as a module, choose M here: the module
 	  will be called vsp1.
 
+config VIDEO_ROCKCHIP_RGA
+	tristate "Rockchip Raster 2d Graphic Acceleration Unit"
+	depends on VIDEO_DEV && VIDEO_V4L2 && HAS_DMA
+	depends on ARCH_ROCKCHIP || COMPILE_TEST
+	select VIDEOBUF2_DMA_SG
+	select V4L2_MEM2MEM_DEV
+	default n
+	---help---
+	  This is a v4l2 driver for Rockchip SOC RGA 2d graphics accelerator.
+	  Rockchip RGA is a separate 2D raster graphic acceleration unit.
+	  It accelerates 2D graphics operations, such as point/line drawing,
+	  image scaling, rotation, BitBLT, alpha blending and image blur/sharpness.
+
+	  To compile this driver as a module choose m here.
+
 config VIDEO_TI_VPE
 	tristate "TI VPE (Video Processing Engine) driver"
 	depends on VIDEO_DEV && VIDEO_V4L2
drivers/media/platform/Makefile +2 -0
index c1ef946bf032..c179de1c98c3 100644
@@ -62,6 +62,8 @@ obj-$(CONFIG_VIDEO_RENESAS_FDP1)	+= rcar_fdp1.o
 obj-$(CONFIG_VIDEO_RENESAS_JPU) 	+= rcar_jpu.o
 obj-$(CONFIG_VIDEO_RENESAS_VSP1)	+= vsp1/
 
+obj-$(CONFIG_VIDEO_ROCKCHIP_RGA)	+= rockchip/rga/
+
 obj-y	+= omap/
 
 obj-$(CONFIG_VIDEO_AM437X_VPFE)		+= am437x/
drivers/media/platform/rockchip/rga/Makefile new file +3 -0
new file mode 100644
index 000000000000..92fe25490ccd
@@ -0,0 +1,3 @@
+rockchip-rga-objs := rga.o rga-hw.o rga-buf.o
+
+obj-$(CONFIG_VIDEO_ROCKCHIP_RGA) += rockchip-rga.o
drivers/media/platform/rockchip/rga/rga-buf.c new file +154 -0

154 lines not on this page · raw message

drivers/media/platform/rockchip/rga/rga-hw.c new file +421 -0

421 lines not on this page · raw message

drivers/media/platform/rockchip/rga/rga-hw.h new file +437 -0

437 lines not on this page · raw message

drivers/media/platform/rockchip/rga/rga.c new file +1012 -0

1,012 lines not on this page · raw message

drivers/media/platform/rockchip/rga/rga.h new file +125 -0

125 lines not on this page · raw message

Signature · 1 line
2.14.1
author maintainer
#3 lore raw

PATCH v12 3/5 MAINTAINERS: add entry for Rockchip RGA driver

In reply to Jacob Chen
---
 MAINTAINERS | 7 +++++++
 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
index 6671f375f7fc..335497bbc3f3 100644
@@ -11509,6 +11509,13 @@ F:	drivers/hid/hid-roccat*
 F:	include/linux/hid-roccat*
 F:	Documentation/ABI/*/sysfs-driver-hid-roccat*
 
+ROCKCHIP RASTER 2D GRAPHIC ACCELERATION UNIT DRIVER
+M:	Jacob chen <[email protected]>
+L:	linux-media at vger.kernel.org
+S:	Maintained
+F:	drivers/media/platform/rockchip/rga/
+F:	Documentation/devicetree/bindings/media/rockchip-rga.txt
+
 ROCKER DRIVER
 M:	Jiri Pirko <[email protected]>
 L:	netdev at vger.kernel.org
Signature · 1 line
2.14.1
author maintainer
#4 lore raw

PATCH v12 4/5 ARM: dts: rockchip: add RGA device node for RK3288

In reply to Jacob Chen

This patch add the RGA dt config of rk3288 SoC.

---
 arch/arm/boot/dts/rk3288.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm/boot/dts/rk3288.dtsi +11 -0
index a0a0b08bff74..8c6dfc0abc42 100644
@@ -972,6 +972,17 @@
 		status = "disabled";
 	};
 
+	rga: rga at ff920000 {
+		compatible = "rockchip,rk3288-rga";
+		reg = <0x0 0xff920000 0x0 0x180>;
+		interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&cru ACLK_RGA>, <&cru HCLK_RGA>, <&cru SCLK_RGA>;
+		clock-names = "aclk", "hclk", "sclk";
+		power-domains = <&power RK3288_PD_VIO>;
+		resets = <&cru SRST_RGA_CORE>, <&cru SRST_RGA_AXI>, <&cru SRST_RGA_AHB>;
+		reset-names = "core", "axi", "ahb";
+	};
+
 	vopb: vop at ff930000 {
 		compatible = "rockchip,rk3288-vop";
 		reg = <0x0 0xff930000 0x0 0x19c>;
Signature · 1 line
2.14.1
author maintainer
#6 lore raw

PATCH v12 5/5 arm64: dts: rockchip: add RGA device node for RK3399

In reply to Jacob Chen

This patch add the RGA dt config of RK3399 SoC.

---
 arch/arm64/boot/dts/rockchip/rk3399.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm64/boot/dts/rockchip/rk3399.dtsi +11 -0
index d79e9b3265b9..a3fab6af5a17 100644
@@ -1204,6 +1204,17 @@
 		status = "disabled";
 	};
 
+	rga: rga at ff680000 {
+		compatible = "rockchip,rk3399-rga";
+		reg = <0x0 0xff680000 0x0 0x10000>;
+		interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH 0>;
+		clocks = <&cru ACLK_RGA>, <&cru HCLK_RGA>, <&cru SCLK_RGA_CORE>;
+		clock-names = "aclk", "hclk", "sclk";
+		resets = <&cru SRST_RGA_CORE>, <&cru SRST_A_RGA>, <&cru SRST_H_RGA>;
+		reset-names = "core", "axi", "ahb";
+		power-domains = <&power RK3399_PD_RGA>;
+	};
+
 	efuse0: efuse at ff690000 {
 		compatible = "rockchip,rk3399-efuse";
 		reg = <0x0 0xff690000 0x0 0x80>;
Signature · 1 line
2.14.1