[PATCH 08/11] drm/sun4i: Add support for H616 HDMI PHY
From: Jernej Skrabec
Date: Thu Nov 26 2026 - 16:45:08 EST
H616 HDMI PHY is a standard Synopsys HDMI 2.0 TX PHY, like on H6, but it
needs its own configuration table. Values are taken from the BSP.
The BSP also sets undocumented bit 15 of MSM_CTRL at 594 MHz. 4K@60 works
fine without it, same as on H6, so it's left out.
Signed-off-by: Jernej Skrabec <jernej.skrabec@xxxxxxxxx>
---
drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c | 170 +++++++++++++++++++++++++
1 file changed, 170 insertions(+)
diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c
index 0d284804e11f..8bef4806c65b 100644
--- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c
+++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c
@@ -124,6 +124,165 @@ static const struct dw_hdmi_phy_config sun50i_h6_phy_config[] = {
{ ~0UL, 0x0000, 0x0000, 0x0000}
};
+/*
+ * Values are from the BSP. Like on H6, PLL settings depend on the TMDS clock
+ * band. The BSP has its own values for CEA clocks, which also apply to
+ * their 1000/1001 variants. PLLGMPCTRL is always 3.
+ */
+static const struct dw_hdmi_mpll_config sun50i_h616_mpll_cfg[] = {
+ {
+ 30666000, {
+ { 0x00b3, 0x0003 },
+ { 0x2153, 0x0003 },
+ { 0x40f3, 0x0003 },
+ },
+ },
+ {
+ 36800000, {
+ { 0x00b3, 0x0003 },
+ { 0x2153, 0x0003 },
+ { 0x40a2, 0x0003 },
+ },
+ },
+ {
+ 46000000, {
+ { 0x00b3, 0x0003 },
+ { 0x2142, 0x0003 },
+ { 0x40a2, 0x0003 },
+ },
+ },
+ {
+ 61333000, {
+ { 0x0072, 0x0003 },
+ { 0x2142, 0x0003 },
+ { 0x40a2, 0x0003 },
+ },
+ },
+ {
+ 73600000, {
+ { 0x0072, 0x0003 },
+ { 0x2142, 0x0003 },
+ { 0x4061, 0x0003 },
+ },
+ },
+ {
+ 92000000, {
+ { 0x0072, 0x0003 },
+ { 0x2145, 0x0003 },
+ { 0x4061, 0x0003 },
+ },
+ },
+ {
+ 122666000, {
+ { 0x0051, 0x0003 },
+ { 0x2145, 0x0003 },
+ { 0x4061, 0x0003 },
+ },
+ },
+ {
+ 147200000, {
+ { 0x0051, 0x0003 },
+ { 0x2145, 0x0003 },
+ { 0x4064, 0x0003 },
+ },
+ },
+ {
+ 184000000, {
+ { 0x0051, 0x0003 },
+ { 0x214c, 0x0003 },
+ { 0x4064, 0x0003 },
+ },
+ },
+ {
+ 226666000, {
+ { 0x0040, 0x0003 },
+ { 0x214c, 0x0003 },
+ { 0x4064, 0x0003 },
+ },
+ },
+ {
+ 272000000, {
+ { 0x0040, 0x0003 },
+ { 0x214c, 0x0003 },
+ { 0x5a64, 0x0003 },
+ },
+ },
+ {
+ 340000000, {
+ { 0x0040, 0x0003 },
+ { 0x3b4c, 0x0003 },
+ { 0x5a64, 0x0003 },
+ },
+ },
+ {
+ 593400000, {
+ { 0x1a40, 0x0003 },
+ { 0x3b4c, 0x0003 },
+ { 0x5a64, 0x0003 },
+ },
+ },
+ {
+ 594000000, {
+ { 0x1a7c, 0x0003 },
+ { 0x3b4c, 0x0003 },
+ { 0x5a64, 0x0003 },
+ },
+ },
+ {
+ ~0UL, {
+ { 0x0000, 0x0000 },
+ { 0x0000, 0x0000 },
+ { 0x0000, 0x0000 },
+ },
+ }
+};
+
+static const struct dw_hdmi_curr_ctrl sun50i_h616_cur_ctr[] = {
+ /* pixelclk bpp8 bpp10 bpp12 */
+ { 26995000, { 0x0000, 0x0000, 0x0000 }, },
+ { 27032000, { 0x0012, 0x0000, 0x0000 }, },
+ { 30666000, { 0x0000, 0x0000, 0x0000 }, },
+ { 36800000, { 0x0000, 0x0000, 0x0008 }, },
+ { 46000000, { 0x0000, 0x0008, 0x0008 }, },
+ { 61333000, { 0x0008, 0x0008, 0x0008 }, },
+ { 73600000, { 0x0008, 0x0008, 0x001b }, },
+ { 74175000, { 0x0008, 0x001a, 0x001b }, },
+ { 74250000, { 0x0013, 0x0013, 0x0013 }, },
+ { 92000000, { 0x0008, 0x001a, 0x001b }, },
+ { 122666000, { 0x001b, 0x001a, 0x001b }, },
+ { 147200000, { 0x001b, 0x001a, 0x0034 }, },
+ { 148350000, { 0x001b, 0x0033, 0x0034 }, },
+ { 148500000, { 0x0019, 0x0019, 0x0019 }, },
+ { 184000000, { 0x001b, 0x0033, 0x0034 }, },
+ { 226666000, { 0x0036, 0x0033, 0x0034 }, },
+ { 272000000, { 0x0036, 0x0033, 0x001b }, },
+ { 296700000, { 0x0036, 0x001b, 0x001b }, },
+ { 297000000, { 0x0019, 0x001b, 0x0019 }, },
+ { 340000000, { 0x0036, 0x001b, 0x001b }, },
+ { 593400000, { 0x003f, 0x001b, 0x001b }, },
+ { 594000000, { 0x0010, 0x001b, 0x001b }, },
+ { ~0UL, { 0x0000, 0x0000, 0x0000 }, }
+};
+
+static const struct dw_hdmi_phy_config sun50i_h616_phy_config[] = {
+ /*pixelclk symbol term vlev*/
+ { 26995000, 0x8009, 0x0004, 0x0232 },
+ { 27032000, 0x8009, 0x0007, 0x02b0 },
+ { 74175000, 0x8009, 0x0004, 0x0232 },
+ { 74250000, 0x8019, 0x0004, 0x0290 },
+ { 148250000, 0x8009, 0x0004, 0x0232 },
+ { 148350000, 0x8009, 0x0004, 0x0230 },
+ { 148500000, 0x8019, 0x0004, 0x0290 },
+ { 218250000, 0x8009, 0x0004, 0x0230 },
+ { 288000000, 0x8009, 0x0004, 0x0273 },
+ { 296700000, 0x8029, 0x0004, 0x0273 },
+ { 297000000, 0x8039, 0x0004, 0x022b },
+ { 340000000, 0x8029, 0x0004, 0x0273 },
+ { 593400000, 0x8039, 0x0004, 0x014a },
+ { 594000000, 0x8029, 0x0000, 0x008a },
+ { ~0UL, 0x0000, 0x0000, 0x0000 }
+};
+
static void sun8i_hdmi_phy_set_polarity(struct sun8i_hdmi_phy *phy,
const struct drm_display_mode *mode)
{
@@ -626,6 +785,13 @@ static const struct sun8i_hdmi_phy_variant sun50i_h6_hdmi_phy = {
.phy_init = &sun50i_hdmi_phy_init_h6,
};
+static const struct sun8i_hdmi_phy_variant sun50i_h616_hdmi_phy = {
+ .cur_ctr = sun50i_h616_cur_ctr,
+ .mpll_cfg = sun50i_h616_mpll_cfg,
+ .phy_cfg = sun50i_h616_phy_config,
+ .phy_init = &sun50i_hdmi_phy_init_h6,
+};
+
static const struct of_device_id sun8i_hdmi_phy_of_table[] = {
{
.compatible = "allwinner,sun8i-a83t-hdmi-phy",
@@ -647,6 +813,10 @@ static const struct of_device_id sun8i_hdmi_phy_of_table[] = {
.compatible = "allwinner,sun50i-h6-hdmi-phy",
.data = &sun50i_h6_hdmi_phy,
},
+ {
+ .compatible = "allwinner,sun50i-h616-hdmi-phy",
+ .data = &sun50i_h616_hdmi_phy,
+ },
{ /* sentinel */ }
};
--
2.43.0