RFC drm bridge hotplug
Get series with b4
b4 am [email protected] change-id 20260515-drm-bridge-hotplug-46265d3a2f85Versions newest first
- v3 RFC Latest31 patches 0 repliesNew
- v2 RFC24 patches 0 repliesSuperseded
- v137 patches 54 repliesSuperseded
Changes in v3 from the cover letter
- Handle use cases where the first bridge after the encoder is hotpluggable
(in v1 and v2 the first bridge was required to be always present)
as well as all cases where the first bridge is a DSI host
- Removed "samsung-dsim: move drm_bridge_add() call to probe", not
needed anymore
- Handle hot-pluggable bridges supporting HPD, add TI SN65DSI86 DSI-to-DP
- Fully implement dynamic connector in drm_bridge_connector (CEC helpers
were missing in v2)
- Fixed shutdown to not shutdown the whole card
- as a consequence, removed (not needed anymore)
"drm/atomic: move [...] from drm_atomic_helper to drm_atomic"
- Many smaller fixes and improvements
- Link to v2: https://patch.msgid.link/[email protected]
Patches in v3 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/31 | drm/display: hdmi-cec-helper: use drmm_ prefix for drmm actiondrivers/ | +2 | 0 replies | |
| 2/31 | drm/display: hdmi-cec-helper: add non-drmm API variantdrivers/ include/ | +47 | 0 replies | |
| 3/31 | drm/display: hdmi-cec-notifier-helper: use drmm_ prefix for drmm actiondrivers/ | +2 | 0 replies | |
| 4/31 | drm/display: hdmi-cec-notifier-helper: add non-drmm API variantdrivers/ include/ | +40 | 0 replies | |
| 5/31 | drm/connector: split drmm_connector_hdmi_init() in 3 partsdrivers/ | +55 | 0 replies | |
| 6/31 | drm/connector: add drm_connector_hdmi_dynamic_init()drivers/ include/ | +49 | 0 replies | |
| 7/31 | drm/display: bridge-connector: split allocation code from initialization codedrivers/ | +38 | 0 replies | |
| 8/31 | drm/display: bridge-connector: hoist error management to common codedrivers/ | +2 | 0 replies | |
| 9/31 | drm/display: bridge-connector: use a dynamic connectordrivers/ | +102 | 0 replies | |
| 10/31 | drm/display: bridge-connector: add APIs to add/remove the connector dynamicallydrivers/ include/ | +27 | 0 replies | |
| 11/31 | drm/bridge: constify of_drm_find_and_get_bridge() device_node parameterdrivers/ include/ | +2 | 0 replies | |
| 12/31 | drm/bridge: initialize chain_node list head on allocationdrivers/ | +1 | 0 replies | |
| 13/31 | drm/bridge: initialize chain_node list head on detach and attach errorsdrivers/ | +2 | 0 replies | |
| 14/31 | drm/bridge: ti-sn65dsi86: protect device resources on unplugdrivers/ | +46 | 0 replies | |
| 15/31 | drm/atomic: drm_atomic_private_obj_fini: protect private_obj removal from listdrivers/ | +6 | 0 replies | |
| 16/31 | drm: event-notifier: add mechanism to notify about hotplug eventsMAINTAINERS drivers/ drivers/ +2 more | +127 | 0 replies | |
| 17/31 | drm/bridge: notify about added and detached bridgesdrivers/ drivers/ | +7 | 0 replies | |
| 18/31 | drm/mipi-dsi: notify about DSI attachdrivers/ drivers/ | +4 | 0 replies | |
| 19/31 | drm/bridge: add drm_bridge_get_next() and supporting funcdrivers/ include/ | +55 | 0 replies | |
| 20/31 | drm/panel: implement .get_next_bridgedrivers/ | +7 | 0 replies | |
| 21/31 | drm/bridge: display-connector: implement .get_next_bridgedrivers/ | +7 | 0 replies | |
| 22/31 | drm/bridge: ti-sn65dsi83: implement .get_next_bridgedrivers/ | +9 | 0 replies | |
| 23/31 | drm/bridge: ti-sn65dsi86: implement .get_next_bridgedrivers/ | +10 | 0 replies | |
| 24/31 | drm/bridge: samsung-dsim: implement .get_next_bridgedrivers/ | +9 | 0 replies | |
| 25/31 | drm/bridge: add drm_bridge_detach_from()drivers/ | +34 | 0 replies | |
| 26/31 | drm/atomic: add drm_atomic_shutdown_encoder()drivers/ include/ | +146 | 0 replies | |
| 27/31 | drm/tests: atomic: add tests for drm_atomic_shutdown_encoder()drivers/ | +209 | 0 replies | |
| 28/31 | drm/bridge: clear bridge->encoder on detachdrivers/ | +1 | 0 replies | |
| 29/31 | drm/bridge: shutdown encoder and detach downstream bridges on bridge unplugdrivers/ | +9 | 0 replies | |
| 30/31 | drm: drm_hotplug_helper: new helper to implement bridge hotplugMAINTAINERS drivers/ drivers/ +2 more | +372 | 0 replies | |
| 31/31 | drm/mxsfb/lcdif: enable bridge hotplugdrivers/ drivers/ | +20 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.
Cover letter [PATCH RFC v3 00/31] drm bridge hotplug
Hello,
this series adds support for 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/[email protected]/
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
* start/stop HPD polling when the connector is added/removed (despite the name, HPD is pretty much orthogonal to bridge hotplug)
Series layout
=============
There are various preparation steps before the last patches introduce bridge hotplug itself.
A. Add a dynamic variant of drmm_connector_hdmi_init() and non-drmm
hdmi-cec API
(needed for the bridge-connector to allocate the connector dynamically)
1 drm/display: hdmi-cec-helper: use drmm_ prefix for drmm action
2 drm/display: hdmi-cec-helper: add non-drmm API variant
3 drm/display: hdmi-cec-notifier-helper: use drmm_ prefix for drmm action
4 drm/display: hdmi-cec-notifier-helper: add non-drmm API variant
5 drm/connector: split drmm_connector_hdmi_init() in 3 parts
6 drm/connector: add drm_connector_hdmi_dynamic_init()
B. bridge-connector: use a dynamic drm_connector
7 drm/display: bridge-connector: split allocation code from initialization code
8 drm/display: bridge-connector: hoist error management to common code
9 drm/display: bridge-connector: use a dynamic connector
10 drm/display: bridge-connector: add APIs to add/remove the connector dynamically
C. Misc preparation work
11 drm/bridge: constify of_drm_find_and_get_bridge() device_node parameter
12 drm/bridge: initialize chain_node list head on allocation
13 drm/bridge: initialize chain_node list head on detach and attach errors
14 drm/bridge: ti-sn65dsi86: protect device resources on unplug
15 drm/atomic: drm_atomic_private_obj_fini: protect private_obj removal from list
D. Add notifier mechanism to let common code (the bridge-connector)
take actions on hotplug events
16 drm: event-notifier: add mechanism to notify about hotplug events
17 drm/bridge: notify about added and detached bridges
18 drm/mipi-dsi: notify about DSI attach
E. Let bridges return their next bridge
(allows to know when the pipeline is complete)
19 drm/bridge: add drm_bridge_get_next() and supporting func
20 drm/panel: implement .get_next_bridge
21 drm/bridge: display-connector: implement .get_next_bridge
22 drm/bridge: ti-sn65dsi83: implement .get_next_bridge
23 drm/bridge: ti-sn65dsi86: implement .get_next_bridge
24 drm/bridge: samsung-dsim: implement .get_next_bridge
F. drm_bridge: stop pipeline when a bridge is removed
25 drm/bridge: add drm_bridge_detach_from()
26 drm/atomic: add drm_atomic_shutdown_encoder()
27 drm/tests: atomic: add tests for drm_atomic_shutdown_encoder()
28 drm/bridge: clear bridge->encoder on detach
29 drm/bridge: shutdown encoder and detach downstream bridges on bridge unplug
G. Implement bridge hotplug in bridge-connector, enable it in a driver
30 drm: drm_hotplug_helper: new helper to implement bridge hotplug
31 drm/mxsfb/lcdif: enable bridge hotplug
== Grand plan
This is part of the work to support hotplug of DRM bridges.
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 *_of_get_bridge(): non-OF drivers (v7.5) d. … remove drmm_of_get_bridge()
e. … remove devm_drm_of_get_bridge(), part 1
f. remove devm_drm_of_get_bridge(), part 2
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
---
Changes in v3:
- Handle use cases where the first bridge after the encoder is hotpluggable
(in v1 and v2 the first bridge was required to be always present)
as well as all cases where the first bridge is a DSI host
- Removed "samsung-dsim: move drm_bridge_add() call to probe", not
needed anymore
- Handle hot-pluggable bridges supporting HPD, add TI SN65DSI86 DSI-to-DP
- Fully implement dynamic connector in drm_bridge_connector (CEC helpers
were missing in v2)
- Fixed shutdown to not shutdown the whole card
- as a consequence, removed (not needed anymore)
"drm/atomic: move [...] from drm_atomic_helper to drm_atomic"
- Many smaller fixes and improvements
- Link to v2: https://patch.msgid.link/[email protected]
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, and stop
using -EPROBE_DEFER to mean a next bridge is needed but currently absent
- 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/[email protected]
---
Luca Ceresoli (31):
drm/display: hdmi-cec-helper: use drmm_ prefix for drmm action drm/display: hdmi-cec-helper: add non-drmm API variant drm/display: hdmi-cec-notifier-helper: use drmm_ prefix for drmm action drm/display: hdmi-cec-notifier-helper: add non-drmm API variant drm/connector: split drmm_connector_hdmi_init() in 3 parts drm/connector: add drm_connector_hdmi_dynamic_init()
drm/display: bridge-connector: split allocation code from initialization code 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: constify of_drm_find_and_get_bridge() device_node parameter drm/bridge: initialize chain_node list head on allocation drm/bridge: initialize chain_node list head on detach and attach errors drm/bridge: ti-sn65dsi86: protect device resources on unplug drm/atomic: drm_atomic_private_obj_fini: protect private_obj removal from list
drm: event-notifier: add mechanism to notify about hotplug events drm/bridge: notify about added and 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/bridge: add drm_bridge_detach_from()
drm/atomic: add drm_atomic_shutdown_encoder()
drm/tests: atomic: add tests for drm_atomic_shutdown_encoder() drm/bridge: clear bridge->encoder on detach
drm/bridge: shutdown encoder and detach downstream bridges on bridge unplug
drm: drm_hotplug_helper: new helper to implement bridge hotplug drm/mxsfb/lcdif: enable bridge hotplug
MAINTAINERS | 16 + drivers/gpu/drm/Kconfig | 5 + drivers/gpu/drm/Makefile | 2 + drivers/gpu/drm/bridge/display-connector.c | 7 + drivers/gpu/drm/bridge/samsung-dsim.c | 9 + drivers/gpu/drm/bridge/ti-sn65dsi83.c | 9 + drivers/gpu/drm/bridge/ti-sn65dsi86.c | 61 +++- drivers/gpu/drm/display/Kconfig | 7 + drivers/gpu/drm/display/Makefile | 2 + drivers/gpu/drm/display/drm_bridge_connector.c | 225 ++++++++++---- drivers/gpu/drm/display/drm_hdmi_cec_helper.c | 62 ++-- .../gpu/drm/display/drm_hdmi_cec_notifier_helper.c | 34 ++- drivers/gpu/drm/display/drm_hotplug_helper.c | 325 +++++++++++++++++++++ drivers/gpu/drm/drm_atomic.c | 151 ++++++++++ drivers/gpu/drm/drm_bridge.c | 87 +++++- drivers/gpu/drm/drm_connector.c | 131 ++++++--- drivers/gpu/drm/drm_hotplug_event_notifier.c | 62 ++++ 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 | 40 ++- drivers/gpu/drm/tests/drm_bridge_test.c | 209 +++++++++++++ include/drm/display/drm_hdmi_cec_helper.h | 21 ++ include/drm/drm_atomic.h | 1 + include/drm/drm_bridge.h | 27 +- include/drm/drm_bridge_connector.h | 4 + include/drm/drm_connector.h | 6 + include/drm/drm_hotplug_event_notifier.h | 52 ++++ include/drm/drm_hotplug_helper.h | 30 ++ 29 files changed, 1442 insertions(+), 156 deletions(-)
---
base-commit: 9c327dceb627a7947de3e82da6363fa508fd619b
change-id: 20260515-drm-bridge-hotplug-46265d3a2f85
Best regards,
Signature · 3 lines
Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com