devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: dri-devel@lists.freedesktop.org
Cc: linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org,
	kernel@pengutronix.de, "Andy Yan" <andy.yan@rock-chips.com>,
	"Benjamin Gaignard" <benjamin.gaignard@collabora.com>,
	"Michael Riesch" <michael.riesch@wolfvision.net>,
	"Sandy Huang" <hjc@rock-chips.com>,
	"Heiko Stübner" <heiko@sntech.de>,
	"Peter Geis" <pgwipeout@gmail.com>,
	"Douglas Anderson" <dianders@chromium.org>,
	"Yakir Yang" <ykk@rock-chips.com>,
	"Sascha Hauer" <s.hauer@pengutronix.de>
Subject: [PATCH v11 11/24] drm/rockchip: dw_hdmi: Use auto-generated tables
Date: Fri, 22 Apr 2022 09:28:28 +0200	[thread overview]
Message-ID: <20220422072841.2206452-12-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20220422072841.2206452-1-s.hauer@pengutronix.de>

From: Douglas Anderson <dianders@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 <https://crrev.com/c/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 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.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Yakir Yang <ykk@rock-chips.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---

Notes:
    Changes since v5:
    - Add missing Signed-off-by me
    
    Changes since v3:
    - new patch

 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 130 +++++++++++---------
 1 file changed, 69 insertions(+), 61 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
index fe4f9556239ac..cb43e7b47157d 100644
--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
@@ -91,80 +91,88 @@ static struct rockchip_hdmi *to_rockchip_hdmi(struct drm_encoder *encoder)
 
 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 },
 		},
 	}
 };
-- 
2.30.2


  parent reply	other threads:[~2022-04-22  7:29 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-22  7:28 [PATCH v11 00/24] drm/rockchip: RK356x VOP2 support Sascha Hauer
2022-04-22  7:28 ` [PATCH v11 01/24] clk: rk3568: Mark hclk_vo as critical Sascha Hauer
2022-04-22  7:28 ` [PATCH v11 02/24] drm/rockchip: Embed drm_encoder into rockchip_decoder Sascha Hauer
2022-04-22  7:28 ` [PATCH v11 03/24] drm/rockchip: Add crtc_endpoint_id to rockchip_encoder Sascha Hauer
2022-04-22  7:28 ` [PATCH v11 04/24] drm/rockchip: dw_hdmi: rename vpll clock to reference clock Sascha Hauer
2022-04-22  7:28 ` [PATCH v11 05/24] dt-bindings: display: rockchip: dw-hdmi: use "ref" as clock name Sascha Hauer
2022-04-22  7:28 ` [PATCH v11 06/24] arm64: dts: rockchip: rk3399: rename HDMI ref clock to 'ref' Sascha Hauer
2022-04-22  7:28 ` [PATCH v11 07/24] drm/rockchip: dw_hdmi: add rk3568 support Sascha Hauer
2022-04-22  7:28 ` [PATCH v11 08/24] dt-bindings: display: rockchip: dw-hdmi: Add compatible for rk3568 HDMI Sascha Hauer
2022-04-22  7:28 ` [PATCH v11 09/24] drm/rockchip: dw_hdmi: add regulator support Sascha Hauer
2024-07-04  9:09   ` Diederik de Haas
2024-07-04 10:00     ` Heiko Stübner
2024-07-04 10:34       ` Diederik de Haas
2024-07-04 10:28     ` Alex Bee
2022-04-22  7:28 ` [PATCH v11 10/24] dt-bindings: display: rockchip: dw-hdmi: Add " Sascha Hauer
2022-04-22  7:28 ` Sascha Hauer [this message]
2022-05-03 11:02   ` [PATCH v11 11/24] drm/rockchip: dw_hdmi: Use auto-generated tables Heiko Stübner
2022-05-03 12:17     ` Robin Murphy
2022-04-22  7:28 ` [PATCH v11 12/24] drm/rockchip: dw_hdmi: relax mode_valid hook Sascha Hauer
2022-04-22  7:28 ` [PATCH v11 13/24] drm/rockchip: dw_hdmi: Set cur_ctr to 0 always Sascha Hauer
2022-04-22  7:28 ` [PATCH v11 14/24] drm/rockchip: dw_hdmi: add default 594Mhz clk for 4K@60hz Sascha Hauer
2022-04-22  7:28 ` [PATCH v11 15/24] dt-bindings: display: rockchip: dw-hdmi: Make unwedge pinctrl optional Sascha Hauer
2022-04-22  7:28 ` [PATCH v11 16/24] arm64: dts: rockchip: rk356x: Add VOP2 nodes Sascha Hauer
2022-05-05  0:28   ` Heiko Stübner
2022-05-05  6:41     ` Sascha Hauer
2022-05-05  7:23       ` Heiko Stübner
2022-05-06  7:10         ` Sascha Hauer
2022-05-06  8:54           ` Heiko Stuebner
2022-04-22  7:28 ` [PATCH v11 17/24] arm64: dts: rockchip: rk356x: Add HDMI nodes Sascha Hauer
2022-05-05  8:45   ` Aw: " Frank Wunderlich
2022-05-05  9:05     ` Sascha Hauer
2022-04-22  7:28 ` [PATCH v11 18/24] arm64: dts: rockchip: rk3568-evb: Enable VOP2 and hdmi Sascha Hauer
2022-04-22  7:28 ` [PATCH v11 19/24] arm64: dts: rockchip: enable vop2 and hdmi tx on quartz64a Sascha Hauer
2022-04-22  7:28 ` [PATCH v11 20/24] arm64: dts: rockchip: enable vop2 and hdmi tx on rock-3a Sascha Hauer
2022-05-08 13:40   ` Piotr Oniszczuk
2022-05-08 16:53     ` Peter Geis
2022-05-08 17:36       ` Piotr Oniszczuk
2022-05-08 18:00         ` Peter Geis
2022-05-08 18:21           ` Piotr Oniszczuk
2022-05-09 16:00             ` Peter Geis
2022-05-09 19:49               ` Piotr Oniszczuk
2022-05-10  1:35                 ` Peter Geis
2022-05-10  7:29                   ` Piotr Oniszczuk
2022-05-10 12:08                     ` Peter Geis
2022-05-10 13:49                       ` Piotr Oniszczuk
2022-05-10 20:54                         ` Peter Geis
2022-05-10 22:49                           ` Peter Geis
2022-05-11 16:17                             ` Piotr Oniszczuk
2022-05-14 13:58               ` Piotr Oniszczuk
2022-06-24  8:29                 ` Piotr Oniszczuk
2022-06-24 12:40                   ` Peter Geis
2022-06-24 18:57                     ` Piotr Oniszczuk
2022-06-24 23:50                       ` Peter Geis
2022-06-25 13:18                         ` Piotr Oniszczuk
2022-06-25 14:00                           ` Peter Geis
2022-06-25 15:31                             ` Piotr Oniszczuk
2022-07-10 17:01                               ` Piotr Oniszczuk
2022-07-11 10:41                               ` Robin Murphy
2022-07-11 11:04                                 ` Piotr Oniszczuk
2022-07-11 11:34                                   ` Robin Murphy
2022-05-12 12:17       ` Robin Murphy
2022-05-12 13:01         ` Peter Geis
2022-04-22  7:28 ` [PATCH v11 21/24] drm/rockchip: Make VOP driver optional Sascha Hauer
2022-04-22  7:28 ` [PATCH v11 22/24] drm: rockchip: Add VOP2 driver Sascha Hauer
2022-04-22  7:28 ` [PATCH v11 23/24] dt-bindings: display: rockchip: Add binding for VOP2 Sascha Hauer
2022-04-22  7:28 ` [PATCH v11 24/24] dt-bindings: display: rockchip: dw-hdmi: fix ports description Sascha Hauer
2022-04-25 12:34 ` [PATCH v11 00/24] drm/rockchip: RK356x VOP2 support Michael Riesch
2022-04-25 14:48 ` Daniel Stone
2022-05-03  9:12 ` (subset) " Heiko Stuebner
2022-05-03  9:26 ` Heiko Stuebner
2022-05-03  9:29 ` Heiko Stuebner
2022-05-03 11:02 ` Heiko Stuebner
2022-05-04 12:08 ` Heiko Stuebner
2022-05-17 18:22 ` Heiko Stuebner
2022-05-17 18:27 ` Heiko Stuebner
2022-05-20 10:02   ` Maya Matuszczyk
2022-05-20 10:12     ` Sascha Hauer
2022-05-20 11:56       ` Peter Geis
2022-05-20 12:15         ` Maya Matuszczyk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220422072841.2206452-12-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=andy.yan@rock-chips.com \
    --cc=benjamin.gaignard@collabora.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dianders@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=heiko@sntech.de \
    --cc=hjc@rock-chips.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=michael.riesch@wolfvision.net \
    --cc=pgwipeout@gmail.com \
    --cc=ykk@rock-chips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).