Add Lontium LT7911EXC eDP to MIPI DSI bridge
Subsystems (4)
v8 cover Add Lontium LT7911EXC eDP to MIPI DSI bridge
From: Sunyun Yang <[email protected]>
The LT7911EXC is an I2C-controlled bridge that receives eDP1.4 and output mipi dsi. This series introduces:
- A device tree binding YAML file describing the hardware
- A new DRM bridge driver implementing the basic functionality
---
Change in v8:
- dt-binding:
- drm/bridge:
1. Protect firmware upgrade and DRM bridge callback paths with ocm_lock. [sashiko-bot]
2. Remove the hardware reset from the remove callback, and ensure that all hardware reset operations are protected by ocm_lock.
3. crc reconstruction explicitly casts each byte to u32 before shifting
4. The display configuration is handled by the firmware, and the MIPI DSI host registration issue has been fixed.
5. The batch register read/write operations have already been updated to include return value checking.
6. The dev_err_probe() used outside of probe context has been fixed.
- Link to v7: https://lore.kernel.org/lkml/[email protected]/
Change in v7:
- dt-binding:
1. fix commit message typos(Receiver、signal) [sashiko-bot]
2. remove the ambiguity caused by "signal/dual".
- drm/bridge:
1. using devm_regulator_get_enable avoids power leaks. [sashiko-bot]
2. set reset gpio is low after cutting off power in lt7911exc_remove function, avoid backpowering.
3. synchronous request_firmware() call cause a permanent probe failure if the driver is built-in, probe executes before the root filesystem is mounted, which would cause this to fail with -ENOENT, we have removed this functionality. Use trigger to upgrade.
4. add depends on I2C and select REGMAP_I2C in Kconfig.
5. add return value of devm_drm_bridge_add() in probe().
6. add directly header files (linux/slab.h, linux/delay.h, linux/regulator/consumer.h)
- Link to v6: https://lore.kernel.org/lkml/[email protected]/
Change in v6:
- dt-binding:
- drm/bridge:
1. use #define FW_FILE "Lontium/lt7911exc_fw.bin" to match linux-firmware
- Link to v5: https://lore.kernel.org/lkml/[email protected]/
Change in v5:
- dt-binding:
- drm/bridge:
1. Change "mipi" to "mipi dsi" in the commit message. [Dmitry]
2. Change "eDP/MIPI" to "eDP/MIPI DSI" in Kconfig.
- Link to v4: https://lore.kernel.org/lkml/[email protected]/
Change in v4:
- dt-binding:
1. Fix the missing spaces on the "subject". [Krzysztof]
2. Fix the error descriptions for port@0 and port@1.
- drm/bridge:
- Link to v3: https://lore.kernel.org/lkml/[email protected]/
Change in v3:
- dt-binding:
- drm/bridge:
1. already submit lt7911exc_fw.bin to linux-firmware. [Dmitry]
2. remove lt7911exc_remove function.
3. drop the "lontium, " in lt7911exc_i2c_table.
- Link to v2: https://lore.kernel.org/lkml/[email protected]/
Change in v2:
- dt-binding:
1. reset pins use active low. [Dmitry]
- drm/bridge:
1. use atomic_* callbacks. [Quentin]
2. fix the incorrect formatting and spaces.
3. add the required header files. [Dmitry]
4. remove "enabled" flag.
5. remove *fw from the lt7911exc struct.
6. .max_register and .range_max use actual range.
7. regulator use bulk interface.
8. use dev_err_probe, devm_mutex_init and devm_drm_bridge_add.
9. Replace GPL v2 with GPL.
- Link to v1: https://lore.kernel.org/lkml/[email protected]/
---
Sunyun Yang (2):
dt-bindings: bridge: Add Lontium LT7911EXC eDP to MIPI DSI bridge drm/bridge: Add Lontium LT7911EXC eDP to MIPI DSI bridge
.../display/bridge/lontium,lt7911exc.yaml | 89 +++ drivers/gpu/drm/bridge/Kconfig | 15 + drivers/gpu/drm/bridge/Makefile | 1 + drivers/gpu/drm/bridge/lontium-lt7911exc.c | 642 ++++++++++++++++++ 4 files changed, 747 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/lontium,lt7911exc.yaml create mode 100644 drivers/gpu/drm/bridge/lontium-lt7911exc.c
Signature · 1 line
2.34.1
PATCH v8 1/2 dt-bindings: bridge: Add Lontium LT7911EXC eDP to MIPI DSI bridge
From: Sunyun Yang <[email protected]>
This commit adds the device tree binding schema for the Lontium LT7911EXC. This device is an I2C-controlled bridge that converts eDP 1.4 input to MIPI DSI output.
--- .../display/bridge/lontium,lt7911exc.yaml | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/lontium,lt7911exc.yaml
Documentation/devicetree/bindings/display/bridge/lontium,lt7911exc.yaml new file +89 -0
@@ -0,0 +1,89 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/bridge/lontium,lt7911exc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Lontium LT7911EXC eDP to MIPI DSI Bridge + +maintainers: + - Sunyun Yang <[email protected]> + +properties: + compatible: + enum: + - lontium,lt7911exc + + reg: + maxItems: 1 + + reset-gpios: + maxItems: 1 + description: GPIO connected to RST_ pin. + + vdd-supply: + description: Regulator for 1.2V MIPI phy power. + + vcc-supply: + description: Regulator for 3.3V IO power. + + ports: + $ref: /schemas/graph.yaml#/properties/ports + + properties: + port@0: + $ref: /schemas/graph.yaml#/properties/port + description: Video port for eDP input. + + port@1: + $ref: /schemas/graph.yaml#/properties/port + description: Video port for MIPI DSI output. + + required: + - port@0 + - port@1 + +required: + - compatible + - reg + - reset-gpios + - vdd-supply + - vcc-supply + - ports + +additionalProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + i2c { + #address-cells = <1>; + #size-cells = <0>; + + mipi-bridge@41 { + compatible = "lontium,lt7911exc"; + reg = <0x41>; + reset-gpios = <&gpy8 8 GPIO_ACTIVE_LOW>; + vdd-supply = <<7911exc_1v2>; + vcc-supply = <<7911exc_3v3>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + bridge_in: endpoint { + remote-endpoint = <&edp_out>; + }; + }; + + port@1 { + reg = <1>; + bridge_out: endpoint { + remote-endpoint = <&panel_in>; + }; + }; + }; + }; + };
Signature · 1 line
2.34.1
PATCH v8 2/2 drm/bridge: Add Lontium LT7911EXC eDP to MIPI DSI bridge
In reply to [email protected]From: Sunyun Yang <[email protected]>
Add support for the Lontium LT7911EXC bridge chip, which converts eDP input to MIPI DSI output using an internal firmware-controlled pipeline.
The driver provides:
- DRM bridge integration for eDP-to-DSI routing
- MIPI DSI host interface for downstream panel attachment
- Firmware upgrade mechanism over I2C (erase/program/verify)
- GPIO-based reset and regulator management
- Basic register access protection using a mutex-controlled OCM lock
Display timing and DSI packet generation are handled by the chip firmware and are not configured by the driver.
--- drivers/gpu/drm/bridge/Kconfig | 15 + drivers/gpu/drm/bridge/Makefile | 1 + drivers/gpu/drm/bridge/lontium-lt7911exc.c | 642 +++++++++++++++++++++ 3 files changed, 658 insertions(+) create mode 100644 drivers/gpu/drm/bridge/lontium-lt7911exc.c
drivers/gpu/drm/bridge/Kconfig +15 -0
@@ -132,6 +132,21 @@ config DRM_ITE_IT6505 help ITE IT6505 DisplayPort bridge chip driver. +config DRM_LONTIUM_LT7911EXC + tristate "Lontium eDP/MIPI DSI bridge" + depends on OF + depends on I2C + select CRC32 + select FW_LOADER + select DRM_PANEL + select DRM_KMS_HELPER + select REGMAP_I2C + help + DRM driver for the Lontium LT7911EXC bridge + chip.The LT7911EXC converts eDP input to MIPI + DSI output. + Please say Y if you have such hardware. + config DRM_LONTIUM_LT8912B tristate "Lontium LT8912B DSI/HDMI bridge" depends on OF
drivers/gpu/drm/bridge/Makefile +1 -0
@@ -13,6 +13,7 @@ obj-$(CONFIG_DRM_I2C_NXP_TDA998X) += tda998x.o obj-$(CONFIG_DRM_INNO_HDMI) += inno-hdmi.o obj-$(CONFIG_DRM_ITE_IT6263) += ite-it6263.o obj-$(CONFIG_DRM_ITE_IT6505) += ite-it6505.o +obj-$(CONFIG_DRM_LONTIUM_LT7911EXC) += lontium-lt7911exc.o obj-$(CONFIG_DRM_LONTIUM_LT8912B) += lontium-lt8912b.o obj-$(CONFIG_DRM_LONTIUM_LT9211) += lontium-lt9211.o obj-$(CONFIG_DRM_LONTIUM_LT9611) += lontium-lt9611.o
drivers/gpu/drm/bridge/lontium-lt7911exc.c new file +642 -0
642 lines not on this page · raw message
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH v8 2/2] drm/bridge: Add Lontium LT7911EXC eDP to MIPI DSI bridge
Thank you for your contribution! Sashiko AI review found 7 potential issue(s) to consider: - [High] DSI transfer callback returns success for reads without populating the receive buffer, leaking…
Thank you for your contribution! Sashiko AI review found 7 potential issue(s) to consider:
- [High] DSI transfer callback returns success for reads without populating the receive buffer, leaking uninitialized memory.
- [High] DSI transfer callback polls for eDP video readiness before the upstream encoder is enabled, guaranteeing a timeout.
- [High] The driver attempts I2C transfers while the hardware is held in physical reset.
- [High] Missing DRM_MIPI_DSI Kconfig dependency causes linker errors.
- [High] request_firmware is called while holding the hardware lock and halting the MCU, risking a system pipeline stall.
- [High] Sleeping functions are called from atomic context in the DRM bridge callbacks.
- [Medium] lt7911exc_dsi_host_transfer bypasses the required MCU hardware halt sequence.
--
commit ac42b7d6e1a6501b8416d964b8bbfde4d4b376bc
Author: Sunyun Yang <[email protected]>
Subject: drm/bridge: Add Lontium LT7911EXC eDP to MIPI DSI bridge
This commit adds support for the Lontium LT7911EXC bridge chip, converting eDP input to MIPI DSI output. It includes I2C firmware upgrade mechanisms, GPIO management, and DRM bridge integration.
Quoted 7 lines
drivers/gpu/drm/bridge/Kconfig +0
-0@@ -132,6 +132,21 @@ config DRM_ITE_IT6505 help ITE IT6505 DisplayPort bridge chip driver.
drivers/gpu/drm/bridge/Kconfig config DRM_ITE_IT6505 · line 143
Quoted 10 lines
drivers/gpu/drm/bridge/Kconfig +9
-0+config DRM_LONTIUM_LT7911EXC + tristate "Lontium eDP/MIPI DSI bridge" + depends on OF + depends on I2C + select CRC32 + select FW_LOADER + select DRM_PANEL + select DRM_KMS_HELPER + select REGMAP_I2C
Is a select DRM_MIPI_DSI missing here?
The driver unconditionally uses MIPI DSI core APIs such as mipi_dsi_host_register() and mipi_dsi_host_unregister(), so building without the MIPI DSI core enabled might result in undefined reference build failures.
[ ... ]
Quoted 5 lines
drivers/gpu/drm/bridge/lontium-lt7911exc.c new file +0
-0
[ ... ]
drivers/gpu/drm/bridge/lontium-lt7911exc.c line 323
Quoted 11 lines
drivers/gpu/drm/bridge/lontium-lt7911exc.c new file +11
-0+static int lt7911exc_firmware_upgrade (struct lt7911exc *lt7911exc) +{ +struct device *dev = lt7911exc->dev; +const struct firmware *fw; +u8 *buffer; +size_t total_size =FW_SIZE -4 ; +u32 crc32; +int ret; + +/* 1. load firmware */ + ret =request_firmware (&fw,FW_FILE , dev);
Could calling request_firmware() here block concurrent DRM atomic commits and freeze the display pipeline?
This function is called by lt7911exc_firmware_store(), which acquires ocm_lock and halts the MCU via lt7911exc_lock() before invoking it. If the firmware file is missing or takes time to load, request_firmware() can block waiting for the userspace fallback mechanism while the mutex is held.
[ ... ]
drivers/gpu/drm/bridge/lontium-lt7911exc.c line 386
Quoted 8 lines
drivers/gpu/drm/bridge/lontium-lt7911exc.c new file +8
-0+static void lt7911exc_atomic_pre_enable (struct drm_bridge *bridge,struct drm_atomic_state *state) +{ +struct lt7911exc *lt7911exc =bridge_to_lt7911exc (bridge); + +guard (mutex)(<7911exc->ocm_lock); + +lt7911exc_reset (lt7911exc); +}
Is it safe to use sleeping functions like guard(mutex) and msleep() inside lt7911exc_reset(), as well as gpiod_set_value_cansleep() here?
The DRM subsystem guide specifies that encoder atomic enable/disable callbacks execute in an atomic context where sleeping is forbidden, which could lead to kernel warnings, system instability, or deadlocks.
drivers/gpu/drm/bridge/lontium-lt7911exc.c line 392
Quoted 6 lines
drivers/gpu/drm/bridge/lontium-lt7911exc.c new file +6
-0+ +static void lt7911exc_atomic_disable (struct drm_bridge *bridge,struct drm_atomic_state *state) +{ +/* Delay after panel is disabled */ +msleep (20 ); +}
Similar to the above, does calling msleep() here violate atomic context constraints?
drivers/gpu/drm/bridge/lontium-lt7911exc.c line 401
Quoted 9 lines
drivers/gpu/drm/bridge/lontium-lt7911exc.c new file +9
-0+ +static void lt7911exc_atomic_post_disable (struct drm_bridge *bridge,struct drm_atomic_state *state) +{ +struct lt7911exc *lt7911exc =bridge_to_lt7911exc (bridge); + +guard (mutex)(<7911exc->ocm_lock); + +gpiod_set_value_cansleep (lt7911exc->reset_gpio,1 ); +}
If the chip is placed in hardware reset here via gpiod_set_value_cansleep(), will subsequent I2C transfers in lt7911exc_dsi_host_transfer() fail?
During the next display enable sequence, the panel's pre_enable will likely send DCS commands before the bridge's atomic_pre_enable deasserts the reset, leaving the chip physically in reset during I2C communication.
[ ... ]
drivers/gpu/drm/bridge/lontium-lt7911exc.c line 473
Quoted 8 lines
drivers/gpu/drm/bridge/lontium-lt7911exc.c new file +8
-0+static ssize_t lt7911exc_dsi_host_transfer (struct mipi_dsi_host *host, +const struct mipi_dsi_msg *msg) +{ +struct lt7911exc *lt7911exc =dsi_host_to_lt7911exc (host); +unsigned int val; +int ret; + +guard (mutex)(<7911exc->ocm_lock);
Should this use lt7911exc_lock() instead of guarding ocm_lock directly?
lt7911exc_lock() is explicitly defined to protect register accesses by halting the on-chip MCU. Bypassing this sequence might lead to I2C collisions with the running firmware.
drivers/gpu/drm/bridge/lontium-lt7911exc.c line 480
Quoted 7 lines
drivers/gpu/drm/bridge/lontium-lt7911exc.c new file +7
-0+ +/* ensure eDP input video ready */ + ret =regmap_read_poll_timeout (lt7911exc->regmap,0xe084 , val, (val &0x01 ),5000 ,50000 ); +if (ret) { +dev_warn (lt7911exc->dev,"Video source not ready within 50ms\n" ); +return -EBUSY ; + }
Will this polling loop always time out during panel initialization?
The downstream panel typically sends initialization DCS commands during its pre_enable phase, which runs before the upstream eDP encoder's enable callback. Since the eDP video source is inactive at this stage, this might permanently break the display initialization pipeline.
drivers/gpu/drm/bridge/lontium-lt7911exc.c line 488
Quoted 8 lines
drivers/gpu/drm/bridge/lontium-lt7911exc.c new file +8
-0+ +/* enable mipi dsi output stream and firmware will send dcs */ + ret =regmap_write (lt7911exc->regmap,0xe0b0 ,0x01 ); +if (ret) +return ret; + +return msg->tx_len; +}
Could returning msg->tx_len for DCS read operations (where msg->rx_len > 0) lead to uninitialized memory being used by the caller?
Because the function returns a positive success value without actually populating msg->rx_buf, the calling panel driver might assume the read was successful and consume uninitialized stack or heap memory.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2