dt-bindings: display: bridge: ldb: Document nxp, enable-termination-resistor
Subsystems (4)
PATCH RESEND v2 1/2 dt-bindings: display: bridge: ldb: Document nxp, enable-termination-resistor
Document the optional nxp,enable-termination-resistor property for the i.MX LVDS display bridge.
This boolean property indicates that the built-in 100 Ohm termination resistor on the LVDS output is enabled. It is controlled via the HS_EN bit in the LVDS_CTRL register. Enabling the resistor can improve LVDS signal quality and may prevent visual artifacts on some boards, but increases the power consumption.
---
Changes since v1:
- Change the property name to nxp,enable-termination-resistor (Frank).
.../devicetree/bindings/display/bridge/fsl,ldb.yaml | 9 +++++++++ 1 file changed, 9 insertions(+)
Documentation/devicetree/bindings/display/bridge/fsl,ldb.yaml +9 -0
@@ -35,6 +35,15 @@ properties: - const: ldb - const: lvds + nxp,enable-termination-resistor: + type: boolean + description: + Indicates that the built-in 100 Ohm termination resistor on the LVDS + output is enabled. This property is optional and controlled via the + HS_EN bit in the LVDS_CTRL register. Enabling it can improve signal + quality and prevent visual artifacts on some boards, but increases + power consumption. + ports: $ref: /schemas/graph.yaml#/properties/ports
Signature · 1 line
2.34.1
PATCH RESEND v2 2/2 drm/bridge: fsl-ldb: Allow the termination resistor to be enabled
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.
---
Changes since v1:
- Change the property name to nxp,enable-termination-resistor (Frank).
drivers/gpu/drm/bridge/fsl-ldb.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/gpu/drm/bridge/fsl-ldb.c +9 -0
@@ -92,6 +92,7 @@ struct fsl_ldb {const struct fsl_ldb_devdata *devdata;bool ch0_enabled;bool ch1_enabled; +bool termination_resistor; };static bool fsl_ldb_is_dual (const struct fsl_ldb *fsl_ldb)
@@ -212,6 +213,10 @@ 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 ; + + reg &= ~LVDS_CTRL_HS_EN ; +if (fsl_ldb->termination_resistor) + reg |=LVDS_CTRL_HS_EN ;regmap_write (fsl_ldb->regmap, fsl_ldb->devdata->lvds_ctrl, reg);/* Wait for VBG to stabilize. */
@@ -292,6 +297,7 @@ static const struct drm_bridge_funcs funcs = {static int fsl_ldb_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev; +struct device_node *np = dev->of_node;struct device_node *panel_node;struct device_node *remote1, *remote2;struct drm_panel *panel;
@@ -340,6 +346,9 @@ static int fsl_ldb_probe(struct platform_device *pdev)if (IS_ERR (panel))return PTR_ERR (panel); +if (of_property_present (np,"nxp,enable-termination-resistor" )) + fsl_ldb->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);
Signature · 1 line
2.34.1
Re: [PATCH RESEND v2 2/2] drm/bridge: fsl-ldb: Allow the termination resistor to be enabled
Hi Liu and Frank,
Quoted 12 lines · Fabio Estevam
The LVDS Control Register (
LVDS_CTRL) register has anHS_ENbit that allows the 100 Ohm termination resistor in the chip to be enabled.Add support to setting the
HS_ENbit 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.
Quoted 4 lines
Signed-off-by Fabio Estevam <[email protected]>---
Changes since v1:
- Change the property name to nxp,enable-termination-resistor (Frank).
Could you please help review this patch?
Thanks
Quoted 48 lines
drivers/gpu/drm/bridge/fsl-ldb.c | 9 +++++++++ 1 file changed, 9 insertions(+)drivers/gpu/drm/bridge/fsl-ldb.c +9
-1@@ -92,6 +92,7 @@ struct fsl_ldb {const struct fsl_ldb_devdata *devdata;bool ch0_enabled;bool ch1_enabled; +bool termination_resistor; };static bool fsl_ldb_is_dual (const struct fsl_ldb *fsl_ldb)@@ -212,6 +213,10 @@ 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 ; + + reg &= ~LVDS_CTRL_HS_EN ; +if (fsl_ldb->termination_resistor) + reg |=LVDS_CTRL_HS_EN ;regmap_write (fsl_ldb->regmap, fsl_ldb->devdata->lvds_ctrl, reg);/* Wait for VBG to stabilize. */ @@ -292,6 +297,7 @@ static const struct drm_bridge_funcs funcs = {static int fsl_ldb_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev; +struct device_node *np = dev->of_node;struct device_node *panel_node;struct device_node *remote1, *remote2;struct drm_panel *panel;@@ -340,6 +346,9 @@ static int fsl_ldb_probe(struct platform_device *pdev)if (IS_ERR (panel))return PTR_ERR (panel); +if (of_property_present (np,"nxp,enable-termination-resistor" )) + fsl_ldb->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); --2.34.1
Re: [PATCH RESEND v2 2/2] drm/bridge: fsl-ldb: Allow the termination resistor to be enabled
In reply to Fabio EstevamHi Fabio,
Quoted 24 lines · Fabio Estevam
The LVDS Control Register (
LVDS_CTRL) register has anHS_ENbit that allows the 100 Ohm termination resistor in the chip to be enabled.Add support to setting the
HS_ENbit 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 <[email protected]>---
Changes since v1:
- Change the property name to nxp,enable-termination-resistor (Frank).drivers/gpu/drm/bridge/fsl-ldb.c | 9 +++++++++ 1 file changed, 9 insertions(+)drivers/gpu/drm/bridge/fsl-ldb.c +0
-0
drivers/gpu/drm/bridge/fsl-ldb.c struct fsl_ldb { · line 95
Quoted 4 lines
drivers/gpu/drm/bridge/fsl-ldb.c +1
-0@@ -92,6 +92,7 @@ struct fsl_ldb {const struct fsl_ldb_devdata *devdata;bool ch0_enabled;bool ch1_enabled; +bool termination_resistor;
Nit: To make this flag a bit more readable, I think it'd be better to rename it to something like termination_resistor_en or use_termination_resistor.
drivers/gpu/drm/bridge/fsl-ldb.c static void fsl_ldb_atomic_enable(struct drm_bridge *bridge, · line 217
Quoted 9 lines
drivers/gpu/drm/bridge/fsl-ldb.c +2
-0};static bool fsl_ldb_is_dual (const struct fsl_ldb *fsl_ldb)@@ -212,6 +213,10 @@ 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 ; + + reg &= ~LVDS_CTRL_HS_EN ;
This is redundant since reg is set without the LVDS_CTRL_HS_EN bit just beforehand.
drivers/gpu/drm/bridge/fsl-ldb.c static const struct drm_bridge_funcs funcs = { · line 300
Quoted 10 lines
drivers/gpu/drm/bridge/fsl-ldb.c +3
-0+if (fsl_ldb->termination_resistor) + reg |=LVDS_CTRL_HS_EN ;regmap_write (fsl_ldb->regmap, fsl_ldb->devdata->lvds_ctrl, reg);/* Wait for VBG to stabilize. */ @@ -292,6 +297,7 @@ static const struct drm_bridge_funcs funcs = {static int fsl_ldb_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev; +struct device_node *np = dev->of_node;
'dev->of_node' is already directly used by function calls in fsl_ldb_probe(), so I'd suggest to keep using it, instead of introducing 'np'.
Quoted 13 lines
drivers/gpu/drm/bridge/fsl-ldb.c +3
-0struct device_node *panel_node;struct device_node *remote1, *remote2;struct drm_panel *panel;@@ -340,6 +346,9 @@ static int fsl_ldb_probe(struct platform_device *pdev)if (IS_ERR (panel))return PTR_ERR (panel); +if (of_property_present (np,"nxp,enable-termination-resistor" )) + fsl_ldb->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);
Signature · 2 lines
Regards, Liu Ying
Re: [PATCH RESEND v2 1/2] dt-bindings: display: bridge: ldb: Document nxp,enable-termination-resistor
In reply to Fabio EstevamHi Fabio,
Quoted 24 lines · Fabio Estevam
Document the optional nxp,enable-termination-resistor property for the i.MX LVDS display bridge.
This boolean property indicates that the built-in 100 Ohm termination resistor on the LVDS output is enabled. It is controlled via the
HS_ENbit in theLVDS_CTRLregister. Enabling the resistor can improve LVDS signal quality and may prevent visual artifacts on some boards, but increases the power consumption.Signed-off-by Fabio Estevam <[email protected]>Reviewed-by Krzysztof Kozlowski <[email protected]>---
Changes since v1:
- Change the property name to nxp,enable-termination-resistor (Frank)..../devicetree/bindings/display/bridge/fsl,ldb.yaml | 9 +++++++++ 1 file changed, 9 insertions(+)Documentation/devicetree/bindings/display/bridge/fsl,ldb.yaml +0
-0@@ -35,6 +35,15 @@ properties: - const: ldb
Documentation/devicetree/bindings/display/bridge/fsl,ldb.yaml properties: · line 45
Quoted 10 lines
Documentation/devicetree/bindings/display/bridge/fsl,ldb.yaml +8
-0- const: lvds + nxp,enable-termination-resistor: + type: boolean + description: + Indicates that the built-in 100 Ohm termination resistor on the LVDS + output is enabled. This property is optional and controlled via the + HS_EN bit in the LVDS_CTRL register. Enabling it can improve signal + quality and prevent visual artifacts on some boards, but increases + power consumption.
i.MX6SX doesn't have the LVDS_CTRL register and the HS_EN bit, so this property should be limited to i.MX8MP LDB and i.MX93 LDB.
Quoted 4 lines
Documentation/devicetree/bindings/display/bridge/fsl,ldb.yaml +1
-0+ ports: $ref: /schemas/graph.yaml#/properties/ports
Signature · 2 lines
Regards, Liu Ying