[PATCH RFC v2 00/24] drm bridge hotplug

From: Luca Ceresoli

Date: Thu Oct 01 2026 - 08:49:11 EST


Hello,

this series adds support for Linux-based devices with a DRM pipeline whose
final components, including one or more bridges, can be hot-plugged and
hot-unplugged

For more about the use case see the v1 cover letter:
https://lore.kernel.org/lkml/20260519-drm-bridge-hotplug-v1-0-45e2bdb3dfb4@xxxxxxxxxxx/

For reviewers with limited time for review
==========================================

These are the patches with the core changes and likely needing review and
discussion (most relevant first):

* 23: the new drm_hotplug_helper (the main patch)
* 24: an example usage
* 5-6: the main changes to the bridge-connector
* 17-22: the new get_next_bridge bridge func

The following can be skipped at this iteration, changes have been requested
in the v1 discussion but not yet implemented, and these patches are not
crucial:

* 10-12: still needs rewording
* 13-16: need docs, still todo

Design
======

The drm_bridge_connector is nowadays the recommended way to implement DRM
connectors when a chain of bridges is used.

This series proposes a small helper (drm_hotplug_helper) which drivers can
use to make their encoder able to:

* receive hotplug-relevant events
* add a drm_bridge_connector when a new bridge is added making the
pipeline complete in the hardware
* remove the drm_bridge_connector when a bridge is removed

Series layout
=============

A. Add a dynamic variant of drmm_connector_hdmi_init()
(needed for the bridge-connector to allocate the connector dynamically)

1 drm/connector: split drmm_connector_hdmi_init() in 3 parts
2 drm/connector: add drm_connector_hdmi_dynamic_init()

B. bridge-connector: use a dynamic drm_connector

3 drm/display: bridge-connector: split code allocation from initialization
4 drm/display: bridge-connector: hoist error management to common code
5 drm/display: bridge-connector: use a dynamic connector
6 drm/display: bridge-connector: add APIs to add/remove the connector dynamically

C. Misc preparation work

7 drm/bridge: samsung-dsim: move drm_bridge_add() call to probe
8 drm/bridge: initialize chain_node list head on allocation
9 drm/bridge: initialize chain_node list head on detach and attach errors

D. drm_bridge: stop pipeline when a bridge is removed

10 drm/encoder: add drm_encoder_cleanup_from()
11 drm/atomic: move drm_atomic_helper_disable_all() and drm_atomic_helper_shutdown() from drm_atomic_helper to drm_atomic
12 drm/bridge: shutdown and cleanup on bridge unplug

E. Add notifier mechanism to let common code (the bridge-connector)
take actions on hotplug events

13 drm/mipi-dsi: turn DRM_MIPI_DSI into a tristate
14 drm: event-notifier: add mechanism to notify about hotplug events
15 drm/bridge: notify about detached bridges
16 drm/mipi-dsi: notify about DSI attach

F. Let bridges return their next bridge
(allows to know when the pipeline is complete)

17 drm/bridge: add drm_bridge_get_next() and supporting func
18 drm/panel: implement .get_next_bridge
19 drm/bridge: display-connector: implement .get_next_bridge
20 drm/bridge: ti-sn65dsi83: implement .get_next_bridge
21 drm/bridge: ti-sn65dsi86: implement .get_next_bridge
22 drm/bridge: samsung-dsim: implement .get_next_bridge

G. Implement bridge hotplug in bridge-connector, enable it in a driver

23 drm: drm_hotplug_helper: new helper to implement bridge hotplug
24 drm/mxsfb/lcdif: enable bridge hotplug

== Grand plan

This is part of the work to support hotplug of DRM bridges. The grand plan
was initially discussed in [0].

Here's the work breakdown (➜ marks the current series):

1. … add refcounting to DRM bridges struct drm_bridge,
based on devm_drm_bridge_alloc()
A. ✔ add new alloc API and refcounting (v6.16)
B. ✔ convert all bridge drivers to new API (v6.17)
C. ✔ kunit tests (v6.17)
D. ✔ add get/put to drm_bridge_add/remove() + attach/detach()
and warn on old allocation pattern (v6.17)
E. … add get/put on drm_bridge accessors
1. ✔ drm_bridge_chain_get_first_bridge(), add cleanup action (v6.18)
2. ✔ drm_bridge_get_prev_bridge() (v6.18)
3. ✔ drm_bridge_get_next_bridge() (v6.19)
4. ✔ drm_for_each_bridge_in_chain() (v6.19)
5. ✔ drm_bridge_connector_init (v6.19)
6. ✔ protect encoder bridge chain with a mutex (v7.2)
7. ✔ of_drm_find_bridge
a. ✔ add of_drm_get_bridge() (v7.0),
convert basic direct users (v7.0-v7.1)
b. ✔ convert direct of_drm_get_bridge() users, part 2 (v7.0)
c. ✔ convert direct of_drm_get_bridge() users, part 3 (v7.0)
d. ✔ convert direct of_drm_get_bridge() users, part 4 (v7.1-v7.2)
e. ✔ bridge-only drm_of_find_panel_or_bridge() users (v7.2)
8. … panel_bridge lifetime
a. ✔ cleanup DRM_PANEL in bridge drivers (v7.4)
b. ✔ embed a drm_bridge in every drm_panel (v7.4)
c. … remove deprecated *_of_get_bridge(): non-OF drivers
d. remove deprecated *_of_get_bridge(): OF drivers
9. ✔ enforce drm_bridge_add before drm_bridge_attach (v6.19)
F. ✔ debugfs improvements
1. ✔ add top-level 'bridges' file (v6.16)
2. ✔ show refcount and list lingering bridges (v6.19)
2. ✔ handle gracefully atomic updates during bridge removal
A. ✔ Add drm_bridge_enter/exit() to protect device resources (v7.0)
B. ✔ Add drm_bridge_clear_and_put() (v7.1)
3. … DSI host-device driver interaction
4. ✔ removing the need for the "always-disconnected" connector
5. ✔ Migrate i.MX LCDIF driver to bridge-connector (v7.2)
6. ➜ DRM bridge hotplug
A. ➜ Bridge hotplug management in the DRM core
1. ✔ bridge-connector: attach encoder to the connector (v7.2)
2. ➜ drm bridge hotplug
B. Device tree description

[0] https://lore.kernel.org/lkml/20250206-hotplug-drm-bridge-v6-0-9d6f2c9c3058@xxxxxxxxxxx/#t


---
Changes in v2:
- Rewrote: added new drm_hotplug_helper, dropped most changes to drm_bridge_connector
- Added get_next_bridge func, dropped is_tail func
- Rebased on drm-misc-next, which required a few reworks
- Fix dynconn mutex locking
- Fix sashiko-reported bugs
- Drop "drm/display: bridge-connector: store the drm_device pointer", not
strongly needed, and adapt the remaining patches
- Simplify handle_hpd code types
- Lots of other smaller improvements
- Link to v1: https://patch.msgid.link/20260519-drm-bridge-hotplug-v1-0-45e2bdb3dfb4@xxxxxxxxxxx

---
Luca Ceresoli (24):
drm/connector: split drmm_connector_hdmi_init() in 3 parts
drm/connector: add drm_connector_hdmi_dynamic_init()
drm/display: bridge-connector: split code allocation from initialization
drm/display: bridge-connector: hoist error management to common code
drm/display: bridge-connector: use a dynamic connector
drm/display: bridge-connector: add APIs to add/remove the connector dynamically
drm/bridge: samsung-dsim: move drm_bridge_add() call to probe
drm/bridge: initialize chain_node list head on allocation
drm/bridge: initialize chain_node list head on detach and attach errors
drm/encoder: add drm_encoder_cleanup_from()
drm/atomic: move drm_atomic_helper_disable_all() and drm_atomic_helper_shutdown() from drm_atomic_helper to drm_atomic
drm/bridge: shutdown and cleanup on bridge unplug
drm/mipi-dsi: turn DRM_MIPI_DSI into a tristate
drm: event-notifier: add mechanism to notify about hotplug events
drm/bridge: notify about detached bridges
drm/mipi-dsi: notify about DSI attach
drm/bridge: add drm_bridge_get_next() and supporting func
drm/panel: implement .get_next_bridge
drm/bridge: display-connector: implement .get_next_bridge
drm/bridge: ti-sn65dsi83: implement .get_next_bridge
drm/bridge: ti-sn65dsi86: implement .get_next_bridge
drm/bridge: samsung-dsim: implement .get_next_bridge
drm: drm_hotplug_helper: new helper to implement bridge hotplug
drm/mxsfb/lcdif: enable bridge hotplug

MAINTAINERS | 8 +
drivers/gpu/drm/Kconfig | 7 +-
drivers/gpu/drm/Makefile | 2 +
drivers/gpu/drm/bridge/display-connector.c | 7 +
drivers/gpu/drm/bridge/samsung-dsim.c | 24 ++-
drivers/gpu/drm/bridge/ti-sn65dsi83.c | 9 +
drivers/gpu/drm/bridge/ti-sn65dsi86.c | 11 +-
drivers/gpu/drm/display/Kconfig | 6 +
drivers/gpu/drm/display/Makefile | 2 +
drivers/gpu/drm/display/drm_bridge_connector.c | 172 +++++++++++------
drivers/gpu/drm/display/drm_hotplug_helper.c | 243 +++++++++++++++++++++++++
drivers/gpu/drm/drm_atomic.c | 115 ++++++++++++
drivers/gpu/drm/drm_atomic_helper.c | 76 +-------
drivers/gpu/drm/drm_bridge.c | 45 ++++-
drivers/gpu/drm/drm_connector.c | 130 +++++++++----
drivers/gpu/drm/drm_encoder.c | 38 ++++
drivers/gpu/drm/drm_event_notifier.c | 58 ++++++
drivers/gpu/drm/drm_mipi_dsi.c | 3 +
drivers/gpu/drm/drm_panel.c | 8 +-
drivers/gpu/drm/mxsfb/Kconfig | 2 +-
drivers/gpu/drm/mxsfb/lcdif_drv.c | 12 +-
include/drm/drm_atomic.h | 3 +
include/drm/drm_bridge.h | 26 +++
include/drm/drm_bridge_connector.h | 4 +
include/drm/drm_connector.h | 6 +
include/drm/drm_encoder.h | 1 +
include/drm/drm_event_notifier.h | 38 ++++
include/drm/drm_hotplug_helper.h | 13 ++
28 files changed, 894 insertions(+), 175 deletions(-)
---
base-commit: e051645b3b4be7c8f9f77596e62f554cd52b008b
change-id: 20260515-drm-bridge-hotplug-46265d3a2f85

Best regards,
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com