]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/bridge: fsl-ldb: Allow the termination resistor to be enabled
authorFabio Estevam <festevam@nabladev.com>
Tue, 20 Jan 2026 23:19:30 +0000 (20:19 -0300)
committerLiu Ying <victor.liu@nxp.com>
Wed, 28 Jan 2026 03:23:20 +0000 (11:23 +0800)
The LVDS Control Register (LVDS_CTRL) register has an HS_EN bit that allows
the 100 Ohm termination resistor in the chip to be enabled.

Add support to setting the HS_EN bit when the optional property
"nxp,enable-termination-resistor" is present.

The motivation for introducing this property was a custom i.MX8MP board
that was showing visual artifacts. After enabling the 100 Ohm termination
resistor the LVDS signal quality improved causing the artifacts to
disappear.

Signed-off-by: Fabio Estevam <festevam@nabladev.com>
Reviewed-by: Liu Ying <victor.liu@nxp.com>
Signed-off-by: Liu Ying <victor.liu@nxp.com>
Link: https://lore.kernel.org/r/20260120231930.2782444-2-festevam@gmail.com
drivers/gpu/drm/bridge/fsl-ldb.c

index 5c3cf37200bcee1db285c97e2b463c9355ee6acb..7b71cde173e0ce0a61fe210e0002eba28091155c 100644 (file)
@@ -92,6 +92,7 @@ struct fsl_ldb {
        const struct fsl_ldb_devdata *devdata;
        bool ch0_enabled;
        bool ch1_enabled;
+       bool use_termination_resistor;
 };
 
 static bool fsl_ldb_is_dual(const struct fsl_ldb *fsl_ldb)
@@ -212,6 +213,9 @@ static void fsl_ldb_atomic_enable(struct drm_bridge *bridge,
        /* Program LVDS_CTRL */
        reg = LVDS_CTRL_CC_ADJ(2) | LVDS_CTRL_PRE_EMPH_EN |
              LVDS_CTRL_PRE_EMPH_ADJ(3) | LVDS_CTRL_VBG_EN;
+
+       if (fsl_ldb->use_termination_resistor)
+               reg |= LVDS_CTRL_HS_EN;
        regmap_write(fsl_ldb->regmap, fsl_ldb->devdata->lvds_ctrl, reg);
 
        /* Wait for VBG to stabilize. */
@@ -340,6 +344,9 @@ static int fsl_ldb_probe(struct platform_device *pdev)
        if (IS_ERR(panel))
                return PTR_ERR(panel);
 
+       if (of_property_present(dev->of_node, "nxp,enable-termination-resistor"))
+               fsl_ldb->use_termination_resistor = true;
+
        fsl_ldb->panel_bridge = devm_drm_panel_bridge_add(dev, panel);
        if (IS_ERR(fsl_ldb->panel_bridge))
                return PTR_ERR(fsl_ldb->panel_bridge);