Skip to contentSkip to conversation

drm/meson: add HDMI support for GXLX2

RFC PATCH New Zinan Zhou 1 participant 3 messages Jul 18

Subsystems (5)
lore
Share & tools
lore

Zinan Zhou

author
#0 lore raw

cover drm/meson: add HDMI support for GXLX2

This RFC adds HDMI transmitter support for the Amlogic GXLX2 family, observed as an S905L3 (CPU major ID 0x2a) in a FiberHome HG680-LC set-top box.

GXLX2 is unusual in that the display pipeline, clocks and HDMI PHY follow the older GXL path, while the HDMI controller register interface is directly mapped: DWC registers are byte-addressed from 0xda800000 and TOP registers are 32-bit registers at 0xda808000 + index * 4. The existing G12A access callbacks implement this layout, but using all G12A match data would select the wrong PHY initialization for GXLX2.

Patch 1 proposes a dedicated amlogic,meson-gxlx2-dw-hdmi compatible without a meson-gx-dw-hdmi fallback. Patch 2 adds dedicated match data combining direct register callbacks with GXL PHY behavior. It also handles the GXLX2 value for the 297 MHz PHY bucket and adds the compatible to the Meson DRM component match list.

This RFC depends on the separately posted common Meson DW-HDMI regmap fix:

drm/meson: constrain the DW-HDMI regmap range
https://lore.kernel.org/all/[email protected]/

That formal bug-fix patch bounds register iteration below the directly mapped TOP block and prevents the legacy 16-bit indirect interface from wrapping. It is intentionally not part of this RFC so it can be reviewed and merged without waiting for agreement on the GXLX2 DT ABI.

I would particularly appreciate feedback on two DT ABI questions:

1. Is amlogic,meson-gxlx2-dw-hdmi the appropriate block compatible name?
2. Should the DWC and TOP windows be represented as one contiguous MMIO resource, as in this RFC, or as two named resources?

Evidence and disclosure:

- The GXLX2 addresses and 297 MHz value are factual results of analysis of the HG680-LC vendor kernel. Firmware SHA-256 and focused behavioral evidence can be supplied if useful, but no firmware, kallsyms dump or disassembly is part of this submission.
- Public Amlogic-derived GPL source documents the ordinary GXL 2.97 Gbps values and public GPL-2.0+/MIT source documents the same direct DWC/TOP access mechanism used on later SoCs. The implementation here does not copy a vendor function body.

Testing:

- An equivalent Linux 6.6.18 implementation boots from eMMC on the HG680-LC.
- 1920x1080 HDMI video was physically verified on an LG 27GL850.
- Two-channel HDMI LPCM through the display and analog stereo audio were physically verified.
- The downstream 6.12 port boots from eMMC with working Ethernet/SSH and has physically verified 1920x1080@60 video and HDMI LPCM.
- With the generic Meson non-CEA mode-range change already present in current mainline, [email protected] video and HDMI LPCM were physically verified on the display's native timing.
- The RFC port builds on arm64 and its binding passes dt_binding_check.
- 3840x2160 at 30 Hz has not yet been physically tested. That test is required before a non-RFC PATCH v1 because it exercises the GXLX2-specific 297 MHz branch. It is not a blocker for the verified 1080p/1440p use case.
- No other GXLX2 board has been tested yet.

The initial RFC intentionally contains no board DTS. A downstream-only HG680-LC DTS is being kept as DO NOT MERGE until the compatible and resource model have received initial feedback.

Assisted-by Codex:gpt-5.6-sol

Zinan Zhou (2):
dt-bindings: display: meson-dw-hdmi: add GXLX2 compatible drm/meson: add GXLX2 HDMI register support

 .../display/amlogic,meson-dw-hdmi.yaml        |  7 ++--
 drivers/gpu/drm/meson/meson_drv.c             |  1 +
 drivers/gpu/drm/meson/meson_dw_hdmi.c         | 33 ++++++++++++++++---
 3 files changed, 34 insertions(+), 7 deletions(-)

base-commit: b0a652436b892eb9a036a031b33099dca036faaa
prerequisite-patch-id: 0a689485bbc3c1d77d52aeee0b81e4943d1e904a

Signature · 1 line
2.43.0
author
#1 lore raw

RFC PATCH 1/2 dt-bindings: display: meson-dw-hdmi: add GXLX2 compatible

The GXLX2 HDMI transmitter uses the byte-addressed DesignWare controller registers and directly mapped TOP window also present on G12A. Its display pipeline and HDMI PHY programming remain GXL-like, however.

Add a dedicated compatible with no fallback. The generic meson-gx-dw-hdmi interface uses indirect address/data registers and cannot operate this hardware, while meson-g12a-dw-hdmi would select incompatible PHY initialization values.

The one-resource representation is proposed for RFC review; DWC and TOP occupy one contiguous MMIO range on the tested HG680-LC.

Assisted-by Codex:gpt-5.6-sol
---
 .../devicetree/bindings/display/amlogic,meson-dw-hdmi.yaml | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.yaml +5 -2
index 416fe263ac92..4a17eccabea9 100644
@@ -29,8 +29,10 @@ description: |
   The HDMI TOP block only supports HPD sensing.
   The Synopsys HDMI Controller interrupt is routed through the
   TOP Block interrupt.
-  Communication to the TOP Block and the Synopsys HDMI Controller is done
-  via a pair of dedicated addr+read/write registers.
+  Communication with the TOP Block and the Synopsys HDMI Controller uses a pair
+  of dedicated address/data registers on GXBB, GXL and GXM. GXLX2 and G12A
+  instead expose byte-addressed controller registers and a directly mapped TOP
+  window.
   The HDMI PHY is configured by registers in the HHI register block.
 
   Pixel data arrives in "4:4:4" format from the VENC block and the VPU HDMI mux
@@ -54,6 +56,7 @@ properties:
               - amlogic,meson-gxm-dw-hdmi # GXM (S912)
           - const: amlogic,meson-gx-dw-hdmi
       - enum:
+          - amlogic,meson-gxlx2-dw-hdmi # GXLX2 (S905L3)
           - amlogic,meson-g12a-dw-hdmi # G12A (S905X2, S905Y2, S905D2)
 
   reg:
Signature · 1 line
2.43.0
author
#2 lore raw

RFC PATCH 2/2 drm/meson: add GXLX2 HDMI register support

In reply to Zinan Zhou

GXLX2 combines a GXL-like display pipeline and HDMI PHY with directly mapped DesignWare and TOP registers. Reusing the indirect GX callbacks returns an invalid HDMI controller ID and prevents the HDMI component from binding.

Add GXLX2 match data using the existing direct register callbacks, while retaining the GXL PHY initialization values. Do not enable APB3 fail-on-error through the legacy indirect control-register offsets for a direct-register device. Add the compatible to the VPU component match list and use the GXLX2-specific HHI_HDMI_PHY_CNTL0 value for the 297 MHz pixel-clock bucket.

The register layout and the 297 MHz value were determined by analysis of the HG680-LC vendor kernel. Public Amlogic-derived source independently documents the direct access mechanism and the ordinary GXL PHY values; no vendor code is copied by this change.

An equivalent Linux 6.6 implementation was tested on an HG680-LC with 1080p HDMI video and two-channel HDMI audio. The Linux 6.12 port boots from eMMC with working Ethernet, 1080p and native 1440p video, and two-channel HDMI audio. This port has passed arm64 compilation; 4K30 physical validation of the 297 MHz branch remains pending.

Assisted-by Codex:gpt-5.6-sol
---
 drivers/gpu/drm/meson/meson_drv.c     |  1 +
 drivers/gpu/drm/meson/meson_dw_hdmi.c | 33 +++++++++++++++++++++++----
 2 files changed, 29 insertions(+), 5 deletions(-)
drivers/gpu/drm/meson/meson_drv.c +1 -0
index 49ff9f1f16d3..5c136743e60c 100644
@@ -469,6 +469,7 @@ static void meson_drv_shutdown(struct platform_device *pdev)
 static const struct of_device_id components_dev_match[] = {
 	{ .compatible = "amlogic,meson-gxbb-dw-hdmi" },
 	{ .compatible = "amlogic,meson-gxl-dw-hdmi" },
+	{ .compatible = "amlogic,meson-gxlx2-dw-hdmi" },
 	{ .compatible = "amlogic,meson-gxm-dw-hdmi" },
 	{ .compatible = "amlogic,meson-g12a-dw-hdmi" },
 	{}
drivers/gpu/drm/meson/meson_dw_hdmi.c +28 -5
index 1004108fb7ca..f02d6a513dd3 100644
@@ -136,6 +136,8 @@ struct meson_dw_hdmi_data {
 				     unsigned int addr, unsigned int data);
 	u32 cntl0_init;
 	u32 cntl1_init;
+	u32 phy_cntl0_3g;
+	bool uses_direct_regs;
 };
 
 struct meson_dw_hdmi {
@@ -287,7 +289,9 @@ static void meson_hdmi_phy_setup_mode(struct meson_dw_hdmi *dw_hdmi,
 	/* For 420, pixel clock is half unlike venc clock */
 	if (mode_is_420) pixel_clock /= 2;
 
-	if (dw_hdmi_is_compatible(dw_hdmi, "amlogic,meson-gxl-dw-hdmi") ||
+	if (dw_hdmi_is_compatible(dw_hdmi,
+				  "amlogic,meson-gxlx2-dw-hdmi") ||
+	    dw_hdmi_is_compatible(dw_hdmi, "amlogic,meson-gxl-dw-hdmi") ||
 	    dw_hdmi_is_compatible(dw_hdmi, "amlogic,meson-gxm-dw-hdmi")) {
 		if (pixel_clock >= 371250) {
 			/* 5.94Gbps, 3.7125Gbps */
@@ -295,7 +299,8 @@ static void meson_hdmi_phy_setup_mode(struct meson_dw_hdmi *dw_hdmi,
 			regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL3, 0x2136315b);
 		} else if (pixel_clock >= 297000) {
 			/* 2.97Gbps */
-			regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL0, 0x33303382);
+			regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL0,
+				     dw_hdmi->data->phy_cntl0_3g);
 			regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL3, 0x2036315b);
 		} else if (pixel_clock >= 148500) {
 			/* 1.485Gbps */
@@ -586,6 +591,7 @@ static const struct meson_dw_hdmi_data meson_dw_hdmi_gxl_data = {
 	.dwc_write = dw_hdmi_dwc_write,
 	.cntl0_init = 0x0,
 	.cntl1_init = PHY_CNTL1_INIT,
+	.phy_cntl0_3g = 0x33303382,
 };
 
 static const struct meson_dw_hdmi_data meson_dw_hdmi_g12a_data = {
@@ -595,6 +601,19 @@ static const struct meson_dw_hdmi_data meson_dw_hdmi_g12a_data = {
 	.dwc_write = dw_hdmi_g12a_dwc_write,
 	.cntl0_init = 0x000b4242, /* Bandgap */
 	.cntl1_init = PHY_CNTL1_INIT,
+	.uses_direct_regs = true,
+};
+
+/* GXLX2 uses the direct register layout with the older GXL PHY setup. */
+static const struct meson_dw_hdmi_data meson_dw_hdmi_gxlx2_data = {
+	.top_read = dw_hdmi_g12a_top_read,
+	.top_write = dw_hdmi_g12a_top_write,
+	.dwc_read = dw_hdmi_g12a_dwc_read,
+	.dwc_write = dw_hdmi_g12a_dwc_write,
+	.cntl0_init = 0x0,
+	.cntl1_init = PHY_CNTL1_INIT,
+	.phy_cntl0_3g = 0x33353382,
+	.uses_direct_regs = true,
 };
 
 static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi)
@@ -612,8 +631,8 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi)
 	reset_control_reset(meson_dw_hdmi->hdmitx_ctrl);
 	reset_control_reset(meson_dw_hdmi->hdmitx_phy);
 
-	/* Enable APB3 fail on error */
-	if (!meson_vpu_is_compatible(priv, VPU_COMPATIBLE_G12A)) {
+	/* The APB3 control registers exist only with the indirect interface. */
+	if (!meson_dw_hdmi->data->uses_direct_regs) {
 		writel_bits_relaxed(BIT(15), BIT(15),
 				    meson_dw_hdmi->hdmitx + HDMITX_TOP_CTRL_REG);
 		writel_bits_relaxed(BIT(15), BIT(15),
@@ -769,7 +788,9 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
 	dw_plat_data->disable_cec = true;
 	dw_plat_data->output_port = 1;
 
-	if (dw_hdmi_is_compatible(meson_dw_hdmi, "amlogic,meson-gxl-dw-hdmi") ||
+	if (dw_hdmi_is_compatible(meson_dw_hdmi,
+				  "amlogic,meson-gxlx2-dw-hdmi") ||
+	    dw_hdmi_is_compatible(meson_dw_hdmi, "amlogic,meson-gxl-dw-hdmi") ||
 	    dw_hdmi_is_compatible(meson_dw_hdmi, "amlogic,meson-gxm-dw-hdmi") ||
 	    dw_hdmi_is_compatible(meson_dw_hdmi, "amlogic,meson-g12a-dw-hdmi"))
 		dw_plat_data->use_drm_infoframe = true;
@@ -854,6 +875,8 @@ static const struct of_device_id meson_dw_hdmi_of_table[] = {
 	  .data = &meson_dw_hdmi_gxl_data },
 	{ .compatible = "amlogic,meson-gxm-dw-hdmi",
 	  .data = &meson_dw_hdmi_gxl_data },
+	{ .compatible = "amlogic,meson-gxlx2-dw-hdmi",
+	  .data = &meson_dw_hdmi_gxlx2_data },
 	{ .compatible = "amlogic,meson-g12a-dw-hdmi",
 	  .data = &meson_dw_hdmi_g12a_data },
 	{ }
Signature · 1 line
2.43.0