[RFC PATCH v2 3/3] drm/meson: support direct HDMI register access on GXLX2
Zinan Zhou
zinan at mieulab.com
Sat Dec 5 07:13:17 PST 2026
The indirect GX accessors return an invalid DesignWare controller ID on
GXLX2 and prevent HDMI component binding. Select the direct G12A TOP and
controller accessors for GXLX2 and skip the indirect APB3 control writes
on controllers with that register layout. Select the GXLX2 legacy PHY
data for device trees that omit the PHY phandle.
Assisted-by: Codex:gpt-5.6-sol
Assisted-by: Codex:gpt-6
Signed-off-by: Zinan Zhou <zinan at mieulab.com>
---
drivers/gpu/drm/meson/meson_drv.c | 1 +
drivers/gpu/drm/meson/meson_dw_hdmi.c | 19 ++++++++++++++++---
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
index 5343323f404a19e063f96b25f01980483b235482..06693856d45401b2ed234564db6e9833865805d4 100644
--- a/drivers/gpu/drm/meson/meson_drv.c
+++ b/drivers/gpu/drm/meson/meson_drv.c
@@ -477,6 +477,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" },
{}
diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
index b54c85c21882e22698033b24a40c47f2718e17b5..0f43c1e2813d77dae5bc3c0a4d3c3328fc98bb95 100644
--- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
+++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
@@ -126,6 +126,7 @@ struct meson_dw_hdmi_data {
unsigned int addr);
void (*dwc_write)(struct meson_dw_hdmi *dw_hdmi,
unsigned int addr, unsigned int data);
+ bool uses_direct_regs;
enum meson_hdmi_phy_soc phy_soc; /* legacy PHY only */
};
@@ -507,12 +508,21 @@ static const struct meson_dw_hdmi_data meson_dw_hdmi_g12a_data = {
.top_write = dw_hdmi_g12a_top_write,
.dwc_read = dw_hdmi_g12a_dwc_read,
.dwc_write = dw_hdmi_g12a_dwc_write,
+ .uses_direct_regs = true,
.phy_soc = MESON_HDMI_PHY_G12A,
};
+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,
+ .uses_direct_regs = true,
+ .phy_soc = MESON_HDMI_PHY_GXLX2,
+};
+
static int meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi)
{
- struct meson_drm *priv = meson_dw_hdmi->priv;
int ret;
/* Reset HDMITX APB & TX & PHY */
@@ -520,8 +530,8 @@ static int 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 on 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),
@@ -699,6 +709,7 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
dw_plat_data->output_port = 1;
if (dw_hdmi_is_compatible(meson_dw_hdmi, "amlogic,meson-gxl-dw-hdmi") ||
+ dw_hdmi_is_compatible(meson_dw_hdmi, "amlogic,meson-gxlx2-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;
@@ -823,6 +834,8 @@ static const struct of_device_id meson_dw_hdmi_of_table[] = {
.data = &meson_dw_hdmi_gxbb_data },
{ .compatible = "amlogic,meson-gxl-dw-hdmi",
.data = &meson_dw_hdmi_gxl_data },
+ { .compatible = "amlogic,meson-gxlx2-dw-hdmi",
+ .data = &meson_dw_hdmi_gxlx2_data },
{ .compatible = "amlogic,meson-gxm-dw-hdmi",
.data = &meson_dw_hdmi_gxl_data },
{ .compatible = "amlogic,meson-g12a-dw-hdmi",
More information about the linux-amlogic
mailing list