2017-11-24 02:38:35

by Jacob Chen

[permalink] [raw]
Subject: [PATCH v2 00/11] Rockchip ISP1 Driver

This patch series add a ISP(Camera) v4l2 driver for rockchip rk3288/rk3399 SoC.

Kernel Branch:
https://github.com/wzyy2/linux/tree/rkisp1/drivers/media/platform/rockchip/isp1

Below are some infomations about driver/hardware:

Rockchip ISP1 have many Hardware Blocks(simplied):

MIPI --> ISP --> DCrop(Mainpath) --> RSZ(Mainpath) --> DMA(Mainpath)
DMA-Input --> --> DCrop(Selfpath) --> RSZ(Selfpath) --> DMA(Selfpath);)

(Acutally the TRM(rk3288, isp) could be found online...... which contains a more detailed block diagrams ;-P)

The funcitons of each hardware block:

Mainpath : up to 4k resolution, support raw/yuv format
Selfpath : up tp 1080p, support rotate, support rgb/yuv format
RSZ: scaling
DCrop: crop
ISP: 3A, Color processing, Crop
MIPI: MIPI Camera interface

Media pipelines:

Mainpath, Selfpath <-- ISP subdev <-- MIPI <-- Sensor
3A stats <-- <-- 3A parms

Code struct:

capture.c : Mainpath, Selfpath, RSZ, DCROP : capture device.
rkisp1.c : ISP : v4l2 sub-device.
isp_params.c : 3A parms : output device.
isp_stats.c : 3A stats : capture device.
mipi_dphy_sy.c : MIPI : sperated v4l2 sub-device.

Usage:
ChromiumOS:
use below v4l2-ctl command to capture frames.

v4l2-ctl --verbose -d /dev/video4 --stream-mmap=2
--stream-to=/tmp/stream.out --stream-count=60 --stream-poll

use below command to playback the video on your PC.

mplayer /tmp/stream.out -loop 0 --demuxer=rawvideo
--rawvideo=w=800:h=600:size=$((800*600*2)):format=yuy2
or
mplayer ./stream.out -loop 0 -demuxer rawvideo -rawvideo
w=800:h=600:size=$((800*600*2)):format=yuy2

Linux:
use rkcamsrc gstreamer plugin(just a modified v4l2src) to preview.

gst-launch-1.0 rkcamsrc device=/dev/video0 io-mode=4 disable-3A=true
videoconvert ! video/x-raw,format=NV12,width=640,height=480 ! kmssink

Jacob Chen (7):
media: rkisp1: add rockchip isp1 driver
media: rkisp1: add Rockchip MIPI Synopsys DPHY driver
dt-bindings: Document the Rockchip ISP1 bindings
dt-bindings: Document the Rockchip MIPI RX D-PHY bindings
ARM: dts: rockchip: add isp node for rk3288
ARM: dts: rockchip: add rx0 mipi-phy for rk3288
MAINTAINERS: add entry for Rockchip ISP1 driver

Jeffy Chen (1):
media: rkisp1: Add user space ABI definitions

Shunqian Zheng (3):
media: videodev2.h, v4l2-ioctl: add rkisp1 meta buffer format
arm64: dts: rockchip: add isp0 node for rk3399
arm64: dts: rockchip: add rx0 mipi-phy for rk3399

.../devicetree/bindings/media/rockchip-isp1.txt | 61 +
.../bindings/media/rockchip-mipi-dphy.txt | 77 +
MAINTAINERS | 10 +
arch/arm/boot/dts/rk3288.dtsi | 24 +
arch/arm64/boot/dts/rockchip/rk3399.dtsi | 26 +
drivers/media/platform/Kconfig | 10 +
drivers/media/platform/Makefile | 1 +
drivers/media/platform/rockchip/isp1/Makefile | 8 +
drivers/media/platform/rockchip/isp1/capture.c | 1691 ++++++++++++++++++++
drivers/media/platform/rockchip/isp1/capture.h | 46 +
drivers/media/platform/rockchip/isp1/common.h | 330 ++++
drivers/media/platform/rockchip/isp1/dev.c | 632 ++++++++
drivers/media/platform/rockchip/isp1/isp_params.c | 1556 ++++++++++++++++++
drivers/media/platform/rockchip/isp1/isp_params.h | 81 +
drivers/media/platform/rockchip/isp1/isp_stats.c | 537 +++++++
drivers/media/platform/rockchip/isp1/isp_stats.h | 81 +
.../media/platform/rockchip/isp1/mipi_dphy_sy.c | 805 ++++++++++
drivers/media/platform/rockchip/isp1/regs.c | 251 +++
drivers/media/platform/rockchip/isp1/regs.h | 1578 ++++++++++++++++++
drivers/media/platform/rockchip/isp1/rkisp1.c | 1230 ++++++++++++++
drivers/media/platform/rockchip/isp1/rkisp1.h | 130 ++
drivers/media/v4l2-core/v4l2-ioctl.c | 2 +
include/uapi/linux/rkisp1-config.h | 554 +++++++
include/uapi/linux/videodev2.h | 4 +
24 files changed, 9725 insertions(+)
create mode 100644 Documentation/devicetree/bindings/media/rockchip-isp1.txt
create mode 100644 Documentation/devicetree/bindings/media/rockchip-mipi-dphy.txt
create mode 100644 drivers/media/platform/rockchip/isp1/Makefile
create mode 100644 drivers/media/platform/rockchip/isp1/capture.c
create mode 100644 drivers/media/platform/rockchip/isp1/capture.h
create mode 100644 drivers/media/platform/rockchip/isp1/common.h
create mode 100644 drivers/media/platform/rockchip/isp1/dev.c
create mode 100644 drivers/media/platform/rockchip/isp1/isp_params.c
create mode 100644 drivers/media/platform/rockchip/isp1/isp_params.h
create mode 100644 drivers/media/platform/rockchip/isp1/isp_stats.c
create mode 100644 drivers/media/platform/rockchip/isp1/isp_stats.h
create mode 100644 drivers/media/platform/rockchip/isp1/mipi_dphy_sy.c
create mode 100644 drivers/media/platform/rockchip/isp1/regs.c
create mode 100644 drivers/media/platform/rockchip/isp1/regs.h
create mode 100644 drivers/media/platform/rockchip/isp1/rkisp1.c
create mode 100644 drivers/media/platform/rockchip/isp1/rkisp1.h
create mode 100644 include/uapi/linux/rkisp1-config.h

--
2.15.0


From 1584833359873881490@xxx Thu Nov 23 05:27:51 +0000 2017
X-GM-THRID: 1584833359873881490
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread


2017-11-24 02:39:28

by Jacob Chen

[permalink] [raw]
Subject: [PATCH v2 09/11] arm64: dts: rockchip: add isp0 node for rk3399

From: Shunqian Zheng <[email protected]>

rk3399 have two ISP, but we havn't test isp1, so just add isp0 at present.

Signed-off-by: Shunqian Zheng <[email protected]>
Signed-off-by: Jacob Chen <[email protected]>
---
arch/arm64/boot/dts/rockchip/rk3399.dtsi | 15 +++++++++++++++
1 file changed, 15 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
index d340b58ab184..66a912fab5dd 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
@@ -1588,6 +1588,21 @@
status = "disabled";
};

+ isp0: isp0@ff910000 {
+ compatible = "rockchip,rk3399-cif-isp";
+ reg = <0x0 0xff910000 0x0 0x4000>;
+ interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH 0>;
+ clocks = <&cru SCLK_ISP0>,
+ <&cru ACLK_ISP0>, <&cru ACLK_ISP0_WRAPPER>,
+ <&cru HCLK_ISP0>, <&cru HCLK_ISP0_WRAPPER>;
+ clock-names = "clk_isp",
+ "aclk_isp", "aclk_isp_wrap",
+ "hclk_isp", "hclk_isp_wrap";
+ power-domains = <&power RK3399_PD_ISP0>;
+ iommus = <&isp0_mmu>;
+ status = "disabled";
+ };
+
isp0_mmu: iommu@ff914000 {
compatible = "rockchip,iommu";
reg = <0x0 0xff914000 0x0 0x100>, <0x0 0xff915000 0x0 0x100>;
--
2.15.0


From 1584839550707752644@xxx Thu Nov 23 07:06:15 +0000 2017
X-GM-THRID: 1584830360558937066
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread

2017-11-24 02:39:41

by Jacob Chen

[permalink] [raw]
Subject: [PATCH v2 11/11] MAINTAINERS: add entry for Rockchip ISP1 driver

From: Jacob Chen <[email protected]>

Add MAINTAINERS entry for the rockchip isp1 driver.
This driver is maintained by rockchip officially and it
will be used for rockchip SoC on all linux-kernel based OS.

Signed-off-by: Jacob Chen <[email protected]>
---
MAINTAINERS | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index b05bc2c5e85c..614196ed7265 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11665,6 +11665,16 @@ F: drivers/hid/hid-roccat*
F: include/linux/hid-roccat*
F: Documentation/ABI/*/sysfs-driver-hid-roccat*

+ROCKCHIP ISP V1 DRIVER
+M: Jacob chen <[email protected]>
+M: Shunqian Zheng <[email protected]>
+M: Yichong Zhong <[email protected]>
+L: [email protected]
+S: Maintained
+F: drivers/media/platform/rockchip/isp1/
+F: Documentation/devicetree/bindings/media/rockchip-isp1.txt
+F: Documentation/devicetree/bindings/media/rockchip-mipi-dphy.txt
+
ROCKCHIP RASTER 2D GRAPHIC ACCELERATION UNIT DRIVER
M: Jacob chen <[email protected]>
L: [email protected]
--
2.15.0


From 1584806734062730386@xxx Wed Nov 22 22:24:38 +0000 2017
X-GM-THRID: 1584034632380977298
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread

2017-11-24 02:38:36

by Jacob Chen

[permalink] [raw]
Subject: [PATCH v2 01/11] media: videodev2.h, v4l2-ioctl: add rkisp1 meta buffer format

From: Shunqian Zheng <[email protected]>

Add the Rockchip ISP1 specific processing parameter format
V4L2_META_FMT_RK_ISP1_PARAMS and metadata format
V4L2_META_FMT_RK_ISP1_STAT_3A for 3A.

Signed-off-by: Shunqian Zheng <[email protected]>
Signed-off-by: Jacob Chen <[email protected]>
---
drivers/media/v4l2-core/v4l2-ioctl.c | 2 ++
include/uapi/linux/videodev2.h | 4 ++++
2 files changed, 6 insertions(+)

diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index d6587b3ec33e..0604ae9ea444 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -1252,6 +1252,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
case V4L2_TCH_FMT_TU08: descr = "8-bit unsigned touch data"; break;
case V4L2_META_FMT_VSP1_HGO: descr = "R-Car VSP1 1-D Histogram"; break;
case V4L2_META_FMT_VSP1_HGT: descr = "R-Car VSP1 2-D Histogram"; break;
+ case V4L2_META_FMT_RK_ISP1_PARAMS: descr = "Rockchip ISP1 3A params"; break;
+ case V4L2_META_FMT_RK_ISP1_STAT_3A: descr = "Rockchip ISP1 3A statistics"; break;

default:
/* Compressed formats */
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 7c871291c1fa..961545e64c12 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -691,6 +691,10 @@ struct v4l2_pix_format {
#define V4L2_META_FMT_VSP1_HGO v4l2_fourcc('V', 'S', 'P', 'H') /* R-Car VSP1 1-D Histogram */
#define V4L2_META_FMT_VSP1_HGT v4l2_fourcc('V', 'S', 'P', 'T') /* R-Car VSP1 2-D Histogram */

+/* Vendor specific - used for IPU3 camera sub-system */
+#define V4L2_META_FMT_RK_ISP1_PARAMS v4l2_fourcc('R', 'K', '1', 'P') /* Rockchip ISP1 params */
+#define V4L2_META_FMT_RK_ISP1_STAT_3A v4l2_fourcc('R', 'K', '1', 'S') /* Rockchip ISP1 3A statistics */
+
/* priv field value to indicates that subsequent fields are valid. */
#define V4L2_PIX_FMT_PRIV_MAGIC 0xfeedcafe

--
2.15.0


From 1584801969423637367@xxx Wed Nov 22 21:08:54 +0000 2017
X-GM-THRID: 1584801969423637367
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread

2017-11-24 02:39:34

by Jacob Chen

[permalink] [raw]
Subject: [PATCH v2 10/11] arm64: dts: rockchip: add rx0 mipi-phy for rk3399

From: Shunqian Zheng <[email protected]>

It's a Designware MIPI D-PHY, used for ISP0 in rk3399.

Signed-off-by: Shunqian Zheng <[email protected]>
Signed-off-by: Jacob Chen <[email protected]>
---
arch/arm64/boot/dts/rockchip/rk3399.dtsi | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
index 66a912fab5dd..a65b110afaf3 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
@@ -1292,6 +1292,17 @@
status = "disabled";
};

+ mipi_dphy_rx0: mipi-dphy-rx0 {
+ compatible = "rockchip,rk3399-mipi-dphy";
+ clocks = <&cru SCLK_MIPIDPHY_REF>,
+ <&cru SCLK_DPHY_RX0_CFG>,
+ <&cru PCLK_VIO_GRF>;
+ clock-names = "dphy-ref", "dphy-cfg", "grf";
+ power-domains = <&power RK3399_PD_VIO>;
+ bus-width = <4>;
+ status = "disabled";
+ };
+
u2phy0: usb2-phy@e450 {
compatible = "rockchip,rk3399-usb2phy";
reg = <0xe450 0x10>;
--
2.15.0


From 1584731394745305606@xxx Wed Nov 22 02:27:09 +0000 2017
X-GM-THRID: 1584731394745305606
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread