Skip to contentSkip to conversation

drm/rockchip: RK356x VOP2 support

PATCH Superseded Sascha Hauer 13 participants 51 messages Nov 17, 2021 – Dec 7, 2021

Subsystems (8)

v1 of 12 Superseded Latest is v12 →

lore
Share & tools
lore
#0 lore raw

cover drm/rockchip: RK356x VOP2 support

This series adds initial graphics support for the Rockchip RK356[68] SoCs. Graphics support is based around the VOP2 controller which replaces the VOP controller found on earlier Rockchip SoCs. The driver has been tested with HDMI support included in this series and MIPI-DSI which is not included because it needs some more work. The driver is taken from the downstream Rockchip kernel and heavily polished, most non standard features have been removed for now. I tested the driver with the libdrm modetest utility and also with weston with both pixman and panfrost driver support. Michael Riesch reported the driver to work on the RK3566 as well, but device tree support for this SoC is not yet included in this series.

The HDMI changes are based on patches from Benjamin Gaignard, but modified a bit as I found out that the HDMI port on the RK3568 only needs one additional clock, not two. Also I added regulator support which is needed to get the HDMI up on the rk3568-EVB board.

All review and testing feedback welcome

Sascha

Benjamin Gaignard (2):
dt-bindings: display: rockchip: Add compatible for rk3568 HDMI drm/rockchip: dw_hdmi: add rk3568 support

Sascha Hauer (10):
drm/rockchip: dw_hdmi: Do not leave clock enabled in error case drm/rockchip: dw_hdmi: add regulator support
of: graph: Allow disabled endpoints
dt-bindings: of: graph: Allow disabled endpoints
dt-bindings: display: rockchip: Add binding for VOP2
arm64: dts: rockchip: rk356x: Add VOP2 nodes
arm64: dts: rockchip: rk356x: Add HDMI nodes
arm64: dts: rockchip: rk3568-evb: Enable VOP2 and hdmi drm/rockchip: Make VOP driver optional
drm: rockchip: Add VOP2 driver

 .../display/rockchip/rockchip,dw-hdmi.yaml    |   12 +-
 .../display/rockchip/rockchip-vop2.yaml       |  114 +
 .../bindings/media/video-interfaces.yaml      |    8 +
 arch/arm/configs/multi_v7_defconfig           |    1 +
 .../boot/dts/rockchip/rk3568-evb1-v10.dts     |   24 +
 arch/arm64/boot/dts/rockchip/rk356x.dtsi      |  117 +
 arch/arm64/configs/defconfig                  |    1 +
 drivers/gpu/drm/drm_of.c                      |    6 +-
 drivers/gpu/drm/rockchip/Kconfig              |   13 +
 drivers/gpu/drm/rockchip/Makefile             |    4 +-
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c   |  137 +-
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c   |    3 +-
 drivers/gpu/drm/rockchip/rockchip_drm_drv.h   |   22 +-
 drivers/gpu/drm/rockchip/rockchip_drm_vop.h   |  774 ++++
 drivers/gpu/drm/rockchip/rockchip_drm_vop2.c  | 3611 +++++++++++++++++
 drivers/gpu/drm/rockchip/rockchip_vop2_reg.c  |  916 +++++
 drivers/of/property.c                         |    3 +
 17 files changed, 5731 insertions(+), 35 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/display/rockchip/rockchip-vop2.yaml
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_vop2_reg.c
Signature · 1 line
2.30.2
#1 lore raw

PATCH 1/12 dt-bindings: display: rockchip: Add compatible for rk3568 HDMI

From: Benjamin Gaignard <[email protected]>

Define a new compatible for rk3568 HDMI.
This version of HDMI hardware block needs two new clocks hclk_vio and hclk to provide phy reference clocks.

---
 .../bindings/display/rockchip/rockchip,dw-hdmi.yaml         | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/display/rockchip/rockchip,dw-hdmi.yaml +5 -1
index da3b889ad8fcd..53fa42479d5b7 100644
@@ -23,6 +23,7 @@ properties:
       - rockchip,rk3288-dw-hdmi
       - rockchip,rk3328-dw-hdmi
       - rockchip,rk3399-dw-hdmi
+      - rockchip,rk3568-dw-hdmi
 
   reg-io-width:
     const: 4
@@ -49,8 +50,11 @@ properties:
           - vpll
       - enum:
           - grf
+          - hclk_vio
+          - vpll
+      - enum:
+          - hclk
           - vpll
-      - const: vpll
 
   ddc-i2c-bus:
     $ref: /schemas/types.yaml#/definitions/phandle
Signature · 1 line
2.30.2
maintainer
#2 lore raw

Re: [PATCH 01/12] dt-bindings: display: rockchip: Add compatible for rk3568 HDMI

Hi,

Am Mittwoch, 17. November 2021, 15:33:36 CET schrieb Sascha Hauer:

Quoted 27 lines

From: Benjamin Gaignard <[email protected]>

Define a new compatible for rk3568 HDMI.
This version of HDMI hardware block needs two new clocks hclk_vio and hclk to provide phy reference clocks.

---
 .../bindings/display/rockchip/rockchip,dw-hdmi.yaml         | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/display/rockchip/rockchip,dw-hdmi.yaml +1 -0
index da3b889ad8fcd..53fa42479d5b7 100644
@@ -23,6 +23,7 @@ properties:
       - rockchip,rk3288-dw-hdmi
       - rockchip,rk3328-dw-hdmi
       - rockchip,rk3399-dw-hdmi
+      - rockchip,rk3568-dw-hdmi
 
   reg-io-width:
     const: 4

Documentation/devicetree/bindings/display/rockchip/rockchip,dw-hdmi.yaml properties: · line 53

Quoted 4 lines
Documentation/devicetree/bindings/display/rockchip/rockchip,dw-hdmi.yaml +1 -0
@@ -49,8 +50,11 @@ properties:
           - vpll
       - enum:
           - grf
+          - hclk_vio

I don't believe this clock should be here:
(1) the rk3568 dts node later in the series doesn't use it at all
(2) generally vio-clocks are part of the interconnect where the ip block connects to, so right now we just enable it as critical on all socs and if someone actually models the interconnect (where also the qos [quality of service configs] nodes would play into), it would need to be included there.

Heiko

Quoted 9 lines
Documentation/devicetree/bindings/display/rockchip/rockchip,dw-hdmi.yaml +3 -1
+          - vpll
+      - enum:
+          - hclk
           - vpll
-      - const: vpll
 
   ddc-i2c-bus:
     $ref: /schemas/types.yaml#/definitions/phandle
#3 lore raw

PATCH 2/12 drm/rockchip: dw_hdmi: Do not leave clock enabled in error case

In reply to Sascha Hauer

The driver returns an error when devm_phy_optional_get() fails leaving the previously enabled clock turned on. Change order and enable the clock only after the phy has been acquired.

---
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +7 -7
index 830bdd5e9b7ce..8677c82716784 100644
@@ -529,13 +529,6 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,
 		return ret;
 	}
 
-	ret = clk_prepare_enable(hdmi->vpll_clk);
-	if (ret) {
-		DRM_DEV_ERROR(hdmi->dev, "Failed to enable HDMI vpll: %d\n",
-			      ret);
-		return ret;
-	}
-
 	hdmi->phy = devm_phy_optional_get(dev, "hdmi");
 	if (IS_ERR(hdmi->phy)) {
 		ret = PTR_ERR(hdmi->phy);
@@ -544,6 +537,13 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,
 		return ret;
 	}
 
+	ret = clk_prepare_enable(hdmi->vpll_clk);
+	if (ret) {
+		DRM_DEV_ERROR(hdmi->dev, "Failed to enable HDMI vpll: %d\n",
+			      ret);
+		return ret;
+	}
+
 	drm_encoder_helper_add(encoder, &dw_hdmi_rockchip_encoder_helper_funcs);
 	drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS);
 
Signature · 1 line
2.30.2
#4 lore raw

PATCH 3/12 drm/rockchip: dw_hdmi: add rk3568 support

In reply to Sascha Hauer

From: Benjamin Gaignard <[email protected]>

Add a new dw_hdmi_plat_data struct and new compatible for rk3568. This version of the HDMI hardware block needs a new clock to provide the phy reference clock: hclk. As this is the third clock the driver uses it is switched to devm_clk_bulk_get_optional() to simplify the clock handling.

---
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 74 +++++++++++++++------
 1 file changed, 52 insertions(+), 22 deletions(-)
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +52 -22
index 8677c82716784..29608c25e2d0e 100644
@@ -50,6 +50,10 @@
 #define RK3399_GRF_SOC_CON20		0x6250
 #define RK3399_HDMI_LCDC_SEL		BIT(6)
 
+#define RK3568_GRF_VO_CON1		0x0364
+#define RK3568_HDMI_SDAIN_MSK		BIT(15)
+#define RK3568_HDMI_SCLIN_MSK		BIT(14)
+
 #define HIWORD_UPDATE(val, mask)	(val | (mask) << 16)
 
 /**
@@ -64,11 +68,18 @@ struct rockchip_hdmi_chip_data {
 	u32	lcdsel_lit;
 };
 
+#define RK_HDMI_CLK_VPLL	0
+#define RK_HDMI_CLK_HCLK	1
+#define RK_HDMI_CLK_GRF		2
+#define RK_HDMI_NCLOCKS		3
+#define RK_HDMI_NCLOCKS_HDMI	2
+
 struct rockchip_hdmi {
 	struct device *dev;
 	struct regmap *regmap;
 	struct drm_encoder encoder;
 	const struct rockchip_hdmi_chip_data *chip_data;
+	struct clk_bulk_data clks[RK_HDMI_NCLOCKS];
 	struct clk *vpll_clk;
 	struct clk *grf_clk;
 	struct dw_hdmi *hdmi;
@@ -189,6 +200,7 @@ static const struct dw_hdmi_phy_config rockchip_phy_config[] = {
 static int rockchip_hdmi_parse_dt(struct rockchip_hdmi *hdmi)
 {
 	struct device_node *np = hdmi->dev->of_node;
+	int ret;
 
 	hdmi->regmap = syscon_regmap_lookup_by_phandle(np, "rockchip,grf");
 	if (IS_ERR(hdmi->regmap)) {
@@ -196,25 +208,19 @@ static int rockchip_hdmi_parse_dt(struct rockchip_hdmi *hdmi)
 		return PTR_ERR(hdmi->regmap);
 	}
 
-	hdmi->vpll_clk = devm_clk_get(hdmi->dev, "vpll");
-	if (PTR_ERR(hdmi->vpll_clk) == -ENOENT) {
-		hdmi->vpll_clk = NULL;
-	} else if (PTR_ERR(hdmi->vpll_clk) == -EPROBE_DEFER) {
-		return -EPROBE_DEFER;
-	} else if (IS_ERR(hdmi->vpll_clk)) {
-		DRM_DEV_ERROR(hdmi->dev, "failed to get vpll clock\n");
-		return PTR_ERR(hdmi->vpll_clk);
-	}
+	hdmi->clks[RK_HDMI_CLK_VPLL].id = "vpll";
+	hdmi->clks[RK_HDMI_CLK_HCLK].id = "hclk";
+	hdmi->clks[RK_HDMI_CLK_GRF].id = "grf";
+	ret = devm_clk_bulk_get_optional(hdmi->dev, RK_HDMI_NCLOCKS, hdmi->clks);
+	printk("%s: %d 0x%08lx 0x%08lx 0x%08lx\n", __func__, ret,
+	       (unsigned long)hdmi->clks[0].clk,
+	       (unsigned long)hdmi->clks[1].clk,
+	       (unsigned long)hdmi->clks[2].clk);
+	if (ret)
+		return ret;
 
-	hdmi->grf_clk = devm_clk_get(hdmi->dev, "grf");
-	if (PTR_ERR(hdmi->grf_clk) == -ENOENT) {
-		hdmi->grf_clk = NULL;
-	} else if (PTR_ERR(hdmi->grf_clk) == -EPROBE_DEFER) {
-		return -EPROBE_DEFER;
-	} else if (IS_ERR(hdmi->grf_clk)) {
-		DRM_DEV_ERROR(hdmi->dev, "failed to get grf clock\n");
-		return PTR_ERR(hdmi->grf_clk);
-	}
+	hdmi->vpll_clk = hdmi->clks[RK_HDMI_CLK_VPLL].clk;
+	hdmi->grf_clk = hdmi->clks[RK_HDMI_CLK_GRF].clk;
 
 	return 0;
 }
@@ -257,7 +263,7 @@ static void dw_hdmi_rockchip_encoder_mode_set(struct drm_encoder *encoder,
 {
 	struct rockchip_hdmi *hdmi = to_rockchip_hdmi(encoder);
 
-	clk_set_rate(hdmi->vpll_clk, adj_mode->clock * 1000);
+	clk_set_rate(hdmi->clks[RK_HDMI_CLK_VPLL].clk, adj_mode->clock * 1000);
 }
 
 static void dw_hdmi_rockchip_encoder_enable(struct drm_encoder *encoder)
@@ -467,6 +473,19 @@ static const struct dw_hdmi_plat_data rk3399_hdmi_drv_data = {
 	.use_drm_infoframe = true,
 };
 
+static struct rockchip_hdmi_chip_data rk3568_chip_data = {
+	.lcdsel_grf_reg = -1,
+};
+
+static const struct dw_hdmi_plat_data rk3568_hdmi_drv_data = {
+	.mode_valid = dw_hdmi_rockchip_mode_valid,
+	.mpll_cfg   = rockchip_mpll_cfg,
+	.cur_ctr    = rockchip_cur_ctr,
+	.phy_config = rockchip_phy_config,
+	.phy_data = &rk3568_chip_data,
+	.use_drm_infoframe = true,
+};
+
 static const struct of_device_id dw_hdmi_rockchip_dt_ids[] = {
 	{ .compatible = "rockchip,rk3228-dw-hdmi",
 	  .data = &rk3228_hdmi_drv_data
@@ -480,6 +499,9 @@ static const struct of_device_id dw_hdmi_rockchip_dt_ids[] = {
 	{ .compatible = "rockchip,rk3399-dw-hdmi",
 	  .data = &rk3399_hdmi_drv_data
 	},
+	{ .compatible = "rockchip,rk3568-dw-hdmi",
+	  .data = &rk3568_hdmi_drv_data
+	},
 	{},
 };
 MODULE_DEVICE_TABLE(of, dw_hdmi_rockchip_dt_ids);
@@ -537,13 +559,21 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,
 		return ret;
 	}
 
-	ret = clk_prepare_enable(hdmi->vpll_clk);
+	ret = clk_bulk_prepare_enable(RK_HDMI_NCLOCKS_HDMI, hdmi->clks);
 	if (ret) {
 		DRM_DEV_ERROR(hdmi->dev, "Failed to enable HDMI vpll: %d\n",
 			      ret);
 		return ret;
 	}
 
+	if (hdmi->chip_data == &rk3568_chip_data) {
+		regmap_write(hdmi->regmap, RK3568_GRF_VO_CON1,
+			     HIWORD_UPDATE(RK3568_HDMI_SDAIN_MSK |
+					   RK3568_HDMI_SCLIN_MSK,
+					   RK3568_HDMI_SDAIN_MSK |
+					   RK3568_HDMI_SCLIN_MSK));
+	}
+
 	drm_encoder_helper_add(encoder, &dw_hdmi_rockchip_encoder_helper_funcs);
 	drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS);
 
@@ -558,7 +588,7 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,
 	if (IS_ERR(hdmi->hdmi)) {
 		ret = PTR_ERR(hdmi->hdmi);
 		drm_encoder_cleanup(encoder);
-		clk_disable_unprepare(hdmi->vpll_clk);
+		clk_bulk_disable_unprepare(RK_HDMI_NCLOCKS_HDMI, hdmi->clks);
 	}
 
 	return ret;
@@ -570,7 +600,7 @@ static void dw_hdmi_rockchip_unbind(struct device *dev, struct device *master,
 	struct rockchip_hdmi *hdmi = dev_get_drvdata(dev);
 
 	dw_hdmi_unbind(hdmi->hdmi);
-	clk_disable_unprepare(hdmi->vpll_clk);
+	clk_bulk_disable_unprepare(RK_HDMI_NCLOCKS_HDMI, hdmi->clks);
 }
 
 static const struct component_ops dw_hdmi_rockchip_ops = {
Signature · 1 line
2.30.2
#5 lore raw

PATCH 4/12 drm/rockchip: dw_hdmi: add regulator support

In reply to Sascha Hauer

The RK3568 has HDMI_TX_AVDD0V9 and HDMI_TX_AVDD_1V8 supply inputs needed for the HDMI port. add support for these to the driver for boards which have them supplied by switchable regulators.

---
 .../display/rockchip/rockchip,dw-hdmi.yaml    |  6 ++
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c   | 58 ++++++++++++++++++-
 2 files changed, 61 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/display/rockchip/rockchip,dw-hdmi.yaml +6 -0
index 53fa42479d5b7..293b2cfbf739f 100644
@@ -28,6 +28,12 @@ properties:
   reg-io-width:
     const: 4
 
+  avdd-0v9-supply:
+    description: A 0.9V supply that powers up the SoC internal circuitry.
+
+  avdd-1v8-supply:
+    description: A 0.9V supply that powers up the SoC internal circuitry.
+
   clocks:
     minItems: 2
     items:
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +55 -3

100 lines not on this page · raw message

Signature · 1 line
2.30.2
maintainer
#6 lore raw

Re: [PATCH 04/12] drm/rockchip: dw_hdmi: add regulator support

Quoted 7 lines · Sascha Hauer

The RK3568 has HDMI_TX_AVDD0V9 and HDMI_TX_AVDD_1V8 supply inputs needed for the HDMI port. add support for these to the driver for boards which have them supplied by switchable regulators.

---
 .../display/rockchip/rockchip,dw-hdmi.yaml    |  6 ++

Bindings should be a separate patch. Include this as part of adding RK3568 support to the binding.

Quoted 8 lines
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c   | 58 ++++++++++++++++++-
 2 files changed, 61 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/display/rockchip/rockchip,dw-hdmi.yaml +0 -0
index 53fa42479d5b7..293b2cfbf739f 100644

Documentation/devicetree/bindings/display/rockchip/rockchip,dw-hdmi.yaml properties: · line 35

Quoted 8 lines
Documentation/devicetree/bindings/display/rockchip/rockchip,dw-hdmi.yaml +5 -0
@@ -28,6 +28,12 @@ properties:
   reg-io-width:
     const: 4
 
+  avdd-0v9-supply:
+    description: A 0.9V supply that powers up the SoC internal circuitry.
+
+  avdd-1v8-supply:
+    description: A 0.9V supply that powers up the SoC internal circuitry.

0.9V ???

Quoted 4 lines
Documentation/devicetree/bindings/display/rockchip/rockchip,dw-hdmi.yaml +1 -0
+
   clocks:
     minItems: 2
     items:
#7 lore raw

Re: [PATCH 04/12] drm/rockchip: dw_hdmi: add regulator support

In reply to Sascha Hauer
Quoted 49 lines · Sascha Hauer

The RK3568 has HDMI_TX_AVDD0V9 and HDMI_TX_AVDD_1V8 supply inputs needed for the HDMI port. add support for these to the driver for boards which have them supplied by switchable regulators.

---
  .../display/rockchip/rockchip,dw-hdmi.yaml    |  6 ++
  drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c   | 58 ++++++++++++++++++-
  2 files changed, 61 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/display/rockchip/rockchip,dw-hdmi.yaml +6 -0
index 53fa42479d5b7..293b2cfbf739f 100644
@@ -28,6 +28,12 @@ properties:
    reg-io-width:
      const: 4
 
+  avdd-0v9-supply:
+    description: A 0.9V supply that powers up the SoC internal circuitry.
+
+  avdd-1v8-supply:
+    description: A 0.9V supply that powers up the SoC internal circuitry.
+
    clocks:
      minItems: 2
      items:
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +3 -0
index 29608c25e2d0e..b8fe56c89cdc9 100644
@@ -9,6 +9,7 @@
  #include <linux/platform_device.h>
  #include <linux/phy/phy.h>
  #include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
 
  #include <drm/bridge/dw_hdmi.h>
  #include <drm/drm_edid.h>
@@ -83,6 +84,8 @@ struct rockchip_hdmi {
  	struct clk *vpll_clk;
  	struct clk *grf_clk;
  	struct dw_hdmi *hdmi;
+	struct regulator *avdd_0v9;
+	struct regulator *avdd_1v8;
  	struct phy *phy;
  };
 

drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c static int rockchip_hdmi_parse_dt(struct rockchip_hdmi *hdmi) · line 228

Quoted 4 lines
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +1 -0
@@ -222,6 +225,22 @@ static int rockchip_hdmi_parse_dt(struct rockchip_hdmi *hdmi)
  	hdmi->vpll_clk = hdmi->clks[RK_HDMI_CLK_VPLL].clk;
  	hdmi->grf_clk = hdmi->clks[RK_HDMI_CLK_GRF].clk;
 
+	hdmi->avdd_0v9 = devm_regulator_get_optional(hdmi->dev, "avdd-0v9");

These are clearly *not* optional, unless the HDMI block is magic and can still work without physical power. Use devm_regulator_get(), and if the real supply is missing from the DT for whatever reason you should get a dummy regulator back, which you can then successfully disable and enable without all the conditional mess.

Robin.

Quoted 85 lines
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +51 -3
+	if (IS_ERR(hdmi->avdd_0v9)) {
+		if (PTR_ERR(hdmi->avdd_0v9) != -ENODEV)
+			return PTR_ERR(hdmi->avdd_0v9);
+
+		hdmi->avdd_0v9 = NULL;
+	}
+
+	hdmi->avdd_1v8 = devm_regulator_get_optional(hdmi->dev, "avdd-1v8");
+	if (IS_ERR(hdmi->avdd_1v8)) {
+		if (PTR_ERR(hdmi->avdd_1v8) != -ENODEV)
+			return PTR_ERR(hdmi->avdd_1v8);
+
+		hdmi->avdd_1v8 = NULL;
+	}
+
  	return 0;
  }
 
@@ -559,11 +578,27 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,
  		return ret;
  	}
 
+	if (hdmi->avdd_0v9) {
+		ret = regulator_enable(hdmi->avdd_0v9);
+		if (ret) {
+			DRM_DEV_ERROR(hdmi->dev, "failed to enable avdd0v9: %d\n", ret);
+			goto err_avdd_0v9;
+		}
+	}
+
+	if (hdmi->avdd_1v8) {
+		ret = regulator_enable(hdmi->avdd_1v8);
+		if (ret) {
+			DRM_DEV_ERROR(hdmi->dev, "failed to enable avdd1v8: %d\n", ret);
+			goto err_avdd_1v8;
+		}
+	}
+
  	ret = clk_bulk_prepare_enable(RK_HDMI_NCLOCKS_HDMI, hdmi->clks);
  	if (ret) {
  		DRM_DEV_ERROR(hdmi->dev, "Failed to enable HDMI vpll: %d\n",
  			      ret);
-		return ret;
+		goto err_clk;
  	}
 
  	if (hdmi->chip_data == &rk3568_chip_data) {
@@ -587,10 +622,21 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,
  	 */
  	if (IS_ERR(hdmi->hdmi)) {
  		ret = PTR_ERR(hdmi->hdmi);
-		drm_encoder_cleanup(encoder);
-		clk_bulk_disable_unprepare(RK_HDMI_NCLOCKS_HDMI, hdmi->clks);
+		goto err_bind;
  	}
 
+	return 0;
+
+err_bind:
+	clk_bulk_disable_unprepare(RK_HDMI_NCLOCKS_HDMI, hdmi->clks);
+	drm_encoder_cleanup(encoder);
+err_clk:
+	if (hdmi->avdd_1v8)
+		regulator_disable(hdmi->avdd_1v8);
+err_avdd_1v8:
+	if (hdmi->avdd_0v9)
+		regulator_disable(hdmi->avdd_0v9);
+err_avdd_0v9:
  	return ret;
  }
 
@@ -601,6 +647,12 @@ static void dw_hdmi_rockchip_unbind(struct device *dev, struct device *master,
 
  	dw_hdmi_unbind(hdmi->hdmi);
  	clk_bulk_disable_unprepare(RK_HDMI_NCLOCKS_HDMI, hdmi->clks);
+
+	if (hdmi->avdd_1v8)
+		regulator_disable(hdmi->avdd_1v8);
+
+	if (hdmi->avdd_0v9)
+		regulator_disable(hdmi->avdd_0v9);
  }
 
  static const struct component_ops dw_hdmi_rockchip_ops = {
#8 lore raw

PATCH 5/12 of: graph: Allow disabled endpoints

In reply to Sascha Hauer

There are cases in which a SoC allows many different routes between components, but not all of them make sense for a board. With this patch we allow standard status = "disabled" properties for ports. With this a SoC level dtsi file can describe all possible ports and only the ones that make sense for the given hardware are enabled at board level.

---
 drivers/gpu/drm/drm_of.c | 6 ++----
 drivers/of/property.c    | 3 +++
 2 files changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_of.c +2 -4
index 37c34146eea83..c2fd9fe505767 100644
@@ -67,10 +67,8 @@ uint32_t drm_of_find_possible_crtcs(struct drm_device *dev,
 
 	for_each_endpoint_of_node(port, ep) {
 		remote_port = of_graph_get_remote_port(ep);
-		if (!remote_port) {
-			of_node_put(ep);
-			return 0;
-		}
+		if (!remote_port)
+			continue;
 
 		possible_crtcs |= drm_of_crtc_port_mask(dev, remote_port);
 
drivers/of/property.c +3 -0
index a3483484a5a2a..40f8da7baa0a9 100644
@@ -730,6 +730,9 @@ EXPORT_SYMBOL(of_graph_get_endpoint_by_regs);
  */
 struct device_node *of_graph_get_remote_endpoint(const struct device_node *node)
 {
+	if (!of_device_is_available(node))
+		return NULL;
+
 	/* Get remote endpoint node. */
 	return of_parse_phandle(node, "remote-endpoint", 0);
 }
Signature · 1 line
2.30.2
#9 lore raw

PATCH 6/12 dt-bindings: of: graph: Allow disabled endpoints

In reply to Sascha Hauer

There are cases in which a SoC allows many different routes between components, but not all of them make sense for a board. With this patch we allow standard status = "disabled" properties for ports. With this a SoC level dtsi file can describe all possible ports and only the ones that make sense for the given hardware are enabled at board level.

---
 .../devicetree/bindings/media/video-interfaces.yaml       | 8 ++++++++
 1 file changed, 8 insertions(+)
Documentation/devicetree/bindings/media/video-interfaces.yaml +8 -0
index 4391dce2caee6..d7e516cd66f5f 100644
@@ -84,6 +84,14 @@ properties:
       source) by the master device (data sink). In the master mode the data
       source device is also the source of the synchronization signals.
 
+  status:
+    enum:
+      - ok
+      - okay
+      - disabled
+    description:
+      Enables or disables the link. Disabled links are ignored.
+
   bus-type:
     $ref: /schemas/types.yaml#/definitions/uint32
     enum:
Signature · 1 line
2.30.2
#10 lore raw

PATCH 7/12 dt-bindings: display: rockchip: Add binding for VOP2

In reply to Sascha Hauer

The VOP2 is found on newer Rockchip SoCs like the rk3568 or the rk3566. The binding differs slightly from the existing VOP binding, so add a new binding file for it.

---
 .../display/rockchip/rockchip-vop2.yaml       | 114 ++++++++++++++++++
 1 file changed, 114 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/rockchip/rockchip-vop2.yaml
Documentation/devicetree/bindings/display/rockchip/rockchip-vop2.yaml new file +114 -0
new file mode 100644
index 0000000000000..d566c423f9d8d
@@ -0,0 +1,114 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/rockchip/rockchip-vop2.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Rockchip SoC display controller (VOP2)
+
+description:
+  VOP2 (Video Output Processor v2) is the display controller for the Rockchip
+  series of SoCs which transfers the image data from a video memory
+  buffer to an external LCD interface.
+
+maintainers:
+  - Sandy Huang <[email protected]>
+  - Heiko Stuebner <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - rockchip,rk3568-vop
+      - rockchip,rk3566-vop
+
+  reg:
+    minItems: 1
+    items:
+      - description:
+          Must contain one entry corresponding to the base address and length
+          of the register space.
+      - description:
+          Can optionally contain a second entry corresponding to
+          the CRTC gamma LUT address.
+
+  interrupts:
+    maxItems: 1
+    description:
+      The VOP interrupt is shared by several interrupt sources, such as
+      frame start (VSYNC), line flag and other status interrupts.
+
+  clocks:
+    items:
+      - description: Clock for ddr buffer transfer.
+      - description: Clock for the ahb bus to R/W the phy regs.
+      - description: Pixel clock for video port 0.
+      - description: Pixel clock for video port 1.
+      - description: Pixel clock for video port 2.
+
+  clock-names:
+    items:
+      - const: aclk_vop
+      - const: hclk_vop
+      - const: dclk_vp0
+      - const: dclk_vp1
+      - const: dclk_vp2
+
+  port:
+    $ref: /schemas/graph.yaml#/properties/port
+
+  assigned-clocks:
+    maxItems: 2
+
+  assigned-clock-rates:
+    maxItems: 2
+
+  iommus:
+    maxItems: 1
+
+  power-domains:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - clock-names
+  - port
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/rk3568-cru.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/power/rk3568-power.h>
+    vop: vop@fe040000 {
+      compatible = "rockchip,rk3568-vop";
+      reg = <0x0 0xfe040000 0x0 0x3000>, <0x0 0xfe044000 0x0 0x1000>;
+      interrupts = <GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>;
+      clocks = <&cru ACLK_VOP>,
+               <&cru HCLK_VOP>,
+               <&cru DCLK_VOP0>,
+               <&cru DCLK_VOP1>,
+               <&cru DCLK_VOP2>;
+      clock-names = "aclk_vop",
+                    "hclk_vop",
+                    "dclk_vp0",
+                    "dclk_vp1",
+                    "dclk_vp2";
+      power-domains = <&power RK3568_PD_VO>;
+      iommus = <&vop_mmu>;
+      vop_out: port {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        vp0_out_dsi0: endpoint@0 {
+          reg = <0>;
+          remote-endpoint = <&dsi0_in_vp0>;
+        };
+        vp0_out_hdmi: endpoint@1 {
+          reg = <1>;
+          remote-endpoint = <&dsi0_in_vp0>;
+        };
+      };
+    };
Signature · 1 line
2.30.2
maintainer
#11 lore raw

Re: [PATCH 07/12] dt-bindings: display: rockchip: Add binding for VOP2

Quoted 10 lines · Sascha Hauer

The VOP2 is found on newer Rockchip SoCs like the rk3568 or the rk3566. The binding differs slightly from the existing VOP binding, so add a new binding file for it.

---
 .../display/rockchip/rockchip-vop2.yaml       | 114 ++++++++++++++++++
 1 file changed, 114 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/rockchip/rockchip-vop2.yaml

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/display/rockchip/rockchip-vop2.example.dt.yaml: example-0: vop@fe040000:reg:0: [0, 4261675008, 0, 12288] is too long
From schema: /usr/local/lib/python3.8/dist-packages/dtschema/schemas/reg.yaml
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/display/rockchip/rockchip-vop2.example.dt.yaml: example-0: vop@fe040000:reg:1: [0, 4261691392, 0, 4096] is too long
From schema: /usr/local/lib/python3.8/dist-packages/dtschema/schemas/reg.yaml

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/patch/1556199

This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit.

#12 lore raw

PATCH 8/12 arm64: dts: rockchip: rk356x: Add VOP2 nodes

In reply to Sascha Hauer

The VOP2 is the display output controller on the RK3568. Add the node for it to the dtsi file along with the required display-subsystem node and the iommu node.

---
 arch/arm64/boot/dts/rockchip/rk356x.dtsi | 52 ++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
arch/arm64/boot/dts/rockchip/rk356x.dtsi +52 -0
index 46d9552f60284..6ebf7c14e096a 100644
@@ -447,6 +447,58 @@ gmac1_mtl_tx_setup: tx-queues-config {
 		};
 	};
 
+	display_subsystem: display-subsystem {
+		compatible = "rockchip,display-subsystem";
+		ports = <&vop_out>;
+	};
+
+	vop: vop@fe040000 {
+		compatible = "rockchip,rk3568-vop";
+		reg = <0x0 0xfe040000 0x0 0x3000>, <0x0 0xfe044000 0x0 0x1000>;
+		reg-names = "regs", "gamma_lut";
+		rockchip,grf = <&grf>;
+		interrupts = <GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&cru ACLK_VOP>, <&cru HCLK_VOP>, <&cru DCLK_VOP0>, <&cru DCLK_VOP1>, <&cru DCLK_VOP2>;
+		clock-names = "aclk_vop", "hclk_vop", "dclk_vp0", "dclk_vp1", "dclk_vp2";
+		iommus = <&vop_mmu>;
+		power-domains = <&power RK3568_PD_VO>;
+		status = "disabled";
+
+		vop_out: ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			vp0: port@0 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				reg = <0>;
+			};
+
+			vp1: port@1 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				reg = <1>;
+			};
+
+			vp2: port@2 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				reg = <2>;
+			};
+		};
+	};
+
+	vop_mmu: iommu@fe043e00 {
+		compatible = "rockchip,rk3568-iommu";
+		reg = <0x0 0xfe043e00 0x0 0x100>, <0x0 0xfe043f00 0x0 0x100>;
+		interrupts = <GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>;
+		interrupt-names = "vop_mmu";
+		clocks = <&cru ACLK_VOP>, <&cru HCLK_VOP>;
+		clock-names = "aclk", "iface";
+		#iommu-cells = <0>;
+		status = "disabled";
+	};
+
 	qos_gpu: qos@fe128000 {
 		compatible = "rockchip,rk3568-qos", "syscon";
 		reg = <0x0 0xfe128000 0x0 0x20>;
Signature · 1 line
2.30.2
#13 lore raw

Re: [PATCH 08/12] arm64: dts: rockchip: rk356x: Add VOP2 nodes

Hi Sascha,

Quoted 14 lines · Sascha Hauer

The VOP2 is the display output controller on the RK3568. Add the node for it to the dtsi file along with the required display-subsystem node and the iommu node.

---
 arch/arm64/boot/dts/rockchip/rk356x.dtsi | 52 ++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
arch/arm64/boot/dts/rockchip/rk356x.dtsi +0 -0
index 46d9552f60284..6ebf7c14e096a 100644

arch/arm64/boot/dts/rockchip/rk356x.dtsi gmac1_mtl_tx_setup: tx-queues-config { · line 454

Quoted 8 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +4 -0
@@ -447,6 +447,58 @@ gmac1_mtl_tx_setup: tx-queues-config {
 		};
 	};
 
 
+	display_subsystem: display-subsystem {
+		compatible = "rockchip,display-subsystem";
+		ports = <&vop_out>;
+	};

Some DT sort rules:

For nodes:
Sort things without reg alphabetical first,
then sort the rest by reg address.

arch/arm64/boot/dts/rockchip/rk356x.dtsi gmac1_mtl_tx_setup: tx-queues-config { · line 456

Quoted 4 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +3 -0
+
+	vop: vop@fe040000 {
 
+		compatible = "rockchip,rk3568-vop";

From rockchip-vop2.yaml:
+properties:
+ compatible:
+ enum:

+ - rockchip,rk3568-vop
+ - rockchip,rk3566-vop

Maybe sort yaml compatibles in alphabetical order.

rockchip,rk3566-vop is not used in the dtsi I think.

Comment by Andy Yan:

Quoted 9 lines

But take care that the vop on rk3566 has a special limitation: there are three

windows(Cluster1/Esmart1/Smart1) that have a mirror lock, that means they

can't be programed framebuffer address independently , they can only

share framebuffer address with Cluster0/Esmart0/Smart0.

Question:
Given Andy's comment could someone explain weather the vop and hdmi nodes should be in rk3566.dtsi and rk3568.dtsi with an extra rockchip,rk3566-dw-hdmi compatible?

arch/arm64/boot/dts/rockchip/rk356x.dtsi gmac1_mtl_tx_setup: tx-queues-config { · line 459

Quoted 4 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +3 -0
+		reg = <0x0 0xfe040000 0x0 0x3000>, <0x0 0xfe044000 0x0 0x1000>;
+		reg-names = "regs", "gamma_lut";
 
+		rockchip,grf = <&grf>;

Heiko's sort rules:

compatible
reg
interrupts
[alphabetical]
status [if needed]

Quoted 6 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +6 -0
+		interrupts = <GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&cru ACLK_VOP>, <&cru HCLK_VOP>, <&cru DCLK_VOP0>, <&cru DCLK_VOP1>, <&cru DCLK_VOP2>;
+		clock-names = "aclk_vop", "hclk_vop", "dclk_vp0", "dclk_vp1", "dclk_vp2";
+		iommus = <&vop_mmu>;
+		power-domains = <&power RK3568_PD_VO>;
+		status = "disabled";

arch/arm64/boot/dts/rockchip/rk356x.dtsi gmac1_mtl_tx_setup: tx-queues-config { · line 474

Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +9 -0
+
+		vop_out: ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			vp0: port@0 {
 
+				#address-cells = <1>;
+				#size-cells = <0>;
+				reg = <0>;

My incomplete list:

Inside nodes:
If exists on top: compatible, reg and interrupts.
In alphabetical order the required properties.
Then in alphabetical order the other properties.
And as last things that start with '#' in alphabetical order. Add status below all other properties for soc internal components with any board-specifics.

Quoted 12 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +12 -0
+			};
+
+			vp1: port@1 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				reg = <1>;
+			};
+
+			vp2: port@2 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				reg = <2>;

arch/arm64/boot/dts/rockchip/rk356x.dtsi gmac1_mtl_tx_setup: tx-queues-config { · line 495

Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +9 -0
+			};
+		};
+	};
+
+	vop_mmu: iommu@fe043e00 {
+		compatible = "rockchip,rk3568-iommu";
+		reg = <0x0 0xfe043e00 0x0 0x100>, <0x0 0xfe043f00 0x0 0x100>;
+		interrupts = <GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>;
 
+		interrupt-names = "vop_mmu";

ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/iommu/rockchip,iommu.yaml

arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dt.yaml: iommu@fe043e00:
'interrupt-names' does not match any of the regexes: 'pinctrl-[0-9]+'
From schema: /Documentation/devicetree/bindings/iommu/rockchip,iommu.yaml

Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +6 -0
+		clocks = <&cru ACLK_VOP>, <&cru HCLK_VOP>;
+		clock-names = "aclk", "iface";
+		#iommu-cells = <0>;
+		status = "disabled";
+	};
+
 	qos_gpu: qos@fe128000 {
 		compatible = "rockchip,rk3568-qos", "syscon";
 		reg = <0x0 0xfe128000 0x0 0x20>;
#14 lore raw

Re: [PATCH 08/12] arm64: dts: rockchip: rk356x: Add VOP2 nodes

Quoted 57 lines · Johan Jonker

Hi Sascha,

Quoted 14 lines · Sascha Hauer

The VOP2 is the display output controller on the RK3568. Add the node for it to the dtsi file along with the required display-subsystem node and the iommu node.

---
 arch/arm64/boot/dts/rockchip/rk356x.dtsi | 52 ++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
arch/arm64/boot/dts/rockchip/rk356x.dtsi +0 -0
index 46d9552f60284..6ebf7c14e096a 100644

arch/arm64/boot/dts/rockchip/rk356x.dtsi gmac1_mtl_tx_setup: tx-queues-config { · line 454

Quoted 8 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +4 -0
@@ -447,6 +447,58 @@ gmac1_mtl_tx_setup: tx-queues-config {
 		};
 	};
 
 
+	display_subsystem: display-subsystem {
+		compatible = "rockchip,display-subsystem";
+		ports = <&vop_out>;
+	};

Some DT sort rules:

For nodes:
Sort things without reg alphabetical first,
then sort the rest by reg address.

arch/arm64/boot/dts/rockchip/rk356x.dtsi gmac1_mtl_tx_setup: tx-queues-config { · line 456

Quoted 4 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +3 -0
+
+	vop: vop@fe040000 {
 
+		compatible = "rockchip,rk3568-vop";

From rockchip-vop2.yaml:

(quoted diff) +5 -0
+properties:
+  compatible:
+    enum:
 
+      - rockchip,rk3568-vop
+      - rockchip,rk3566-vop

Maybe sort yaml compatibles in alphabetical order.

rockchip,rk3566-vop is not used in the dtsi I think.

Comment by Andy Yan:

Quoted 6 lines

But take care that the vop on rk3566 has a special limitation: there are three

windows(Cluster1/Esmart1/Smart1) that have a mirror lock, that means they

Quoted 8 lines
Quoted 3 lines

can't be programed framebuffer address independently , they can only

share framebuffer address with Cluster0/Esmart0/Smart0.

Question:
Given Andy's comment could someone explain weather the vop and hdmi nodes should be in rk3566.dtsi and rk3568.dtsi with an extra rockchip,rk3566-dw-hdmi compatible?

We could put the vop/hdmi nodes into rk356x.dtsi and just add the compatible properties to rk3566.dtsi and rk3568.dtsi.
We'll need the exact SoC type, besides the mirror lock thingy there are a few other minor differences between the SoCs.

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
maintainer
#15 lore raw

Re: [PATCH 08/12] arm64: dts: rockchip: rk356x: Add VOP2 nodes

Am Freitag, 26. November 2021, 08:40:21 CET schrieb Sascha Hauer:

Quoted 62 lines · Johan Jonker
Quoted 61 lines

Hi Sascha,

Quoted 14 lines · Sascha Hauer

The VOP2 is the display output controller on the RK3568. Add the node for it to the dtsi file along with the required display-subsystem node and the iommu node.

---
 arch/arm64/boot/dts/rockchip/rk356x.dtsi | 52 ++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
arch/arm64/boot/dts/rockchip/rk356x.dtsi +0 -0
index 46d9552f60284..6ebf7c14e096a 100644

arch/arm64/boot/dts/rockchip/rk356x.dtsi gmac1_mtl_tx_setup: tx-queues-config { · line 454

Quoted 8 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +4 -0
@@ -447,6 +447,58 @@ gmac1_mtl_tx_setup: tx-queues-config {
 		};
 	};
 
 
+	display_subsystem: display-subsystem {
+		compatible = "rockchip,display-subsystem";
+		ports = <&vop_out>;
+	};

Some DT sort rules:

For nodes:
Sort things without reg alphabetical first,
then sort the rest by reg address.

arch/arm64/boot/dts/rockchip/rk356x.dtsi gmac1_mtl_tx_setup: tx-queues-config { · line 456

Quoted 4 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +3 -0
+
+	vop: vop@fe040000 {
 
+		compatible = "rockchip,rk3568-vop";

From rockchip-vop2.yaml:

(quoted diff) +5 -0
+properties:
+  compatible:
+    enum:
 
+      - rockchip,rk3568-vop
+      - rockchip,rk3566-vop

Maybe sort yaml compatibles in alphabetical order.

rockchip,rk3566-vop is not used in the dtsi I think.

Comment by Andy Yan:

Quoted 9 lines

But take care that the vop on rk3566 has a special limitation: there are three

windows(Cluster1/Esmart1/Smart1) that have a mirror lock, that means they

can't be programed framebuffer address independently , they can only

share framebuffer address with Cluster0/Esmart0/Smart0.

Quoted 7 lines
Quoted 4 lines

Question:
Given Andy's comment could someone explain weather the vop and hdmi nodes should be in rk3566.dtsi and rk3568.dtsi with an extra rockchip,rk3566-dw-hdmi compatible?

We could put the vop/hdmi nodes into rk356x.dtsi and just add the compatible properties to rk3566.dtsi and rk3568.dtsi.

sounds about right. We have similar solutions in place in other socs.

Heiko

#16 lore raw

PATCH 9/12 arm64: dts: rockchip: rk356x: Add HDMI nodes

In reply to Sascha Hauer

Add support for the HDMI port found on RK3568.

---
 arch/arm64/boot/dts/rockchip/rk356x.dtsi | 65 ++++++++++++++++++++++++
 1 file changed, 65 insertions(+)
arch/arm64/boot/dts/rockchip/rk356x.dtsi +65 -0
index 6ebf7c14e096a..53be61a7ce595 100644
@@ -472,18 +472,36 @@ vp0: port@0 {
 				#address-cells = <1>;
 				#size-cells = <0>;
 				reg = <0>;
+
+				vp0_out_hdmi: endpoint@0 {
+					reg = <0>;
+					remote-endpoint = <&hdmi_in_vp0>;
+					status = "disabled";
+				};
 			};
 
 			vp1: port@1 {
 				#address-cells = <1>;
 				#size-cells = <0>;
 				reg = <1>;
+
+				vp1_out_hdmi: endpoint@0 {
+					reg = <0>;
+					remote-endpoint = <&hdmi_in_vp1>;
+					status = "disabled";
+				};
 			};
 
 			vp2: port@2 {
 				#address-cells = <1>;
 				#size-cells = <0>;
 				reg = <2>;
+
+				vp2_out_hdmi: endpoint@0 {
+					reg = <0>;
+					remote-endpoint = <&hdmi_in_vp2>;
+					status = "disabled";
+				};
 			};
 		};
 	};
@@ -499,6 +517,53 @@ vop_mmu: iommu@fe043e00 {
 		status = "disabled";
 	};
 
+	hdmi: hdmi@fe0a0000 {
+		compatible = "rockchip,rk3568-dw-hdmi";
+		reg = <0x0 0xfe0a0000 0x0 0x20000>;
+		interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&cru PCLK_HDMI_HOST>,
+			 <&cru CLK_HDMI_SFR>,
+			 <&cru CLK_HDMI_CEC>,
+			 <&cru HCLK_VOP>;
+		clock-names = "iahb", "isfr", "cec", "hclk";
+		power-domains = <&power RK3568_PD_VO>;
+		reg-io-width = <4>;
+		rockchip,grf = <&grf>;
+		#sound-dai-cells = <0>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&hdmitx_scl &hdmitx_sda &hdmitxm0_cec>;
+		status = "disabled";
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			hdmi_in: port@0 {
+				reg = <0>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				hdmi_in_vp0: endpoint@0 {
+					reg = <0>;
+					remote-endpoint = <&vp0_out_hdmi>;
+					status = "disabled";
+				};
+
+				hdmi_in_vp1: endpoint@1 {
+					reg = <1>;
+					remote-endpoint = <&vp1_out_hdmi>;
+					status = "disabled";
+				};
+
+				hdmi_in_vp2: endpoint@2 {
+					reg = <2>;
+					remote-endpoint = <&vp2_out_hdmi>;
+					status = "disabled";
+				};
+			};
+		};
+	};
+
 	qos_gpu: qos@fe128000 {
 		compatible = "rockchip,rk3568-qos", "syscon";
 		reg = <0x0 0xfe128000 0x0 0x20>;
Signature · 1 line
2.30.2
maintainer
#17 lore raw

Re: [PATCH 09/12] arm64: dts: rockchip: rk356x: Add HDMI nodes

Quoted 65 lines · Sascha Hauer

Add support for the HDMI port found on RK3568.

---
 arch/arm64/boot/dts/rockchip/rk356x.dtsi | 65 ++++++++++++++++++++++++
 1 file changed, 65 insertions(+)
arch/arm64/boot/dts/rockchip/rk356x.dtsi +30 -0
index 6ebf7c14e096a..53be61a7ce595 100644
@@ -472,18 +472,36 @@ vp0: port@0 {
                                #address-cells = <1>;
                                #size-cells = <0>;
                                reg = <0>;
+
+                               vp0_out_hdmi: endpoint@0 {
+                                       reg = <0>;
+                                       remote-endpoint = <&hdmi_in_vp0>;
+                                       status = "disabled";
+                               };
                        };
 
                        vp1: port@1 {
                                #address-cells = <1>;
                                #size-cells = <0>;
                                reg = <1>;
+
+                               vp1_out_hdmi: endpoint@0 {
+                                       reg = <0>;
+                                       remote-endpoint = <&hdmi_in_vp1>;
+                                       status = "disabled";
+                               };
                        };
 
                        vp2: port@2 {
                                #address-cells = <1>;
                                #size-cells = <0>;
                                reg = <2>;
+
+                               vp2_out_hdmi: endpoint@0 {
+                                       reg = <0>;
+                                       remote-endpoint = <&hdmi_in_vp2>;
+                                       status = "disabled";
+                               };
                        };
                };
        };
@@ -499,6 +517,53 @@ vop_mmu: iommu@fe043e00 {
                status = "disabled";
        };
 
+       hdmi: hdmi@fe0a0000 {
+               compatible = "rockchip,rk3568-dw-hdmi";
+               reg = <0x0 0xfe0a0000 0x0 0x20000>;
+               interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&cru PCLK_HDMI_HOST>,
+                        <&cru CLK_HDMI_SFR>,
+                        <&cru CLK_HDMI_CEC>,
+                        <&cru HCLK_VOP>;
+               clock-names = "iahb", "isfr", "cec", "hclk";
+               power-domains = <&power RK3568_PD_VO>;
+               reg-io-width = <4>;
+               rockchip,grf = <&grf>;

arch/arm64/boot/dts/rockchip/rk356x.dtsi vop_mmu: iommu@fe043e00 { · line 541

Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +10 -0
+               #sound-dai-cells = <0>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&hdmitx_scl &hdmitx_sda &hdmitxm0_cec>;
+               status = "disabled";
+
+               ports {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       hdmi_in: port@0 {

The schema says there is only 1 'port' node. Please run schema validation when making DT changes.

However, an HDMI bridge should also define an output port to a connector node (or another bridge). So the fix is to allow 'port@0' and add an output port.

Quoted 31 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +25 -1
+                               reg = <0>;
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+
+                               hdmi_in_vp0: endpoint@0 {
+                                       reg = <0>;
+                                       remote-endpoint = <&vp0_out_hdmi>;
+                                       status = "disabled";
+                               };
+
+                               hdmi_in_vp1: endpoint@1 {
+                                       reg = <1>;
+                                       remote-endpoint = <&vp1_out_hdmi>;
+                                       status = "disabled";
+                               };
+
+                               hdmi_in_vp2: endpoint@2 {
+                                       reg = <2>;
+                                       remote-endpoint = <&vp2_out_hdmi>;
+                                       status = "disabled";
+                               };
+                       };
+               };
+       };
+
        qos_gpu: qos@fe128000 {
                compatible = "rockchip,rk3568-qos", "syscon";
                reg = <0x0 0xfe128000 0x0 0x20>;
--

2.30.2

#18 lore raw

Re: [PATCH 09/12] arm64: dts: rockchip: rk356x: Add HDMI nodes

Quoted 81 lines · Rob Herring
Quoted 65 lines · Sascha Hauer

Add support for the HDMI port found on RK3568.

---
 arch/arm64/boot/dts/rockchip/rk356x.dtsi | 65 ++++++++++++++++++++++++
 1 file changed, 65 insertions(+)
arch/arm64/boot/dts/rockchip/rk356x.dtsi +30 -0
index 6ebf7c14e096a..53be61a7ce595 100644
@@ -472,18 +472,36 @@ vp0: port@0 {
                                #address-cells = <1>;
                                #size-cells = <0>;
                                reg = <0>;
+
+                               vp0_out_hdmi: endpoint@0 {
+                                       reg = <0>;
+                                       remote-endpoint = <&hdmi_in_vp0>;
+                                       status = "disabled";
+                               };
                        };
 
                        vp1: port@1 {
                                #address-cells = <1>;
                                #size-cells = <0>;
                                reg = <1>;
+
+                               vp1_out_hdmi: endpoint@0 {
+                                       reg = <0>;
+                                       remote-endpoint = <&hdmi_in_vp1>;
+                                       status = "disabled";
+                               };
                        };
 
                        vp2: port@2 {
                                #address-cells = <1>;
                                #size-cells = <0>;
                                reg = <2>;
+
+                               vp2_out_hdmi: endpoint@0 {
+                                       reg = <0>;
+                                       remote-endpoint = <&hdmi_in_vp2>;
+                                       status = "disabled";
+                               };
                        };
                };
        };
@@ -499,6 +517,53 @@ vop_mmu: iommu@fe043e00 {
                status = "disabled";
        };
 
+       hdmi: hdmi@fe0a0000 {
+               compatible = "rockchip,rk3568-dw-hdmi";
+               reg = <0x0 0xfe0a0000 0x0 0x20000>;
+               interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&cru PCLK_HDMI_HOST>,
+                        <&cru CLK_HDMI_SFR>,
+                        <&cru CLK_HDMI_CEC>,
+                        <&cru HCLK_VOP>;
+               clock-names = "iahb", "isfr", "cec", "hclk";
+               power-domains = <&power RK3568_PD_VO>;
+               reg-io-width = <4>;
+               rockchip,grf = <&grf>;

arch/arm64/boot/dts/rockchip/rk356x.dtsi vop_mmu: iommu@fe043e00 { · line 541

Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +10 -0
+               #sound-dai-cells = <0>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&hdmitx_scl &hdmitx_sda &hdmitxm0_cec>;
+               status = "disabled";
+
+               ports {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       hdmi_in: port@0 {

The schema says there is only 1 'port' node. Please run schema validation when making DT changes.

Quoted 3 lines

However, an HDMI bridge should also define an output port to a connector node (or another bridge). So the fix is to allow 'port@0' and add an output port.

The rockchip bindings traditionally don't have a connector explicitly specified in their device trees. I'll stick to that for the next round. If necessary I'll look later what it takes to add a connector node.

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#19 lore raw

PATCH 10/12 arm64: dts: rockchip: rk3568-evb: Enable VOP2 and hdmi

In reply to Sascha Hauer

This enabled the VOP2 display controller along with hdmi and the required port routes which is enough to get a picture out of the hdmi port of the board.

---
 .../boot/dts/rockchip/rk3568-evb1-v10.dts     | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)
arch/arm64/boot/dts/rockchip/rk3568-evb1-v10.dts +24 -0
index 184e2aa2416af..156e001492173 100644
@@ -106,6 +106,12 @@ &gmac1m1_rgmii_clk
 	status = "okay";
 };
 
+&hdmi {
+	status = "okay";
+	avdd-0v9-supply = <&vdda0v9_image>;
+	avdd-1v8-supply = <&vcca1v8_image>;
+};
+
 &i2c0 {
 	status = "okay";
 
@@ -390,3 +396,21 @@ &sdmmc0 {
 &uart2 {
 	status = "okay";
 };
+
+&vop {
+	status = "okay";
+	assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>;
+	assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>;
+};
+
+&vop_mmu {
+	status = "okay";
+};
+
+&hdmi_in_vp0 {
+	status = "okay";
+};
+
+&vp0_out_hdmi {
+	status = "okay";
+};
Signature · 1 line
2.30.2
maintainer
#20 lore raw

Re: [PATCH 10/12] arm64: dts: rockchip: rk3568-evb: Enable VOP2 and hdmi

Quoted 39 lines · Sascha Hauer

This enabled the VOP2 display controller along with hdmi and the required port routes which is enough to get a picture out of the hdmi port of the board.

---
 .../boot/dts/rockchip/rk3568-evb1-v10.dts     | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)
arch/arm64/boot/dts/rockchip/rk3568-evb1-v10.dts +14 -0
index 184e2aa2416af..156e001492173 100644
@@ -106,6 +106,12 @@ &gmac1m1_rgmii_clk
        status = "okay";
 };
 
+&hdmi {
+       status = "okay";
+       avdd-0v9-supply = <&vdda0v9_image>;
+       avdd-1v8-supply = <&vcca1v8_image>;
+};
+
 &i2c0 {
        status = "okay";
 
@@ -390,3 +396,21 @@ &sdmmc0 {
 &uart2 {
        status = "okay";
 };
+
+&vop {
+       status = "okay";
+       assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>;
+       assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>;
+};
+
+&vop_mmu {

arch/arm64/boot/dts/rockchip/rk3568-evb1-v10.dts &sdmmc0 { · line 416

Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk3568-evb1-v10.dts +10 -0
+       status = "okay";
+};
+
+&hdmi_in_vp0 {
+       status = "okay";
+};
+
+&vp0_out_hdmi {
+       status = "okay";
+};

You can accomplish the same thing already with:

&vp0_out_hdmi {
remote-endpoint = <&hdmi_in_vp0>;
};

or:

&vp0_out_hdmi {
/delete-property/ remote-endpoint;
};

#21 lore raw

Re: [PATCH 10/12] arm64: dts: rockchip: rk3568-evb: Enable VOP2 and hdmi

Quoted 53 lines · Rob Herring
Quoted 39 lines · Sascha Hauer

This enabled the VOP2 display controller along with hdmi and the required port routes which is enough to get a picture out of the hdmi port of the board.

---
 .../boot/dts/rockchip/rk3568-evb1-v10.dts     | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)
arch/arm64/boot/dts/rockchip/rk3568-evb1-v10.dts +14 -0
index 184e2aa2416af..156e001492173 100644
@@ -106,6 +106,12 @@ &gmac1m1_rgmii_clk
        status = "okay";
 };
 
+&hdmi {
+       status = "okay";
+       avdd-0v9-supply = <&vdda0v9_image>;
+       avdd-1v8-supply = <&vcca1v8_image>;
+};
+
 &i2c0 {
        status = "okay";
 
@@ -390,3 +396,21 @@ &sdmmc0 {
 &uart2 {
        status = "okay";
 };
+
+&vop {
+       status = "okay";
+       assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>;
+       assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>;
+};
+
+&vop_mmu {

arch/arm64/boot/dts/rockchip/rk3568-evb1-v10.dts &sdmmc0 { · line 416

Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk3568-evb1-v10.dts +10 -0
+       status = "okay";
+};
+
+&hdmi_in_vp0 {
+       status = "okay";
+};
+
+&vp0_out_hdmi {
+       status = "okay";
+};

You can accomplish the same thing already with:

Quoted 3 lines

&vp0_out_hdmi {
remote-endpoint = <&hdmi_in_vp0>;
};

My idea was to describe all possible connections in the dtsi file and let the board dts writer only en/disable the needed connections. When the connections are specified in the dts file then writing it is more difficult and error prone.

Quoted 6 lines

or:

&vp0_out_hdmi {
/delete-property/ remote-endpoint;
};

With this I have to change all connections that I don't need. With status = "okay" I have to change all connections that I actually do need, which will be much easier to read and write.

I'll stick to the status = "okay" method for the next round, maybe I can still convince you ;)

If it's the 'status' property you don't like being used when it's not a device that is enabled/disabled, then every other name would be fine with me as well.

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
maintainer
#22 lore raw

Re: [PATCH 10/12] arm64: dts: rockchip: rk3568-evb: Enable VOP2 and hdmi

Hi Sascha,

Am Donnerstag, 2. Dezember 2021, 16:34:49 CET schrieb Sascha Hauer:

Quoted 74 lines · Rob Herring
Quoted 53 lines · Sascha Hauer
Quoted 39 lines

This enabled the VOP2 display controller along with hdmi and the required port routes which is enough to get a picture out of the hdmi port of the board.

---
 .../boot/dts/rockchip/rk3568-evb1-v10.dts     | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)
arch/arm64/boot/dts/rockchip/rk3568-evb1-v10.dts +14 -0
index 184e2aa2416af..156e001492173 100644
@@ -106,6 +106,12 @@ &gmac1m1_rgmii_clk
        status = "okay";
 };
 
+&hdmi {
+       status = "okay";
+       avdd-0v9-supply = <&vdda0v9_image>;
+       avdd-1v8-supply = <&vcca1v8_image>;
+};
+
 &i2c0 {
        status = "okay";
 
@@ -390,3 +396,21 @@ &sdmmc0 {
 &uart2 {
        status = "okay";
 };
+
+&vop {
+       status = "okay";
+       assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>;
+       assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>;
+};
+
+&vop_mmu {

arch/arm64/boot/dts/rockchip/rk3568-evb1-v10.dts &sdmmc0 { · line 416

Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk3568-evb1-v10.dts +10 -0
+       status = "okay";
+};
+
+&hdmi_in_vp0 {
+       status = "okay";
+};
+
+&vp0_out_hdmi {
+       status = "okay";
+};

You can accomplish the same thing already with:

Quoted 3 lines

&vp0_out_hdmi {
remote-endpoint = <&hdmi_in_vp0>;
};

My idea was to describe all possible connections in the dtsi file and let the board dts writer only en/disable the needed connections. When the connections are specified in the dts file then writing it is more difficult and error prone.

Quoted 6 lines

or:

&vp0_out_hdmi {
/delete-property/ remote-endpoint;
};

With this I have to change all connections that I don't need. With status = "okay" I have to change all connections that I actually do need, which will be much easier to read and write.

Quoted 6 lines

I'll stick to the status = "okay" method for the next round, maybe I can still convince you ;)

If it's the 'status' property you don't like being used when it's not a device that is enabled/disabled, then every other name would be fine with me as well.

hmm, we do have code in the rockchip drm-driver to find out if the device at the end of a graph-connection is disabled or not [0] , So on previous Rockchip socs, there are already all connections established, and the driver weeds out the disabled ones.

So I'm wondering what is missing to use that in a vop2 context?

Heiko

[0] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/rockchip/rockchip_drm_drv.c#n274

#23 lore raw

Re: [PATCH 10/12] arm64: dts: rockchip: rk3568-evb: Enable VOP2 and hdmi

Hi Heiko,

Quoted 84 lines · Heiko Stübner

Hi Sascha,

Am Donnerstag, 2. Dezember 2021, 16:34:49 CET schrieb Sascha Hauer:

Quoted 74 lines · Rob Herring
Quoted 53 lines · Sascha Hauer
Quoted 39 lines

This enabled the VOP2 display controller along with hdmi and the required port routes which is enough to get a picture out of the hdmi port of the board.

---
 .../boot/dts/rockchip/rk3568-evb1-v10.dts     | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)
arch/arm64/boot/dts/rockchip/rk3568-evb1-v10.dts +14 -0
index 184e2aa2416af..156e001492173 100644
@@ -106,6 +106,12 @@ &gmac1m1_rgmii_clk
        status = "okay";
 };
 
+&hdmi {
+       status = "okay";
+       avdd-0v9-supply = <&vdda0v9_image>;
+       avdd-1v8-supply = <&vcca1v8_image>;
+};
+
 &i2c0 {
        status = "okay";
 
@@ -390,3 +396,21 @@ &sdmmc0 {
 &uart2 {
        status = "okay";
 };
+
+&vop {
+       status = "okay";
+       assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>;
+       assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>;
+};
+
+&vop_mmu {

arch/arm64/boot/dts/rockchip/rk3568-evb1-v10.dts &sdmmc0 { · line 416

Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk3568-evb1-v10.dts +10 -0
+       status = "okay";
+};
+
+&hdmi_in_vp0 {
+       status = "okay";
+};
+
+&vp0_out_hdmi {
+       status = "okay";
+};

You can accomplish the same thing already with:

Quoted 3 lines

&vp0_out_hdmi {
remote-endpoint = <&hdmi_in_vp0>;
};

My idea was to describe all possible connections in the dtsi file and let the board dts writer only en/disable the needed connections. When the connections are specified in the dts file then writing it is more difficult and error prone.

Quoted 6 lines

or:

&vp0_out_hdmi {
/delete-property/ remote-endpoint;
};

With this I have to change all connections that I don't need. With status = "okay" I have to change all connections that I actually do need, which will be much easier to read and write.

Quoted 6 lines

I'll stick to the status = "okay" method for the next round, maybe I can still convince you ;)

If it's the 'status' property you don't like being used when it's not a device that is enabled/disabled, then every other name would be fine with me as well.

Quoted 6 lines

hmm, we do have code in the rockchip drm-driver to find out if the device at the end of a graph-connection is disabled or not [0] , So on previous Rockchip socs, there are already all connections established, and the driver weeds out the disabled ones.

So I'm wondering what is missing to use that in a vop2 context?

The vop2 has three video ports (crtcs) instead of only one. All three are described in the device tree and each of them has a of_graph connection to the different encoders, so something like:

vp0 <-> hdmi
vp0 <-> mipi
vp1 <-> hdmi
vp1 <-> mipi
vp2 <-> hdmi
vp2 <-> mipi

Enabling just vp0 <-> hdmi means only the first video port is can do hdmi. Different constraints in the clock tree (hdmi reference clock is hardwired to hpll, not enough PLLs to put all video ports on independent ones) prevent us from just allowing all connections.

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#24 lore raw

Re: [PATCH 10/12] arm64: dts: rockchip: rk3568-evb: Enable VOP2 and hdmi

In reply to Sascha Hauer

Hi Sascha,

Quoted 34 lines · Sascha Hauer

This enabled the VOP2 display controller along with hdmi and the required port routes which is enough to get a picture out of the hdmi port of the board.

---
  .../boot/dts/rockchip/rk3568-evb1-v10.dts     | 24 +++++++++++++++++++
  1 file changed, 24 insertions(+)
arch/arm64/boot/dts/rockchip/rk3568-evb1-v10.dts +10 -0
index 184e2aa2416af..156e001492173 100644
@@ -106,6 +106,12 @@ &gmac1m1_rgmii_clk
  	status = "okay";
  };
 
+&hdmi {
+	status = "okay";
+	avdd-0v9-supply = <&vdda0v9_image>;
+	avdd-1v8-supply = <&vcca1v8_image>;
+};
+
  &i2c0 {
  	status = "okay";
 
@@ -390,3 +396,21 @@ &sdmmc0 {
  &uart2 {
  	status = "okay";
  };
+
+&vop {
+	status = "okay";
+	assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>;

arch/arm64/boot/dts/rockchip/rk3568-evb1-v10.dts &sdmmc0 { · line 412

Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk3568-evb1-v10.dts +10 -0
+	assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>;
+};
+
+&vop_mmu {
+	status = "okay";
+};
+
+&hdmi_in_vp0 {
+	status = "okay";
+};

Minor nitpick: This should probably be sorted alphabetically.

Best regards,
Michael

Quoted 5 lines
arch/arm64/boot/dts/rockchip/rk3568-evb1-v10.dts +4 -0
+
+&vp0_out_hdmi {
+	status = "okay";
+};
#25 lore raw

PATCH 1/1 arm64: dts: rockchip: enable vop2 and hdmi tx on quartz64a

In reply to Sascha Hauer

Enable the RK356x Video Output Processor (VOP) 2 on the Pine64 Quartz64 Model A.

---
 .../boot/dts/rockchip/rk3566-quartz64-a.dts   | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)
arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts +24 -0
index 4d4b2a301b1a..9fba790c6af4 100644
@@ -205,6 +205,16 @@ &gmac1m0_clkinout
 	status = "okay";
 };
 
+&hdmi {
+	status = "okay";
+	avdd-0v9-supply = <&vdda_0v9>;
+	avdd-1v8-supply = <&vcc_1v8>;
+};
+
+&hdmi_in_vp0 {
+	status = "okay";
+};
+
 &i2c0 {
 	status = "okay";
 
@@ -546,3 +556,17 @@ bluetooth {
 &uart2 {
 	status = "okay";
 };
+
+&vop {
+	status = "okay";
+	assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>;
+	assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>;
+};
+
+&vop_mmu {
+	status = "okay";
+};
+
+&vp0_out_hdmi {
+	status = "okay";
+};
Signature · 1 line
2.30.2
#26 lore raw

Re: [PATCH] arm64: dts: rockchip: enable vop2 and hdmi tx on quartz64a

Quoted 13 lines · Michael Riesch

Enable the RK356x Video Output Processor (VOP) 2 on the Pine64 Quartz64 Model A.

---
 .../boot/dts/rockchip/rk3566-quartz64-a.dts   | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)
arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts +0 -0
index 4d4b2a301b1a..9fba790c6af4 100644

arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts &gmac1m0_clkinout · line 212

Quoted 8 lines
arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts +4 -0
@@ -205,6 +205,16 @@ &gmac1m0_clkinout
 	status = "okay";
 };
 
+&hdmi {
 
+	status = "okay";
+	avdd-0v9-supply = <&vdda_0v9>;
+	avdd-1v8-supply = <&vcc_1v8>;

Heiko's sort rules:

compatible
reg
interrupts
[alphabetical]
status [if needed]

Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts +6 -0
+};
+
+&hdmi_in_vp0 {
+	status = "okay";
+};
+
 &i2c0 {
 	status = "okay";

arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts bluetooth { · line 561

Quoted 7 lines
arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts +3 -0
@@ -546,3 +556,17 @@ bluetooth {
 &uart2 {
 	status = "okay";
 };
+
+&vop {
 
+	status = "okay";

status below

Quoted 12 lines
arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts +11 -0
+	assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>;
+	assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>;
+};
+
+&vop_mmu {
+	status = "okay";
+};
+
+&vp0_out_hdmi {
+	status = "okay";
+};
#27 lore raw

PATCH 11/12 drm/rockchip: Make VOP driver optional

In reply to Sascha Hauer

With upcoming VOP2 support VOP won't be the only choice anymore, so make the VOP driver optional.

---
 arch/arm/configs/multi_v7_defconfig         | 1 +
 arch/arm64/configs/defconfig                | 1 +
 drivers/gpu/drm/rockchip/Kconfig            | 7 +++++++
 drivers/gpu/drm/rockchip/Makefile           | 3 ++-
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 2 +-
 5 files changed, 12 insertions(+), 2 deletions(-)
arch/arm/configs/multi_v7_defconfig +1 -0
index c951aeed2138c..fc123e8f3e2f9 100644
@@ -667,6 +667,7 @@ CONFIG_DRM_EXYNOS_DPI=y
 CONFIG_DRM_EXYNOS_DSI=y
 CONFIG_DRM_EXYNOS_HDMI=y
 CONFIG_DRM_ROCKCHIP=m
+CONFIG_ROCKCHIP_VOP=y
 CONFIG_ROCKCHIP_ANALOGIX_DP=y
 CONFIG_ROCKCHIP_DW_HDMI=y
 CONFIG_ROCKCHIP_DW_MIPI_DSI=y
arch/arm64/configs/defconfig +1 -0
index f2e2b9bdd7024..a623386473dc9 100644
@@ -682,6 +682,7 @@ CONFIG_DRM_EXYNOS_DSI=y
 CONFIG_DRM_EXYNOS_HDMI=y
 CONFIG_DRM_EXYNOS_MIC=y
 CONFIG_DRM_ROCKCHIP=m
+CONFIG_ROCKCHIP_VOP=y
 CONFIG_ROCKCHIP_ANALOGIX_DP=y
 CONFIG_ROCKCHIP_CDN_DP=y
 CONFIG_ROCKCHIP_DW_HDMI=y
drivers/gpu/drm/rockchip/Kconfig +7 -0
index 9f1ecefc39332..a1c4158259099 100644
@@ -21,8 +21,15 @@ config DRM_ROCKCHIP
 
 if DRM_ROCKCHIP
 
+config ROCKCHIP_VOP
+	bool "Rockchip VOP driver"
+	help
+	  This selects support for the VOP driver. You should enable it
+	  on all older SoCs up to RK3399.
+
 config ROCKCHIP_ANALOGIX_DP
 	bool "Rockchip specific extensions for Analogix DP driver"
+	depends on ROCKCHIP_VOP
 	help
 	  This selects support for Rockchip SoC specific extensions
 	  for the Analogix Core DP driver. If you want to enable DP
drivers/gpu/drm/rockchip/Makefile +2 -1
index 17a9e7eb2130d..cd6e7bb5ce9c5 100644
@@ -4,9 +4,10 @@
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
 rockchipdrm-y := rockchip_drm_drv.o rockchip_drm_fb.o \
-		rockchip_drm_gem.o rockchip_drm_vop.o rockchip_vop_reg.o
+		rockchip_drm_gem.o
 rockchipdrm-$(CONFIG_DRM_FBDEV_EMULATION) += rockchip_drm_fbdev.o
 
+rockchipdrm-$(CONFIG_ROCKCHIP_VOP) += rockchip_drm_vop.o rockchip_vop_reg.o
 rockchipdrm-$(CONFIG_ROCKCHIP_ANALOGIX_DP) += analogix_dp-rockchip.o
 rockchipdrm-$(CONFIG_ROCKCHIP_CDN_DP) += cdn-dp-core.o cdn-dp-reg.o
 rockchipdrm-$(CONFIG_ROCKCHIP_DW_HDMI) += dw_hdmi-rockchip.o
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +1 -1
index e4ebe60b3cc1a..64fa5fd62c01a 100644
@@ -473,7 +473,7 @@ static int __init rockchip_drm_init(void)
 	int ret;
 
 	num_rockchip_sub_drivers = 0;
-	ADD_ROCKCHIP_SUB_DRIVER(vop_platform_driver, CONFIG_DRM_ROCKCHIP);
+	ADD_ROCKCHIP_SUB_DRIVER(vop_platform_driver, CONFIG_ROCKCHIP_VOP);
 	ADD_ROCKCHIP_SUB_DRIVER(rockchip_lvds_driver,
 				CONFIG_ROCKCHIP_LVDS);
 	ADD_ROCKCHIP_SUB_DRIVER(rockchip_dp_driver,
Signature · 1 line
2.30.2
maintainer
#28 lore raw

Re: [PATCH 11/12] drm/rockchip: Make VOP driver optional

Am Mittwoch, 17. November 2021, 15:33:46 CET schrieb Sascha Hauer:

Quoted 41 lines

With upcoming VOP2 support VOP won't be the only choice anymore, so make the VOP driver optional.

---
 arch/arm/configs/multi_v7_defconfig         | 1 +
 arch/arm64/configs/defconfig                | 1 +
 drivers/gpu/drm/rockchip/Kconfig            | 7 +++++++
 drivers/gpu/drm/rockchip/Makefile           | 3 ++-
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 2 +-
 5 files changed, 12 insertions(+), 2 deletions(-)
arch/arm/configs/multi_v7_defconfig +1 -0
index c951aeed2138c..fc123e8f3e2f9 100644
@@ -667,6 +667,7 @@ CONFIG_DRM_EXYNOS_DPI=y
 CONFIG_DRM_EXYNOS_DSI=y
 CONFIG_DRM_EXYNOS_HDMI=y
 CONFIG_DRM_ROCKCHIP=m
+CONFIG_ROCKCHIP_VOP=y
 CONFIG_ROCKCHIP_ANALOGIX_DP=y
 CONFIG_ROCKCHIP_DW_HDMI=y
 CONFIG_ROCKCHIP_DW_MIPI_DSI=y
arch/arm64/configs/defconfig +1 -0
index f2e2b9bdd7024..a623386473dc9 100644
@@ -682,6 +682,7 @@ CONFIG_DRM_EXYNOS_DSI=y
 CONFIG_DRM_EXYNOS_HDMI=y
 CONFIG_DRM_EXYNOS_MIC=y
 CONFIG_DRM_ROCKCHIP=m
+CONFIG_ROCKCHIP_VOP=y
 CONFIG_ROCKCHIP_ANALOGIX_DP=y
 CONFIG_ROCKCHIP_CDN_DP=y
 CONFIG_ROCKCHIP_DW_HDMI=y
drivers/gpu/drm/rockchip/Kconfig +0 -0
index 9f1ecefc39332..a1c4158259099 100644

drivers/gpu/drm/rockchip/Kconfig config DRM_ROCKCHIP · line 25

Quoted 5 lines
drivers/gpu/drm/rockchip/Kconfig +2 -0
@@ -21,8 +21,15 @@ config DRM_ROCKCHIP
 
 if DRM_ROCKCHIP
 
+config ROCKCHIP_VOP
+	bool "Rockchip VOP driver"

would this benefit from a default-y ?
For builds reusing preexisting .configs.

Heiko

Quoted 40 lines
drivers/gpu/drm/rockchip/Kconfig +5 -0
+	help
+	  This selects support for the VOP driver. You should enable it
+	  on all older SoCs up to RK3399.
+
 config ROCKCHIP_ANALOGIX_DP
 	bool "Rockchip specific extensions for Analogix DP driver"
+	depends on ROCKCHIP_VOP
 	help
 	  This selects support for Rockchip SoC specific extensions
 	  for the Analogix Core DP driver. If you want to enable DP
drivers/gpu/drm/rockchip/Makefile +2 -1
index 17a9e7eb2130d..cd6e7bb5ce9c5 100644
@@ -4,9 +4,10 @@
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
 rockchipdrm-y := rockchip_drm_drv.o rockchip_drm_fb.o \
-		rockchip_drm_gem.o rockchip_drm_vop.o rockchip_vop_reg.o
+		rockchip_drm_gem.o
 rockchipdrm-$(CONFIG_DRM_FBDEV_EMULATION) += rockchip_drm_fbdev.o
 
+rockchipdrm-$(CONFIG_ROCKCHIP_VOP) += rockchip_drm_vop.o rockchip_vop_reg.o
 rockchipdrm-$(CONFIG_ROCKCHIP_ANALOGIX_DP) += analogix_dp-rockchip.o
 rockchipdrm-$(CONFIG_ROCKCHIP_CDN_DP) += cdn-dp-core.o cdn-dp-reg.o
 rockchipdrm-$(CONFIG_ROCKCHIP_DW_HDMI) += dw_hdmi-rockchip.o
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +1 -1
index e4ebe60b3cc1a..64fa5fd62c01a 100644
@@ -473,7 +473,7 @@ static int __init rockchip_drm_init(void)
 	int ret;
 
 	num_rockchip_sub_drivers = 0;
-	ADD_ROCKCHIP_SUB_DRIVER(vop_platform_driver, CONFIG_DRM_ROCKCHIP);
+	ADD_ROCKCHIP_SUB_DRIVER(vop_platform_driver, CONFIG_ROCKCHIP_VOP);
 	ADD_ROCKCHIP_SUB_DRIVER(rockchip_lvds_driver,
 				CONFIG_ROCKCHIP_LVDS);
 	ADD_ROCKCHIP_SUB_DRIVER(rockchip_dp_driver,
#29 lore raw

Re: [PATCH 11/12] drm/rockchip: Make VOP driver optional

Quoted 43 lines · Heiko Stübner

Am Mittwoch, 17. November 2021, 15:33:46 CET schrieb Sascha Hauer:

Quoted 42 lines

With upcoming VOP2 support VOP won't be the only choice anymore, so make the VOP driver optional.

---
 arch/arm/configs/multi_v7_defconfig         | 1 +
 arch/arm64/configs/defconfig                | 1 +
 drivers/gpu/drm/rockchip/Kconfig            | 7 +++++++
 drivers/gpu/drm/rockchip/Makefile           | 3 ++-
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 2 +-
 5 files changed, 12 insertions(+), 2 deletions(-)
arch/arm/configs/multi_v7_defconfig +1 -0
index c951aeed2138c..fc123e8f3e2f9 100644
@@ -667,6 +667,7 @@ CONFIG_DRM_EXYNOS_DPI=y
 CONFIG_DRM_EXYNOS_DSI=y
 CONFIG_DRM_EXYNOS_HDMI=y
 CONFIG_DRM_ROCKCHIP=m
+CONFIG_ROCKCHIP_VOP=y
 CONFIG_ROCKCHIP_ANALOGIX_DP=y
 CONFIG_ROCKCHIP_DW_HDMI=y
 CONFIG_ROCKCHIP_DW_MIPI_DSI=y
arch/arm64/configs/defconfig +1 -0
index f2e2b9bdd7024..a623386473dc9 100644
@@ -682,6 +682,7 @@ CONFIG_DRM_EXYNOS_DSI=y
 CONFIG_DRM_EXYNOS_HDMI=y
 CONFIG_DRM_EXYNOS_MIC=y
 CONFIG_DRM_ROCKCHIP=m
+CONFIG_ROCKCHIP_VOP=y
 CONFIG_ROCKCHIP_ANALOGIX_DP=y
 CONFIG_ROCKCHIP_CDN_DP=y
 CONFIG_ROCKCHIP_DW_HDMI=y
drivers/gpu/drm/rockchip/Kconfig +0 -0
index 9f1ecefc39332..a1c4158259099 100644
@@ -21,8 +21,15 @@ config DRM_ROCKCHIP
 
Quoted 7 lines

drivers/gpu/drm/rockchip/Kconfig config DRM_ROCKCHIP · line 25

Quoted 4 lines
drivers/gpu/drm/rockchip/Kconfig +2 -0
 if DRM_ROCKCHIP
 
+config ROCKCHIP_VOP
+	bool "Rockchip VOP driver"

would this benefit from a default-y ?
For builds reusing preexisting .configs.

I enabled CONFIG_ROCKCHIP_VOP for all configs in the tree that enable CONFIG_DRM_ROCKCHIP, so defconfig users shouldn't see any surprises. That won't help users of custom configs of course.

I don't know what's preferred in such cases, I can change to default-y if you like.

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
maintainer
#30 lore raw

Re: [PATCH 11/12] drm/rockchip: Make VOP driver optional

Am Mittwoch, 17. November 2021, 15:50:54 CET schrieb Sascha Hauer:

Quoted 52 lines · Heiko Stübner
Quoted 43 lines

Am Mittwoch, 17. November 2021, 15:33:46 CET schrieb Sascha Hauer:

Quoted 42 lines

With upcoming VOP2 support VOP won't be the only choice anymore, so make the VOP driver optional.

---
 arch/arm/configs/multi_v7_defconfig         | 1 +
 arch/arm64/configs/defconfig                | 1 +
 drivers/gpu/drm/rockchip/Kconfig            | 7 +++++++
 drivers/gpu/drm/rockchip/Makefile           | 3 ++-
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 2 +-
 5 files changed, 12 insertions(+), 2 deletions(-)
arch/arm/configs/multi_v7_defconfig +1 -0
index c951aeed2138c..fc123e8f3e2f9 100644
@@ -667,6 +667,7 @@ CONFIG_DRM_EXYNOS_DPI=y
 CONFIG_DRM_EXYNOS_DSI=y
 CONFIG_DRM_EXYNOS_HDMI=y
 CONFIG_DRM_ROCKCHIP=m
+CONFIG_ROCKCHIP_VOP=y
 CONFIG_ROCKCHIP_ANALOGIX_DP=y
 CONFIG_ROCKCHIP_DW_HDMI=y
 CONFIG_ROCKCHIP_DW_MIPI_DSI=y
arch/arm64/configs/defconfig +1 -0
index f2e2b9bdd7024..a623386473dc9 100644
@@ -682,6 +682,7 @@ CONFIG_DRM_EXYNOS_DSI=y
 CONFIG_DRM_EXYNOS_HDMI=y
 CONFIG_DRM_EXYNOS_MIC=y
 CONFIG_DRM_ROCKCHIP=m
+CONFIG_ROCKCHIP_VOP=y
 CONFIG_ROCKCHIP_ANALOGIX_DP=y
 CONFIG_ROCKCHIP_CDN_DP=y
 CONFIG_ROCKCHIP_DW_HDMI=y
drivers/gpu/drm/rockchip/Kconfig +0 -0
index 9f1ecefc39332..a1c4158259099 100644
@@ -21,8 +21,15 @@ config DRM_ROCKCHIP
 
Quoted 7 lines

drivers/gpu/drm/rockchip/Kconfig config DRM_ROCKCHIP · line 25

Quoted 4 lines
drivers/gpu/drm/rockchip/Kconfig +2 -0
 if DRM_ROCKCHIP
 
+config ROCKCHIP_VOP
+	bool "Rockchip VOP driver"

would this benefit from a default-y ?
For builds reusing preexisting .configs.

Quoted 6 lines

I enabled CONFIG_ROCKCHIP_VOP for all configs in the tree that enable CONFIG_DRM_ROCKCHIP, so defconfig users shouldn't see any surprises. That won't help users of custom configs of course.

I don't know what's preferred in such cases, I can change to default-y if you like.

default-y would keep the behaviour identical for all existing configs I guess and right now vop(1) is still the most used variant and will stay that way for a while longer, so I guess my preference would be for going that route - also so that we don't drown in "my display stopped working" during 5.17 ;-)

Heiko

#31 lore raw

PATCH 12/12 drm: rockchip: Add VOP2 driver

In reply to Sascha Hauer

The VOP2 unit is found on Rockchip SoCs beginning with rk3566/rk3568. It replaces the VOP unit found in the older Rockchip SoCs.

This driver has been derived from the downstream Rockchip Kernel and heavily modified:

- All nonstandard DRM properties have been removed
- dropped struct vop2_plane_state and pass around less data between functions
- Dropped all DRM_FORMAT_* not known on upstream
- rework register access to get rid of excessively used macros

The driver is tested with HDMI and MIPI-DSI display on a RK3568-EVB board. Overlay support is tested with the modetest utility. AFBC support is still present in the driver, but currently untested due to the lack of suitable image sources. Also the driver has been tested with weston using pixman and (yet to be upstreamed) panfrost driver support.

---
 drivers/gpu/drm/rockchip/Kconfig             |    6 +
 drivers/gpu/drm/rockchip/Makefile            |    1 +
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c  |    1 +
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c  |    1 +
 drivers/gpu/drm/rockchip/rockchip_drm_drv.h  |   22 +-
 drivers/gpu/drm/rockchip/rockchip_drm_vop.h  |  774 ++++
 drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 3611 ++++++++++++++++++
 drivers/gpu/drm/rockchip/rockchip_vop2_reg.c |  916 +++++
 8 files changed, 5331 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_vop2_reg.c
drivers/gpu/drm/rockchip/Kconfig +6 -0
index a1c4158259099..b841f4873f7f3 100644
@@ -27,6 +27,12 @@ config ROCKCHIP_VOP
 	  This selects support for the VOP driver. You should enable it
 	  on all older SoCs up to RK3399.
 
+config ROCKCHIP_VOP2
+	bool "Rockchip VOP2 driver"
+	help
+	  This selects support for the VOP2 driver. You should enable it
+	  on all newer SoCs beginning form RK3568.
+
 config ROCKCHIP_ANALOGIX_DP
 	bool "Rockchip specific extensions for Analogix DP driver"
 	depends on ROCKCHIP_VOP
drivers/gpu/drm/rockchip/Makefile +1 -0
index cd6e7bb5ce9c5..29848caef5c21 100644
@@ -7,6 +7,7 @@ rockchipdrm-y := rockchip_drm_drv.o rockchip_drm_fb.o \
 		rockchip_drm_gem.o
 rockchipdrm-$(CONFIG_DRM_FBDEV_EMULATION) += rockchip_drm_fbdev.o
 
+rockchipdrm-$(CONFIG_ROCKCHIP_VOP2) += rockchip_drm_vop2.o rockchip_vop2_reg.o
 rockchipdrm-$(CONFIG_ROCKCHIP_VOP) += rockchip_drm_vop.o rockchip_vop_reg.o
 rockchipdrm-$(CONFIG_ROCKCHIP_ANALOGIX_DP) += analogix_dp-rockchip.o
 rockchipdrm-$(CONFIG_ROCKCHIP_CDN_DP) += cdn-dp-core.o cdn-dp-reg.o
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +1 -0
index b8fe56c89cdc9..f6296b8a123ab 100644
@@ -324,6 +324,7 @@ dw_hdmi_rockchip_encoder_atomic_check(struct drm_encoder *encoder,
 
 	s->output_mode = ROCKCHIP_OUT_MODE_AAAA;
 	s->output_type = DRM_MODE_CONNECTOR_HDMIA;
+	s->output_if = VOP_OUTPUT_IF_HDMI0;
 
 	return 0;
 }
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +1 -0
index 64fa5fd62c01a..2bd9acb265e5a 100644
@@ -474,6 +474,7 @@ static int __init rockchip_drm_init(void)
 
 	num_rockchip_sub_drivers = 0;
 	ADD_ROCKCHIP_SUB_DRIVER(vop_platform_driver, CONFIG_ROCKCHIP_VOP);
+	ADD_ROCKCHIP_SUB_DRIVER(vop2_platform_driver, CONFIG_ROCKCHIP_VOP2);
 	ADD_ROCKCHIP_SUB_DRIVER(rockchip_lvds_driver,
 				CONFIG_ROCKCHIP_LVDS);
 	ADD_ROCKCHIP_SUB_DRIVER(rockchip_dp_driver,
drivers/gpu/drm/rockchip/rockchip_drm_drv.h +21 -1
index aa0909e8edf93..cdd2c2847441a 100644
@@ -18,12 +18,26 @@
 
 #define ROCKCHIP_MAX_FB_BUFFER	3
 #define ROCKCHIP_MAX_CONNECTOR	2
-#define ROCKCHIP_MAX_CRTC	2
+#define ROCKCHIP_MAX_CRTC	4
 
 struct drm_device;
 struct drm_connector;
 struct iommu_domain;
 
+#define VOP_OUTPUT_IF_RGB       BIT(0)
+#define VOP_OUTPUT_IF_BT1120    BIT(1)
+#define VOP_OUTPUT_IF_BT656     BIT(2)
+#define VOP_OUTPUT_IF_LVDS0     BIT(3)
+#define VOP_OUTPUT_IF_LVDS1     BIT(4)
+#define VOP_OUTPUT_IF_MIPI0     BIT(5)
+#define VOP_OUTPUT_IF_MIPI1     BIT(6)
+#define VOP_OUTPUT_IF_eDP0      BIT(7)
+#define VOP_OUTPUT_IF_eDP1      BIT(8)
+#define VOP_OUTPUT_IF_DP0       BIT(9)
+#define VOP_OUTPUT_IF_DP1       BIT(10)
+#define VOP_OUTPUT_IF_HDMI0     BIT(11)
+#define VOP_OUTPUT_IF_HDMI1     BIT(12)
+
 struct rockchip_crtc_state {
 	struct drm_crtc_state base;
 	int output_type;
@@ -31,6 +45,10 @@ struct rockchip_crtc_state {
 	int output_bpc;
 	int output_flags;
 	bool enable_afbc;
+	uint32_t bus_format;
+	uint32_t output_if;
+	u32 bus_flags;
+	int color_space;
 };
 #define to_rockchip_crtc_state(s) \
 		container_of(s, struct rockchip_crtc_state, base)
@@ -65,4 +83,6 @@ extern struct platform_driver rockchip_dp_driver;
 extern struct platform_driver rockchip_lvds_driver;
 extern struct platform_driver vop_platform_driver;
 extern struct platform_driver rk3066_hdmi_driver;
+extern struct platform_driver vop2_platform_driver;
+
 #endif /* _ROCKCHIP_DRM_DRV_H_ */
drivers/gpu/drm/rockchip/rockchip_drm_vop.h +774 -0

806 lines not on this page · raw message

drivers/gpu/drm/rockchip/rockchip_drm_vop2.c new file +3611 -0

2,118 lines not on this page · raw message

drivers/gpu/drm/rockchip/rockchip_vop2_reg.c new file +916 -0

916 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.30.2

Part of the diff is not shown here. View the raw message.

#32 lore raw

Re: [PATCH 12/12] drm: rockchip: Add VOP2 driver

Quoted 12 lines · On Mittwoch, 17. November 2021 15:33:47 CET Sascha Hauer wrote:

The VOP2 unit is found on Rockchip SoCs beginning with rk3566/rk3568. It replaces the VOP unit found in the older Rockchip SoCs.

This driver has been derived from the downstream Rockchip Kernel and heavily modified:

- All nonstandard DRM properties have been removed
- dropped struct vop2_plane_state and pass around less data between functions
- Dropped all DRM_FORMAT_* not known on upstream
- rework register access to get rid of excessively used macros

Quoted 8 lines

The driver is tested with HDMI and MIPI-DSI display on a RK3568-EVB board. Overlay support is tested with the modetest utility. AFBC support is still present in the driver, but currently untested due to the lack of suitable image sources. Also the driver has been tested with weston using pixman and (yet to be upstreamed) panfrost driver support.

---

Hi Sascha,

thank you very much for your work on this! I gave it a try tonight, and unfortunately it appears to currently always attempt to use 1920x1080p60 as the mode regardless of the monitor. For example, on an old 720p monitor I had laying around:

	[  225.732342] rockchip-drm display-subsystem: [drm] Update mode to 1920x1080p60, type: 11 for vp0, output 0x00000800  HDMI0

This results in a broken picture (all white with occasional glitches). Somebody else observed the same behaviour on a 1440p monitor.

Thanks,
Nicolas Frattaroli

#33 lore raw

Re: [PATCH 12/12] drm: rockchip: Add VOP2 driver

Den 17.11.2021 kl. 19.05 skrev Nicolas Frattaroli:

Quoted 28 lines · On Mittwoch, 17. November 2021 15:33:47 CET Sascha Hauer wrote:
Quoted 12 lines

The VOP2 unit is found on Rockchip SoCs beginning with rk3566/rk3568. It replaces the VOP unit found in the older Rockchip SoCs.

This driver has been derived from the downstream Rockchip Kernel and heavily modified:

- All nonstandard DRM properties have been removed
- dropped struct vop2_plane_state and pass around less data between functions
- Dropped all DRM_FORMAT_* not known on upstream
- rework register access to get rid of excessively used macros

Quoted 8 lines

The driver is tested with HDMI and MIPI-DSI display on a RK3568-EVB board. Overlay support is tested with the modetest utility. AFBC support is still present in the driver, but currently untested due to the lack of suitable image sources. Also the driver has been tested with weston using pixman and (yet to be upstreamed) panfrost driver support.

---

Hi Sascha,

thank you very much for your work on this! I gave it a try tonight, and unfortunately it appears to currently always attempt to use 1920x1080p60 as the mode regardless of the monitor. For example, on an old 720p monitor I had laying around:

Quoted 4 lines
	[  225.732342] rockchip-drm display-subsystem: [drm] Update mode to 1920x1080p60, type: 11 for vp0, output 0x00000800  HDMI0

This results in a broken picture (all white with occasional glitches). Somebody else observed the same behaviour on a 1440p monitor.

Yes, my 1440p Dell screen showed white noise picture and so does my Sony Bravia 1080p TV, but that is likely not running at 60 hertz.

In any case, nice work as I've heard it works on regular 1080p monitors.

Quoted 10 lines

Thanks,
Nicolas Frattaroli

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

Signature · 9 lines
Kind regards
*Dan Johansen*
Project lead of the *Manjaro ARM* project
Manjaro-ARM <https://manjaro.org>

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
#34 lore raw

Re: [PATCH 12/12] drm: rockchip: Add VOP2 driver

In reply to Nicolas Frattaroli
Quoted 29 lines · Nicolas Frattaroli
Quoted 12 lines · On Mittwoch, 17. November 2021 15:33:47 CET Sascha Hauer wrote:

The VOP2 unit is found on Rockchip SoCs beginning with rk3566/rk3568. It replaces the VOP unit found in the older Rockchip SoCs.

This driver has been derived from the downstream Rockchip Kernel and heavily modified:

- All nonstandard DRM properties have been removed
- dropped struct vop2_plane_state and pass around less data between functions
- Dropped all DRM_FORMAT_* not known on upstream
- rework register access to get rid of excessively used macros

Quoted 8 lines

The driver is tested with HDMI and MIPI-DSI display on a RK3568-EVB board. Overlay support is tested with the modetest utility. AFBC support is still present in the driver, but currently untested due to the lack of suitable image sources. Also the driver has been tested with weston using pixman and (yet to be upstreamed) panfrost driver support.

---

Hi Sascha,

thank you very much for your work on this! I gave it a try tonight, and unfortunately it appears to currently always attempt to use 1920x1080p60 as the mode regardless of the monitor. For example, on an old 720p monitor I had laying around:

Quoted 4 lines
	[  225.732342] rockchip-drm display-subsystem: [drm] Update mode to 1920x1080p60, type: 11 for vp0, output 0x00000800  HDMI0

This results in a broken picture (all white with occasional glitches). Somebody else observed the same behaviour on a 1440p monitor.

Unfortunately all my monitors I have here have exactly 1920x1080p60, so I didn't notice. Anyway, when I try another mode like 1280x1024 which should be supported as well then my monitor responds with "out of range", so something is indeed fishy here.

I'll have a look into it.

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#35 lore raw

Re: [PATCH 12/12] drm: rockchip: Add VOP2 driver

In reply to Sascha Hauer
I love your patch! Perhaps something to improve:

Hi Sascha,

I love your patch! Perhaps something to improve:

[auto build test WARNING on rockchip/for-next]
[also build test WARNING on drm/drm-next v5.16-rc2 next-20211125] [cannot apply to arm64/for-next/core]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Sascha-Hauer/drm-rockchip-RK356x-VOP2-support/20211117-223601
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip.git for-next
config: mips-allmodconfig (https://download.01.org/0day-ci/archive/20211126/202111261442.VG18rKq6-lkp(a)intel.com/config)
compiler: mips-linux-gcc (GCC) 11.2.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/f8c11ce8b4d254bb4824a87adbf9ed187a3c1178
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Sascha-Hauer/drm-rockchip-RK356x-VOP2-support/20211117-223601 git checkout f8c11ce8b4d254bb4824a87adbf9ed187a3c1178
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=mips

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

drivers/gpu/drm/rockchip/rockchip_drm_vop2.c: In function 'vop2_setup_dly_for_window':

>> drivers/gpu/drm/rockchip/rockchip_drm_vop2.c:2943:27: warning: variable 'plane' set but not used [-Wunused-but-set-variable]
    2943 |         struct drm_plane *plane;
         |                           ^~~~~

vim +/plane +2943 drivers/gpu/drm/rockchip/rockchip_drm_vop2.c

2937
2938 static void vop2_setup_dly_for_window(struct vop2_video_port *vp, const struct vop2_zpos *vop2_zpos,
2939 int nr_layers)
2940 {
2941 struct vop2 *vop2 = vp->vop2;
2942 const struct vop2_zpos *zpos;

> 2943		struct drm_plane *plane;

2944 struct vop2_win *win;
2945 uint32_t dly;
2946 int i = 0;
2947
2948 for (i = 0; i < nr_layers; i++) {
2949 zpos = &vop2_zpos[i];
2950 win = zpos->win;
2951 plane = &win->base;
2952 dly = win->data->dly[VOP2_DLY_MODE_DEFAULT];
2953
2954 if (vop2_cluster_window(win))
2955 dly |= dly << 8;
2956
2957 vop2_write(vop2, &vop2->data->ctrl->win_dly[win->data->phys_id], dly);
2958 }
2959

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

maintainer
#36 lore raw
In reply to Sascha Hauer
Quoted 12 lines · Sascha Hauer

This series adds initial graphics support for the Rockchip RK356[68] SoCs. Graphics support is based around the VOP2 controller which replaces the VOP controller found on earlier Rockchip SoCs. The driver has been tested with HDMI support included in this series and MIPI-DSI which is not included because it needs some more work. The driver is taken from the downstream Rockchip kernel and heavily polished, most non standard features have been removed for now. I tested the driver with the libdrm modetest utility and also with weston with both pixman and panfrost driver support. Michael Riesch reported the driver to work on the RK3566 as well, but device tree support for this SoC is not yet included in this series.

Can you outline what exactly you want to disable? I don't think 'status' is the right way. I think between the parent device being disabled, an incomplete graph and user configuration choice that should be enough to disable parts.

Rob

#37 lore raw
Quoted 14 lines · Rob Herring
Quoted 12 lines · Sascha Hauer

This series adds initial graphics support for the Rockchip RK356[68] SoCs. Graphics support is based around the VOP2 controller which replaces the VOP controller found on earlier Rockchip SoCs. The driver has been tested with HDMI support included in this series and MIPI-DSI which is not included because it needs some more work. The driver is taken from the downstream Rockchip kernel and heavily polished, most non standard features have been removed for now. I tested the driver with the libdrm modetest utility and also with weston with both pixman and panfrost driver support. Michael Riesch reported the driver to work on the RK3566 as well, but device tree support for this SoC is not yet included in this series.

Quoted 4 lines

Can you outline what exactly you want to disable? I don't think 'status' is the right way. I think between the parent device being disabled, an incomplete graph and user configuration choice that should be enough to disable parts.

The VOP2 on the RK3568 has three CRTCS, or video ports (VP) in Rockchip nomenclature. Each of them can be connected to the different outputs, like HDMI, MIPI-DSI and so on. In the device tree the CRTCs are described as of-graph ports with links to the HDMI, MIPI-DSI nodes. An example limited to HDMI looks like this:

	vop: vop@fe040000 {
		compatible = "rockchip,rk3568-vop";
		vop_out: ports {
			vp0: port@0 {
				vp0_out_hdmi: endpoint@0 {
					reg = <0>;
					remote-endpoint = <&hdmi_in_vp0>;
					status = "disabled";
				};

				... MIPI, dP, ...
			};

			vp1: port@1 {
				vp1_out_hdmi: endpoint@0 {
					reg = <0>;
					remote-endpoint = <&hdmi_in_vp1>;
					status = "disabled";
				};

				... MIPI, dP, ...
			};

			vp2: port@2 {
				...
			};
		};
	};

	hdmi: hdmi@fe0a0000 {
		compatible = "rockchip,rk3568-dw-hdmi";
		ports {
			hdmi_in: port@0 {
				hdmi_in_vp0: endpoint@0 {
					reg = <0>;
					remote-endpoint = <&vp0_out_hdmi>;
					status = "disabled";
				};

				hdmi_in_vp1: endpoint@1 {
					reg = <1>;
					remote-endpoint = <&vp1_out_hdmi>;
					status = "disabled";
				};

				...
			};
		};
	};

Theoretically every VP can be routed to every output, but depending on the board there are some constraints. For example for the three vps there are only two PLLs for the pixel clock, and the HDMI port is hardwired to one single PLL. To avoid different VPs setting conflicting rates on a PLL we can only allow a subset of the possible routes.

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#38 lore raw
In reply to Sascha Hauer

Hi Sascha Hauer,

Quoted 6 lines · Sascha Hauer

This series adds initial graphics support for the Rockchip RK356[68] SoCs. Graphics support is based around the VOP2 controller which replaces the VOP controller found on earlier Rockchip SoCs. The driver has been tested with HDMI support included in this series and MIPI-DSI which is not included because it needs some more work. The driver is taken from the downstream Rockchip kernel

Yes, you do know this is from Rockchip kernel.

Could you point me out where is the information about original author  in your commit?

Quoted 2 lines

and heavily polished, most non
standard features have been removed for now.

I don't agree with this, we do believe you have do some clean up to meet the requirement

of upstream, but all the framework and feature implement are from Rockchip engineer,

we have made a great effort to make everything work which block us to upstream this driver for now.

NAK for this series.

- Kever

maintainer
#39 lore raw

Hi Kever,

Am Donnerstag, 18. November 2021, 02:27:10 CET schrieb Kever Yang:

Quoted 10 lines

Hi Sascha Hauer,

Quoted 6 lines · Sascha Hauer

This series adds initial graphics support for the Rockchip RK356[68] SoCs. Graphics support is based around the VOP2 controller which replaces the VOP controller found on earlier Rockchip SoCs. The driver has been tested with HDMI support included in this series and MIPI-DSI which is not included because it needs some more work. The driver is taken from the downstream Rockchip kernel

Quoted 4 lines

Yes, you do know this is from Rockchip kernel.

Could you point me out where is the information about original author in your commit?

The copyrights for added files seem to have stayed intact. For example the added rockchip_drm_vop2.c file in patch12 does contain the copyright as

Copyright (c) 2020 Rockchip Electronics Co., Ltd.
Author: Andy Yan <[email protected]>

We can of course debate if the commit-author should also be set to Andy or another Rockchip engineer, with Sascha adding a "Co-developed-by" with his credentials.

That's probably a nice compromise, I guess.

Quoted 11 lines
Quoted 2 lines

and heavily polished, most non
standard features have been removed for now.

I don't agree with this, we do believe you have do some clean up to meet the requirement

of upstream, but all the framework and feature implement are from Rockchip engineer,

we have made a great effort to make everything work which block us to upstream this driver for now.

I don't fully understand what you mean here (language barrier probably), but dropping non-essential functionality in a first round is pretty common to at least get basic functionality working for everyone. With the special features getting added again in later patches over time. This happenened on the old vop as well.

And of course, having a kernel that can "just" do normal graphics without the additional features is still preferable over having _NO_ graphics support at all ;-)

Quoted 1 line

NAK for this series.

As you might've seen from previous graphics related patches, there is a big number of people _and companies_ that seems to want/need to work with the rk3566/rk3568 with a kernel based on mainline.

--> Most likely even in real products!

While Rockchip did say that they want to upstream VOP2 support, there has been _NO_ movement or even information at all on this over at least the last year(!), so it's pretty understandable that developers will do this themself at some point, because they don't want to wait anymore for something that might never happen.

So a simple "NAK" without additional information is not really helpful here.

If you don't like Sascha's series, I really want to know _WHEN_ Rockchip plans on upstreaming at least basic graphis support themself.

The kernel is often called a do-ocracy - the one who does the work, gets to decide. So if you really don't like Sascha's series at all, I do expect Rockchip to step up and provide a solution themself - and in a usable timeframe.

Heiko

#40 lore raw

Hi,

Quoted 20 lines · Heiko Stübner

Am Donnerstag, 18. November 2021, 02:27:10 CET schrieb Kever Yang:

Quoted 8 lines

I don't agree with this, we do believe you have do some clean up to meet the requirement

of upstream, but all the framework and feature implement are from Rockchip engineer,

we have made a great effort to make everything work which block us to upstream this driver for now.

I don't fully understand what you mean here (language barrier probably), but dropping non-essential functionality in a first round is pretty common to at least get basic functionality working for everyone. With the special features getting added again in later patches over time. This happenened on the old vop as well.

And of course, having a kernel that can "just" do normal graphics without the additional features is still preferable over having _NO_ graphics support at all ;-)

Quoted 7 lines
Quoted 1 line

NAK for this series.

As you might've seen from previous graphics related patches, there is a big number of people _and companies_ that seems to want/need to work with the rk3566/rk3568 with a kernel based on mainline.

--> Most likely even in real products!

Yes, we've been trying to ship a real product based on RK356x. We started by using the vendor VOP2 driver, but it is broken beyond belief. The driver needs a fundamental ground-up rework, and all the additional features get in the way of doing this core rework to make it actually function correctly.

So, NAK to the NAK. I would like to see the VOP2 support start simple, with more features being added one by one.

Quoted 8 lines

While Rockchip did say that they want to upstream VOP2 support, there has been _NO_ movement or even information at all on this over at least the last year(!), so it's pretty understandable that developers will do this themself at some point, because they don't want to wait anymore for something that might never happen.

So a simple "NAK" without additional information is not really helpful here.

Quoted 7 lines

If you don't like Sascha's series, I really want to know _WHEN_ Rockchip plans on upstreaming at least basic graphis support themself.

The kernel is often called a do-ocracy - the one who does the work, gets to decide. So if you really don't like Sascha's series at all, I do expect Rockchip to step up and provide a solution themself - and in a usable timeframe.

Exactly what Heiko said. If you would like to upstream the driver then that would be fantastic to see, but I'm afraid you do not get to prevent someone else from doing the work themselves.

Cheers,
Daniel

#41 lore raw
Quoted 48 lines · Daniel Stone

Hi,

Quoted 19 lines · Heiko Stübner

Am Donnerstag, 18. November 2021, 02:27:10 CET schrieb Kever Yang:

Quoted 8 lines

I don't agree with this, we do believe you have do some clean up to meet the requirement

of upstream, but all the framework and feature implement are from Rockchip engineer,

we have made a great effort to make everything work which block us to upstream this driver for now.

I don't fully understand what you mean here (language barrier probably), but dropping non-essential functionality in a first round is pretty common to at least get basic functionality working for everyone. With the special features getting added again in later patches over time. This happenened on the old vop as well.

And of course, having a kernel that can "just" do normal graphics without the additional features is still preferable over having _NO_ graphics support at all ;-)

Quoted 6 lines
Quoted 1 line

NAK for this series.

As you might've seen from previous graphics related patches, there is a big number of people _and companies_ that seems to want/need to work with the rk3566/rk3568 with a kernel based on mainline.

--> Most likely even in real products!

Yes, we've been trying to ship a real product based on RK356x. We started by using the vendor VOP2 driver, but it is broken beyond belief. The driver needs a fundamental ground-up rework, and all the additional features get in the way of doing this core rework to make it actually function correctly.

So, NAK to the NAK. I would like to see the VOP2 support start simple, with more features being added one by one.

Quoted 11 lines

While Rockchip did say that they want to upstream VOP2 support, there has been _NO_ movement or even information at all on this over at least the last year(!), so it's pretty understandable that developers will do this themself at some point, because they don't want to wait anymore for something that might never happen.

So a simple "NAK" without additional information is not really helpful here.

If you don't like Sascha's series, I really want to know _WHEN_ Rockchip plans on upstreaming at least basic graphis support themself.

Quoted 7 lines
Quoted 4 lines

The kernel is often called a do-ocracy - the one who does the work, gets to decide. So if you really don't like Sascha's series at all, I do expect Rockchip to step up and provide a solution themself - and in a usable timeframe.

Exactly what Heiko said. If you would like to upstream the driver then that would be fantastic to see, but I'm afraid you do not get to prevent someone else from doing the work themselves.

First of all, we never stop any one to doing there work on upstream if the source code is write totally by themselves.

Second, there are also many modules are upstream by developers based on Rockchip source code, please note that all of them have basic respect to our work, they do communicate with us first.

But this committer do not take any respect to our engineers and their hard working:
- He didn't contact with us;
- There isn't  any information about original author in the commit message;
    As I have known, if I use source code from another developer, I need to at least add a "Signed-off-by" with original author;
- This commit and mail does not even have a 'CC' to original author.

I NAK because I  think this is not part of the  open source spirit, and this kind of  behavior should not be encouraged.

Thanks,
- Kever

#42 lore raw

Hello Kever,

Quoted 58 lines · Kever Yang
Quoted 48 lines · Daniel Stone

Hi,

Quoted 19 lines · Heiko Stübner

Am Donnerstag, 18. November 2021, 02:27:10 CET schrieb Kever Yang:

Quoted 8 lines

I don't agree with this, we do believe you have do some clean up to meet the requirement

of upstream, but all the framework and feature implement are from Rockchip engineer,

we have made a great effort to make everything work which block us to upstream this driver for now.

I don't fully understand what you mean here (language barrier probably), but dropping non-essential functionality in a first round is pretty common to at least get basic functionality working for everyone. With the special features getting added again in later patches over time. This happenened on the old vop as well.

And of course, having a kernel that can "just" do normal graphics without the additional features is still preferable over having _NO_ graphics support at all ;-)

Quoted 6 lines
Quoted 1 line

NAK for this series.

As you might've seen from previous graphics related patches, there is a big number of people _and companies_ that seems to want/need to work with the rk3566/rk3568 with a kernel based on mainline.

--> Most likely even in real products!

Yes, we've been trying to ship a real product based on RK356x. We started by using the vendor VOP2 driver, but it is broken beyond belief. The driver needs a fundamental ground-up rework, and all the additional features get in the way of doing this core rework to make it actually function correctly.

So, NAK to the NAK. I would like to see the VOP2 support start simple, with more features being added one by one.

Quoted 11 lines

While Rockchip did say that they want to upstream VOP2 support, there has been _NO_ movement or even information at all on this over at least the last year(!), so it's pretty understandable that developers will do this themself at some point, because they don't want to wait anymore for something that might never happen.

So a simple "NAK" without additional information is not really helpful here.

If you don't like Sascha's series, I really want to know _WHEN_ Rockchip plans on upstreaming at least basic graphis support themself.

Quoted 7 lines
Quoted 4 lines

The kernel is often called a do-ocracy - the one who does the work, gets to decide. So if you really don't like Sascha's series at all, I do expect Rockchip to step up and provide a solution themself - and in a usable timeframe.

Exactly what Heiko said. If you would like to upstream the driver then that would be fantastic to see, but I'm afraid you do not get to prevent someone else from doing the work themselves.

Quoted 8 lines

First of all, we never stop any one to doing there work on upstream if the source code is write totally by themselves.

Second, there are also many modules are upstream by developers based on Rockchip source code, please note that all of them have basic respect to our work, they do communicate with us first.

But this committer do not take any respect to our engineers and their hard working:
- He didn't contact with us;

I approached Andy Yan and you off-list on October 20, 2021 in this regard, as Andy mentioned on linux-rockchip in July 2021 some plans to bring the driver mainline. Since there was no response, we asked Sascha to make this happen.

Quoted 3 lines

- There isn't  any information about original author in the commit message; As I have known, if I use source code from another developer, I
need to at least add a "Signed-off-by" with original author;

As has been discussed before, this will be fixed in v2. Simple mistake, no harm intended.

Quoted 3 lines

- This commit and mail does not even have a 'CC' to original author.

I NAK because I  think this is not part of the  open source spirit, and this kind of  behavior should not be encouraged.

It is great to hear that you care about the open source spirit. IMHO communication is a big part thereof. If Rockchip would communicate better their plans to bring things mainline including a time schedule, it would be a lot easier for all of us.

Best regards,
Michael

#43 lore raw
In reply to Kever Yang

Hi Kever,

Quoted 21 lines · Kever Yang
Quoted 3 lines · Daniel Stone

Exactly what Heiko said. If you would like to upstream the driver then that would be fantastic to see, but I'm afraid you do not get to prevent someone else from doing the work themselves.

First of all, we never stop any one to doing there work on upstream if the source code is write totally by themselves.

Second, there are also many modules are upstream by developers based on Rockchip source code, please note that
all of them have basic respect to our work, they do communicate with us first.

But this committer do not take any respect to our engineers and their hard working:
- He didn't contact with us;
- There isn't any information about original author in the commit message; As I have known, if I use source code from another developer, I
need to at least add a "Signed-off-by" with original author;
- This commit and mail does not even have a 'CC' to original author.

Quoted 2 lines

I NAK because I think this is not part of the open source spirit, and this kind of behavior should not be encouraged.

OK, I see where you're coming from, and I agree that the attribution should have been handled more carefully.

On the other hand, please consider this from the other perspective. Sascha has been free to take the downstream Rockchip BSP code and attempt to upstream it to the Linux kernel, which you are unhappy about. But then the Rockchip driver was developed totally downstream, with no attempt to ever communicate with the upstream Linux or DRM/KMS developers. Rockchip advertises that it is shipped as a Linux kernel with a KMS driver. But we were never informed, or CCed, or anything.

If you would like the community to more actively work with you - then please yourself work more actively with the community. The first commit of the VOP2 driver was in July 2020, and that was of the full driver so presumably it started quite some time before then. So that is a minimum of 17 months that you have had to engage with upstream
...

Technically, the driver cannot be upstreamed as-is. It looks as if it were a pre-atomic driver, that was half-converted to atomic, and then has been half-converted to atomic helpers as well. Things like reference counting and global state are not handled correctly at all. You can see this if you try to run Weston on top of the VOP2 driver:
the framerate is decimated because the event handling massively over-synchronises, and the event timestamps which arrive are incorrect. This would be fixed by correctly using the event helpers that we have had in the tree for years (which would also eliminate the unnecessary framebuffer reference handling). It also does not work with the GPU drivers in the tree because it lacks the one-liner to correctly handle dma_resv synchronisation, which makes it both too fast as it displays content which is not ready, and too slow because it can't do it at full frame rate.

Similarly, on the RK3566 EVB, the DSI does not work unless HDMI is also active, but when HDMI is active at the same time as DSI, it just shows a blank screen. I believe the root cause of this is that the VOP2 driver does not use any of the atomic state correctly, and instead stores its own state in driver-global structures, using a lot of unnecessary mutexes to try to synchronise this state. Not only does this synchronisation not actually work, but it causes a severe performance degradation due to mutex contention.

I believe the best path forward to an upstream VOP2 driver is a patch series consisting of:
- start from a blank slate, using the atomic framework and helpers
as they were intended to be, with basic support for the VOP2 and one or two connector types, doing linear XRGB only
- any cleanups which would enable this to share more code with
- add YUV support, including planar buffers
- add AFBC support, with the AFBC enable/disable correctly
synchronised through atomic state (this is necessary since the AFBC decoder is not directly on the planes per se but shared)
- add more connector types
- add writeback support
- add other Rockchip-specific codepaths such as HDR10

Cheers,
Daniel

#44 lore raw

Hi Daniel:

Quoted 43 lines · Daniel Stone

Hi Kever,

Quoted 20 lines · Kever Yang
Quoted 3 lines · Daniel Stone

Exactly what Heiko said. If you would like to upstream the driver then that would be fantastic to see, but I'm afraid you do not get to prevent someone else from doing the work themselves.

First of all, we never stop any one to doing there work on upstream if the source code is write totally by themselves.

Second, there are also many modules are upstream by developers based on Rockchip source code, please note that
all of them have basic respect to our work, they do communicate with us first.

But this committer do not take any respect to our engineers and their hard working:
- He didn't contact with us;
- There isn't any information about original author in the commit message; As I have known, if I use source code from another developer, I
need to at least add a "Signed-off-by" with original author;
- This commit and mail does not even have a 'CC' to original author.

Quoted 2 lines

I NAK because I think this is not part of the open source spirit, and this kind of behavior should not be encouraged.

OK, I see where you're coming from, and I agree that the attribution should have been handled more carefully.

On the other hand, please consider this from the other perspective. Sascha has been free to take the downstream Rockchip BSP code and attempt to upstream it to the Linux kernel, which you are unhappy about. But then the Rockchip driver was developed totally downstream, with no attempt to ever communicate with the upstream Linux or DRM/KMS developers. Rockchip advertises that it is shipped as a Linux kernel with a KMS driver. But we were never informed, or CCed, or anything.

If you would like the community to more actively work with you - then please yourself work more actively with the community. The first commit of the VOP2 driver was in July 2020, and that was of the full driver so presumably it started quite some time before then. So that is a minimum of 17 months that you have had to engage with upstream
...

Quoted 14 lines

Technically, the driver cannot be upstreamed as-is. It looks as if it were a pre-atomic driver, that was half-converted to atomic, and then has been half-converted to atomic helpers as well. Things like reference counting and global state are not handled correctly at all. You can see this if you try to run Weston on top of the VOP2 driver:
the framerate is decimated because the event handling massively over-synchronises, and the event timestamps which arrive are incorrect. This would be fixed by correctly using the event helpers that we have had in the tree for years (which would also eliminate the unnecessary framebuffer reference handling). It also does not work with the GPU drivers in the tree because it lacks the one-liner to correctly handle dma_resv synchronisation, which makes it both too fast as it displays content which is not ready, and too slow because it can't do it at full frame rate.

We have different team run Android , X11, Weston on rk356x, especially for android, we can run at 60 fps.

Our vop2 driver is developed on Linux 4.19, am not sure which version of kernel you put our drivers on.

Quoted 3 lines

Similarly, on the RK3566 EVB, the DSI does not work unless HDMI is also active, but when HDMI is active at the same time as DSI, it just

I am very sure rk3566 evb DSI can work without HDMI.

But take care that the vop on rk3566 has a special limitation: there are three

windows(Cluster1/Esmart1/Smart1) that have a mirror lock, that means they

can't be programed framebuffer address independently , they can only

share framebuffer address with Cluster0/Esmart0/Smart0. We use these feature

on Android.

I have comment these limitation in our driver.

Compared to old vop, vop is strong but a bit complicated, we try very had to

make it work on as much display framework as possible.

We have upstream plane, but I am really in a rush this year. So sorry for the late of upstream, but we glad to work with community.

So Sascha, please feel free to go on with your work.

Quoted 21 lines

shows a blank screen. I believe the root cause of this is that the VOP2 driver does not use any of the atomic state correctly, and instead stores its own state in driver-global structures, using a lot of unnecessary mutexes to try to synchronise this state. Not only does this synchronisation not actually work, but it causes a severe performance degradation due to mutex contention.

I believe the best path forward to an upstream VOP2 driver is a patch series consisting of:
- start from a blank slate, using the atomic framework and helpers
as they were intended to be, with basic support for the VOP2 and one or two connector types, doing linear XRGB only
- any cleanups which would enable this to share more code with
- add YUV support, including planar buffers
- add AFBC support, with the AFBC enable/disable correctly
synchronised through atomic state (this is necessary since the AFBC decoder is not directly on the planes per se but shared)
- add more connector types
- add writeback support
- add other Rockchip-specific codepaths such as HDR10

Quoted 5 lines

Cheers,
Daniel

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

#45 lore raw

Hi Andy,

Quoted 16 lines · Andy Yan
Quoted 6 lines · Daniel Stone

Technically, the driver cannot be upstreamed as-is. It looks as if it were a pre-atomic driver, that was half-converted to atomic, and then has been half-converted to atomic helpers as well. Things like reference counting and global state are not handled correctly at all. You can see this if you try to run Weston on top of the VOP2 driver:
the framerate is decimated because the event handling massively

Quoted 8 lines

over-synchronises, and the event timestamps which arrive are incorrect. This would be fixed by correctly using the event helpers that we have had in the tree for years (which would also eliminate the unnecessary framebuffer reference handling). It also does not work with the GPU drivers in the tree because it lacks the one-liner to correctly handle dma_resv synchronisation, which makes it both too fast as it displays content which is not ready, and too slow because it can't do it at full frame rate.

Quoted 5 lines

We have different team run Android , X11, Weston on rk356x, especially for android, we can run at 60 fps.

Our vop2 driver is developed on Linux 4.19, am not sure which version of kernel you put our drivers on.

We forward-ported it to a current mainline kernel and started to work on fixing some of the issues. When we did this, we went back to the BSP tree posted on GitHub to test using a pure-BSP environment, and observed the same breakage there.

Quoted 4 lines
Quoted 2 lines

Similarly, on the RK3566 EVB, the DSI does not work unless HDMI is also active, but when HDMI is active at the same time as DSI, it just

I am very sure rk3566 evb DSI can work without HDMI.

I'd love to know how. :) Using the meta-rockchip layer as published on GitHub, we cannot get working DSI without HDMI, using upstream Weston. When the HDMI connector is disabled, DSI comes up blank. When the HDMI connector is enabled, DSI works fine but HDMI is blank.

Quoted 7 lines

But take care that the vop on rk3566 has a special limitation: there are three windows(Cluster1/Esmart1/Smart1) that have a mirror lock, that means they can't be programed framebuffer address independently , they can only share framebuffer address with Cluster0/Esmart0/Smart0. We use these feature on Android.

I have comment these limitation in our driver.

Yeah, we noticed this.

Quoted 7 lines

Compared to old vop, vop is strong but a bit complicated, we try very had to make it work on as much display framework as possible.

We have upstream plane, but I am really in a rush this year. So sorry for the late of upstream, but we glad to work with community.

So Sascha, please feel free to go on with your work.

Great, thanks. If you agree with the plan I posted, then we can all go forward with that upstream, doing the development work with ourselves and Sascha. Hopefully Rockchip will be able to support this effort.

Cheers,
Daniel

#46 lore raw
In reply to Heiko Stübner
Quoted 26 lines · Heiko Stübner

Hi Kever,

Am Donnerstag, 18. November 2021, 02:27:10 CET schrieb Kever Yang:

Quoted 10 lines

Hi Sascha Hauer,

Quoted 6 lines · Sascha Hauer

This series adds initial graphics support for the Rockchip RK356[68] SoCs. Graphics support is based around the VOP2 controller which replaces the VOP controller found on earlier Rockchip SoCs. The driver has been tested with HDMI support included in this series and MIPI-DSI which is not included because it needs some more work. The driver is taken from the downstream Rockchip kernel

Quoted 4 lines

Yes, you do know this is from Rockchip kernel.

Could you point me out where is the information about original author in your commit?

The copyrights for added files seem to have stayed intact. For example the added rockchip_drm_vop2.c file in patch12 does contain the copyright as

Copyright (c) 2020 Rockchip Electronics Co., Ltd.
Author: Andy Yan <[email protected]>

Quoted 5 lines

We can of course debate if the commit-author should also be set to Andy or another Rockchip engineer, with Sascha adding a "Co-developed-by" with his credentials.

That's probably a nice compromise, I guess.

The commit author was merely lost while copying the driver file into my git. Changing it back to Andy is fine with me, I didn't mean to steal anyones credits.

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#47 lore raw
In reply to Sascha Hauer

Hi Sascha,

Am 17.11.21 um 15:33 schrieb Sascha Hauer:

Quoted 12 lines

This series adds initial graphics support for the Rockchip RK356[68] SoCs. Graphics support is based around the VOP2 controller which replaces the VOP controller found on earlier Rockchip SoCs. The driver has been tested with HDMI support included in this series and MIPI-DSI which is not included because it needs some more work. The driver is taken from the downstream Rockchip kernel and heavily polished, most non standard features have been removed for now. I tested the driver with the libdrm modetest utility and also with weston with both pixman and panfrost driver support. Michael Riesch reported the driver to work on the RK3566 as well, but device tree support for this SoC is not yet included in this series.

Quoted 6 lines

The HDMI changes are based on patches from Benjamin Gaignard, but modified a bit as I found out that the HDMI port on the RK3568 only needs one additional clock, not two. Also I added regulator support which is needed to get the HDMI up on the rk3568-EVB board.

All review and testing feedback welcome

thanks for working on that - it's very (very,very) much appreciated.

It took me some time to figure it out: It seems rk3568-iommu driver s broken - I did only get "white noise" when using it alongside vop (similar like it was reported here before). However: removing the iommu-property from vop makes it working for me with HDMI output on quartz64 as well. Could you check if you have the iommu driver in kernel enabled if it works for you, if the property is present in DT? (I used 5.16-rc1 + this series + [0]). Also vop mmu seems to have the power-domain missing in your series (same as downstream) - however adding that doesn't help much currently.
As a sidenote: I verfied this with using Ezequiel's vpu addtion for
RK356x: It did only work when removing the iommu there as well (getting tons of page faults otherwise) - so iommu driver really seems to broken, at least for RK3566. (Or I'm a missing a option in kernel config, which wasn't required for the older iommu version?)

But as reported before: For HDMI this does currently only work for pixel clock rates, which are integer-divisable with hpll clock rate (which is the hardcoded parent of vop0's dclk)
As discussed in Benjamin's initial submission of the addition of RK3568's hdmi controller [1] same as with RK3288's and RK3399's hdmi phy needs a reference clock (it's called vpll there) which needs to get switched before the vop switches the mode (since phy rate switching is done before) - it's HPLL in case of RK356x. For whatever reason it's called "ref" for RK356x only downstream [2] - so you should add another clock "vpll" (renaming it to "ref" for _ALL_ SoCs which have it would be a _GREAT_ idea) which is <&pmucru PLL_HPLL>.
What brings us to the "real" clock problem and the reason, why non-integer divisable pixel clock rates are not possible ATM: This is a long standing issue for RK3288 and RK3399 as well (and one of the main reasons why 4k modes are not possible for those older SoCs currently):
Upstream all PLL rates are controlled with those PLL rate tables in the clock driver and they have to be _exactly_ defined as they are used (HDMI sinks are very picky).
You will not see any additional rates downstream for RK3568: they have a mechanism there to automatically calculate the PLL settings if the rate doesn't exist in these tables (IIRC this was submitted upstream also:
but it was rejected/ignored by maintainers). As a quick hackarround (for testing): You could use this table [3] we are using in LibreElec for RK3399 to get 4k modes working and assign it to HPLL in RK3568's clock driver (I tested it and it works great). It might be possible to just add those rates (some also without frac dividers) to the common PLL table for RK3568.

I'm sorry I didn't reply inline as I'm supposed to do: It's late and I wanted to offload my findings now :)

(You probably should also remove the printks in V2)

Best,

Alex

[0]
https://patchwork.kernel.org/project/linux-rockchip/patch/[email protected]/

[1] https://patchwork.kernel.org/comment/24295683/
[2]
https://github.com/rockchip-linux/kernel/blob/develop-4.19/arch/arm64/boot/dts/rockchip/rk3568.dtsi#L1715-L1720

[3]
https://github.com/LibreELEC/LibreELEC.tv/blob/master/projects/Rockchip/patches/linux/default/linux-1000-drm-rockchip.patch#L3155-L3182

#48 lore raw

Hi Alex,

Quoted 25 lines · Alex Bee

Hi Sascha,

Am 17.11.21 um 15:33 schrieb Sascha Hauer:

Quoted 12 lines

This series adds initial graphics support for the Rockchip RK356[68] SoCs. Graphics support is based around the VOP2 controller which replaces the VOP controller found on earlier Rockchip SoCs. The driver has been tested with HDMI support included in this series and MIPI-DSI which is not included because it needs some more work. The driver is taken from the downstream Rockchip kernel and heavily polished, most non standard features have been removed for now. I tested the driver with the libdrm modetest utility and also with weston with both pixman and panfrost driver support. Michael Riesch reported the driver to work on the RK3566 as well, but device tree support for this SoC is not yet included in this series.

Quoted 6 lines

The HDMI changes are based on patches from Benjamin Gaignard, but modified a bit as I found out that the HDMI port on the RK3568 only needs one additional clock, not two. Also I added regulator support which is needed to get the HDMI up on the rk3568-EVB board.

All review and testing feedback welcome

thanks for working on that - it's very (very,very) much appreciated.

Quoted 7 lines

It took me some time to figure it out: It seems rk3568-iommu driver s broken - I did only get "white noise" when using it alongside vop (similar like it was reported here before). However: removing the iommu-property from vop makes it working for me with HDMI output on quartz64 as well. Could you check if you have the iommu driver in kernel enabled if it works for you, if the property is present in DT? (I used 5.16-rc1 + this series + [0]).

I have the iommu driver enabled and it works for me. I get this during boot:

[0.263287] rockchip-vop2 fe040000.vop: Adding to iommu group 0

So I expect it is indeed used.

Quoted 3 lines

Also vop mmu seems to have the
power-domain missing in your series (same as downstream) - however adding that doesn't help much currently.

Probably the power domain gets enabled anyway when the VOP is activated, so adding it to the iommu won't help anything. Nevertheless it seems correct to add the property, I'll do so in the next round.

Quoted 5 lines

As a sidenote: I verfied this with using Ezequiel's vpu addtion for
RK356x: It did only work when removing the iommu there as well (getting tons of page faults otherwise) - so iommu driver really seems to broken, at least for RK3566. (Or I'm a missing a option in kernel config, which wasn't required for the older iommu version?)

I don't think so. I started from defconfig and disabled other architectures and unneeded drivers, but I did not enable anything specific to iommu.

Quoted 4 lines


But as reported before: For HDMI this does currently only work for pixel clock rates, which are integer-divisable with hpll clock rate (which is the hardcoded parent of vop0's dclk)

Quoted 8 lines

As discussed in Benjamin's initial submission of the addition of RK3568's hdmi controller [1] same as with RK3288's and RK3399's hdmi phy needs a reference clock (it's called vpll there) which needs to get switched before the vop switches the mode (since phy rate switching is done before) - it's HPLL in case of RK356x. For whatever reason it's called "ref" for RK356x only downstream [2] - so you should add another clock "vpll" (renaming it to "ref" for _ALL_ SoCs which have it would be a _GREAT_ idea) which is <&pmucru PLL_HPLL>.

Yeah, a consumer clock should be named after the usage in the consumer, not after the provider name. I also stumbled over this and naming it "ref" makes much more sense. We'll likely have to keep supporting "vpll" as well for compatibility to old device trees.

Quoted 11 lines

What brings us to the "real" clock problem and the reason, why non-integer divisable pixel clock rates are not possible ATM: This is a long standing issue for RK3288 and RK3399 as well (and one of the main reasons why 4k modes are not possible for those older SoCs currently):
Upstream all PLL rates are controlled with those PLL rate tables in the clock driver and they have to be _exactly_ defined as they are used (HDMI sinks are very picky).
You will not see any additional rates downstream for RK3568: they have a mechanism there to automatically calculate the PLL settings if the rate doesn't exist in these tables (IIRC this was submitted upstream also:
but it was rejected/ignored by maintainers).

Looks like we have to try harder to get it upstream. Do you have a pointer to this patch?

Quoted 6 lines

As a quick hackarround (for
testing): You could use this table [3] we are using in LibreElec for RK3399 to get 4k modes working and assign it to HPLL in RK3568's clock driver (I tested it and it works great). It might be possible to just add those rates (some also without frac dividers) to the common PLL table for RK3568.

Thanks for noting. This could also explain why currently only 1080p is working.

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#49 lore raw

Am 22.11.21 um 09:10 schrieb Sascha Hauer:

Quoted 48 lines

Hi Alex,

Quoted 24 lines · Alex Bee

Hi Sascha,

Am 17.11.21 um 15:33 schrieb Sascha Hauer:

Quoted 12 lines

This series adds initial graphics support for the Rockchip RK356[68] SoCs. Graphics support is based around the VOP2 controller which replaces the VOP controller found on earlier Rockchip SoCs. The driver has been tested with HDMI support included in this series and MIPI-DSI which is not included because it needs some more work. The driver is taken from the downstream Rockchip kernel and heavily polished, most non standard features have been removed for now. I tested the driver with the libdrm modetest utility and also with weston with both pixman and panfrost driver support. Michael Riesch reported the driver to work on the RK3566 as well, but device tree support for this SoC is not yet included in this series.

Quoted 6 lines

The HDMI changes are based on patches from Benjamin Gaignard, but modified a bit as I found out that the HDMI port on the RK3568 only needs one additional clock, not two. Also I added regulator support which is needed to get the HDMI up on the rk3568-EVB board.

All review and testing feedback welcome

thanks for working on that - it's very (very,very) much appreciated.

Quoted 7 lines

It took me some time to figure it out: It seems rk3568-iommu driver s broken - I did only get "white noise" when using it alongside vop (similar like it was reported here before). However: removing the iommu-property from vop makes it working for me with HDMI output on quartz64 as well. Could you check if you have the iommu driver in kernel enabled if it works for you, if the property is present in DT? (I used 5.16-rc1 + this series + [0]).

I have the iommu driver enabled and it works for me. I get this during boot:

[0.263287] rockchip-vop2 fe040000.vop: Adding to iommu group 0

So I expect it is indeed used.

Quoted 3 lines

Also vop mmu seems to have the
power-domain missing in your series (same as downstream) - however adding that doesn't help much currently.

Probably the power domain gets enabled anyway when the VOP is activated, so adding it to the iommu won't help anything. Nevertheless it seems correct to add the property, I'll do so in the next round.

Quoted 8 lines
Quoted 5 lines

As a sidenote: I verfied this with using Ezequiel's vpu addtion for
RK356x: It did only work when removing the iommu there as well (getting tons of page faults otherwise) - so iommu driver really seems to broken, at least for RK3566. (Or I'm a missing a option in kernel config, which wasn't required for the older iommu version?)

I don't think so. I started from defconfig and disabled other architectures and unneeded drivers, but I did not enable anything specific to iommu.

I've found out now that I can make it work with iommu, by limiting the available memory to something below 4G (I have a 8G board). So there is something wrong in the driver or somewhere in memory mapping, iommu api (since it works when using CMA), ... however: it does clearly not relate to your patch.

Quoted 28 lines
Quoted 4 lines


But as reported before: For HDMI this does currently only work for pixel clock rates, which are integer-divisable with hpll clock rate (which is the hardcoded parent of vop0's dclk)

Quoted 8 lines

As discussed in Benjamin's initial submission of the addition of RK3568's hdmi controller [1] same as with RK3288's and RK3399's hdmi phy needs a reference clock (it's called vpll there) which needs to get switched before the vop switches the mode (since phy rate switching is done before) - it's HPLL in case of RK356x. For whatever reason it's called "ref" for RK356x only downstream [2] - so you should add another clock "vpll" (renaming it to "ref" for _ALL_ SoCs which have it would be a _GREAT_ idea) which is <&pmucru PLL_HPLL>.

Yeah, a consumer clock should be named after the usage in the consumer, not after the provider name. I also stumbled over this and naming it "ref" makes much more sense. We'll likely have to keep supporting "vpll" as well for compatibility to old device trees.

Quoted 11 lines

What brings us to the "real" clock problem and the reason, why non-integer divisable pixel clock rates are not possible ATM: This is a long standing issue for RK3288 and RK3399 as well (and one of the main reasons why 4k modes are not possible for those older SoCs currently):
Upstream all PLL rates are controlled with those PLL rate tables in the clock driver and they have to be _exactly_ defined as they are used (HDMI sinks are very picky).
You will not see any additional rates downstream for RK3568: they have a mechanism there to automatically calculate the PLL settings if the rate doesn't exist in these tables (IIRC this was submitted upstream also:
but it was rejected/ignored by maintainers).

Quoted 2 lines

Looks like we have to try harder to get it upstream. Do you have a pointer to this patch?

Sure:

https://patchwork.kernel.org/project/linux-clk/patch/[email protected]/

I don't know if that is the was last submitted version.

Best regards,

Alex

Quoted 11 lines
Quoted 6 lines

As a quick hackarround (for
testing): You could use this table [3] we are using in LibreElec for RK3399 to get 4k modes working and assign it to HPLL in RK3568's clock driver (I tested it and it works great). It might be possible to just add those rates (some also without frac dividers) to the common PLL table for RK3568.

Thanks for noting. This could also explain why currently only 1080p is working.

Sascha

#50 lore raw
Quoted 58 lines · Alex Bee

Am 22.11.21 um 09:10 schrieb Sascha Hauer:

Quoted 48 lines

Hi Alex,

Quoted 24 lines · Alex Bee

Hi Sascha,

Am 17.11.21 um 15:33 schrieb Sascha Hauer:

Quoted 12 lines

This series adds initial graphics support for the Rockchip RK356[68] SoCs. Graphics support is based around the VOP2 controller which replaces the VOP controller found on earlier Rockchip SoCs. The driver has been tested with HDMI support included in this series and MIPI-DSI which is not included because it needs some more work. The driver is taken from the downstream Rockchip kernel and heavily polished, most non standard features have been removed for now. I tested the driver with the libdrm modetest utility and also with weston with both pixman and panfrost driver support. Michael Riesch reported the driver to work on the RK3566 as well, but device tree support for this SoC is not yet included in this series.

Quoted 6 lines

The HDMI changes are based on patches from Benjamin Gaignard, but modified a bit as I found out that the HDMI port on the RK3568 only needs one additional clock, not two. Also I added regulator support which is needed to get the HDMI up on the rk3568-EVB board.

All review and testing feedback welcome

thanks for working on that - it's very (very,very) much appreciated.

Quoted 7 lines

It took me some time to figure it out: It seems rk3568-iommu driver s broken - I did only get "white noise" when using it alongside vop (similar like it was reported here before). However: removing the iommu-property from vop makes it working for me with HDMI output on quartz64 as well. Could you check if you have the iommu driver in kernel enabled if it works for you, if the property is present in DT? (I used 5.16-rc1 + this series + [0]).

I have the iommu driver enabled and it works for me. I get this during boot:

[0.263287] rockchip-vop2 fe040000.vop: Adding to iommu group 0

So I expect it is indeed used.

Quoted 3 lines

Also vop mmu seems to have the
power-domain missing in your series (same as downstream) - however adding that doesn't help much currently.

Probably the power domain gets enabled anyway when the VOP is activated, so adding it to the iommu won't help anything. Nevertheless it seems correct to add the property, I'll do so in the next round.

Quoted 8 lines
Quoted 5 lines

As a sidenote: I verfied this with using Ezequiel's vpu addtion for
RK356x: It did only work when removing the iommu there as well (getting tons of page faults otherwise) - so iommu driver really seems to broken, at least for RK3566. (Or I'm a missing a option in kernel config, which wasn't required for the older iommu version?)

I don't think so. I started from defconfig and disabled other architectures and unneeded drivers, but I did not enable anything specific to iommu.

Quoted 5 lines

I've found out now that I can make it work with iommu, by limiting the available memory to something below 4G (I have a 8G board). So there is something wrong in the driver or somewhere in memory mapping, iommu api (since it works when using CMA), ... however: it does clearly not relate to your patch.

FWIW it doesn't surprise me that there might still be bugs lurking in the IOMMU driver's relatively recent changes for packing 40-bit physical addresses into 32-bit pagetable entries and registers - that sort of thing is always tricky to get right. You're correct that that's something that wants debugging in its own right, though.

Robin.