Skip to contentSkip to conversation

drm/rockchip: RK356x VOP2 support

PATCH Applied Sascha Hauer 10 participants 57 messages Jan 26, 2022 – Feb 9, 2022 1 message not in the archive

Subsystems (6)

v4 of 12 Applied Latest is v12 →

lore
Share & tools
lore
#0 lore raw

v4 cover drm/rockchip: RK356x VOP2 support

This is v4 of adding RK356x VOP2 support. Due to popular demand I added a changelog to each patch, at least starting with changes to v3, I didn't care to add the older changes as well. I hopefully integrated all feedback I received to v3. Additionally I added some patches to the HDMI driver to support resolutions up to 4k@60Hz. The patches are mostly taken from the downstream kernel. Some have been send to public lists, but were never applied upstream for reasons I do not know. The patches are a bit more intrusive than needed for my case, but are present in the downstream kernel for a long time, so I decided just to take them instead of stripping them down to my needs. With these patches I successfully used the driver with 4k@30Hz. 4k@60Hz doesn't work for me, I hope this is due to my low quality cable.

Sascha

Changes since v3:
- added changelog to each patch
- Add 4k support to hdmi driver
- rebase on v5.17-rc1

Changes since v2:
- Add pin names to HDMI supply pin description
- Add hclk support to HDMI driver
- Dual license rockchip-vop2 binding, update binding
- Add HDMI connector to board dts files
- drop unnecessary gamma_lut registers from vop2
- Update dclk_vop[012] clock handling, no longer hacks needed
- Complete regmap conversion

Changes since v1:
- drop all unnecessary waiting for frames within atomic modeset and plane update
- Cluster subwin support removed
- gamma support removed
- unnecessary irq_lock removed
- interrupt handling simplified
- simplified zpos handling
- drop is_alpha_support(), use fb->format->has_alpha instead
- use devm_regulator_get() rather than devm_regulator_get_optional() for hdmi regulators
- Use fixed number of planes per video port
- Drop homegrown regmap code from vop2 driver (not complete yet)
- Add separate include file for vop2 driver to not pollute the vop include

Andy Yan (1):
drm: rockchip: Add VOP2 driver

Benjamin Gaignard (1):
dt-bindings: display: rockchip: dw-hdmi: Add compatible for rk3568
HDMI

Douglas Anderson (2):
drm/rockchip: dw_hdmi: Use auto-generated tables drm/rockchip: dw_hdmi: Set cur_ctr to 0 always

Michael Riesch (1):
arm64: dts: rockchip: enable vop2 and hdmi tx on quartz64a

Nickey Yang (1):
drm/rockchip: dw_hdmi: add default 594Mhz clk for 4K@60hz

Sascha Hauer (21):
drm/encoder: Add of_graph port to struct drm_encoder drm/rockchip: dw_hdmi: Do not leave clock enabled in error case drm/rockchip: dw_hdmi: rename vpll clock to reference clock drm/rockchip: dw_hdmi: add rk3568 support
drm/rockchip: dw_hdmi: add regulator support
drm/rockchip: dw_hdmi: Add support for hclk
drm/rockchip: dw_hdmi: drop mode_valid hook
clk: rockchip: rk3568: Add more PLL rates
dt-bindings: display: rockchip: dw-hdmi: Make unwedge pinctrl optional
dt-bindings: display: rockchip: dw-hdmi: use "ref" as clock name
dt-bindings: display: rockchip: dw-hdmi: Add regulator support
dt-bindings: display: rockchip: dw-hdmi: Add additional clock
dt-bindings: display: rockchip: Add binding for VOP2
arm64: dts: rockchip: rk3399: reorder hmdi clocks
arm64: dts: rockchip: rk3399: rename HDMI ref clock to 'ref'
arm64: dts: rockchip: rk356x: Add VOP2 nodes
arm64: dts: rockchip: rk356x: Add HDMI nodes
arm64: dts: rockchip: rk3568-evb: Enable VOP2 and hdmi
clk: rk3568: drop CLK_SET_RATE_PARENT from dclk_vop*
clk: rk3568: Add CLK_SET_RATE_PARENT to the HDMI reference clock drm/rockchip: Make VOP driver optional

 .../display/rockchip/rockchip,dw-hdmi.yaml    |   29 +-
 .../display/rockchip/rockchip-vop2.yaml       |  146 +
 arch/arm64/boot/dts/rockchip/rk3399.dtsi      |    6 +-
 .../boot/dts/rockchip/rk3566-quartz64-a.dts   |   48 +
 arch/arm64/boot/dts/rockchip/rk3566.dtsi      |    4 +
 .../boot/dts/rockchip/rk3568-evb1-v10.dts     |   48 +
 arch/arm64/boot/dts/rockchip/rk3568.dtsi      |    4 +
 arch/arm64/boot/dts/rockchip/rk356x.dtsi      |   86 +
 drivers/clk/rockchip/clk-rk3568.c             |   14 +-
 drivers/gpu/drm/rockchip/Kconfig              |   14 +
 drivers/gpu/drm/rockchip/Makefile             |    4 +-
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c   |  293 +-
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c   |    3 +-
 drivers/gpu/drm/rockchip/rockchip_drm_drv.h   |    7 +-
 drivers/gpu/drm/rockchip/rockchip_drm_fb.c    |    2 +
 drivers/gpu/drm/rockchip/rockchip_drm_vop.h   |   15 +
 drivers/gpu/drm/rockchip/rockchip_drm_vop2.c  | 2665 +++++++++++++++++
 drivers/gpu/drm/rockchip/rockchip_drm_vop2.h  |  480 +++
 drivers/gpu/drm/rockchip/rockchip_vop2_reg.c  |  285 ++
 include/drm/drm_encoder.h                     |    2 +
 include/dt-bindings/soc/rockchip,vop2.h       |   14 +
 21 files changed, 4039 insertions(+), 130 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_drm_vop2.h
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_vop2_reg.c
 create mode 100644 include/dt-bindings/soc/rockchip,vop2.h
Signature · 1 line
2.30.2
#1 lore raw

PATCH v4 1/27 drm/encoder: Add of_graph port to struct drm_encoder

Add a device node to drm_encoder which corresponds with the port node in the DT description of the encoder. This allows drivers to find the of_graph link between a crtc and an encoder.

---
 include/drm/drm_encoder.h | 2 ++
 1 file changed, 2 insertions(+)
include/drm/drm_encoder.h +2 -0
index 6e91a0280f31..3acd054b1eb3 100644
@@ -99,6 +99,8 @@ struct drm_encoder {
 	struct drm_device *dev;
 	struct list_head head;
 
+	struct device_node *port;
+
 	struct drm_mode_object base;
 	char *name;
 	/**
Signature · 1 line
2.30.2
#2 lore raw

Aw: [PATCH 01/27] drm/encoder: Add of_graph port to struct drm_encoder

Hi

Quoted 3 lines

Gesendet: Mittwoch, 26. Januar 2022 um 15:55 Uhr
Von: "Sascha Hauer" <[email protected]>
Betreff: [PATCH 01/27] drm/encoder: Add of_graph port to struct drm_encoder

Please use "git format-patch -vX ..." when creating your patches to make sure the version is set in every patch and not only the coverletter. That makes it easier to find Patch from specific version and shows version also in Patchwork where the coverletter is hidden

regards Frank

#3 lore raw

PATCH v4 2/27 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 830bdd5e9b7c..8677c8271678 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 v4 3/27 drm/rockchip: dw_hdmi: rename vpll clock to reference clock

In reply to Sascha Hauer

"vpll" is a misnomer. A clock input to a device should be named after the usage in the device, not after the clock that drives it. On the rk3568 the same clock is driven by the HPLL.
To fix that, this patch renames the vpll clock to ref clock. The clock name "vpll" is left for compatibility to old device trees.

---
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 29 ++++++++++++---------
 1 file changed, 16 insertions(+), 13 deletions(-)
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +16 -13
index 8677c8271678..e352e0404f77 100644
@@ -69,7 +69,7 @@ struct rockchip_hdmi {
 	struct regmap *regmap;
 	struct drm_encoder encoder;
 	const struct rockchip_hdmi_chip_data *chip_data;
-	struct clk *vpll_clk;
+	struct clk *ref_clk;
 	struct clk *grf_clk;
 	struct dw_hdmi *hdmi;
 	struct phy *phy;
@@ -196,14 +196,17 @@ 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) {
+	hdmi->ref_clk = devm_clk_get(hdmi->dev, "ref");
+	if (PTR_ERR(hdmi->ref_clk) == -ENOENT)
+		hdmi->ref_clk = devm_clk_get(hdmi->dev, "vpll");
+
+	if (PTR_ERR(hdmi->ref_clk) == -ENOENT) {
+		hdmi->ref_clk = NULL;
+	} else if (PTR_ERR(hdmi->ref_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);
+	} else if (IS_ERR(hdmi->ref_clk)) {
+		DRM_DEV_ERROR(hdmi->dev, "failed to get reference clock\n");
+		return PTR_ERR(hdmi->ref_clk);
 	}
 
 	hdmi->grf_clk = devm_clk_get(hdmi->dev, "grf");
@@ -257,7 +260,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->ref_clk, adj_mode->clock * 1000);
 }
 
 static void dw_hdmi_rockchip_encoder_enable(struct drm_encoder *encoder)
@@ -537,9 +540,9 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,
 		return ret;
 	}
 
-	ret = clk_prepare_enable(hdmi->vpll_clk);
+	ret = clk_prepare_enable(hdmi->ref_clk);
 	if (ret) {
-		DRM_DEV_ERROR(hdmi->dev, "Failed to enable HDMI vpll: %d\n",
+		DRM_DEV_ERROR(hdmi->dev, "Failed to enable HDMI reference clock: %d\n",
 			      ret);
 		return ret;
 	}
@@ -558,7 +561,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_disable_unprepare(hdmi->ref_clk);
 	}
 
 	return ret;
@@ -570,7 +573,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_disable_unprepare(hdmi->ref_clk);
 }
 
 static const struct component_ops dw_hdmi_rockchip_ops = {
Signature · 1 line
2.30.2
#5 lore raw

PATCH v4 4/27 drm/rockchip: dw_hdmi: add rk3568 support

In reply to Sascha Hauer

Add a new dw_hdmi_plat_data struct and new compatible for rk3568.

---
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 31 +++++++++++++++++++++
 1 file changed, 31 insertions(+)
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +31 -0
index e352e0404f77..262eef614cb1 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)
 
 /**
@@ -470,6 +474,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
@@ -483,6 +500,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);
@@ -517,6 +537,9 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,
 	encoder = &hdmi->encoder;
 
 	encoder->possible_crtcs = drm_of_find_possible_crtcs(drm, dev->of_node);
+
+	encoder->port = of_graph_get_port_by_id(dev->of_node, 0);
+
 	/*
 	 * If we failed to find the CRTC(s) which this encoder is
 	 * supposed to be connected to, it's because the CRTC has
@@ -547,6 +570,14 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,
 		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);
 
Signature · 1 line
2.30.2
#6 lore raw

PATCH v4 5/27 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.

---
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 41 +++++++++++++++++++--
 1 file changed, 38 insertions(+), 3 deletions(-)
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +38 -3
index 262eef614cb1..3d7c3f6fdf22 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>
@@ -76,6 +77,8 @@ struct rockchip_hdmi {
 	struct clk *ref_clk;
 	struct clk *grf_clk;
 	struct dw_hdmi *hdmi;
+	struct regulator *avdd_0v9;
+	struct regulator *avdd_1v8;
 	struct phy *phy;
 };
 
@@ -223,6 +226,14 @@ static int rockchip_hdmi_parse_dt(struct rockchip_hdmi *hdmi)
 		return PTR_ERR(hdmi->grf_clk);
 	}
 
+	hdmi->avdd_0v9 = devm_regulator_get(hdmi->dev, "avdd-0v9");
+	if (IS_ERR(hdmi->avdd_0v9))
+		return PTR_ERR(hdmi->avdd_0v9);
+
+	hdmi->avdd_1v8 = devm_regulator_get(hdmi->dev, "avdd-1v8");
+	if (IS_ERR(hdmi->avdd_1v8))
+		return PTR_ERR(hdmi->avdd_1v8);
+
 	return 0;
 }
 
@@ -563,11 +574,23 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,
 		return ret;
 	}
 
+	ret = regulator_enable(hdmi->avdd_0v9);
+	if (ret) {
+		DRM_DEV_ERROR(hdmi->dev, "failed to enable avdd0v9: %d\n", ret);
+		goto err_avdd_0v9;
+	}
+
+	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_prepare_enable(hdmi->ref_clk);
 	if (ret) {
 		DRM_DEV_ERROR(hdmi->dev, "Failed to enable HDMI reference clock: %d\n",
 			      ret);
-		return ret;
+		goto err_clk;
 	}
 
 	if (hdmi->chip_data == &rk3568_chip_data) {
@@ -591,10 +614,19 @@ 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->ref_clk);
+		goto err_bind;
 	}
 
+	return 0;
+
+err_bind:
+	clk_disable_unprepare(hdmi->ref_clk);
+	drm_encoder_cleanup(encoder);
+err_clk:
+	regulator_disable(hdmi->avdd_1v8);
+err_avdd_1v8:
+	regulator_disable(hdmi->avdd_0v9);
+err_avdd_0v9:
 	return ret;
 }
 
@@ -605,6 +637,9 @@ static void dw_hdmi_rockchip_unbind(struct device *dev, struct device *master,
 
 	dw_hdmi_unbind(hdmi->hdmi);
 	clk_disable_unprepare(hdmi->ref_clk);
+
+	regulator_disable(hdmi->avdd_1v8);
+	regulator_disable(hdmi->avdd_0v9);
 }
 
 static const struct component_ops dw_hdmi_rockchip_ops = {
Signature · 1 line
2.30.2
#7 lore raw

PATCH v4 6/27 drm/rockchip: dw_hdmi: Add support for hclk

In reply to Sascha Hauer

The rk3568 HDMI has an additional clock that needs to be enabled for the HDMI controller to work. The purpose of that clock is not clear. It is named "hclk" in the downstream driver, so use the same name.

---
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +18 -0
index 3d7c3f6fdf22..b9928e622adf 100644
@@ -76,6 +76,7 @@ struct rockchip_hdmi {
 	const struct rockchip_hdmi_chip_data *chip_data;
 	struct clk *ref_clk;
 	struct clk *grf_clk;
+	struct clk *hclk_clk;
 	struct dw_hdmi *hdmi;
 	struct regulator *avdd_0v9;
 	struct regulator *avdd_1v8;
@@ -226,6 +227,16 @@ static int rockchip_hdmi_parse_dt(struct rockchip_hdmi *hdmi)
 		return PTR_ERR(hdmi->grf_clk);
 	}
 
+	hdmi->hclk_clk = devm_clk_get(hdmi->dev, "hclk");
+	if (PTR_ERR(hdmi->hclk_clk) == -ENOENT) {
+		hdmi->hclk_clk = NULL;
+	} else if (PTR_ERR(hdmi->hclk_clk) == -EPROBE_DEFER) {
+		return -EPROBE_DEFER;
+	} else if (IS_ERR(hdmi->hclk_clk)) {
+		DRM_DEV_ERROR(hdmi->dev, "failed to get hclk_clk clock\n");
+		return PTR_ERR(hdmi->hclk_clk);
+	}
+
 	hdmi->avdd_0v9 = devm_regulator_get(hdmi->dev, "avdd-0v9");
 	if (IS_ERR(hdmi->avdd_0v9))
 		return PTR_ERR(hdmi->avdd_0v9);
@@ -593,6 +604,13 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,
 		goto err_clk;
 	}
 
+	ret = clk_prepare_enable(hdmi->hclk_clk);
+	if (ret) {
+		DRM_DEV_ERROR(hdmi->dev, "Failed to enable HDMI hclk clock: %d\n",
+			      ret);
+		goto err_clk;
+	}
+
 	if (hdmi->chip_data == &rk3568_chip_data) {
 		regmap_write(hdmi->regmap, RK3568_GRF_VO_CON1,
 			     HIWORD_UPDATE(RK3568_HDMI_SDAIN_MSK |
Signature · 1 line
2.30.2
#8 lore raw

PATCH v4 7/27 drm/rockchip: dw_hdmi: Use auto-generated tables

In reply to Sascha Hauer

From: Douglas Anderson <dianders at chromium.org>

The previous tables for mpll_cfg and curr_ctrl were created using the 20-pages of example settings provided by the PHY vendor. Those example settings weren't particularly dense, so there were places where we were guessing what the settings would be for 10-bit and 12-bit (not that we use those anyway). It was also always a lot of extra work every time we wanted to add a new clock rate since we had to cross-reference several tables.

In <http://crosreview.com/285855> I've gone through the work to figure out how to generate this table automatically. Let's now use the automatically generated table and then we'll never need to look at it again.

We only support 8-bit mode right now and only support a small number of clock rates and and I've verified that the only 8-bit rate that was affected was 148.5. That mode appears to have been wrong in the old table.

Changes since v3:
- new patch

Signed-off-by Douglas Anderson <dianders at chromium.org>
Signed-off-by Yakir Yang <ykk at rock-chips.com>
Reviewed-by Stéphane Marchesin <marcheu at chromium.org>
---
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 130 +++++++++++---------
 1 file changed, 69 insertions(+), 61 deletions(-)
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +69 -61
index b9928e622adf..160107b333ef 100644
@@ -87,80 +87,88 @@ struct rockchip_hdmi {
 
 static const struct dw_hdmi_mpll_config rockchip_mpll_cfg[] = {
 	{
-		27000000, {
-			{ 0x00b3, 0x0000},
-			{ 0x2153, 0x0000},
-			{ 0x40f3, 0x0000}
+		30666000, {
+			{ 0x00b3, 0x0000 },
+			{ 0x2153, 0x0000 },
+			{ 0x40f3, 0x0000 },
 		},
-	}, {
-		36000000, {
-			{ 0x00b3, 0x0000},
-			{ 0x2153, 0x0000},
-			{ 0x40f3, 0x0000}
+	},  {
+		36800000, {
+			{ 0x00b3, 0x0000 },
+			{ 0x2153, 0x0000 },
+			{ 0x40a2, 0x0001 },
 		},
-	}, {
-		40000000, {
-			{ 0x00b3, 0x0000},
-			{ 0x2153, 0x0000},
-			{ 0x40f3, 0x0000}
+	},  {
+		46000000, {
+			{ 0x00b3, 0x0000 },
+			{ 0x2142, 0x0001 },
+			{ 0x40a2, 0x0001 },
 		},
-	}, {
-		54000000, {
-			{ 0x0072, 0x0001},
-			{ 0x2142, 0x0001},
-			{ 0x40a2, 0x0001},
+	},  {
+		61333000, {
+			{ 0x0072, 0x0001 },
+			{ 0x2142, 0x0001 },
+			{ 0x40a2, 0x0001 },
 		},
-	}, {
-		65000000, {
-			{ 0x0072, 0x0001},
-			{ 0x2142, 0x0001},
-			{ 0x40a2, 0x0001},
+	},  {
+		73600000, {
+			{ 0x0072, 0x0001 },
+			{ 0x2142, 0x0001 },
+			{ 0x4061, 0x0002 },
 		},
-	}, {
-		66000000, {
-			{ 0x013e, 0x0003},
-			{ 0x217e, 0x0002},
-			{ 0x4061, 0x0002}
+	},  {
+		92000000, {
+			{ 0x0072, 0x0001 },
+			{ 0x2145, 0x0002 },
+			{ 0x4061, 0x0002 },
 		},
-	}, {
-		74250000, {
-			{ 0x0072, 0x0001},
-			{ 0x2145, 0x0002},
-			{ 0x4061, 0x0002}
+	},  {
+		122666000, {
+			{ 0x0051, 0x0002 },
+			{ 0x2145, 0x0002 },
+			{ 0x4061, 0x0002 },
 		},
-	}, {
-		83500000, {
-			{ 0x0072, 0x0001},
+	},  {
+		147200000, {
+			{ 0x0051, 0x0002 },
+			{ 0x2145, 0x0002 },
+			{ 0x4064, 0x0003 },
 		},
-	}, {
-		108000000, {
-			{ 0x0051, 0x0002},
-			{ 0x2145, 0x0002},
-			{ 0x4061, 0x0002}
+	},  {
+		184000000, {
+			{ 0x0051, 0x0002 },
+			{ 0x214c, 0x0003 },
+			{ 0x4064, 0x0003 },
 		},
-	}, {
-		106500000, {
-			{ 0x0051, 0x0002},
-			{ 0x2145, 0x0002},
-			{ 0x4061, 0x0002}
+	},  {
+		226666000, {
+			{ 0x0040, 0x0003 },
+			{ 0x214c, 0x0003 },
+			{ 0x4064, 0x0003 },
 		},
-	}, {
-		146250000, {
-			{ 0x0051, 0x0002},
-			{ 0x2145, 0x0002},
-			{ 0x4061, 0x0002}
+	},  {
+		272000000, {
+			{ 0x0040, 0x0003 },
+			{ 0x214c, 0x0003 },
+			{ 0x5a64, 0x0003 },
 		},
-	}, {
-		148500000, {
-			{ 0x0051, 0x0003},
-			{ 0x214c, 0x0003},
-			{ 0x4064, 0x0003}
+	},  {
+		340000000, {
+			{ 0x0040, 0x0003 },
+			{ 0x3b4c, 0x0003 },
+			{ 0x5a64, 0x0003 },
 		},
-	}, {
+	},  {
+		600000000, {
+			{ 0x1a40, 0x0003 },
+			{ 0x3b4c, 0x0003 },
+			{ 0x5a64, 0x0003 },
+		},
+	},  {
 		~0UL, {
-			{ 0x00a0, 0x000a },
-			{ 0x2001, 0x000f },
-			{ 0x4002, 0x000f },
+			{ 0x0000, 0x0000 },
+			{ 0x0000, 0x0000 },
+			{ 0x0000, 0x0000 },
 		},
 	}
 };
Signature · 1 line
2.30.2
#9 lore raw

Re: [PATCH 07/27] drm/rockchip: dw_hdmi: Use auto-generated tables

Hi,

Quoted 11 lines · Sascha Hauer

From: Douglas Anderson <dianders at chromium.org>

The previous tables for mpll_cfg and curr_ctrl were created using the 20-pages of example settings provided by the PHY vendor. Those example settings weren't particularly dense, so there were places where we were guessing what the settings would be for 10-bit and 12-bit (not that we use those anyway). It was also always a lot of extra work every time we wanted to add a new clock rate since we had to cross-reference several tables.

Quoted 1 line

In <http://crosreview.com/285855> I've gone through the work to figure

The crosreview.com syntax doesn't seem to work anymore. Could maybe update to https://crrev.com/c/285855 ?

Quoted 9 lines

out how to generate this table automatically. Let's now use the automatically generated table and then we'll never need to look at it again.

We only support 8-bit mode right now and only support a small number of clock rates and and I've verified that the only 8-bit rate that was affected was 148.5. That mode appears to have been wrong in the old table.

Quoted 5 lines

Changes since v3:
- new patch

Signed-off-by Douglas Anderson <dianders at chromium.org>
Signed-off-by Yakir Yang <ykk at rock-chips.com>

Should probably change the "at" to "@" ?

Quoted 1 line
Reviewed-by Stéphane Marchesin <marcheu at chromium.org>

In general shouldn't carry downstream reviews when posting upstream unless you're certain that the person intended it...

It's been a long time, but in general I think I was fairly confident in the numbers that my script pumped out, at least given the caveat of no pixel repetition and 8-bit only. That being said, I didn't have any inside knowledge of the hardware and just figured out formulas that seemed to match the table that I had. YMMV.

I'll also say that when I did a rebase of veyron (rk3288-based Chromebook) to 4.19 about 2.5 years ago, I ended up squashing several of these patches into 1. That can be found at
<https://crrev.com/c/1661056>. That also has details about why some of these patches never made it upstream. The main reason, at least in the case of rk3288, was the PLL sharing problem that nobody ever solved. rk3288 didn't have quite enough PLLs and thus, if you were using both VOPs, one of the VOPs was going to be severely limited in what pixel clocks it could make. There was no framework deciding which VOP should be limited and how the system should react to this...

In any case, I'm pretty far disconnected from all this stuff now, but I wish you the best of luck in trying to get it all solved!

-Doug

#10 lore raw

Re: [PATCH 07/27] drm/rockchip: dw_hdmi: Use auto-generated tables

Quoted 14 lines · Doug Anderson

Hi,

Quoted 11 lines · Sascha Hauer

From: Douglas Anderson <dianders at chromium.org>

The previous tables for mpll_cfg and curr_ctrl were created using the 20-pages of example settings provided by the PHY vendor. Those example settings weren't particularly dense, so there were places where we were guessing what the settings would be for 10-bit and 12-bit (not that we use those anyway). It was also always a lot of extra work every time we wanted to add a new clock rate since we had to cross-reference several tables.

Quoted 4 lines
Quoted 1 line

In <http://crosreview.com/285855> I've gone through the work to figure

The crosreview.com syntax doesn't seem to work anymore. Could maybe update to https://crrev.com/c/285855 ?

did that, thanks.

Quoted 10 lines
Quoted 10 lines

out how to generate this table automatically. Let's now use the automatically generated table and then we'll never need to look at it again.

We only support 8-bit mode right now and only support a small number of clock rates and and I've verified that the only 8-bit rate that was affected was 148.5. That mode appears to have been wrong in the old table.

Quoted 7 lines
Quoted 5 lines

Changes since v3:
- new patch

Signed-off-by Douglas Anderson <dianders at chromium.org>
Signed-off-by Yakir Yang <ykk at rock-chips.com>

Should probably change the "at" to "@" ?

yes.

Quoted 7 lines
Quoted 2 lines
Reviewed-by Stéphane Marchesin <marcheu at chromium.org>

In general shouldn't carry downstream reviews when posting upstream unless you're certain that the person intended it...

Quoted 5 lines

It's been a long time, but in general I think I was fairly confident in the numbers that my script pumped out, at least given the caveat of no pixel repetition and 8-bit only. That being said, I didn't have any inside knowledge of the hardware and just figured out formulas that seemed to match the table that I had. YMMV.

Rockchip adopted this patch for their downstream Kernel, so they haven't been able to come up with better values. Given that you created this patch for a fairly old SoC and the values are still usable on rk3568 I think that's the way to go.

Quoted 13 lines

I'll also say that when I did a rebase of veyron (rk3288-based Chromebook) to 4.19 about 2.5 years ago, I ended up squashing several of these patches into 1. That can be found at
<https://crrev.com/c/1661056>. That also has details about why some of these patches never made it upstream. The main reason, at least in the case of rk3288, was the PLL sharing problem that nobody ever solved. rk3288 didn't have quite enough PLLs and thus, if you were using both VOPs, one of the VOPs was going to be severely limited in what pixel clocks it could make. There was no framework deciding which VOP should be limited and how the system should react to this...

Quoted 2 lines

In any case, I'm pretty far disconnected from all this stuff now, but I wish you the best of luck in trying to get it all solved!

Nah, sorry, I won't get that all solved ;)

I am not that interested in rk3288, my main concern is the rk3568. That one has two spare PLLs for three heads instead of one PLL for two heads, so the problem is less pressing.

I'll stick to this version of the patch instead of the combined one because this patch seems to be correct regardless of the PLL problem.

Thanks for the link though, it gives me some insights why things are the way they are currently.

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 |
#11 lore raw

PATCH v4 8/27 drm/rockchip: dw_hdmi: drop mode_valid hook

In reply to Sascha Hauer

The driver checks if the pixel clock of the given mode matches an entry in the mpll config table. The frequencies in the mpll table are meant as a frequency range up to which the entry works, not as a frequency that must match the pixel clock. The downstream Kernel also does not have this check, so drop it to allow for more display resolutions.

Changes since v3:
- new patch

---
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 25 ---------------------
 1 file changed, 25 deletions(-)
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +0 -25
index 160107b333ef..c44eb4d2e2d5 100644
@@ -256,26 +256,6 @@ static int rockchip_hdmi_parse_dt(struct rockchip_hdmi *hdmi)
 	return 0;
 }
 
-static enum drm_mode_status
-dw_hdmi_rockchip_mode_valid(struct dw_hdmi *hdmi, void *data,
-			    const struct drm_display_info *info,
-			    const struct drm_display_mode *mode)
-{
-	const struct dw_hdmi_mpll_config *mpll_cfg = rockchip_mpll_cfg;
-	int pclk = mode->clock * 1000;
-	bool valid = false;
-	int i;
-
-	for (i = 0; mpll_cfg[i].mpixelclock != (~0UL); i++) {
-		if (pclk == mpll_cfg[i].mpixelclock) {
-			valid = true;
-			break;
-		}
-	}
-
-	return (valid) ? MODE_OK : MODE_BAD;
-}
-
 static void dw_hdmi_rockchip_encoder_disable(struct drm_encoder *encoder)
 {
 }
@@ -441,7 +421,6 @@ static struct rockchip_hdmi_chip_data rk3228_chip_data = {
 };
 
 static const struct dw_hdmi_plat_data rk3228_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,
@@ -458,7 +437,6 @@ static struct rockchip_hdmi_chip_data rk3288_chip_data = {
 };
 
 static const struct dw_hdmi_plat_data rk3288_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,
@@ -478,7 +456,6 @@ static struct rockchip_hdmi_chip_data rk3328_chip_data = {
 };
 
 static const struct dw_hdmi_plat_data rk3328_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,
@@ -496,7 +473,6 @@ static struct rockchip_hdmi_chip_data rk3399_chip_data = {
 };
 
 static const struct dw_hdmi_plat_data rk3399_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,
@@ -509,7 +485,6 @@ static struct rockchip_hdmi_chip_data rk3568_chip_data = {
 };
 
 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,
Signature · 1 line
2.30.2
#12 lore raw

PATCH v4 9/27 drm/rockchip: dw_hdmi: Set cur_ctr to 0 always

In reply to Sascha Hauer

From: Douglas Anderson <[email protected]>

Jitter was improved by lowering the MPLL bandwidth to account for high frequency noise in the rk3288 PLL. In each case MPLL bandwidth was lowered only enough to get us a comfortable margin. We believe that lowering the bandwidth like this is safe given sufficient testing.

Changes since v3:
- new patch

(am from https://patchwork.kernel.org/patch/9223301/)

---
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +2 -14
index c44eb4d2e2d5..77f82a4fd027 100644
@@ -176,20 +176,8 @@ static const struct dw_hdmi_mpll_config rockchip_mpll_cfg[] = {
 static const struct dw_hdmi_curr_ctrl rockchip_cur_ctr[] = {
 	/*      pixelclk    bpp8    bpp10   bpp12 */
 	{
-		40000000,  { 0x0018, 0x0018, 0x0018 },
-	}, {
-		65000000,  { 0x0028, 0x0028, 0x0028 },
-	}, {
-		66000000,  { 0x0038, 0x0038, 0x0038 },
-	}, {
-		74250000,  { 0x0028, 0x0038, 0x0038 },
-	}, {
-		83500000,  { 0x0028, 0x0038, 0x0038 },
-	}, {
-		146250000, { 0x0038, 0x0038, 0x0038 },
-	}, {
-		148500000, { 0x0000, 0x0038, 0x0038 },
-	}, {
+		600000000, { 0x0000, 0x0000, 0x0000 },
+	},  {
 		~0UL,      { 0x0000, 0x0000, 0x0000},
 	}
 };
Signature · 1 line
2.30.2
#13 lore raw

Re: [PATCH 09/27] drm/rockchip: dw_hdmi: Set cur_ctr to 0 always

Hi,

Quoted 8 lines · Sascha Hauer

From: Douglas Anderson <[email protected]>

Jitter was improved by lowering the MPLL bandwidth to account for high frequency noise in the rk3288 PLL. In each case MPLL bandwidth was lowered only enough to get us a comfortable margin. We believe that lowering the bandwidth like this is safe given sufficient testing.

Quoted 6 lines

Changes since v3:
- new patch

(am from https://patchwork.kernel.org/patch/9223301/)

Probably remove the "am from" line? It's not standard in upstream and that link doesn't seem to go anywhere anymore...

Quoted 19 lines
---
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +0 -6
index c44eb4d2e2d5..77f82a4fd027 100644
@@ -176,20 +176,8 @@ static const struct dw_hdmi_mpll_config rockchip_mpll_cfg[] = {
 static const struct dw_hdmi_curr_ctrl rockchip_cur_ctr[] = {
        /*      pixelclk    bpp8    bpp10   bpp12 */
        {
-               40000000,  { 0x0018, 0x0018, 0x0018 },
-       }, {
-               65000000,  { 0x0028, 0x0028, 0x0028 },
-       }, {
-               66000000,  { 0x0038, 0x0038, 0x0038 },
-       }, {

drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c static const struct dw_hdmi_mpll_config rockchip_mpll_cfg[] = { · line 180

Quoted 10 lines
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +2 -8
-               74250000,  { 0x0028, 0x0038, 0x0038 },
-       }, {
-               83500000,  { 0x0028, 0x0038, 0x0038 },
-       }, {
-               146250000, { 0x0038, 0x0038, 0x0038 },
-       }, {
-               148500000, { 0x0000, 0x0038, 0x0038 },
-       }, {
+               600000000, { 0x0000, 0x0000, 0x0000 },
+       },  {

This is what we did for rk3288. I can't personally vouch for the effects on other SoCs.

-Doug

#14 lore raw

Re: [PATCH 09/27] drm/rockchip: dw_hdmi: Set cur_ctr to 0 always

Quoted 46 lines · Doug Anderson

Hi,

Quoted 8 lines · Sascha Hauer

From: Douglas Anderson <[email protected]>

Jitter was improved by lowering the MPLL bandwidth to account for high frequency noise in the rk3288 PLL. In each case MPLL bandwidth was lowered only enough to get us a comfortable margin. We believe that lowering the bandwidth like this is safe given sufficient testing.

Quoted 6 lines

Changes since v3:
- new patch

(am from https://patchwork.kernel.org/patch/9223301/)

Probably remove the "am from" line? It's not standard in upstream and that link doesn't seem to go anywhere anymore...

Quoted 24 lines
---
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +0 -11
index c44eb4d2e2d5..77f82a4fd027 100644
@@ -176,20 +176,8 @@ static const struct dw_hdmi_mpll_config rockchip_mpll_cfg[] = {
 static const struct dw_hdmi_curr_ctrl rockchip_cur_ctr[] = {
        /*      pixelclk    bpp8    bpp10   bpp12 */
        {
-               40000000,  { 0x0018, 0x0018, 0x0018 },
-       }, {
-               65000000,  { 0x0028, 0x0028, 0x0028 },
-       }, {
-               66000000,  { 0x0038, 0x0038, 0x0038 },
-       }, {
-               74250000,  { 0x0028, 0x0038, 0x0038 },
-       }, {
-               83500000,  { 0x0028, 0x0038, 0x0038 },
-       }, {
-               146250000, { 0x0038, 0x0038, 0x0038 },
Quoted 8 lines

drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c static const struct dw_hdmi_mpll_config rockchip_mpll_cfg[] = { · line 180

Quoted 5 lines
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +2 -3
-       }, {
-               148500000, { 0x0000, 0x0038, 0x0038 },
-       }, {
+               600000000, { 0x0000, 0x0000, 0x0000 },
+       },  {

This is what we did for rk3288. I can't personally vouch for the effects on other SoCs.

Fair enough. Rockchip has this patch in their downstream Kernel, so I am confident it works on SoCs newer as the rk3288 as well. I don't know how much they care about the older SoCs, but it seems there is only the rk3228 that is older than the rk3288 that is supported by this driver.

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 |
#15 lore raw

PATCH v4 10/27 drm/rockchip: dw_hdmi: add default 594Mhz clk for 4K@60hz

In reply to Sascha Hauer

From: Nickey Yang <[email protected]>

add 594Mhz configuration parameters in rockchip_phy_config

Changes since v3:
- new patch

Change-Id Iaa335cdd90059817fd9892877e574f8b84f2b5dc
---
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +1 -0
index 77f82a4fd027..c038674271b2 100644
@@ -187,6 +187,7 @@ static const struct dw_hdmi_phy_config rockchip_phy_config[] = {
 	{ 74250000,  0x8009, 0x0004, 0x0272},
 	{ 148500000, 0x802b, 0x0004, 0x028d},
 	{ 297000000, 0x8039, 0x0005, 0x028d},
+	{ 594000000, 0x8039, 0x0000, 0x019d},
 	{ ~0UL,	     0x0000, 0x0000, 0x0000}
 };
 
Signature · 1 line
2.30.2
#16 lore raw

PATCH v4 11/27 clk: rockchip: rk3568: Add more PLL rates

In reply to Sascha Hauer

This adds a few more PLL settings needed for some standard resolutions:

297MHz    3840x2160-30.00
241.5MHz  2560x1440-59.95
135MHz    1280x1024-75.02
119MHz    1680x1050-59.88
108MHz    1280x1024-60.02

78.75MHz 1024x768-75.03

Changes since v3:
- new patch

---
 drivers/clk/rockchip/clk-rk3568.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/clk/rockchip/clk-rk3568.c +6 -0
index 69a9e8069a48..9d889fc46811 100644
@@ -71,11 +71,17 @@ static struct rockchip_pll_rate_table rk3568_pll_rates[] = {
 	RK3036_PLL_RATE(500000000, 1, 125, 6, 1, 1, 0),
 	RK3036_PLL_RATE(408000000, 1, 68, 2, 2, 1, 0),
 	RK3036_PLL_RATE(312000000, 1, 78, 6, 1, 1, 0),
+	RK3036_PLL_RATE(297000000, 2, 99, 4, 1, 1, 0),
+	RK3036_PLL_RATE(241500000, 2, 161, 4, 2, 1, 0),
 	RK3036_PLL_RATE(216000000, 1, 72, 4, 2, 1, 0),
 	RK3036_PLL_RATE(200000000, 1, 100, 3, 4, 1, 0),
 	RK3036_PLL_RATE(148500000, 1, 99, 4, 4, 1, 0),
+	RK3036_PLL_RATE(135000000, 2, 45, 4, 1, 1, 0),
+	RK3036_PLL_RATE(119000000, 3, 119, 4, 2, 1, 0),
+	RK3036_PLL_RATE(108000000, 2, 45, 5, 1, 1, 0),
 	RK3036_PLL_RATE(100000000, 1, 150, 6, 6, 1, 0),
 	RK3036_PLL_RATE(96000000, 1, 96, 6, 4, 1, 0),
+	RK3036_PLL_RATE(78750000, 1, 96, 6, 4, 1, 0),
 	RK3036_PLL_RATE(74250000, 2, 99, 4, 4, 1, 0),
 	{ /* sentinel */ },
 };
Signature · 1 line
2.30.2
#17 lore raw

PATCH v4 12/27 dt-bindings: display: rockchip: dw-hdmi: Add compatible for rk3568 HDMI

In reply to Sascha Hauer

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.

---
 .../devicetree/bindings/display/rockchip/rockchip,dw-hdmi.yaml   | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/display/rockchip/rockchip,dw-hdmi.yaml +1 -0
index da3b889ad8fc..45cae4f57a1c 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
Signature · 1 line
2.30.2
#18 lore raw

PATCH v4 13/27 dt-bindings: display: rockchip: dw-hdmi: Make unwedge pinctrl optional

In reply to Sascha Hauer

None of the upstream device tree files has a "unwedge" pinctrl specified. Make it optional.

---
 .../devicetree/bindings/display/rockchip/rockchip,dw-hdmi.yaml   | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/display/rockchip/rockchip,dw-hdmi.yaml +1 -0
index 45cae4f57a1c..6e09dd2ee05a 100644
@@ -73,6 +73,7 @@ properties:
       The unwedge pinctrl entry shall drive the DDC SDA line low. This is
       intended to work around a hardware errata that can cause the DDC I2C
       bus to be wedged.
+    minItems: 1
     items:
       - const: default
       - const: unwedge
Signature · 1 line
2.30.2
maintainer Acked-by on v4 13/27
#19 lore raw

Re: [PATCH 13/27] dt-bindings: display: rockchip: dw-hdmi: Make unwedge pinctrl optional

Quoted 8 lines · Sascha Hauer

None of the upstream device tree files has a "unwedge" pinctrl specified. Make it optional.

---
 .../devicetree/bindings/display/rockchip/rockchip,dw-hdmi.yaml   | 1 +
 1 file changed, 1 insertion(+)
#20 lore raw

PATCH v4 14/27 dt-bindings: display: rockchip: dw-hdmi: use "ref" as clock name

In reply to Sascha Hauer

"vpll" is a misnomer. A clock input to a device should be named after the usage in the device, not after the clock that drives it. On the rk3568 the same clock is driven by the HPLL.
This patch adds "ref" as a new alternative clock name for "vpll"

Changes since v3:
- Keep old clock name for compatibility reasons

---
 .../bindings/display/rockchip/rockchip,dw-hdmi.yaml      | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/display/rockchip/rockchip,dw-hdmi.yaml +7 -2
index 6e09dd2ee05a..638119924ad8 100644
@@ -37,7 +37,8 @@ properties:
       # order when present.
       - description: The HDMI CEC controller main clock
       - description: Power for GRF IO
-      - description: External clock for some HDMI PHY
+      - description: External clock for some HDMI PHY (old clock name, deprecated)
+      - description: External clock for some HDMI PHY (new name)
 
   clock-names:
     minItems: 2
@@ -48,10 +49,14 @@ properties:
           - cec
           - grf
           - vpll
+          - ref
       - enum:
           - grf
           - vpll
-      - const: vpll
+          - ref
+      - enum:
+          - vpll
+          - ref
 
   ddc-i2c-bus:
     $ref: /schemas/types.yaml#/definitions/phandle
Signature · 1 line
2.30.2
maintainer Acked-by on v4 14/27
#21 lore raw

Re: [PATCH 14/27] dt-bindings: display: rockchip: dw-hdmi: use "ref" as clock name

Quoted 5 lines · Sascha Hauer

"vpll" is a misnomer. A clock input to a device should be named after the usage in the device, not after the clock that drives it. On the rk3568 the same clock is driven by the HPLL.
This patch adds "ref" as a new alternative clock name for "vpll"

Quoted 8 lines

Changes since v3:
- Keep old clock name for compatibility reasons

---
 .../bindings/display/rockchip/rockchip,dw-hdmi.yaml      | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
#22 lore raw

PATCH v4 15/27 dt-bindings: display: 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 the binding for these supplies.

---
 .../bindings/display/rockchip/rockchip,dw-hdmi.yaml   | 11 +++++++++++
 1 file changed, 11 insertions(+)
Documentation/devicetree/bindings/display/rockchip/rockchip,dw-hdmi.yaml +11 -0
index 638119924ad8..d7cb2b2be60e 100644
@@ -28,6 +28,17 @@ properties:
   reg-io-width:
     const: 4
 
+  avdd-0v9-supply:
+    description:
+      A 0.9V supply that powers up the SoC internal circuitry. The actual pin name
+      varies between the different SoCs and is usually HDMI_TX_AVDD_0V9 or sometimes
+      HDMI_AVDD_1V0.
+
+  avdd-1v8-supply:
+    description:
+      A 1.8V supply that powers up the SoC internal circuitry. The pin name on the
+      SoC usually is HDMI_TX_AVDD_1V8.
+
   clocks:
     minItems: 2
     items:
Signature · 1 line
2.30.2
maintainer Acked-by on v4 15/27
#23 lore raw

Re: [PATCH 15/27] dt-bindings: display: rockchip: dw-hdmi: Add regulator support

Quoted 8 lines · Sascha Hauer

The RK3568 has HDMI_TX_AVDD0V9 and HDMI_TX_AVDD_1V8 supply inputs needed for the HDMI port. Add the binding for these supplies.

---
 .../bindings/display/rockchip/rockchip,dw-hdmi.yaml   | 11 +++++++++++
 1 file changed, 11 insertions(+)
#24 lore raw

PATCH v4 16/27 dt-bindings: display: rockchip: dw-hdmi: Add additional clock

In reply to Sascha Hauer

The rk3568 HDMI has an additional clock that needs to be enabled for the HDMI controller to work. The purpose of that clock is not clear. It is named "hclk" in the downstream driver, so use the same name.

---
 .../bindings/display/rockchip/rockchip,dw-hdmi.yaml        | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/display/rockchip/rockchip,dw-hdmi.yaml +6 -1
index d7cb2b2be60e..7dd753630b46 100644
@@ -44,12 +44,13 @@ properties:
     items:
       - {}
       - {}
-      # The next three clocks are all optional, but shall be specified in this
+      # The next four clocks are all optional, but shall be specified in this
       # order when present.
       - description: The HDMI CEC controller main clock
       - description: Power for GRF IO
       - description: External clock for some HDMI PHY (old clock name, deprecated)
       - description: External clock for some HDMI PHY (new name)
+      - description: hclk
 
   clock-names:
     minItems: 2
@@ -61,13 +62,17 @@ properties:
           - grf
           - vpll
           - ref
+          - hclk
       - enum:
           - grf
           - vpll
           - ref
+          - hclk
       - enum:
           - vpll
           - ref
+          - hclk
+      - const: hclk
 
   ddc-i2c-bus:
     $ref: /schemas/types.yaml#/definitions/phandle
Signature · 1 line
2.30.2
maintainer Acked-by on v4 16/27
#25 lore raw

Re: [PATCH 16/27] dt-bindings: display: rockchip: dw-hdmi: Add additional clock

Quoted 9 lines · Sascha Hauer

The rk3568 HDMI has an additional clock that needs to be enabled for the HDMI controller to work. The purpose of that clock is not clear. It is named "hclk" in the downstream driver, so use the same name.

---
 .../bindings/display/rockchip/rockchip,dw-hdmi.yaml        | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
#26 lore raw

PATCH v4 17/27 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.

Changes since v3:
- drop redundant _vop suffix from clock names

---
 .../display/rockchip/rockchip-vop2.yaml       | 146 ++++++++++++++++++
 1 file changed, 146 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/rockchip/rockchip-vop2.yaml
Documentation/devicetree/bindings/display/rockchip/rockchip-vop2.yaml new file +146 -0
new file mode 100644
index 000000000000..572cfb307c20
@@ -0,0 +1,146 @@
+# SPDX-License-Identifier: GPL-2.0-only or BSD-2-Clause
+%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,rk3566-vop
+      - rockchip,rk3568-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
+      - const: hclk
+      - const: dclk_vp0
+      - const: dclk_vp1
+      - const: dclk_vp2
+
+  rockchip,grf:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      Phandle to GRF regs used for misc control
+
+  ports:
+    $ref: /schemas/graph.yaml#/properties/ports
+
+    properties:
+      port@0:
+        $ref: /schemas/graph.yaml#/properties/port
+        description:
+          Output endpoint of VP0
+
+      port@1:
+        $ref: /schemas/graph.yaml#/properties/port
+        description:
+          Output endpoint of VP1
+
+      port@2:
+        $ref: /schemas/graph.yaml#/properties/port
+        description:
+          Output endpoint of VP2
+
+  assigned-clocks: true
+
+  assigned-clock-rates: true
+
+  assigned-clock-parents: true
+
+  iommus:
+    maxItems: 1
+
+  power-domains:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - clock-names
+  - ports
+
+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>
+        bus {
+            #address-cells = <2>;
+            #size-cells = <2>;
+            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: ports {
+                    #address-cells = <1>;
+                    #size-cells = <0>;
+                    vp0: port@0 {
+                        reg = <0>;
+                        #address-cells = <1>;
+                        #size-cells = <0>;
+                    };
+                    vp1: port@1 {
+                        reg = <1>;
+                        #address-cells = <1>;
+                        #size-cells = <0>;
+                    };
+                    vp2: port@2 {
+                        reg = <2>;
+                        #address-cells = <1>;
+                        #size-cells = <0>;
+                    };
+                };
+            };
+        };
Signature · 1 line
2.30.2
maintainer
#27 lore raw

Re: [PATCH 17/27] dt-bindings: display: rockchip: Add binding for VOP2

Quoted 4 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.

Quoted 9 lines

Changes since v3:
- drop redundant _vop suffix from clock names

---
 .../display/rockchip/rockchip-vop2.yaml       | 146 ++++++++++++++++++
 1 file changed, 146 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: vop@fe040000: clock-names:0: 'aclk' was expected
From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/display/rockchip/rockchip-vop2.yaml
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/display/rockchip/rockchip-vop2.example.dt.yaml: vop@fe040000: clock-names:1: 'hclk' was expected
From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/display/rockchip/rockchip-vop2.yaml

doc reference errors (make refcheckdocs):

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

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.

maintainer
#28 lore raw

Re: [PATCH 17/27] dt-bindings: display: rockchip: Add binding for VOP2

In reply to Sascha Hauer
Quoted 94 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.

Changes since v3:
- drop redundant _vop suffix from clock names

---
 .../display/rockchip/rockchip-vop2.yaml       | 146 ++++++++++++++++++
 1 file changed, 146 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/rockchip/rockchip-vop2.yaml
Documentation/devicetree/bindings/display/rockchip/rockchip-vop2.yaml new file +75 -0
new file mode 100644
index 000000000000..572cfb307c20
@@ -0,0 +1,146 @@
+# SPDX-License-Identifier: GPL-2.0-only or BSD-2-Clause
+%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,rk3566-vop
+      - rockchip,rk3568-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
+      - const: hclk
+      - const: dclk_vp0
+      - const: dclk_vp1
+      - const: dclk_vp2
+
+  rockchip,grf:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      Phandle to GRF regs used for misc control
+
+  ports:
+    $ref: /schemas/graph.yaml#/properties/ports
+
+    properties:
+      port@0:
+        $ref: /schemas/graph.yaml#/properties/port
+        description:
+          Output endpoint of VP0
+
+      port@1:
+        $ref: /schemas/graph.yaml#/properties/port
+        description:
+          Output endpoint of VP1
+
+      port@2:

Documentation/devicetree/bindings/display/rockchip/rockchip-vop2.yaml line 84

Quoted 10 lines
Documentation/devicetree/bindings/display/rockchip/rockchip-vop2.yaml new file +9 -0
+        $ref: /schemas/graph.yaml#/properties/port
+        description:
+          Output endpoint of VP2
+
 
+  assigned-clocks: true
+
+  assigned-clock-rates: true
+
+  assigned-clock-parents: true

You can drop these. They are implicitly allowed with 'clocks'.

Quoted 66 lines
Documentation/devicetree/bindings/display/rockchip/rockchip-vop2.yaml new file +62 -0
+
+  iommus:
+    maxItems: 1
+
+  power-domains:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - clock-names
+  - ports
+
+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>
+        bus {
+            #address-cells = <2>;
+            #size-cells = <2>;
+            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: ports {
+                    #address-cells = <1>;
+                    #size-cells = <0>;
+                    vp0: port@0 {
+                        reg = <0>;
+                        #address-cells = <1>;
+                        #size-cells = <0>;
+                    };
+                    vp1: port@1 {
+                        reg = <1>;
+                        #address-cells = <1>;
+                        #size-cells = <0>;
+                    };
+                    vp2: port@2 {
+                        reg = <2>;
+                        #address-cells = <1>;
+                        #size-cells = <0>;
+                    };
+                };
+            };
+        };
Signature · 1 line
2.30.2
#29 lore raw

PATCH v4 18/27 arm64: dts: rockchip: rk3399: reorder hmdi clocks

In reply to Sascha Hauer

The binding specifies the clock order to "cec", "grf", "vpll". Reorder the clocks accordingly.

---
 arch/arm64/boot/dts/rockchip/rk3399.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/rockchip/rk3399.dtsi +3 -3
index d3cdf6f42a30..080457a68e3c 100644
@@ -1881,10 +1881,10 @@ hdmi: hdmi@ff940000 {
 		interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH 0>;
 		clocks = <&cru PCLK_HDMI_CTRL>,
 			 <&cru SCLK_HDMI_SFR>,
-			 <&cru PLL_VPLL>,
+			 <&cru SCLK_HDMI_CEC>,
 			 <&cru PCLK_VIO_GRF>,
-			 <&cru SCLK_HDMI_CEC>;
-		clock-names = "iahb", "isfr", "vpll", "grf", "cec";
+			 <&cru PLL_VPLL>;
+		clock-names = "iahb", "isfr", "cec", "grf", "vpll";
 		power-domains = <&power RK3399_PD_HDCP>;
 		reg-io-width = <4>;
 		rockchip,grf = <&grf>;
Signature · 1 line
2.30.2
#30 lore raw

PATCH v4 19/27 arm64: dts: rockchip: rk3399: rename HDMI ref clock to 'ref'

In reply to Sascha Hauer

The reference clock for the HDMI controller has been renamed to 'ref', the previous 'vpll' name is only left for compatibility in the driver. Rename the clock to the new name.

---
 arch/arm64/boot/dts/rockchip/rk3399.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk3399.dtsi +1 -1
index 080457a68e3c..d0add619b0d2 100644
@@ -1884,7 +1884,7 @@ hdmi: hdmi@ff940000 {
 			 <&cru SCLK_HDMI_CEC>,
 			 <&cru PCLK_VIO_GRF>,
 			 <&cru PLL_VPLL>;
-		clock-names = "iahb", "isfr", "cec", "grf", "vpll";
+		clock-names = "iahb", "isfr", "cec", "grf", "ref";
 		power-domains = <&power RK3399_PD_HDCP>;
 		reg-io-width = <4>;
 		rockchip,grf = <&grf>;
Signature · 1 line
2.30.2
#31 lore raw

PATCH v4 20/27 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.

changes since v3:
- Bring back gamma_lut regs
- Drop redundant _vop suffix from clock names

---
 arch/arm64/boot/dts/rockchip/rk3566.dtsi |  4 ++
 arch/arm64/boot/dts/rockchip/rk3568.dtsi |  4 ++
 arch/arm64/boot/dts/rockchip/rk356x.dtsi | 51 ++++++++++++++++++++++++
 include/dt-bindings/soc/rockchip,vop2.h  | 14 +++++++
 4 files changed, 73 insertions(+)
 create mode 100644 include/dt-bindings/soc/rockchip,vop2.h
arch/arm64/boot/dts/rockchip/rk3566.dtsi +4 -0
index 3839eef5e4f7..595fa2562cb8 100644
@@ -18,3 +18,7 @@ power-domain@RK3568_PD_PIPE {
 		#power-domain-cells = <0>;
 	};
 };
+
+&vop {
+	compatible = "rockchip,rk3566-vop";
+};
arch/arm64/boot/dts/rockchip/rk3568.dtsi +4 -0
index 2fd313a295f8..1e55efb6fcfd 100644
@@ -95,3 +95,7 @@ power-domain@RK3568_PD_PIPE {
 		#power-domain-cells = <0>;
 	};
 };
+
+&vop {
+	compatible = "rockchip,rk3568-vop";
+};
arch/arm64/boot/dts/rockchip/rk356x.dtsi +51 -0

69 lines not on this page · raw message

include/dt-bindings/soc/rockchip,vop2.h new file +14 -0
new file mode 100644
index 000000000000..0a87bc90564a
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */
+
+#ifndef __DT_BINDINGS_ROCKCHIP_VOP2_H
+#define __DT_BINDINGS_ROCKCHIP_VOP2_H
+
+#define RK3568_VOP2_EP_RGB	0
+#define RK3568_VOP2_EP_HDMI	1
+#define RK3568_VOP2_EP_EDP	2
+#define RK3568_VOP2_EP_MIPI0	3
+#define RK3568_VOP2_EP_LVDS0	4
+#define RK3568_VOP2_EP_MIPI1	5
+#define RK3568_VOP2_EP_LVDS1	6
+
+#endif /* __DT_BINDINGS_ROCKCHIP_VOP2_H */
Signature · 1 line
2.30.2
maintainer Acked-by on v4 20/27
#32 lore raw

Re: [PATCH 20/27] arm64: dts: rockchip: rk356x: Add VOP2 nodes

Quoted 8 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.

changes since v3:
- Bring back gamma_lut regs
- Drop redundant _vop suffix from clock names

Quoted 9 lines
---
 arch/arm64/boot/dts/rockchip/rk3566.dtsi |  4 ++
 arch/arm64/boot/dts/rockchip/rk3568.dtsi |  4 ++
 arch/arm64/boot/dts/rockchip/rk356x.dtsi | 51 ++++++++++++++++++++++++
 include/dt-bindings/soc/rockchip,vop2.h  | 14 +++++++
 4 files changed, 73 insertions(+)
 create mode 100644 include/dt-bindings/soc/rockchip,vop2.h
#33 lore raw

PATCH v4 21/27 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 | 37 +++++++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk356x.dtsi +36 -1
index 4008bd666d01..e38fb223e9b8 100644
@@ -10,7 +10,6 @@
 #include <dt-bindings/pinctrl/rockchip.h>
 #include <dt-bindings/power/rk3568-power.h>
 #include <dt-bindings/soc/rockchip,boot-mode.h>
-#include <dt-bindings/soc/rockchip,vop2.h>
 #include <dt-bindings/thermal/thermal.h>
 
 / {
@@ -502,6 +501,42 @@ 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>,
+			 <&pmucru CLK_HDMI_REF>,
+			 <&cru HCLK_VOP>;
+		clock-names = "iahb", "isfr", "cec", "ref", "hclk";
+		pinctrl-names = "default";
+		pinctrl-0 = <&hdmitx_scl &hdmitx_sda &hdmitxm0_cec>;
+		power-domains = <&power RK3568_PD_VO>;
+		reg-io-width = <4>;
+		rockchip,grf = <&grf>;
+		#sound-dai-cells = <0>;
+		status = "disabled";
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			hdmi_in: port@0 {
+				reg = <0>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+			};
+
+			hdmi_out: port@1 {
+				reg = <1>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+			};
+		};
+	};
+
 	qos_gpu: qos@fe128000 {
 		compatible = "rockchip,rk3568-qos", "syscon";
 		reg = <0x0 0xfe128000 0x0 0x20>;
Signature · 1 line
2.30.2
#34 lore raw

Re: [PATCH 21/27] arm64: dts: rockchip: rk356x: Add HDMI nodes

Quoted 26 lines · Sascha Hauer

Add support for the HDMI port found on RK3568.

---
 arch/arm64/boot/dts/rockchip/rk356x.dtsi | 37 +++++++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk356x.dtsi +2 -1
index 4008bd666d01..e38fb223e9b8 100644
@@ -10,7 +10,6 @@
 #include <dt-bindings/pinctrl/rockchip.h>
 #include <dt-bindings/power/rk3568-power.h>
 #include <dt-bindings/soc/rockchip,boot-mode.h>
-#include <dt-bindings/soc/rockchip,vop2.h>
 #include <dt-bindings/thermal/thermal.h>
 
 / {
@@ -502,6 +501,42 @@ vop_mmu: iommu@fe043e00 {
                status = "disabled";
        };
 
+       hdmi: hdmi@fe0a0000 {
+               compatible = "rockchip,rk3568-dw-hdmi";

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

Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +10 -0
+               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>,
+                        <&pmucru CLK_HDMI_REF>,
+                        <&cru HCLK_VOP>;
+               clock-names = "iahb", "isfr", "cec", "ref", "hclk";
+               pinctrl-names = "default";
+               pinctrl-0 = <&hdmitx_scl &hdmitx_sda &hdmitxm0_cec>;

I looked into CEC support here, and it seems that it does work with one change. Please add the two following lines to your patch:
assigned-clocks = <&cru CLK_HDMI_CEC>;
assigned-clock-rates = <32768>;

The issue is the clk_rtc32k_frac clock that feeds clk_rtc_32k which feeds clk_hdmi_cec is 24mhz at boot, which is too high for CEC to function.

Quoted 30 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +24 -1
+               power-domains = <&power RK3568_PD_VO>;
+               reg-io-width = <4>;
+               rockchip,grf = <&grf>;
+               #sound-dai-cells = <0>;
+               status = "disabled";
+
+               ports {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       hdmi_in: port@0 {
+                               reg = <0>;
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                       };
+
+                       hdmi_out: port@1 {
+                               reg = <1>;
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                       };
+               };
+       };
+
        qos_gpu: qos@fe128000 {
                compatible = "rockchip,rk3568-qos", "syscon";
                reg = <0x0 0xfe128000 0x0 0x20>;
--

2.30.2

#35 lore raw

Re: [PATCH 21/27] arm64: dts: rockchip: rk356x: Add HDMI nodes

Quoted 43 lines · Peter Geis
Quoted 26 lines · Sascha Hauer

Add support for the HDMI port found on RK3568.

---
  arch/arm64/boot/dts/rockchip/rk356x.dtsi | 37 +++++++++++++++++++++++-
  1 file changed, 36 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk356x.dtsi +2 -1
index 4008bd666d01..e38fb223e9b8 100644
@@ -10,7 +10,6 @@
  #include <dt-bindings/pinctrl/rockchip.h>
  #include <dt-bindings/power/rk3568-power.h>
  #include <dt-bindings/soc/rockchip,boot-mode.h>
-#include <dt-bindings/soc/rockchip,vop2.h>
  #include <dt-bindings/thermal/thermal.h>
 
  / {
@@ -502,6 +501,42 @@ vop_mmu: iommu@fe043e00 {
                 status = "disabled";
         };
 
+       hdmi: hdmi@fe0a0000 {
+               compatible = "rockchip,rk3568-dw-hdmi";

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

Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +10 -0
+               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>,
+                        <&pmucru CLK_HDMI_REF>,
+                        <&cru HCLK_VOP>;
+               clock-names = "iahb", "isfr", "cec", "ref", "hclk";
+               pinctrl-names = "default";
+               pinctrl-0 = <&hdmitx_scl &hdmitx_sda &hdmitxm0_cec>;

I looked into CEC support here, and it seems that it does work with one change. Please add the two following lines to your patch:
assigned-clocks = <&cru CLK_HDMI_CEC>;
assigned-clock-rates = <32768>;

Quoted 3 lines

The issue is the clk_rtc32k_frac clock that feeds clk_rtc_32k which feeds clk_hdmi_cec is 24mhz at boot, which is too high for CEC to function.

Wouldn't it make far more sense to just stick a suitable clk_set_rate() call in the driver? AFAICS it's already explicitly aware of the CEC clock.

Robin.

Quoted 35 lines
Quoted 28 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +24 -1
+               power-domains = <&power RK3568_PD_VO>;
+               reg-io-width = <4>;
+               rockchip,grf = <&grf>;
+               #sound-dai-cells = <0>;
+               status = "disabled";
+
+               ports {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       hdmi_in: port@0 {
+                               reg = <0>;
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                       };
+
+                       hdmi_out: port@1 {
+                               reg = <1>;
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                       };
+               };
+       };
+
         qos_gpu: qos@fe128000 {
                 compatible = "rockchip,rk3568-qos", "syscon";
                 reg = <0x0 0xfe128000 0x0 0x20>;
--
Quoted 2 lines

2.30.2

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

#36 lore raw

Re: [PATCH 21/27] arm64: dts: rockchip: rk356x: Add HDMI nodes

Quoted 45 lines · Robin Murphy
Quoted 43 lines · Peter Geis
Quoted 26 lines · Sascha Hauer

Add support for the HDMI port found on RK3568.

---
  arch/arm64/boot/dts/rockchip/rk356x.dtsi | 37 +++++++++++++++++++++++-
  1 file changed, 36 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk356x.dtsi +2 -1
index 4008bd666d01..e38fb223e9b8 100644
@@ -10,7 +10,6 @@
  #include <dt-bindings/pinctrl/rockchip.h>
  #include <dt-bindings/power/rk3568-power.h>
  #include <dt-bindings/soc/rockchip,boot-mode.h>
-#include <dt-bindings/soc/rockchip,vop2.h>
  #include <dt-bindings/thermal/thermal.h>
 
  / {
@@ -502,6 +501,42 @@ vop_mmu: iommu@fe043e00 {
                 status = "disabled";
         };
 
+       hdmi: hdmi@fe0a0000 {
+               compatible = "rockchip,rk3568-dw-hdmi";

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

Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +10 -0
+               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>,
+                        <&pmucru CLK_HDMI_REF>,
+                        <&cru HCLK_VOP>;
+               clock-names = "iahb", "isfr", "cec", "ref", "hclk";
+               pinctrl-names = "default";
+               pinctrl-0 = <&hdmitx_scl &hdmitx_sda &hdmitxm0_cec>;

I looked into CEC support here, and it seems that it does work with one change. Please add the two following lines to your patch:
assigned-clocks = <&cru CLK_HDMI_CEC>;
assigned-clock-rates = <32768>;

Quoted 6 lines
Quoted 3 lines

The issue is the clk_rtc32k_frac clock that feeds clk_rtc_32k which feeds clk_hdmi_cec is 24mhz at boot, which is too high for CEC to function.

Wouldn't it make far more sense to just stick a suitable clk_set_rate() call in the driver? AFAICS it's already explicitly aware of the CEC clock.

This is handled purely in the drivers/gpu/drm/bridge/synopsys/dw-hdmi.c driver, so I'm hesitant to touch it there as it would affect all users, not just Rockchip.

Could someone familiar with the dw-hdmi IP weigh in on the minimum and maximum clock rate the CEC block can handle?

Quoted 38 lines

Robin.

Quoted 35 lines
Quoted 28 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +24 -1
+               power-domains = <&power RK3568_PD_VO>;
+               reg-io-width = <4>;
+               rockchip,grf = <&grf>;
+               #sound-dai-cells = <0>;
+               status = "disabled";
+
+               ports {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       hdmi_in: port@0 {
+                               reg = <0>;
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                       };
+
+                       hdmi_out: port@1 {
+                               reg = <1>;
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                       };
+               };
+       };
+
         qos_gpu: qos@fe128000 {
                 compatible = "rockchip,rk3568-qos", "syscon";
                 reg = <0x0 0xfe128000 0x0 0x20>;
--
Quoted 2 lines

2.30.2

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

#37 lore raw

Re: [PATCH 21/27] arm64: dts: rockchip: rk356x: Add HDMI nodes

Quoted 50 lines · Peter Geis
Quoted 49 lines · Robin Murphy
Quoted 46 lines · Peter Geis
Quoted 26 lines · Sascha Hauer

Add support for the HDMI port found on RK3568.

---
   arch/arm64/boot/dts/rockchip/rk356x.dtsi | 37 +++++++++++++++++++++++-
   1 file changed, 36 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk356x.dtsi +2 -1
index 4008bd666d01..e38fb223e9b8 100644
@@ -10,7 +10,6 @@
   #include <dt-bindings/pinctrl/rockchip.h>
   #include <dt-bindings/power/rk3568-power.h>
   #include <dt-bindings/soc/rockchip,boot-mode.h>
-#include <dt-bindings/soc/rockchip,vop2.h>
   #include <dt-bindings/thermal/thermal.h>
 
   / {
@@ -502,6 +501,42 @@ vop_mmu: iommu@fe043e00 {
                  status = "disabled";
          };
 
+       hdmi: hdmi@fe0a0000 {
+               compatible = "rockchip,rk3568-dw-hdmi";

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

Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +10 -0
+               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>,
+                        <&pmucru CLK_HDMI_REF>,
+                        <&cru HCLK_VOP>;
+               clock-names = "iahb", "isfr", "cec", "ref", "hclk";
+               pinctrl-names = "default";
+               pinctrl-0 = <&hdmitx_scl &hdmitx_sda &hdmitxm0_cec>;

I looked into CEC support here, and it seems that it does work with one change. Please add the two following lines to your patch:
assigned-clocks = <&cru CLK_HDMI_CEC>;
assigned-clock-rates = <32768>;

The issue is the clk_rtc32k_frac clock that feeds clk_rtc_32k which feeds clk_hdmi_cec is 24mhz at boot, which is too high for CEC to function.

Quoted 6 lines
Quoted 2 lines

Wouldn't it make far more sense to just stick a suitable clk_set_rate() call in the driver? AFAICS it's already explicitly aware of the CEC clock.

This is handled purely in the drivers/gpu/drm/bridge/synopsys/dw-hdmi.c driver, so I'm hesitant to touch it there as it would affect all users, not just Rockchip.

I'd have a strong hunch that it's a standard thing for the DesignWare IP and not affected by platform integration. I don't have the magical Synopsys databook, but between the trusty old i.MX6 manual and most of the other in-tree DTs getting their dw-hdmi "cec" clock from suspiciously-obviously-named sources, I'd be somewhat surprised if it was ever anything other than 32KHz.

Robin.

Quoted 41 lines

Could someone familiar with the dw-hdmi IP weigh in on the minimum and maximum clock rate the CEC block can handle?

Quoted 38 lines

Robin.

Quoted 35 lines
Quoted 28 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +24 -1
+               power-domains = <&power RK3568_PD_VO>;
+               reg-io-width = <4>;
+               rockchip,grf = <&grf>;
+               #sound-dai-cells = <0>;
+               status = "disabled";
+
+               ports {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       hdmi_in: port@0 {
+                               reg = <0>;
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                       };
+
+                       hdmi_out: port@1 {
+                               reg = <1>;
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                       };
+               };
+       };
+
          qos_gpu: qos@fe128000 {
                  compatible = "rockchip,rk3568-qos", "syscon";
                  reg = <0x0 0xfe128000 0x0 0x20>;
--
Quoted 2 lines

2.30.2

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

#38 lore raw

Re: [PATCH 21/27] arm64: dts: rockchip: rk356x: Add HDMI nodes

Quoted 59 lines · Robin Murphy
Quoted 50 lines · Peter Geis
Quoted 49 lines · Robin Murphy
Quoted 46 lines · Peter Geis
Quoted 26 lines · Sascha Hauer

Add support for the HDMI port found on RK3568.

---
   arch/arm64/boot/dts/rockchip/rk356x.dtsi | 37 +++++++++++++++++++++++-
   1 file changed, 36 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk356x.dtsi +2 -1
index 4008bd666d01..e38fb223e9b8 100644
@@ -10,7 +10,6 @@
   #include <dt-bindings/pinctrl/rockchip.h>
   #include <dt-bindings/power/rk3568-power.h>
   #include <dt-bindings/soc/rockchip,boot-mode.h>
-#include <dt-bindings/soc/rockchip,vop2.h>
   #include <dt-bindings/thermal/thermal.h>
 
   / {
@@ -502,6 +501,42 @@ vop_mmu: iommu@fe043e00 {
                  status = "disabled";
          };
 
+       hdmi: hdmi@fe0a0000 {
+               compatible = "rockchip,rk3568-dw-hdmi";

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

Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +10 -0
+               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>,
+                        <&pmucru CLK_HDMI_REF>,
+                        <&cru HCLK_VOP>;
+               clock-names = "iahb", "isfr", "cec", "ref", "hclk";
+               pinctrl-names = "default";
+               pinctrl-0 = <&hdmitx_scl &hdmitx_sda &hdmitxm0_cec>;

I looked into CEC support here, and it seems that it does work with one change. Please add the two following lines to your patch:
assigned-clocks = <&cru CLK_HDMI_CEC>;
assigned-clock-rates = <32768>;

The issue is the clk_rtc32k_frac clock that feeds clk_rtc_32k which feeds clk_hdmi_cec is 24mhz at boot, which is too high for CEC to function.

Quoted 6 lines
Quoted 2 lines

Wouldn't it make far more sense to just stick a suitable clk_set_rate() call in the driver? AFAICS it's already explicitly aware of the CEC clock.

This is handled purely in the drivers/gpu/drm/bridge/synopsys/dw-hdmi.c driver, so I'm hesitant to touch it there as it would affect all users, not just Rockchip.

Quoted 6 lines

I'd have a strong hunch that it's a standard thing for the DesignWare IP and not affected by platform integration. I don't have the magical Synopsys databook, but between the trusty old i.MX6 manual and most of the other in-tree DTs getting their dw-hdmi "cec" clock from suspiciously-obviously-named sources, I'd be somewhat surprised if it was ever anything other than 32KHz.

My main concern was similar to the other HDMI clock issues, mainly setting the clock can propagate up and affect other users of the upstream clock.
I'll spin up a quick patch for this method.

Thanks,
Peter

Quoted 44 lines

Robin.

Quoted 41 lines

Could someone familiar with the dw-hdmi IP weigh in on the minimum and maximum clock rate the CEC block can handle?

Quoted 38 lines

Robin.

Quoted 35 lines
Quoted 28 lines
arch/arm64/boot/dts/rockchip/rk356x.dtsi +24 -1
+               power-domains = <&power RK3568_PD_VO>;
+               reg-io-width = <4>;
+               rockchip,grf = <&grf>;
+               #sound-dai-cells = <0>;
+               status = "disabled";
+
+               ports {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       hdmi_in: port@0 {
+                               reg = <0>;
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                       };
+
+                       hdmi_out: port@1 {
+                               reg = <1>;
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                       };
+               };
+       };
+
          qos_gpu: qos@fe128000 {
                  compatible = "rockchip,rk3568-qos", "syscon";
                  reg = <0x0 0xfe128000 0x0 0x20>;
--
Quoted 2 lines

2.30.2

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

#39 lore raw

PATCH v4 22/27 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.

Changes since v3:
- Fix HDMI connector type

---
 .../boot/dts/rockchip/rk3568-evb1-v10.dts     | 48 +++++++++++++++++++
 1 file changed, 48 insertions(+)
arch/arm64/boot/dts/rockchip/rk3568-evb1-v10.dts +48 -0
index 184e2aa2416a..9a669240e49a 100644
@@ -7,6 +7,7 @@
 /dts-v1/;
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/pinctrl/rockchip.h>
+#include <dt-bindings/soc/rockchip,vop2.h>
 #include "rk3568.dtsi"
 
 / {
@@ -33,6 +34,17 @@ dc_12v: dc-12v {
 		regulator-max-microvolt = <12000000>;
 	};
 
+	hdmi-con {
+		compatible = "hdmi-connector";
+		type = "a";
+
+		port {
+			hdmi_con_in: endpoint {
+				remote-endpoint = <&hdmi_out_con>;
+			};
+		};
+	};
+
 	vcc3v3_sys: vcc3v3-sys {
 		compatible = "regulator-fixed";
 		regulator-name = "vcc3v3_sys";
@@ -106,6 +118,12 @@ &gmac1m1_rgmii_clk
 	status = "okay";
 };
 
+&hdmi {
+	avdd-0v9-supply = <&vdda0v9_image>;
+	avdd-1v8-supply = <&vcca1v8_image>;
+	status = "okay";
+};
+
 &i2c0 {
 	status = "okay";
 
@@ -390,3 +408,33 @@ &sdmmc0 {
 &uart2 {
 	status = "okay";
 };
+
+&vop {
+	assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>;
+	assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>;
+	status = "okay";
+};
+
+&vop_mmu {
+	status = "okay";
+};
+
+&hdmi_in {
+	hdmi_in_vp0: endpoint@0 {
+		reg = <0>;
+		remote-endpoint = <&vp0_out_hdmi>;
+	};
+};
+
+&hdmi_out {
+	hdmi_out_con: endpoint {
+		remote-endpoint = <&hdmi_con_in>;
+	};
+};
+
+&vp0 {
+	vp0_out_hdmi: endpoint@RK3568_VOP2_EP_HDMI {
+		reg = <RK3568_VOP2_EP_HDMI>;
+		remote-endpoint = <&hdmi_in_vp0>;
+	};
+};
Signature · 1 line
2.30.2
#40 lore raw

PATCH v4 23/27 arm64: dts: rockchip: enable vop2 and hdmi tx on quartz64a

In reply to Sascha Hauer

From: Michael Riesch <[email protected]>

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

Changes since v3:
- Fix HDMI connector type

---
 .../boot/dts/rockchip/rk3566-quartz64-a.dts   | 48 +++++++++++++++++++
 1 file changed, 48 insertions(+)
arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts +48 -0
index 166399b7f13f..64de5b15f572 100644
@@ -4,6 +4,7 @@
 
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/pinctrl/rockchip.h>
+#include <dt-bindings/soc/rockchip,vop2.h>
 #include "rk3566.dtsi"
 
 / {
@@ -35,6 +36,17 @@ fan: gpio_fan {
 		#cooling-cells = <2>;
 	};
 
+	hdmi-con {
+		compatible = "hdmi-connector";
+		type = "a";
+
+		port {
+			hdmi_con_in: endpoint {
+				remote-endpoint = <&hdmi_out_con>;
+			};
+		};
+	};
+
 	leds {
 		compatible = "gpio-leds";
 
@@ -205,6 +217,18 @@ &gmac1m0_clkinout
 	status = "okay";
 };
 
+&hdmi {
+	avdd-0v9-supply = <&vdda_0v9>;
+	avdd-1v8-supply = <&vcc_1v8>;
+	status = "okay";
+};
+
+&hdmi_out {
+	hdmi_out_con: endpoint {
+		remote-endpoint = <&hdmi_con_in>;
+	};
+};
+
 &i2c0 {
 	status = "okay";
 
@@ -551,3 +575,27 @@ bluetooth {
 &uart2 {
 	status = "okay";
 };
+
+&vop {
+	assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>;
+	assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>;
+	status = "okay";
+};
+
+&vop_mmu {
+	status = "okay";
+};
+
+&hdmi_in {
+	hdmi_in_vp0: endpoint@0 {
+		reg = <0>;
+		remote-endpoint = <&vp0_out_hdmi>;
+	};
+};
+
+&vp0 {
+	vp0_out_hdmi: endpoint@RK3568_VOP2_EP_HDMI {
+		reg = <RK3568_VOP2_EP_HDMI>;
+		remote-endpoint = <&hdmi_in_vp0>;
+	};
+};
Signature · 1 line
2.30.2
#41 lore raw

PATCH v4 24/27 clk: rk3568: drop CLK_SET_RATE_PARENT from dclk_vop*

In reply to Sascha Hauer

The pixel clocks dclk_vop[012] can be clocked from hpll, vpll, gpll or cpll. gpll and cpll also drive many other clocks, so changing the dclk_vop[012] clocks could change these other clocks as well. Drop CLK_SET_RATE_PARENT to fix that. With this change the VOP2 driver can only adjust the pixel clocks with the divider between the PLL and the dclk_vop[012] which means the user may have to adjust the PLL clock to a suitable rate using the assigned-clock-rate device tree property.

---
 drivers/clk/rockchip/clk-rk3568.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/clk/rockchip/clk-rk3568.c +3 -3
index 9d889fc46811..7687c62d1fa8 100644
@@ -1044,13 +1044,13 @@ static struct rockchip_clk_branch rk3568_clk_branches[] __initdata = {
 			RK3568_CLKGATE_CON(20), 8, GFLAGS),
 	GATE(HCLK_VOP, "hclk_vop", "hclk_vo", 0,
 			RK3568_CLKGATE_CON(20), 9, GFLAGS),
-	COMPOSITE(DCLK_VOP0, "dclk_vop0", hpll_vpll_gpll_cpll_p, CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
+	COMPOSITE(DCLK_VOP0, "dclk_vop0", hpll_vpll_gpll_cpll_p, CLK_SET_RATE_NO_REPARENT,
 			RK3568_CLKSEL_CON(39), 10, 2, MFLAGS, 0, 8, DFLAGS,
 			RK3568_CLKGATE_CON(20), 10, GFLAGS),
-	COMPOSITE(DCLK_VOP1, "dclk_vop1", hpll_vpll_gpll_cpll_p, CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
+	COMPOSITE(DCLK_VOP1, "dclk_vop1", hpll_vpll_gpll_cpll_p, CLK_SET_RATE_NO_REPARENT,
 			RK3568_CLKSEL_CON(40), 10, 2, MFLAGS, 0, 8, DFLAGS,
 			RK3568_CLKGATE_CON(20), 11, GFLAGS),
-	COMPOSITE(DCLK_VOP2, "dclk_vop2", hpll_vpll_gpll_cpll_p, 0,
+	COMPOSITE(DCLK_VOP2, "dclk_vop2", hpll_vpll_gpll_cpll_p, CLK_SET_RATE_NO_REPARENT,
 			RK3568_CLKSEL_CON(41), 10, 2, MFLAGS, 0, 8, DFLAGS,
 			RK3568_CLKGATE_CON(20), 12, GFLAGS),
 	GATE(CLK_VOP_PWM, "clk_vop_pwm", "xin24m", 0,
Signature · 1 line
2.30.2
maintainer
#42 lore raw

Re: [PATCH 24/27] clk: rk3568: drop CLK_SET_RATE_PARENT from dclk_vop*

Am Mittwoch, 26. Januar 2022, 15:55:46 CET schrieb Sascha Hauer:

Quoted 18 lines

The pixel clocks dclk_vop[012] can be clocked from hpll, vpll, gpll or cpll. gpll and cpll also drive many other clocks, so changing the dclk_vop[012] clocks could change these other clocks as well. Drop CLK_SET_RATE_PARENT to fix that. With this change the VOP2 driver can only adjust the pixel clocks with the divider between the PLL and the dclk_vop[012] which means the user may have to adjust the PLL clock to a suitable rate using the assigned-clock-rate device tree property.

---
 drivers/clk/rockchip/clk-rk3568.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/clk/rockchip/clk-rk3568.c +0 -0
index 9d889fc46811..7687c62d1fa8 100644

drivers/clk/rockchip/clk-rk3568.c static struct rockchip_clk_branch rk3568_clk_branches[] __initdata = { · line 1047

Quoted 5 lines
drivers/clk/rockchip/clk-rk3568.c +1 -1
@@ -1044,13 +1044,13 @@ static struct rockchip_clk_branch rk3568_clk_branches[] __initdata = {
 			RK3568_CLKGATE_CON(20), 8, GFLAGS),
 	GATE(HCLK_VOP, "hclk_vop", "hclk_vo", 0,
 			RK3568_CLKGATE_CON(20), 9, GFLAGS),
-	COMPOSITE(DCLK_VOP0, "dclk_vop0", hpll_vpll_gpll_cpll_p, CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
+	COMPOSITE(DCLK_VOP0, "dclk_vop0", hpll_vpll_gpll_cpll_p, CLK_SET_RATE_NO_REPARENT,

hmm, I'm wondering about the use of having CLK_SET_RATE_NO_REPARENT here (and even adding it below).

Using SET_RATE_PARENT in the following patch for the hdmi-pll, should give us at least a suitable rate for the hdmi output, so the vop using that should already find a nice rate to use.

The normal system-PLLs don't normally don't change their rate at runtime, so I think we should liberate the dclks to select a PLL that best matches their target rate - so drop the CLK_SET_RATE_NO_REPARENT as well.

That way the DCLKs can change to another PLL source if that provides a rate nearer to their target.

Heiko

Quoted 12 lines
drivers/clk/rockchip/clk-rk3568.c +2 -2
 			RK3568_CLKSEL_CON(39), 10, 2, MFLAGS, 0, 8, DFLAGS,
 			RK3568_CLKGATE_CON(20), 10, GFLAGS),
-	COMPOSITE(DCLK_VOP1, "dclk_vop1", hpll_vpll_gpll_cpll_p, CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
+	COMPOSITE(DCLK_VOP1, "dclk_vop1", hpll_vpll_gpll_cpll_p, CLK_SET_RATE_NO_REPARENT,
 			RK3568_CLKSEL_CON(40), 10, 2, MFLAGS, 0, 8, DFLAGS,
 			RK3568_CLKGATE_CON(20), 11, GFLAGS),
-	COMPOSITE(DCLK_VOP2, "dclk_vop2", hpll_vpll_gpll_cpll_p, 0,
+	COMPOSITE(DCLK_VOP2, "dclk_vop2", hpll_vpll_gpll_cpll_p, CLK_SET_RATE_NO_REPARENT,
 			RK3568_CLKSEL_CON(41), 10, 2, MFLAGS, 0, 8, DFLAGS,
 			RK3568_CLKGATE_CON(20), 12, GFLAGS),
 	GATE(CLK_VOP_PWM, "clk_vop_pwm", "xin24m", 0,
#43 lore raw

Re: [PATCH 24/27] clk: rk3568: drop CLK_SET_RATE_PARENT from dclk_vop*

Quoted 32 lines · Heiko Stübner

Am Mittwoch, 26. Januar 2022, 15:55:46 CET schrieb Sascha Hauer:

Quoted 18 lines

The pixel clocks dclk_vop[012] can be clocked from hpll, vpll, gpll or cpll. gpll and cpll also drive many other clocks, so changing the dclk_vop[012] clocks could change these other clocks as well. Drop CLK_SET_RATE_PARENT to fix that. With this change the VOP2 driver can only adjust the pixel clocks with the divider between the PLL and the dclk_vop[012] which means the user may have to adjust the PLL clock to a suitable rate using the assigned-clock-rate device tree property.

---
 drivers/clk/rockchip/clk-rk3568.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/clk/rockchip/clk-rk3568.c +0 -0
index 9d889fc46811..7687c62d1fa8 100644

drivers/clk/rockchip/clk-rk3568.c static struct rockchip_clk_branch rk3568_clk_branches[] __initdata = { · line 1047

Quoted 5 lines
drivers/clk/rockchip/clk-rk3568.c +1 -1
@@ -1044,13 +1044,13 @@ static struct rockchip_clk_branch rk3568_clk_branches[] __initdata = {
 			RK3568_CLKGATE_CON(20), 8, GFLAGS),
 	GATE(HCLK_VOP, "hclk_vop", "hclk_vo", 0,
 			RK3568_CLKGATE_CON(20), 9, GFLAGS),
-	COMPOSITE(DCLK_VOP0, "dclk_vop0", hpll_vpll_gpll_cpll_p, CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
+	COMPOSITE(DCLK_VOP0, "dclk_vop0", hpll_vpll_gpll_cpll_p, CLK_SET_RATE_NO_REPARENT,

hmm, I'm wondering about the use of having CLK_SET_RATE_NO_REPARENT here (and even adding it below).

Using SET_RATE_PARENT in the following patch for the hdmi-pll, should give us at least a suitable rate for the hdmi output, so the vop using that should already find a nice rate to use.

Quoted 6 lines

The normal system-PLLs don't normally don't change their rate at runtime, so I think we should liberate the dclks to select a PLL that best matches their target rate - so drop the CLK_SET_RATE_NO_REPARENT as well.

That way the DCLKs can change to another PLL source if that provides a rate nearer to their target.

The HDMI reference clock has the CLK_SET_RATE_PARENT flag set and we need that to program the HPLL clock to suitable rates for the HDMI output. Now any other display choosing HPLL as parent, because that provides the best rate in that point of time, hangs on a PLL which changes its rate whenever the resolution is changed on the HDMI output.

Changing parents on rate changes only works when all possible parents of all the children involved have a constant rate. IMO allowing reparenting on rate changes is a poorly chosen default because it's very unsafe. We should rather have a CLK_SET_RATE_ALLOW_REPARENT flag.

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
#44 lore raw

Re: [PATCH 24/27] clk: rk3568: drop CLK_SET_RATE_PARENT from dclk_vop*

Am Montag, 31. Januar 2022, 09:10:42 CET schrieb Sascha Hauer:

Quoted 37 lines · Heiko Stübner
Quoted 36 lines

Am Mittwoch, 26. Januar 2022, 15:55:46 CET schrieb Sascha Hauer:

Quoted 18 lines

The pixel clocks dclk_vop[012] can be clocked from hpll, vpll, gpll or cpll. gpll and cpll also drive many other clocks, so changing the dclk_vop[012] clocks could change these other clocks as well. Drop CLK_SET_RATE_PARENT to fix that. With this change the VOP2 driver can only adjust the pixel clocks with the divider between the PLL and the dclk_vop[012] which means the user may have to adjust the PLL clock to a suitable rate using the assigned-clock-rate device tree property.

---
 drivers/clk/rockchip/clk-rk3568.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/clk/rockchip/clk-rk3568.c +0 -0
index 9d889fc46811..7687c62d1fa8 100644

drivers/clk/rockchip/clk-rk3568.c static struct rockchip_clk_branch rk3568_clk_branches[] __initdata = { · line 1047

Quoted 5 lines
drivers/clk/rockchip/clk-rk3568.c +1 -1
@@ -1044,13 +1044,13 @@ static struct rockchip_clk_branch rk3568_clk_branches[] __initdata = {
 			RK3568_CLKGATE_CON(20), 8, GFLAGS),
 	GATE(HCLK_VOP, "hclk_vop", "hclk_vo", 0,
 			RK3568_CLKGATE_CON(20), 9, GFLAGS),
-	COMPOSITE(DCLK_VOP0, "dclk_vop0", hpll_vpll_gpll_cpll_p, CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT,
+	COMPOSITE(DCLK_VOP0, "dclk_vop0", hpll_vpll_gpll_cpll_p, CLK_SET_RATE_NO_REPARENT,

hmm, I'm wondering about the use of having CLK_SET_RATE_NO_REPARENT here (and even adding it below).

Using SET_RATE_PARENT in the following patch for the hdmi-pll, should give us at least a suitable rate for the hdmi output, so the vop using that should already find a nice rate to use.

The normal system-PLLs don't normally don't change their rate at runtime, so I think we should liberate the dclks to select a PLL that best matches their target rate - so drop the CLK_SET_RATE_NO_REPARENT as well.

Quoted 8 lines
Quoted 2 lines

That way the DCLKs can change to another PLL source if that provides a rate nearer to their target.

The HDMI reference clock has the CLK_SET_RATE_PARENT flag set and we need that to program the HPLL clock to suitable rates for the HDMI output. Now any other display choosing HPLL as parent, because that provides the best rate in that point of time, hangs on a PLL which changes its rate whenever the resolution is changed on the HDMI output.

Ah, right ... the hpll is in the parent list, that changes things as you said. I somehow only noticed the regular PLLs that normally have a constant rate. So never mind ;-)

Heiko

Quoted 8 lines

Changing parents on rate changes only works when all possible parents of all the children involved have a constant rate. IMO allowing reparenting on rate changes is a poorly chosen default because it's very unsafe. We should rather have a CLK_SET_RATE_ALLOW_REPARENT flag.

Sascha

#45 lore raw

PATCH v4 25/27 clk: rk3568: Add CLK_SET_RATE_PARENT to the HDMI reference clock

In reply to Sascha Hauer

On the rk3568 we have this (simplified) situation:

 .--------.     .-----.    .---------.
-| hpll   |--.--| /n  |----|dclk_vop0|-
 `--------´  |  `-----´    `---------´
             |  .-----.    .---------.
             `--| /m  |----|dclk_vop1|-
             |  `-----´    `---------´
             |             .---------.
             `-------------|hdmi_ref |-
                           `---------´

For the HDMI to work the HDMI reference clock needs to be the same as the pixel clock which means the dividers have be set to one. The last patch removed the CLK_SET_RATE_PARENT flag from the pixel clocks which means the hpll is not changed on pixel clock changes. In order to allow the HDMI controller to set a suitable PLL rate we now add the CLK_SET_RATE_PARENT flag to the HDMI reference clock. With this the flow becomes:

1) HDMI controller driver sets the rate to its pixel clock which means hpll is set to the pixel clock
2) VOP2 driver sets dclk_vop[012] to the pixel clock. As this can't change the hpll clock anymore this means only the divider is adjusted to the desired value of dividing by one.

---
 drivers/clk/rockchip/clk-rk3568.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/rockchip/clk-rk3568.c +1 -1
index 7687c62d1fa8..63dfbeeeb06d 100644
@@ -1568,7 +1568,7 @@ static struct rockchip_clk_branch rk3568_clk_pmu_branches[] __initdata = {
 			RK3568_PMU_CLKGATE_CON(2), 14, GFLAGS),
 	GATE(XIN_OSC0_EDPPHY_G, "xin_osc0_edpphy_g", "xin24m", 0,
 			RK3568_PMU_CLKGATE_CON(2), 15, GFLAGS),
-	MUX(CLK_HDMI_REF, "clk_hdmi_ref", clk_hdmi_ref_p, 0,
+	MUX(CLK_HDMI_REF, "clk_hdmi_ref", clk_hdmi_ref_p, CLK_SET_RATE_PARENT,
 			RK3568_PMU_CLKSEL_CON(8), 7, 1, MFLAGS),
 };
 
Signature · 1 line
2.30.2
#46 lore raw

PATCH v4 26/27 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.

---
 drivers/gpu/drm/rockchip/Kconfig            | 8 ++++++++
 drivers/gpu/drm/rockchip/Makefile           | 3 ++-
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 2 +-
 3 files changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/rockchip/Kconfig +8 -0
index 9f1ecefc3933..b9b156308460 100644
@@ -21,8 +21,16 @@ config DRM_ROCKCHIP
 
 if DRM_ROCKCHIP
 
+config ROCKCHIP_VOP
+	bool "Rockchip VOP driver"
+	default y
+	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 1a56f696558c..dfc5512fdb9f 100644
@@ -4,8 +4,9 @@
 # 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_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 bec207de4544..82c8faf1fb6b 100644
@@ -458,7 +458,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
#47 lore raw

PATCH v4 27/27 drm: rockchip: Add VOP2 driver

In reply to Sascha Hauer

From: Andy Yan <[email protected]>

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
- Drop all waiting for framesyncs

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 on the cluster windows is tested with weston-simple-dmabuf-egl on weston using the (yet to be upstreamed) panfrost driver support.

Changes since v3:
- Sort includes
- fix typos
- Drop spinlock
- Use regmap_set_bits()/regmap_clear_bits()
- simplify vop2_scale_factor()
- simplify vop2_afbc_transform_offset()

---
 drivers/gpu/drm/rockchip/Kconfig             |    6 +
 drivers/gpu/drm/rockchip/Makefile            |    1 +
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c  |    1 +
 drivers/gpu/drm/rockchip/rockchip_drm_drv.h  |    7 +-
 drivers/gpu/drm/rockchip/rockchip_drm_fb.c   |    2 +
 drivers/gpu/drm/rockchip/rockchip_drm_vop.h  |   15 +
 drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 2665 ++++++++++++++++++
 drivers/gpu/drm/rockchip/rockchip_drm_vop2.h |  480 ++++
 drivers/gpu/drm/rockchip/rockchip_vop2_reg.c |  285 ++
 9 files changed, 3461 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_vop2.h
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_vop2_reg.c
drivers/gpu/drm/rockchip/Kconfig +6 -0
index b9b156308460..4ff0043f0ee7 100644
@@ -28,6 +28,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 dfc5512fdb9f..3ff7b21c0414 100644
@@ -6,6 +6,7 @@
 rockchipdrm-y := rockchip_drm_drv.o rockchip_drm_fb.o \
 		rockchip_drm_gem.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/rockchip_drm_drv.c +1 -0
index 82c8faf1fb6b..95f6c5985fdd 100644
@@ -459,6 +459,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 +6 -1
index 143a48330f84..6e1f97e1e4a6 100644
@@ -18,7 +18,7 @@
 
 #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;
@@ -31,6 +31,9 @@ struct rockchip_crtc_state {
 	int output_bpc;
 	int output_flags;
 	bool enable_afbc;
+	uint32_t bus_format;
+	u32 bus_flags;
+	int color_space;
 };
 #define to_rockchip_crtc_state(s) \
 		container_of(s, struct rockchip_crtc_state, base)
@@ -63,4 +66,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_fb.c +2 -0
index 3aa37e177667..0d2cb4f3922b 100644
@@ -134,4 +134,6 @@ void rockchip_drm_mode_config_init(struct drm_device *dev)
 
 	dev->mode_config.funcs = &rockchip_drm_mode_config_funcs;
 	dev->mode_config.helper_private = &rockchip_mode_config_helpers;
+
+	dev->mode_config.normalize_zpos = true;
 }
drivers/gpu/drm/rockchip/rockchip_drm_vop.h +15 -0
index 857d97cdc67c..1e364d7b50e6 100644
@@ -54,9 +54,23 @@ struct vop_afbc {
 	struct vop_reg enable;
 	struct vop_reg win_sel;
 	struct vop_reg format;
+	struct vop_reg rb_swap;
+	struct vop_reg uv_swap;
+	struct vop_reg auto_gating_en;
+	struct vop_reg block_split_en;
+	struct vop_reg pic_vir_width;
+	struct vop_reg tile_num;
 	struct vop_reg hreg_block_split;
+	struct vop_reg pic_offset;
 	struct vop_reg pic_size;
+	struct vop_reg dsp_offset;
+	struct vop_reg transform_offset;
 	struct vop_reg hdr_ptr;
+	struct vop_reg half_block_en;
+	struct vop_reg xmirror;
+	struct vop_reg ymirror;
+	struct vop_reg rotate_270;
+	struct vop_reg rotate_90;
 	struct vop_reg rstn;
 };
 
@@ -410,4 +424,5 @@ static inline int scl_vop_cal_lb_mode(int width, bool is_yuv)
 }
 
 extern const struct component_ops vop_component_ops;
+
 #endif /* _ROCKCHIP_DRM_VOP_H */
drivers/gpu/drm/rockchip/rockchip_drm_vop2.c new file +2665 -0

2,665 lines not on this page · raw message

drivers/gpu/drm/rockchip/rockchip_drm_vop2.h new file +480 -0

252 lines not on this page · raw message

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

285 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.

#49 lore raw

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

In reply to Sascha Hauer

Sascha,

FYI
small report regarding 4k modes support in v4:

-on rk3399 it gives me 4k screen where right vertical 1/3 part of screen is garbage
-on rk3566 my samsung 4k monitor has black screen and cycle of OSD msgs: HDMI2 connected; HDMI2 disconnected; ....

I would suggest split v4 into 2 separated series:

-VOP2 support
-HDMI 4k modes support

BTW: getting well working 4k HDMI modes on rk3399 was real story for me.
There is many different series of patches to address this - but all have some subtle issues for me (i.e. 4k HDMI modes works but i.e. Qt is failing with DRM atomic commits in EGLFS) I developed well working [1] giving me reliable 4k on rk3399 (including working Qt DRM drawing in EGLFS mode)
Maybe it will be somehow helpful to get 4k modes solution for rk3566 _and_ rk3399 (on single kernel binary)?

[1] https://github.com/warpme/minimyth2/blob/master/script/kernel/linux-5.16/files/0730-drm-rockchip-add-4k-videomodes-support.patch

br

Quoted 30 lines

Wiadomość napisana przez Sascha Hauer <[email protected]> w dniu 26.01.2022, o godz. 15:55:

From: Andy Yan <[email protected]>

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
- Drop all waiting for framesyncs

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 on the cluster windows is tested with weston-simple-dmabuf-egl on weston using the (yet to be upstreamed) panfrost driver support.

Changes since v3:
- Sort includes
- fix typos
- Drop spinlock
- Use regmap_set_bits()/regmap_clear_bits()
- simplify vop2_scale_factor()
- simplify vop2_afbc_transform_offset()

#50 lore raw

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

Review

Quoted 7 lines · Piotr Oniszczuk

Sascha,

FYI
small report regarding 4k modes support in v4:

(quoted diff) +0 -2
-on rk3399 it gives me 4k screen where right vertical 1/3 part of screen is garbage
-on rk3566 my samsung 4k monitor has black screen and cycle of OSD msgs: HDMI2 connected; HDMI2 disconnected; ....

Same here on my rk3568, also with a samsung monitor. Was it 4k@60Hz or 4k@30Hz? If the former, could you give 4k@30Hz a try? That mode works well here.

Quoted 2 lines

I would suggest split v4 into 2 separated series:

Yeah, splitting up the series makes sense. At the moment I have it all in one series to ease others testing it.

Sascha

Quoted 10 lines
(quoted diff) +0 -2
-VOP2 support
-HDMI 4k modes support

BTW: getting well working 4k HDMI modes on rk3399 was real story for me.
There is many different series of patches to address this - but all have some subtle issues for me (i.e. 4k HDMI modes works but i.e. Qt is failing with DRM atomic commits in EGLFS) I developed well working [1] giving me reliable 4k on rk3399 (including working Qt DRM drawing in EGLFS mode)
Maybe it will be somehow helpful to get 4k modes solution for rk3566 _and_ rk3399 (on single kernel binary)?

[1] https://github.com/warpme/minimyth2/blob/master/script/kernel/linux-5.16/files/0730-drm-rockchip-add-4k-videomodes-support.patch

At least there are patches in it that I have in my series as well and keep popping up everywhere like "drm/rockchip: dw_hdmi: Use auto-generated tables" and "drm/rockchip: dw_hdmi: Set cur_ctr to 0 always"

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 |
#51 lore raw

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

Quoted 11 lines

Wiadomość napisana przez Sascha Hauer <[email protected]> w dniu 27.01.2022, o godz. 12:00:

Review

Quoted 3 lines
(quoted diff) +0 -2
-on rk3399 it gives me 4k screen where right vertical 1/3 part of screen is garbage
-on rk3566 my samsung 4k monitor has black screen and cycle of OSD msgs: HDMI2 connected; HDMI2 disconnected; ....

Same here on my rk3568, also with a samsung monitor. Was it 4k@60Hz or 4k@30Hz? If the former, could you give 4k@30Hz a try? That mode works well here.

It was 4k@30
Indeed - firmware of my samsung is total crap in UI aspects - so maybe in hdmi modes are as well :-p Anyway - this crap monitor works ok with 4k@30 on AW/RPI4/rk3399/n3450/MacBookPro

Quoted 6 lines
Quoted 6 lines

BTW: getting well working 4k HDMI modes on rk3399 was real story for me.
There is many different series of patches to address this - but all have some subtle issues for me (i.e. 4k HDMI modes works but i.e. Qt is failing with DRM atomic commits in EGLFS) I developed well working [1] giving me reliable 4k on rk3399 (including working Qt DRM drawing in EGLFS mode)
Maybe it will be somehow helpful to get 4k modes solution for rk3566 _and_ rk3399 (on single kernel binary)?

Quoted 7 lines
Quoted 1 line

[1] https://github.com/warpme/minimyth2/blob/master/script/kernel/linux-5.16/files/0730-drm-rockchip-add-4k-videomodes-support.patch

At least there are patches in it that I have in my series as well and keep popping up everywhere like "drm/rockchip: dw_hdmi: Use auto-generated tables" and "drm/rockchip: dw_hdmi: Set cur_ctr to 0 always"

What was time-consuming for me was finding working patches combination which not breaks Qt DRM Atomic commits. Many series floating arround various git repos/projects were offering 4k modes but breaking Qt in the same time....

btw: have you plans to look/address non-working DRM planes in VOP2? Rendering to DRM plane gives me green screen on rk3566.
The same code (and binaries) are working ok on rk3399 (and other SoCs).

A message that is not in the archive (sent off-list or not yet received): [email protected]

#53 lore raw

Re: MiPi DSI interface for RK3566 ?

Hi Philip,

Quoted 14 lines · subs

Hello Sascha

Please excuse me for reaching out unsolicited.

I have a project for which I want to use the DSI interface for the Pine Quartz64 and other RK3566 boards.

The problem is that the DSI interface (unless I am mistaken) is only supported with the BSP kernels. As functionality of mainline kernels is now approaching that of the BSP kernels and is clearly the future for this SoC this leaves those of us who want to use LCD panels left a bit out on a limb. Other developers are telling me to forget about the BSP kernels but if one wants to use an LCD panel that isn't so easy.

Quoted 7 lines

I am not a kernel developer and so I only have three choices, wait, put significant effort into working around the BSP kernel, or give up and target another SoC.

Are you able to give any indication whether you know if anyone is working on DSI support in mainline and if something is coming any time soon? so that I can plan my project accordingly?

I have MIPI DSI working based on these VOP2 patches. MIPI DSI is currently out of scope for us, I only worked on it up to the point where it works for me on the RK3568 EVB board to be able to test the VOP2 driver.

You can get the patches here:

https://git.pengutronix.de/cgit/sha/linux/log/?h=rockchip-vop2-mipi

The patches are not in a mainline suitable shape, but could well serve as a starting point.

Sascha

Signature · 9 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 |

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

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

In reply to Sascha Hauer
Thank you for the patch! Perhaps something to improve:

Hi Sascha,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm/drm-next]
[also build test WARNING on drm-tip/drm-tip drm-exynos/exynos-drm-next tegra-drm/drm/tegra/for-next v5.17-rc1] [cannot apply to rockchip/for-next drm-intel/for-linux-next airlied/drm-next next-20220128] [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/20220126-225854
base:   git://anongit.freedesktop.org/drm/drm drm-next
config: openrisc-allmodconfig (https://download.01.org/0day-ci/archive/20220129/202201291832.8LdxrySt-lkp(a)intel.com/config)
compiler: or1k-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/08336907e22eeb28385d746fc74e6f3850c9c838
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Sascha-Hauer/drm-rockchip-RK356x-VOP2-support/20220126-225854
git checkout 08336907e22eeb28385d746fc74e6f3850c9c838
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=openrisc SHELL=/bin/bash drivers/gpu/drm/rockchip/

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_cluster_init':

>> drivers/gpu/drm/rockchip/rockchip_drm_vop2.c:2423:1: warning: the frame size of 1100 bytes is larger than 1024 bytes [-Wframe-larger-than=]
    2423 | };
         | ^
   drivers/gpu/drm/rockchip/rockchip_drm_vop2.c: In function 'vop2_esmart_init':
   drivers/gpu/drm/rockchip/rockchip_drm_vop2.c:2495:1: warning: the frame size of 1100 bytes is larger than 1024 bytes [-Wframe-larger-than=]
    2495 | };
         | ^

vim +2423 drivers/gpu/drm/rockchip/rockchip_drm_vop2.c

2348
2349 static int vop2_cluster_init(struct vop2_win *win)
2350 {
2351 struct vop2 *vop2 = win->vop2;
2352 int i;
2353 struct reg_field vop2_cluster_regs[VOP2_WIN_MAX_REG] = {
2354 [VOP2_WIN_ENABLE] = REG_FIELD(RK3568_CLUSTER_WIN_CTRL0, 0, 0),
2355 [VOP2_WIN_FORMAT] = REG_FIELD(RK3568_CLUSTER_WIN_CTRL0, 1, 5),
2356 [VOP2_WIN_RB_SWAP] = REG_FIELD(RK3568_CLUSTER_WIN_CTRL0, 14, 14),
2357 [VOP2_WIN_DITHER_UP] = REG_FIELD(RK3568_CLUSTER_WIN_CTRL0, 18, 18),
2358 [VOP2_WIN_ACT_INFO] = REG_FIELD(RK3568_CLUSTER_WIN_ACT_INFO, 0, 31),
2359 [VOP2_WIN_DSP_INFO] = REG_FIELD(RK3568_CLUSTER_WIN_DSP_INFO, 0, 31),
2360 [VOP2_WIN_DSP_ST] = REG_FIELD(RK3568_CLUSTER_WIN_DSP_ST, 0, 31),
2361 [VOP2_WIN_YRGB_MST] = REG_FIELD(RK3568_CLUSTER_WIN_YRGB_MST, 0, 31),
2362 [VOP2_WIN_UV_MST] = REG_FIELD(RK3568_CLUSTER_WIN_CBR_MST, 0, 31),
2363 [VOP2_WIN_YUV_CLIP] = REG_FIELD(RK3568_CLUSTER_WIN_CTRL0, 19, 19),
2364 [VOP2_WIN_YRGB_VIR] = REG_FIELD(RK3568_CLUSTER_WIN_VIR, 0, 15),
2365 [VOP2_WIN_UV_VIR] = REG_FIELD(RK3568_CLUSTER_WIN_VIR, 16, 31),
2366 [VOP2_WIN_Y2R_EN] = REG_FIELD(RK3568_CLUSTER_WIN_CTRL0, 8, 8),
2367 [VOP2_WIN_R2Y_EN] = REG_FIELD(RK3568_CLUSTER_WIN_CTRL0, 9, 9),
2368 [VOP2_WIN_CSC_MODE] = REG_FIELD(RK3568_CLUSTER_WIN_CTRL0, 10, 11),
2369
2370 /* Scale */
2371 [VOP2_WIN_SCALE_YRGB_X] = REG_FIELD(RK3568_CLUSTER_WIN_SCL_FACTOR_YRGB, 0, 15),
2372 [VOP2_WIN_SCALE_YRGB_Y] = REG_FIELD(RK3568_CLUSTER_WIN_SCL_FACTOR_YRGB, 16, 31),
2373 [VOP2_WIN_YRGB_VER_SCL_MODE] = REG_FIELD(RK3568_CLUSTER_WIN_CTRL1, 14, 15),
2374 [VOP2_WIN_YRGB_HOR_SCL_MODE] = REG_FIELD(RK3568_CLUSTER_WIN_CTRL1, 12, 13),
2375 [VOP2_WIN_BIC_COE_SEL] = REG_FIELD(RK3568_CLUSTER_WIN_CTRL1, 2, 3),
2376 [VOP2_WIN_VSD_YRGB_GT2] = REG_FIELD(RK3568_CLUSTER_WIN_CTRL1, 28, 28),
2377 [VOP2_WIN_VSD_YRGB_GT4] = REG_FIELD(RK3568_CLUSTER_WIN_CTRL1, 29, 29),
2378
2379 /* cluster regs */
2380 [VOP2_WIN_AFBC_ENABLE] = REG_FIELD(RK3568_CLUSTER_CTRL, 1, 1),
2381 [VOP2_WIN_CLUSTER_ENABLE] = REG_FIELD(RK3568_CLUSTER_CTRL, 0, 0),
2382 [VOP2_WIN_CLUSTER_LB_MODE] = REG_FIELD(RK3568_CLUSTER_CTRL, 4, 7),
2383
2384 /* afbc regs */
2385 [VOP2_WIN_AFBC_FORMAT] = REG_FIELD(RK3568_CLUSTER_WIN_AFBCD_CTRL, 2, 6),
2386 [VOP2_WIN_AFBC_RB_SWAP] = REG_FIELD(RK3568_CLUSTER_WIN_AFBCD_CTRL, 9, 9),
2387 [VOP2_WIN_AFBC_UV_SWAP] = REG_FIELD(RK3568_CLUSTER_WIN_AFBCD_CTRL, 10, 10),
2388 [VOP2_WIN_AFBC_AUTO_GATING_EN] = REG_FIELD(RK3568_CLUSTER_WIN_AFBCD_OUTPUT_CTRL, 4, 4),
2389 [VOP2_WIN_AFBC_HALF_BLOCK_EN] = REG_FIELD(RK3568_CLUSTER_WIN_AFBCD_CTRL, 7, 7),
2390 [VOP2_WIN_AFBC_BLOCK_SPLIT_EN] = REG_FIELD(RK3568_CLUSTER_WIN_AFBCD_CTRL, 8, 8),
2391 [VOP2_WIN_AFBC_HDR_PTR] = REG_FIELD(RK3568_CLUSTER_WIN_AFBCD_HDR_PTR, 0, 31),
2392 [VOP2_WIN_AFBC_PIC_SIZE] = REG_FIELD(RK3568_CLUSTER_WIN_AFBCD_PIC_SIZE, 0, 31),
2393 [VOP2_WIN_AFBC_PIC_VIR_WIDTH] = REG_FIELD(RK3568_CLUSTER_WIN_AFBCD_VIR_WIDTH, 0, 15),
2394 [VOP2_WIN_AFBC_TILE_NUM] = REG_FIELD(RK3568_CLUSTER_WIN_AFBCD_VIR_WIDTH, 16, 31),
2395 [VOP2_WIN_AFBC_PIC_OFFSET] = REG_FIELD(RK3568_CLUSTER_WIN_AFBCD_PIC_OFFSET, 0, 31),
2396 [VOP2_WIN_AFBC_DSP_OFFSET] = REG_FIELD(RK3568_CLUSTER_WIN_AFBCD_DSP_OFFSET, 0, 31),
2397 [VOP2_WIN_AFBC_TRANSFORM_OFFSET] = REG_FIELD(RK3568_CLUSTER_WIN_AFBCD_TRANSFORM_OFFSET, 0, 31),
2398 [VOP2_WIN_AFBC_ROTATE_90] = REG_FIELD(RK3568_CLUSTER_WIN_AFBCD_ROTATE_MODE, 0, 0),
2399 [VOP2_WIN_AFBC_ROTATE_270] = REG_FIELD(RK3568_CLUSTER_WIN_AFBCD_ROTATE_MODE, 1, 1),
2400 [VOP2_WIN_XMIRROR] = REG_FIELD(RK3568_CLUSTER_WIN_AFBCD_ROTATE_MODE, 2, 2),
2401 [VOP2_WIN_YMIRROR] = REG_FIELD(RK3568_CLUSTER_WIN_AFBCD_ROTATE_MODE, 3, 3),
2402 [VOP2_WIN_UV_SWAP] = { .reg = 0xffffffff },
2403 [VOP2_WIN_COLOR_KEY] = { .reg = 0xffffffff },
2404 [VOP2_WIN_COLOR_KEY_EN] = { .reg = 0xffffffff },
2405 [VOP2_WIN_SCALE_CBCR_X] = { .reg = 0xffffffff },
2406 [VOP2_WIN_SCALE_CBCR_Y] = { .reg = 0xffffffff },
2407 [VOP2_WIN_YRGB_HSCL_FILTER_MODE] = { .reg = 0xffffffff },
2408 [VOP2_WIN_YRGB_VSCL_FILTER_MODE] = { .reg = 0xffffffff },
2409 [VOP2_WIN_CBCR_VER_SCL_MODE] = { .reg = 0xffffffff },
2410 [VOP2_WIN_CBCR_HSCL_FILTER_MODE] = { .reg = 0xffffffff },
2411 [VOP2_WIN_CBCR_HOR_SCL_MODE] = { .reg = 0xffffffff },
2412 [VOP2_WIN_CBCR_VSCL_FILTER_MODE] = { .reg = 0xffffffff },
2413 [VOP2_WIN_VSD_CBCR_GT2] = { .reg = 0xffffffff },
2414 [VOP2_WIN_VSD_CBCR_GT4] = { .reg = 0xffffffff },
2415 };
2416
2417 for (i = 0; i < ARRAY_SIZE(vop2_cluster_regs); i++)
2418 vop2_cluster_regs[i].reg += win->offset;
2419
2420 return devm_regmap_field_bulk_alloc(vop2->dev, vop2->map, win->reg,
2421 vop2_cluster_regs,
2422 ARRAY_SIZE(vop2_cluster_regs));

> 2423	};

2424

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

Tested-by on the v4 series
#55 lore raw
In reply to Sascha Hauer

Hello Sascha,

Quoted 4 lines · Sascha Hauer

This is v4 of adding RK356x VOP2 support. Due to popular demand I added a changelog to each patch, at least starting with changes to v3, I didn't care to add the older changes as well. I hopefully integrated all feedback I received to v3. Additionally I added some patches to the HDMI

Quoted 8 lines

driver to support resolutions up to 4k@60Hz. The patches are mostly taken from the downstream kernel. Some have been send to public lists, but were never applied upstream for reasons I do not know. The patches are a bit more intrusive than needed for my case, but are present in the downstream kernel for a long time, so I decided just to take them instead of stripping them down to my needs. With these patches I successfully used the driver with 4k@30Hz. 4k@60Hz doesn't work for me, I hope this is due to my low quality cable.

The cable might be the issue indeed, at least in my tests 4k@60Hz worked just fine. On a RK3568 EVB1, using

$ modetest -M rockchip -s 69:{1920x1080,3840x2160}-{30,60}

and a HP 27f 4K monitor:

Thanks for your work and best regards,
Michael

Quoted 98 lines

Sascha

Changes since v3:
- added changelog to each patch
- Add 4k support to hdmi driver
- rebase on v5.17-rc1

Changes since v2:
- Add pin names to HDMI supply pin description
- Add hclk support to HDMI driver
- Dual license rockchip-vop2 binding, update binding
- Add HDMI connector to board dts files
- drop unnecessary gamma_lut registers from vop2
- Update dclk_vop[012] clock handling, no longer hacks needed
- Complete regmap conversion

Changes since v1:
- drop all unnecessary waiting for frames within atomic modeset and plane update
- Cluster subwin support removed
- gamma support removed
- unnecessary irq_lock removed
- interrupt handling simplified
- simplified zpos handling
- drop is_alpha_support(), use fb->format->has_alpha instead
- use devm_regulator_get() rather than devm_regulator_get_optional() for hdmi regulators
- Use fixed number of planes per video port
- Drop homegrown regmap code from vop2 driver (not complete yet)
- Add separate include file for vop2 driver to not pollute the vop include

Andy Yan (1):
drm: rockchip: Add VOP2 driver

Benjamin Gaignard (1):
dt-bindings: display: rockchip: dw-hdmi: Add compatible for rk3568
HDMI

Douglas Anderson (2):
drm/rockchip: dw_hdmi: Use auto-generated tables drm/rockchip: dw_hdmi: Set cur_ctr to 0 always

Michael Riesch (1):
arm64: dts: rockchip: enable vop2 and hdmi tx on quartz64a

Nickey Yang (1):
drm/rockchip: dw_hdmi: add default 594Mhz clk for 4K@60hz

Sascha Hauer (21):
drm/encoder: Add of_graph port to struct drm_encoder drm/rockchip: dw_hdmi: Do not leave clock enabled in error case drm/rockchip: dw_hdmi: rename vpll clock to reference clock drm/rockchip: dw_hdmi: add rk3568 support
drm/rockchip: dw_hdmi: add regulator support
drm/rockchip: dw_hdmi: Add support for hclk
drm/rockchip: dw_hdmi: drop mode_valid hook
clk: rockchip: rk3568: Add more PLL rates
dt-bindings: display: rockchip: dw-hdmi: Make unwedge pinctrl optional
dt-bindings: display: rockchip: dw-hdmi: use "ref" as clock name
dt-bindings: display: rockchip: dw-hdmi: Add regulator support
dt-bindings: display: rockchip: dw-hdmi: Add additional clock
dt-bindings: display: rockchip: Add binding for VOP2
arm64: dts: rockchip: rk3399: reorder hmdi clocks
arm64: dts: rockchip: rk3399: rename HDMI ref clock to 'ref'
arm64: dts: rockchip: rk356x: Add VOP2 nodes
arm64: dts: rockchip: rk356x: Add HDMI nodes
arm64: dts: rockchip: rk3568-evb: Enable VOP2 and hdmi
clk: rk3568: drop CLK_SET_RATE_PARENT from dclk_vop*
clk: rk3568: Add CLK_SET_RATE_PARENT to the HDMI reference clock drm/rockchip: Make VOP driver optional

 .../display/rockchip/rockchip,dw-hdmi.yaml    |   29 +-
 .../display/rockchip/rockchip-vop2.yaml       |  146 +
 arch/arm64/boot/dts/rockchip/rk3399.dtsi      |    6 +-
 .../boot/dts/rockchip/rk3566-quartz64-a.dts   |   48 +
 arch/arm64/boot/dts/rockchip/rk3566.dtsi      |    4 +
 .../boot/dts/rockchip/rk3568-evb1-v10.dts     |   48 +
 arch/arm64/boot/dts/rockchip/rk3568.dtsi      |    4 +
 arch/arm64/boot/dts/rockchip/rk356x.dtsi      |   86 +
 drivers/clk/rockchip/clk-rk3568.c             |   14 +-
 drivers/gpu/drm/rockchip/Kconfig              |   14 +
 drivers/gpu/drm/rockchip/Makefile             |    4 +-
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c   |  293 +-
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c   |    3 +-
 drivers/gpu/drm/rockchip/rockchip_drm_drv.h   |    7 +-
 drivers/gpu/drm/rockchip/rockchip_drm_fb.c    |    2 +
 drivers/gpu/drm/rockchip/rockchip_drm_vop.h   |   15 +
 drivers/gpu/drm/rockchip/rockchip_drm_vop2.c  | 2665 +++++++++++++++++
 drivers/gpu/drm/rockchip/rockchip_drm_vop2.h  |  480 +++
 drivers/gpu/drm/rockchip/rockchip_vop2_reg.c  |  285 ++
 include/drm/drm_encoder.h                     |    2 +
 include/dt-bindings/soc/rockchip,vop2.h       |   14 +
 21 files changed, 4039 insertions(+), 130 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_drm_vop2.h
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_vop2_reg.c
 create mode 100644 include/dt-bindings/soc/rockchip,vop2.h
maintainer Applied
#56 lore raw

Re: (subset) [PATCH v4 00/27] drm/rockchip: RK356x VOP2 support

In reply to Sascha Hauer
Quoted 13 lines · Sascha Hauer

This is v4 of adding RK356x VOP2 support. Due to popular demand I added a changelog to each patch, at least starting with changes to v3, I didn't care to add the older changes as well. I hopefully integrated all feedback I received to v3. Additionally I added some patches to the HDMI driver to support resolutions up to 4k@60Hz. The patches are mostly taken from the downstream kernel. Some have been send to public lists, but were never applied upstream for reasons I do not know. The patches are a bit more intrusive than needed for my case, but are present in the downstream kernel for a long time, so I decided just to take them instead of stripping them down to my needs. With these patches I successfully used the driver with 4k@30Hz. 4k@60Hz doesn't work for me, I hope this is due to my low quality cable.

Quoted 1 line

[...]

Applied, thanks!

[11/27] clk: rockchip: rk3568: Add more PLL rates

        commit: 842f4cb7263953020f4e2f2f0005fc3e6fc56144
[24/27] clk: rk3568: drop CLK_SET_RATE_PARENT from dclk_vop*
        commit: ff3187eabb5ce478d15b6ed62eb286756adefac3
[25/27] clk: rk3568: Add CLK_SET_RATE_PARENT to the HDMI reference clock
        commit: 6e69052f01d9131388cfcfaee929120118a267f4

Best regards,

Signature · 1 line
Heiko Stuebner <[email protected]>
maintainer Applied
#57 lore raw

Re: (subset) [PATCH v4 00/27] drm/rockchip: RK356x VOP2 support

In reply to Sascha Hauer
Quoted 13 lines · Sascha Hauer

This is v4 of adding RK356x VOP2 support. Due to popular demand I added a changelog to each patch, at least starting with changes to v3, I didn't care to add the older changes as well. I hopefully integrated all feedback I received to v3. Additionally I added some patches to the HDMI driver to support resolutions up to 4k@60Hz. The patches are mostly taken from the downstream kernel. Some have been send to public lists, but were never applied upstream for reasons I do not know. The patches are a bit more intrusive than needed for my case, but are present in the downstream kernel for a long time, so I decided just to take them instead of stripping them down to my needs. With these patches I successfully used the driver with 4k@30Hz. 4k@60Hz doesn't work for me, I hope this is due to my low quality cable.

Quoted 1 line

[...]

Applied, thanks!

[18/27] arm64: dts: rockchip: rk3399: reorder hmdi clocks

        commit: 2e8a8b5955a000cc655f7e368670518cbb77fe58

Best regards,

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