This introduces the Sunxi-Cedrus VPU driver that supports the VPU found
in Allwinner SoCs, also known as Video Engine. It is implemented through
a v4l2 m2m decoder device and a media device (used for media requests).
So far, it only supports MPEG2 decoding.
Since this VPU is stateless, synchronization with media requests is
required in order to ensure consistency between frame headers that
contain metadata about the frame to process and the raw slice data that
is used to generate the frame.
This driver was made possible thanks to the long-standing effort
carried out by the linux-sunxi community in the interest of reverse
engineering, documenting and implementing support for Allwinner VPU.
Signed-off-by: Florent Revest
Signed-off-by: Paul Kocialkowski
---
drivers/media/platform/Kconfig | 15 +
drivers/media/platform/Makefile| 1 +
drivers/media/platform/sunxi/cedrus/Makefile | 4 +
drivers/media/platform/sunxi/cedrus/sunxi_cedrus.c | 292
.../platform/sunxi/cedrus/sunxi_cedrus_common.h| 105 +
.../media/platform/sunxi/cedrus/sunxi_cedrus_dec.c | 228 ++
.../media/platform/sunxi/cedrus/sunxi_cedrus_dec.h | 36 ++
.../media/platform/sunxi/cedrus/sunxi_cedrus_hw.c | 201 +
.../media/platform/sunxi/cedrus/sunxi_cedrus_hw.h | 29 ++
.../platform/sunxi/cedrus/sunxi_cedrus_mpeg2.c | 157 +++
.../platform/sunxi/cedrus/sunxi_cedrus_mpeg2.h | 33 ++
.../platform/sunxi/cedrus/sunxi_cedrus_regs.h | 172 +++
.../platform/sunxi/cedrus/sunxi_cedrus_video.c | 497 +
.../platform/sunxi/cedrus/sunxi_cedrus_video.h | 31 ++
14 files changed, 1801 insertions(+)
create mode 100644 drivers/media/platform/sunxi/cedrus/Makefile
create mode 100644 drivers/media/platform/sunxi/cedrus/sunxi_cedrus.c
create mode 100644 drivers/media/platform/sunxi/cedrus/sunxi_cedrus_common.h
create mode 100644 drivers/media/platform/sunxi/cedrus/sunxi_cedrus_dec.c
create mode 100644 drivers/media/platform/sunxi/cedrus/sunxi_cedrus_dec.h
create mode 100644 drivers/media/platform/sunxi/cedrus/sunxi_cedrus_hw.c
create mode 100644 drivers/media/platform/sunxi/cedrus/sunxi_cedrus_hw.h
create mode 100644 drivers/media/platform/sunxi/cedrus/sunxi_cedrus_mpeg2.c
create mode 100644 drivers/media/platform/sunxi/cedrus/sunxi_cedrus_mpeg2.h
create mode 100644 drivers/media/platform/sunxi/cedrus/sunxi_cedrus_regs.h
create mode 100644 drivers/media/platform/sunxi/cedrus/sunxi_cedrus_video.c
create mode 100644 drivers/media/platform/sunxi/cedrus/sunxi_cedrus_video.h
diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index 614fbef08ddc..77d89e84ed3b 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -488,6 +488,21 @@ config VIDEO_TI_VPE
Support for the TI VPE(Video Processing Engine) block
found on DRA7XX SoC.
+config VIDEO_SUNXI_CEDRUS
+ tristate "Sunxi-Cedrus VPU driver"
+ depends on VIDEO_DEV && VIDEO_V4L2 && MEDIA_CONTROLLER
+ depends on ARCH_SUNXI
+ depends on HAS_DMA
+ select VIDEOBUF2_DMA_CONTIG
+ select MEDIA_REQUEST_API
+ select V4L2_MEM2MEM_DEV
+ ---help---
+ Support for the VPU found in Allwinner SoCs, also known as the Cedar
+ video engine.
+
+ To compile this driver as a module, choose M here: the module
+ will be called sunxi-cedrus.
+
config VIDEO_TI_VPE_DEBUG
bool "VPE debug messages"
depends on VIDEO_TI_VPE
diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile
index 7f3080437be6..a2be170f6dff 100644
--- a/drivers/media/platform/Makefile
+++ b/drivers/media/platform/Makefile
@@ -72,6 +72,7 @@ obj-$(CONFIG_VIDEO_ROCKCHIP_RGA) += rockchip/rga/
obj-y += omap/
obj-$(CONFIG_VIDEO_AM437X_VPFE)+= am437x/
+obj-$(CONFIG_VIDEO_SUNXI_CEDRUS) += sunxi/cedrus/
obj-$(CONFIG_VIDEO_XILINX) += xilinx/
diff --git a/drivers/media/platform/sunxi/cedrus/Makefile
b/drivers/media/platform/sunxi/cedrus/Makefile
new file mode 100644
index ..98f30df626a9
--- /dev/null
+++ b/drivers/media/platform/sunxi/cedrus/Makefile
@@ -0,0 +1,4 @@
+obj-$(CONFIG_VIDEO_SUNXI_CEDRUS) += sunxi-cedrus.o
+
+sunxi-cedrus-y = sunxi_cedrus.o sunxi_cedrus_video.o sunxi_cedrus_hw.o \
+sunxi_cedrus_dec.o sunxi_cedrus_mpeg2.o
diff --git a/drivers/media/platform/sunxi/cedrus/sunxi_cedrus.c
b/drivers/media/platform/sunxi/cedrus/sunxi_cedrus.c
new file mode 100644
index ..364799c00703
--- /dev/null
+++ b/drivers/media/platform/sunxi/cedrus/sunxi_cedrus.c
@@ -0,0 +1,292 @@
+/*
+ * Sunxi-Cedrus VPU driver
+ *
+ * Copyright (C) 2018 Paul Kocialkowski
+ * Copyright (C) 2016 Florent Revest
+ *
+ * Based on the vim2m driver, that is:
+ *
+ * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
+ * Pawel Osciak,
+ * Marek Szyprowski,
+ *
+ * This software is l