Skip to contentSkip to conversation

drm/rockchip: dw_hdmi: Add 4k@30 support

PATCH Superseded Sascha Hauer 4 participants 12 messages Sep 26, 2022 – Oct 18, 2022

Subsystems (4)

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v2 cover drm/rockchip: dw_hdmi: Add 4k@30 support

This series adds support for 4k@30 to the rockchip HDMI controller. This
has been tested on a rk3568 rock3a board. It should be possible to add
4k@60 support the same way, but it doesn't work for me, so let's add
4k@30 as a first step.
Sascha

Changes since v1:
- Allow non standard clock rates only on Synopsys phy as suggested by Robin Murphy

Sascha Hauer (2):
drm/rockchip: dw_hdmi: relax mode_valid hook drm/rockchip: dw_hdmi: Add support for 4k@30 resolution

 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 34 ++++++++++++++++-----
 1 file changed, 27 insertions(+), 7 deletions(-)
Signature · 1 line
2.30.2
#1 lore raw

PATCH v2 1/2 drm/rockchip: dw_hdmi: relax mode_valid hook

The driver checks if the pixel clock of the given mode matches an entry in the mpll config table. At least for the Synopsys phy 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. Return MODE_OK when the pixelclock is smaller than one of the mpll frequencies to allow for more display resolutions.
Limit this behaviour to the Synopsys phy at the moment and keep the current behaviour of forcing exact pixelclock rates for the other phys until it has been sorted out how and if the vendor specific phys work with non standard clock rates.

---

Notes:
Changes since v1:
- Allow non standard clock rates only for the Synopsys phy and stick the vendor specific phys to current behaviour.

 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 26 +++++++++++++++------
 1 file changed, 19 insertions(+), 7 deletions(-)
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +19 -7
index c14f888938688..6a387780562b1 100644
@@ -74,6 +74,7 @@ struct rockchip_hdmi {
 	struct regmap *regmap;
 	struct rockchip_encoder encoder;
 	const struct rockchip_hdmi_chip_data *chip_data;
+	const struct dw_hdmi_plat_data *plat_data;
 	struct clk *ref_clk;
 	struct clk *grf_clk;
 	struct dw_hdmi *hdmi;
@@ -241,23 +242,32 @@ static int rockchip_hdmi_parse_dt(struct rockchip_hdmi *hdmi)
 }
 
 static enum drm_mode_status
-dw_hdmi_rockchip_mode_valid(struct dw_hdmi *hdmi, void *data,
+dw_hdmi_rockchip_mode_valid(struct dw_hdmi *dw_hdmi, void *data,
 			    const struct drm_display_info *info,
 			    const struct drm_display_mode *mode)
 {
+	struct rockchip_hdmi *hdmi = data;
 	const struct dw_hdmi_mpll_config *mpll_cfg = rockchip_mpll_cfg;
 	int pclk = mode->clock * 1000;
-	bool valid = false;
+	bool exact_match = hdmi->plat_data->phy_force_vendor;
 	int i;
 
 	for (i = 0; mpll_cfg[i].mpixelclock != (~0UL); i++) {
-		if (pclk == mpll_cfg[i].mpixelclock) {
-			valid = true;
-			break;
-		}
+		/*
+		 * For vendor specific phys force an exact match of the pixelclock
+		 * to preserve the original behaviour of the driver.
+		 */
+		if (exact_match && pclk == mpll_cfg[i].mpixelclock)
+			return MODE_OK;
+		/*
+		 * The Synopsys phy can work with pixelclocks up to the value given
+		 * in the corresponding mpll_cfg entry.
+		 */
+		if (!exact_match && pclk <= mpll_cfg[i].mpixelclock)
+			return MODE_OK;
 	}
 
-	return (valid) ? MODE_OK : MODE_BAD;
+	return MODE_BAD;
 }
 
 static void dw_hdmi_rockchip_encoder_disable(struct drm_encoder *encoder)
@@ -546,8 +556,10 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,
 		return -ENOMEM;
 
 	hdmi->dev = &pdev->dev;
+	hdmi->plat_data = plat_data;
 	hdmi->chip_data = plat_data->phy_data;
 	plat_data->phy_data = hdmi;
+	plat_data->priv_data = hdmi;
 	encoder = &hdmi->encoder.encoder;
 
 	encoder->possible_crtcs = drm_of_find_possible_crtcs(drm, dev->of_node);
Signature · 7 lines
2.30.2


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

PATCH v2 2/2 drm/rockchip: dw_hdmi: Add support for 4k@30 resolution

In reply to Sascha Hauer

This adds the PLL/phy settings to support higher resolutions like 4k@30. The values were taken from the Rockchip downstream Kernel.

---
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +8 -0
index 6a387780562b1..cf86a2936c4d9 100644
@@ -161,6 +161,12 @@ static const struct dw_hdmi_mpll_config rockchip_mpll_cfg[] = {
 			{ 0x214c, 0x0003},
 			{ 0x4064, 0x0003}
 		},
+	}, {
+		340000000, {
+			{ 0x0052, 0x0003 },
+			{ 0x214d, 0x0003 },
+			{ 0x4065, 0x0003 },
+		},
 	}, {
 		~0UL, {
 			{ 0x00a0, 0x000a },
@@ -186,6 +192,8 @@ static const struct dw_hdmi_curr_ctrl rockchip_cur_ctr[] = {
 		146250000, { 0x0038, 0x0038, 0x0038 },
 	}, {
 		148500000, { 0x0000, 0x0038, 0x0038 },
+	}, {
+		600000000, { 0x0000, 0x0000, 0x0000 },
 	}, {
 		~0UL,      { 0x0000, 0x0000, 0x0000},
 	}
Signature · 1 line
2.30.2
Tested-by on the v2 series
#3 lore raw
In reply to Sascha Hauer

Hi Sascha,

Quoted 10 lines · Sascha Hauer

This series adds support for 4k@30 to the rockchip HDMI controller. This
has been tested on a rk3568 rock3a board. It should be possible to add
4k@60 support the same way, but it doesn't work for me, so let's add
4k@30 as a first step.
Sascha

Changes since v1:
- Allow non standard clock rates only on Synopsys phy as suggested by Robin Murphy

Quoted 6 lines

Sascha Hauer (2):
drm/rockchip: dw_hdmi: relax mode_valid hook drm/rockchip: dw_hdmi: Add support for 4k@30 resolution

 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 34 ++++++++++++++++-----
 1 file changed, 27 insertions(+), 7 deletions(-)

Thanks for the v2! On a RK3568 EVB1 with a HP 27f 4k monitor

Best regards,
Michael

#4 lore raw

Den 26.09.2022 kl. 12.30 skrev Michael Riesch:

Quoted 17 lines

Hi Sascha,

Quoted 14 lines · Sascha Hauer

This series adds support for 4k@30 to the rockchip HDMI controller. This
has been tested on a rk3568 rock3a board. It should be possible to add
4k@60 support the same way, but it doesn't work for me, so let's add
4k@30 as a first step.
Sascha

Changes since v1:
- Allow non standard clock rates only on Synopsys phy as suggested by Robin Murphy

Sascha Hauer (2):
drm/rockchip: dw_hdmi: relax mode_valid hook drm/rockchip: dw_hdmi: Add support for 4k@30 resolution

Quoted 5 lines
Quoted 2 lines
  drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 34 ++++++++++++++++-----
  1 file changed, 27 insertions(+), 7 deletions(-)

Thanks for the v2! On a RK3568 EVB1 with a HP 27f 4k monitor

Sadly this still doesn't give my display out on my 2k monitor. Not even just 1080p picture like the old current implementation does.

Quoted 8 lines

Best regards,
Michael

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

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

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
#5 lore raw
Quoted 19 lines · Dan Johansen

Den 26.09.2022 kl. 12.30 skrev Michael Riesch:

Quoted 17 lines

Hi Sascha,

Quoted 14 lines · Sascha Hauer

This series adds support for 4k@30 to the rockchip HDMI controller. This
has been tested on a rk3568 rock3a board. It should be possible to add
4k@60 support the same way, but it doesn't work for me, so let's add
4k@30 as a first step.
Sascha

Changes since v1:
- Allow non standard clock rates only on Synopsys phy as suggested by Robin Murphy

Sascha Hauer (2):
drm/rockchip: dw_hdmi: relax mode_valid hook drm/rockchip: dw_hdmi: Add support for 4k@30 resolution

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
  drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 34 ++++++++++++++++-----
  1 file changed, 27 insertions(+), 7 deletions(-)

Thanks for the v2! On a RK3568 EVB1 with a HP 27f 4k monitor

Sadly this still doesn't give my display out on my 2k monitor. Not even just 1080p picture like the old current implementation does.

By "like the old current implementation" you mean that this patchset introduces a regression for you?

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

Den 28.09.2022 kl. 10.37 skrev Sascha Hauer:

Quoted 21 lines · Dan Johansen
Quoted 20 lines

Den 26.09.2022 kl. 12.30 skrev Michael Riesch:

Quoted 19 lines

Hi Sascha,

Quoted 16 lines · Sascha Hauer

This series adds support for 4k@30 to the rockchip HDMI controller. This
has been tested on a rk3568 rock3a board. It should be possible to add
4k@60 support the same way, but it doesn't work for me, so let's add
4k@30 as a first step.
Sascha

Changes since v1:
- Allow non standard clock rates only on Synopsys phy as suggested by Robin Murphy

Sascha Hauer (2):
drm/rockchip: dw_hdmi: relax mode_valid hook drm/rockchip: dw_hdmi: Add support for 4k@30 resolution

   drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 34 ++++++++++++++++-----
   1 file changed, 27 insertions(+), 7 deletions(-)
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Thanks for the v2! On a RK3568 EVB1 with a HP 27f 4k monitor

Sadly this still doesn't give my display out on my 2k monitor. Not even just 1080p picture like the old current implementation does.

By "like the old current implementation" you mean that this patchset introduces a regression for you?

Yes. What currently in the kernel at least shows as 1080p on my 2K monitor, while this patchset turns off the screen.

Quoted 3 lines

Sascha

Signature · 4 lines
Kind regards
*Dan Johansen*
Project lead of the *Manjaro ARM* project
Manjaro-ARM <https://manjaro.org>
#7 lore raw
Quoted 25 lines · Dan Johansen

Den 28.09.2022 kl. 10.37 skrev Sascha Hauer:

Quoted 23 lines · Dan Johansen
Quoted 22 lines

Den 26.09.2022 kl. 12.30 skrev Michael Riesch:

Quoted 21 lines

Hi Sascha,

Quoted 10 lines · Sascha Hauer

This series adds support for 4k@30 to the rockchip HDMI controller. This
has been tested on a rk3568 rock3a board. It should be possible to add
4k@60 support the same way, but it doesn't work for me, so let's add
4k@30 as a first step.
Sascha

Changes since v1:
- Allow non standard clock rates only on Synopsys phy as suggested by Robin Murphy

Quoted 6 lines

Sascha Hauer (2):
drm/rockchip: dw_hdmi: relax mode_valid hook drm/rockchip: dw_hdmi: Add support for 4k@30 resolution

   drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 34 ++++++++++++++++-----
   1 file changed, 27 insertions(+), 7 deletions(-)

Thanks for the v2! On a RK3568 EVB1 with a HP 27f 4k monitor

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Sadly this still doesn't give my display out on my 2k monitor. Not even just 1080p picture like the old current implementation does.

By "like the old current implementation" you mean that this patchset introduces a regression for you?

Yes. What currently in the kernel at least shows as 1080p on my 2K monitor, while this patchset turns off the screen.

Which SoC are you testing this on? I assume RK3568, right? Which patch introduces that regression, the first or the second one?

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

Den 05.10.2022 kl. 12.06 skrev Sascha Hauer:

Quoted 26 lines · Dan Johansen
Quoted 25 lines

Den 28.09.2022 kl. 10.37 skrev Sascha Hauer:

Quoted 24 lines · Dan Johansen
Quoted 23 lines

Den 26.09.2022 kl. 12.30 skrev Michael Riesch:

Quoted 22 lines

Hi Sascha,

Quoted 10 lines · Sascha Hauer

This series adds support for 4k@30 to the rockchip HDMI controller. This
has been tested on a rk3568 rock3a board. It should be possible to add
4k@60 support the same way, but it doesn't work for me, so let's add
4k@30 as a first step.
Sascha

Changes since v1:
- Allow non standard clock rates only on Synopsys phy as suggested by Robin Murphy

Quoted 6 lines

Sascha Hauer (2):
drm/rockchip: dw_hdmi: relax mode_valid hook drm/rockchip: dw_hdmi: Add support for 4k@30 resolution

drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 34 ++++++++++++++++----- 1 file changed, 27 insertions(+), 7 deletions(-)

Thanks for the v2! On a RK3568 EVB1 with a HP 27f 4k monitor

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Sadly this still doesn't give my display out on my 2k monitor. Not even just 1080p picture like the old current implementation does.

By "like the old current implementation" you mean that this patchset introduces a regression for you?

Yes. What currently in the kernel at least shows as 1080p on my 2K monitor, while this patchset turns off the screen.

Which SoC are you testing this on? I assume RK3568, right? Which patch introduces that regression, the first or the second one?

I tested on the Odroid M, which is rk3568.
I have only applied them both, as I was under the impression that both are needed for the 4k support.

Quoted 3 lines

Sascha

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

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
#9 lore raw
Quoted 32 lines · Dan Johansen

Den 05.10.2022 kl. 12.06 skrev Sascha Hauer:

Quoted 30 lines · Dan Johansen
Quoted 29 lines

Den 28.09.2022 kl. 10.37 skrev Sascha Hauer:

Quoted 28 lines · Dan Johansen
Quoted 18 lines

Den 26.09.2022 kl. 12.30 skrev Michael Riesch:

Quoted 17 lines

Hi Sascha,

Quoted 14 lines · Sascha Hauer

This series adds support for 4k@30 to the rockchip HDMI controller. This
has been tested on a rk3568 rock3a board. It should be possible to add
4k@60 support the same way, but it doesn't work for me, so let's add
4k@30 as a first step.
Sascha

Changes since v1:
- Allow non standard clock rates only on Synopsys phy as suggested by Robin Murphy

Sascha Hauer (2):
drm/rockchip: dw_hdmi: relax mode_valid hook drm/rockchip: dw_hdmi: Add support for 4k@30 resolution

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
    drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 34 ++++++++++++++++-----
    1 file changed, 27 insertions(+), 7 deletions(-)

Thanks for the v2! On a RK3568 EVB1 with a HP 27f 4k monitor

Sadly this still doesn't give my display out on my 2k monitor. Not even just 1080p picture like the old current implementation does.

By "like the old current implementation" you mean that this patchset introduces a regression for you?

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Yes. What currently in the kernel at least shows as 1080p on my 2K monitor, while this patchset turns off the screen.

Which SoC are you testing this on? I assume RK3568, right? Which patch introduces that regression, the first or the second one?

I tested on the Odroid M, which is rk3568.
I have only applied them both, as I was under the impression that both are needed for the 4k support.

Yes, both I needed, but I am interested which one introduces the regression as I can't reproduce it.

Sascha

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

Den 05.10.2022 kl. 12.06 skrev Sascha Hauer:

Quoted 32 lines · Dan Johansen
Quoted 31 lines

Den 28.09.2022 kl. 10.37 skrev Sascha Hauer:

Quoted 21 lines · Dan Johansen
Quoted 20 lines

Den 26.09.2022 kl. 12.30 skrev Michael Riesch:

Quoted 19 lines

Hi Sascha,

Quoted 16 lines · Sascha Hauer

This series adds support for 4k@30 to the rockchip HDMI controller. This
has been tested on a rk3568 rock3a board. It should be possible to add
4k@60 support the same way, but it doesn't work for me, so let's add
4k@30 as a first step.
Sascha

Changes since v1:
- Allow non standard clock rates only on Synopsys phy as suggested by Robin Murphy

Sascha Hauer (2):
drm/rockchip: dw_hdmi: relax mode_valid hook drm/rockchip: dw_hdmi: Add support for 4k@30 resolution

drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 34 ++++++++++++++++----- 1 file changed, 27 insertions(+), 7 deletions(-)

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Thanks for the v2! On a RK3568 EVB1 with a HP 27f 4k monitor

Sadly this still doesn't give my display out on my 2k monitor. Not even just 1080p picture like the old current implementation does.

By "like the old current implementation" you mean that this patchset introduces a regression for you?

Yes. What currently in the kernel at least shows as 1080p on my 2K monitor, while this patchset turns off the screen.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Which SoC are you testing this on? I assume RK3568, right? Which patch introduces that regression, the first or the second one?

I tested on the Odroid M, which is rk3568.
I have only applied them both, as I was under the impression that both are needed for the 4k support.

Yes, both I needed, but I am interested which one introduces the regression as I can't reproduce it.

One thing that might be worthwhile is to compare what "drm.debug=4" output says about the chosen mode and its clock rate vs. what /sys/kernel/debug/clk/clk_summary says about how things ended up in practice, to see whether it's a case of the clock not being able to get close enough to the correct rate at all.

Robin.

#11 lore raw
In reply to Sascha Hauer

Den 05.10.2022 kl. 13.10 skrev Sascha Hauer:

Quoted 34 lines · Dan Johansen
Quoted 33 lines

Den 05.10.2022 kl. 12.06 skrev Sascha Hauer:

Quoted 32 lines · Dan Johansen
Quoted 31 lines

Den 28.09.2022 kl. 10.37 skrev Sascha Hauer:

Quoted 21 lines · Dan Johansen
Quoted 20 lines

Den 26.09.2022 kl. 12.30 skrev Michael Riesch:

Quoted 19 lines

Hi Sascha,

Quoted 16 lines · Sascha Hauer

This series adds support for 4k@30 to the rockchip HDMI controller. This
has been tested on a rk3568 rock3a board. It should be possible to add
4k@60 support the same way, but it doesn't work for me, so let's add
4k@30 as a first step.
Sascha

Changes since v1:
- Allow non standard clock rates only on Synopsys phy as suggested by Robin Murphy

Sascha Hauer (2):
drm/rockchip: dw_hdmi: relax mode_valid hook drm/rockchip: dw_hdmi: Add support for 4k@30 resolution

drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 34 ++++++++++++++++----- 1 file changed, 27 insertions(+), 7 deletions(-)

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Thanks for the v2! On a RK3568 EVB1 with a HP 27f 4k monitor

Sadly this still doesn't give my display out on my 2k monitor. Not even just 1080p picture like the old current implementation does.

By "like the old current implementation" you mean that this patchset introduces a regression for you?

Yes. What currently in the kernel at least shows as 1080p on my 2K monitor, while this patchset turns off the screen.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Which SoC are you testing this on? I assume RK3568, right? Which patch introduces that regression, the first or the second one?

I tested on the Odroid M, which is rk3568.
I have only applied them both, as I was under the impression that both are needed for the 4k support.

Yes, both I needed, but I am interested which one introduces the regression as I can't reproduce it.

Okay. Here's the result of some more tests of mine.

Patch 1 by itself does not introduce any regressions on either 1080p or 2k monitors.

Patch 2 by itself does not introduce any regressions on either 1080p or 2k monitors.

Applying both Patch 1 and 2, _does_ introduce the regression on my 2k monitor, but _not_ on my 1080p monitor.

The 2k monitor is a Dell P2418D with up to 2560x1440 resolution.

The 1080p monitor is a Sony Bravia 46" TV with up to 1920x1080 resolution.

Quoted 3 lines

Sascha

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