[PATCH 25/37] drm/bridge: shutdown and cleanup on bridge unplug
Luca Ceresoli
luca.ceresoli at bootlin.com
Tue Jun 9 02:31:59 PDT 2026
On Mon Jun 8, 2026 at 2:07 PM CEST, Maxime Ripard wrote:
> Hi,
>
> On Tue, May 19, 2026 at 12:37:42PM +0200, Luca Ceresoli wrote:
>> With the upcoming support for DRM bridge hot(un)plugging, bridges can be
>> removed at any time withotu tearing down the entire card. When this
>> happens, shutdown the pipeline and detach from the encoder chain the bridge
>> being removed along with all the following ones.
>>
>> Signed-off-by: Luca Ceresoli <luca.ceresoli at bootlin.com>
>> ---
>> drivers/gpu/drm/drm_bridge.c | 8 ++++++++
>> 1 file changed, 8 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
>> index 7f2d1a81d730..d45fb74ec8c2 100644
>> --- a/drivers/gpu/drm/drm_bridge.c
>> +++ b/drivers/gpu/drm/drm_bridge.c
>> @@ -462,9 +462,17 @@ EXPORT_SYMBOL(devm_drm_bridge_add);
>> * it won't be found by users via of_drm_find_and_get_bridge(), and add it
>> * to the lingering bridge list, to keep track of it until its allocated
>> * memory is eventually freed.
>> + *
>> + * If the bridge is attached, also disable the active output and detach
>> + * this bridge and the following ones.
>> */
>> void drm_bridge_remove(struct drm_bridge *bridge)
>> {
>> + if (bridge->encoder) {
>> + drm_atomic_shutdown(bridge->dev);
>> + drm_encoder_cleanup_from(bridge->encoder, bridge);
>> + }
>> +
>> mutex_lock(&bridge_lock);
>> list_move_tail(&bridge->list, &bridge_lingering_list);
>> mutex_unlock(&bridge_lock);
>
> I don't think this makes a lot of sense to disable the whole device at
> once. The connector, encoder, and the CRTC might, but the whole device
> doesn't.
Indeed this is wrong. Dmitry pointed it out during the discussion at
Display Next Hackfest (see my report in reply to the cover letter). The
drm_atomic_shutdown() call will be dropped.
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
More information about the linux-arm-kernel
mailing list