drm/bridge: Add Lontium LT9721 HDMI to eDP bridge support
Subsystems (4)
cover drm/bridge: Add Lontium LT9721 HDMI to eDP bridge support
This series adds Device Tree binding documentation and a DRM bridge driver for the Lontium LT9721 HDMI 1.4 to 1/2/4-lane eDP 1.4 bridge chip.
The LT9721 accepts an HDMI 1.4 TMDS video stream (up to 3.4 Gbps/lane) and drives a 1-, 2-, or 4-lane eDP 1.4 output at RBR (1.62 Gbps) or HBR (2.7 Gbps) per lane, controlled over a paged I2C register interface.
Patch 1 documents the "lontium,lt9721" binding, including power supplies, reset GPIO, OF graph input/output endpoints with lane/polarity remapping, and the DisplayPort AUX bus.
Patch 2 implements the atomic DRM bridge driver, registering the DP AUX channel (supporting both Native AUX for DPCD and I2C-over-AUX for EDID) and populating downstream eDP panels via devm_of_dp_aux_populate_bus().
Hardware-tested on an NXP i.MX8MP-based platform on a v5.10 kernel (driving a 2-lane 1080p eDP panel with dynamic EDID mode discovery over DP AUX), and forward-ported and build-/schema-tested against linux-next.
Gianfranco Mariotti (2):
dt-bindings: display: bridge: Add Lontium LT9721 HDMI to eDP bridge drm/bridge: Add Lontium LT9721 HDMI to eDP bridge driver
.../display/bridge/lontium,lt9721.yaml | 169 ++ MAINTAINERS | 8 + drivers/gpu/drm/bridge/Kconfig | 16 + drivers/gpu/drm/bridge/Makefile | 1 + drivers/gpu/drm/bridge/lontium-lt9721.c | 1640 +++++++++++++++++ 5 files changed, 1834 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/lontium,lt9721.yaml create mode 100644 drivers/gpu/drm/bridge/lontium-lt9721.c
Signature · 1 line
2.25.1
PATCH 1/2 dt-bindings: display: bridge: Add Lontium LT9721 HDMI to eDP bridge
Document the Lontium LT9721 HDMI 1.4 to 1/2/4-lane eDP 1.4 bridge device tree binding, including power supplies, reset GPIO, OF graph input/output endpoints with lane/polarity remapping, and the DP AUX bus.
--- .../display/bridge/lontium,lt9721.yaml | 169 ++++++++++++++++++ MAINTAINERS | 7 + 2 files changed, 176 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/lontium,lt9721.yaml
Documentation/devicetree/bindings/display/bridge/lontium,lt9721.yaml new file +169 -0
@@ -0,0 +1,169 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/bridge/lontium,lt9721.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Lontium LT9721 HDMI 1.4 to eDP 1.4 Bridge + +maintainers: + - Gianfranco Mariotti <[email protected]> + +description: + The Lontium LT9721 is a bridge device that converts an HDMI 1.4 input + (up to 3.4 Gbps/lane) to a 1-, 2-, or 4-lane eDP 1.4 output (1.62 Gbps + RBR or 2.7 Gbps HBR per lane), controlled over I2C. + +properties: + compatible: + const: lontium,lt9721 + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + reset-gpios: + maxItems: 1 + description: Active-low GPIO connected to the RST_N pin. + + vcc-supply: + description: Regulator for 3.3V analog and I/O power (VCC33_RX, VCC33_TX). + + vdd-supply: + description: Regulator for 1.8V analog and core power (VCC18_RX, VCC18_TX, VDD). + + aux-bus: + $ref: /schemas/display/dp-aux-bus.yaml# + + ports: + $ref: /schemas/graph.yaml#/properties/ports + + properties: + port@0: + $ref: /schemas/graph.yaml#/$defs/port-base + unevaluatedProperties: false + description: HDMI 1.4 input port. + + properties: + endpoint: + $ref: /schemas/media/video-interfaces.yaml# + unevaluatedProperties: false + + properties: + lane-polarities: + minItems: 4 + maxItems: 4 + items: + enum: [0, 1] + description: + TMDS pair P/N polarity inversion for clock and data lanes. + The LT9721 applies P/N inversion globally across all four + TMDS pairs, so all entries must match. + + port@1: + $ref: /schemas/graph.yaml#/$defs/port-base + unevaluatedProperties: false + description: eDP 1.4 output port. + + properties: + endpoint: + $ref: /schemas/media/video-interfaces.yaml# + unevaluatedProperties: false + + properties: + data-lanes: + oneOf: + - minItems: 1 + maxItems: 1 + items: + enum: [0, 1, 2, 3] + - minItems: 2 + maxItems: 2 + uniqueItems: true + items: + enum: [0, 1, 2, 3] + - minItems: 4 + maxItems: 4 + uniqueItems: true + items: + enum: [0, 1, 2, 3] + + lane-polarities: + minItems: 1 + maxItems: 4 + items: + enum: [0, 1] + + dependencies: + lane-polarities: [data-lanes] + + required: + - port@0 + - port@1 + +required: + - compatible + - reg + - vcc-supply + - vdd-supply + - ports + +additionalProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + bridge@33 { + compatible = "lontium,lt9721"; + reg = <0x33>; + reset-gpios = <&gpio1 1 GPIO_ACTIVE_LOW>; + vcc-supply = <®_3v3>; + vdd-supply = <®_1v8>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + lt9721_in: endpoint { + remote-endpoint = <&hdmi_out>; + lane-polarities = <1 1 1 1>; + }; + }; + + port@1 { + reg = <1>; + + lt9721_out: endpoint { + remote-endpoint = <&edp_panel_in>; + data-lanes = <0 1>; + }; + }; + }; + + aux-bus { + panel { + compatible = "edp-panel"; + power-supply = <®_panel_3v3>; + backlight = <&backlight>; + no-hpd; + + port { + edp_panel_in: endpoint { + remote-endpoint = <<9721_out>; + }; + }; + }; + }; + }; + }; +...
MAINTAINERS +7 -0
@@ -15790,6 +15790,13 @@ S: Maintained F: Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml F: drivers/gpu/drm/bridge/lontium-lt8912b.c +LONTIUM LT9721 HDMI TO EDP BRIDGE +M: Gianfranco Mariotti <[email protected]> +L: [email protected] +S: Maintained +T: git https://gitlab.freedesktop.org/drm/misc/kernel.git +F: Documentation/devicetree/bindings/display/bridge/lontium,lt9721.yaml + LOONGARCH M: Huacai Chen <[email protected]> R: WANG Xuerui <[email protected]>
Signature · 1 line
2.25.1
PATCH 2/2 drm/bridge: Add Lontium LT9721 HDMI to eDP bridge driver
In reply to Gianfranco MariottiAdd a DRM bridge driver for the Lontium LT9721 HDMI 1.4 to 1/2/4-lane eDP 1.4 bridge chip.
The driver supports:
- Atomic DRM bridge chain integration (DRM_BRIDGE_ATTACH_NO_CONNECTOR)
- DP AUX channel registration (Native AUX for DPCD and I2C-over-AUX for EDID) with DP AUX bus panel population via devm_of_dp_aux_populate_bus()
- 1-, 2-, and 4-lane eDP 1.4 link training at RBR (1.62 Gbps) and HBR (2.7 Gbps) with per-lane voltage swing and pre-emphasis adjustment
- HDMI 1.4 RX CDR, adaptive equalization, PLL lock, and RGB/YCbCr format handling
- Standard OF graph data-lanes and lane-polarities remapping on RX and TX ports, plus power supply and reset sequencing
--- MAINTAINERS | 1 + drivers/gpu/drm/bridge/Kconfig | 16 + drivers/gpu/drm/bridge/Makefile | 1 + drivers/gpu/drm/bridge/lontium-lt9721.c | 1640 +++++++++++++++++++++++ 4 files changed, 1658 insertions(+) create mode 100644 drivers/gpu/drm/bridge/lontium-lt9721.c
MAINTAINERS +1 -0
@@ -15796,6 +15796,7 @@ L: [email protected] S: Maintained T: git https://gitlab.freedesktop.org/drm/misc/kernel.git F: Documentation/devicetree/bindings/display/bridge/lontium,lt9721.yaml +F: drivers/gpu/drm/bridge/lontium-lt9721.c LOONGARCH M: Huacai Chen <[email protected]>
drivers/gpu/drm/bridge/Kconfig +16 -0
@@ -191,6 +191,22 @@ config DRM_LONTIUM_LT9611UXC HDMI signals Please say Y if you have such hardware. +config DRM_LONTIUM_LT9721 + tristate "Lontium LT9721 HDMI/eDP bridge" + depends on OF + select DRM_DISPLAY_DP_AUX_BUS + select DRM_DISPLAY_DP_HELPER + select DRM_DISPLAY_HELPER + select DRM_KMS_HELPER + select DRM_PANEL_BRIDGE + select REGMAP_I2C + help + Driver for Lontium LT9721 HDMI 1.4 to eDP 1.4 bridge chip. + Please say Y if you have such hardware. + + Say M here if you want to support this hardware as a module. + The module will be named "lontium-lt9721". + config DRM_LONTIUM_LT8713SX tristate "Lontium LT8713SX DP MST bridge" depends on OF
drivers/gpu/drm/bridge/Makefile +1 -0
@@ -17,6 +17,7 @@ obj-$(CONFIG_DRM_LONTIUM_LT8912B) += lontium-lt8912b.o obj-$(CONFIG_DRM_LONTIUM_LT9211) += lontium-lt9211.o obj-$(CONFIG_DRM_LONTIUM_LT9611) += lontium-lt9611.o obj-$(CONFIG_DRM_LONTIUM_LT9611UXC) += lontium-lt9611uxc.o +obj-$(CONFIG_DRM_LONTIUM_LT9721) += lontium-lt9721.o obj-$(CONFIG_DRM_LONTIUM_LT8713SX) += lontium-lt8713sx.o obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o obj-$(CONFIG_DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW) += megachips-stdpxxxx-ge-b850v3-fw.o
drivers/gpu/drm/bridge/lontium-lt9721.c new file +1640 -0
1,640 lines not on this page · raw message
Signature · 1 line
2.25.1
[email protected]
AI reviewRe: [PATCH 2/2] drm/bridge: Add Lontium LT9721 HDMI to eDP bridge driver
Thank you for your contribution! Sashiko AI review found 4 potential issues to consider: - [High] drm/bridge: lt9721: refcount underflow on next_bridge in lt9721_link_panel() - [Medium] drm/bridge…
Thank you for your contribution! Sashiko AI review found 4 potential issues to consider:
- [High] drm/bridge: lt9721: refcount underflow on next_bridge in lt9721_link_panel()
- [Medium] drm/bridge: lt9721: off-by-one partial write count in lt9721_aux_transfer_i2c()
- [Low] drm/bridge: lt9721: missing DRM_BRIDGE_OP_DETECT for panels in lt9721_link_panel()
- [Low] drm/bridge: lt9721: positional initializer in lt9721_i2c_ids[] --
commit aa23cf54f8347a08ccdc8bd2c65d1c07c8f8ba0d
Author: Gianfranco Mariotti <[email protected]>
drm/bridge: Add Lontium LT9721 HDMI to eDP bridge driver
This commit adds a DRM bridge driver for the Lontium LT9721 HDMI 1.4 to 1/2/4-lane eDP 1.4 bridge chip.
Quoted 5 lines
drivers/gpu/drm/bridge/lontium-lt9721.c new file +0
-0
[ ... ]
Quoted 3 lines
drivers/gpu/drm/bridge/lontium-lt9721.c new file +3
-0+static ssize_t lt9721_aux_transfer_i2c (struct lt9721 *lt9721, +struct drm_dp_aux_msg *msg) +{
[ ... ]
Quoted 9 lines
drivers/gpu/drm/bridge/lontium-lt9721.c new file +9
-0+if (is_read) { + data_len =min_t (size_t, msg->size, rx_cnt -1 ); +for (i =0 ; i < data_len; i++) { + ret =regmap_read (lt9721->regmap, +LT9721_REG_AUX_SOFT_FIFO , &val); +if (ret) + goto out_drain; + buf[i] = val; + }
drivers/gpu/drm/bridge/lontium-lt9721.c line 649
Quoted 10 lines
drivers/gpu/drm/bridge/lontium-lt9721.c new file +10
-0+ ret = data_len; + }else if (rx_cnt >1 ) { +/* Partial write: sink returned count M (M + 1 bytes written) */ + ret =regmap_read (lt9721->regmap,LT9721_REG_AUX_SOFT_FIFO , + &val); +if (ret ==0 ) + ret =min_t (size_t, msg->size, val +1 ); + }else { + ret = msg->size; + }
[Severity: Medium]
Does this over-report partial I2C-over-AUX writes by one byte?
Unlike the 4-bit length field in the AUX request header, the reply data byte M returned by a DisplayPort sink on a short I2C write is already the exact number of bytes written (0 < M < msg->size). Returning val + 1 causes drm_dp_i2c_drain_msg() to advance msg.buffer by one unwritten byte on each partial write.
[ ... ]
Quoted 16 lines
drivers/gpu/drm/bridge/lontium-lt9721.c new file +16
-0+static enum drm_connector_status +lt9721_bridge_detect (struct drm_bridge *bridge, +struct drm_connector *connector) +{ +struct lt9721 *lt9721 =bridge_to_lt9721 (bridge); +unsigned int val =0 ; + +if (lt9721->is_panel) +return connector_status_connected; + +if (regmap_read (lt9721->regmap,LT9721_REG_HPD_STATUS , &val)) +return connector_status_unknown; + +return (val <9721_EDP_HPD_STATUS ) ? + connector_status_connected : connector_status_disconnected; +}
[ ... ]
Quoted 4 lines
drivers/gpu/drm/bridge/lontium-lt9721.c new file +4
-0+static int lt9721_link_panel (struct drm_dp_aux *aux) +{ +struct lt9721 *lt9721 =aux_to_lt9721 (aux); +struct device *dev = lt9721->dev;
drivers/gpu/drm/bridge/lontium-lt9721.c line 1526
Quoted 10 lines
drivers/gpu/drm/bridge/lontium-lt9721.c new file +10
-0+struct drm_bridge *next_bridge; + + next_bridge =devm_drm_of_get_bridge (dev, dev->of_node,1 ,0 ); +if (IS_ERR (next_bridge)) +return PTR_ERR (next_bridge); + +if (drm_bridge_is_panel (next_bridge)) + lt9721->is_panel = true; +else + lt9721->bridge.ops =DRM_BRIDGE_OP_DETECT |DRM_BRIDGE_OP_EDID ;
[Severity: Low]
Should DRM_BRIDGE_OP_DETECT also be set when drm_bridge_is_panel() is true? Without it, drm_bridge_connector_init() and drm_bridge_detect() never invoke lt9721_bridge_detect() for panels, leaving the lt9721->is_panel check unreachable and failing to override an upstream HDMI bridge's DRM_BRIDGE_OP_DETECT.
drivers/gpu/drm/bridge/lontium-lt9721.c line 1531
Quoted 5 lines
drivers/gpu/drm/bridge/lontium-lt9721.c new file +5
-0+ + lt9721->bridge.next_bridge = next_bridge; + +return devm_drm_bridge_add (dev, <9721->bridge); +}
[Severity: High]
Does assigning devm_drm_of_get_bridge() to lt9721->bridge.next_bridge underflow next_bridge->refcount when lt9721->bridge is freed?
__drm_bridge_free() unconditionally calls drm_bridge_put(bridge->next_bridge), so bridge.next_bridge requires an owned reference. devm_drm_of_get_bridge() does not return a reference for bridge.next_bridge to consume: for a panel, devm_drm_panel_bridge_add() already registers devm_drm_panel_bridge_release() to drop its reference on unbind, and for a non-panel bridge, drm_of_find_panel_or_bridge() returns an unreferenced pointer from of_drm_find_bridge(). On driver unbind or probe unwind, __drm_bridge_free() drops an extra reference and frees the downstream bridge prematurely.
Using of_drm_get_bridge_by_endpoint() (or taking a reference with drm_bridge_get()) would provide the reference that bridge.next_bridge expects.
[ ... ]
drivers/gpu/drm/bridge/lontium-lt9721.c line 1619
Quoted 4 lines
drivers/gpu/drm/bridge/lontium-lt9721.c new file +4
-0+static const struct i2c_device_id lt9721_i2c_ids[] = { + {"lt9721" }, + { } +};
[Severity: Low]
This isn't a bug, but new struct i2c_device_id entries should use named initializers ({ .name = "lt9721" }).
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2