From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 078D4518140 for ; Thu, 1 Oct 2026 12:43:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790858636; cv=none; b=oYRUZe1CndRpgC01hz0j2APuKEj5LfdVhsoWv4hhWbWwuxq07yHG3uOGzVv2XaIYma4V7khf/wEBwKjoGDJo9Nv4UtRBeaQZ/o1b5xTJreNNgibdpGQQmzCwWpActEzG/gb3I5YcG9BybwZHb18Di4b8KbU5Q9vxi2/IWJxnWHg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790858636; c=relaxed/simple; bh=+alCd0R9/Szgi4Z3GwJaNlW9HBwAuYf9hJxdF6+uSK0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OzHHODPBmNeDRRJQSiyZV9K2ZMEOIoMxVaT0WWSMoQPN711oHznsn3WKr8g+fy1FcbdF0HyvOC1J+fo+w+ce1I1k4Iol/zm5KOJDqkYqc5XwjGDeVn8MKUWZ3+npnJhrH3dTdxuQJ7pCph9JG3q9eLT0r8a1phUJNasL/B0ZuaI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=uKqwpUTx; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="uKqwpUTx" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 7FAA84E41E84; Thu, 1 Oct 2026 12:43:53 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 2C5A160341; Thu, 1 Oct 2026 12:43:53 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id B20031032809F; Thu, 1 Oct 2026 14:43:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1790858630; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=d8sRHCj1LfeaitArGCptBNg5yIjIKKLU8Yc9pqpZHp8=; b=uKqwpUTxeMSVETp8oi2R2qfYX3XikeUsnqq6J6anFGUgYa0FuvoZkeKx3hY5Sx2qrYcPHH Js5oT13YMmnmZvKP83HPQIdRLekLXWkwgb5yFixpjBmh0/Fc+qJpqTdIGpVj5I251YMCWx Lw0V2VSRgJ6hwfFwu3zEbOCr/EbfOiGX3M5tonBIXjJftpVfZmlAPki2k4AyMWuStB9hrs LuHYY8vNXRPVMAxmyaKjivrL6T9L8pHpgJi8twn24DOQiRUdj5ac1hF8zt2IXnsjEzoOCa cpITW9wSrIBWoPhGuFE+YJAjH44ioVtKFeGk/lC0C/S7gvmqFAV3q459WcQI2w== From: Luca Ceresoli Date: Thu, 01 Oct 2026 14:42:34 +0200 Subject: [PATCH RFC v2 12/24] drm/bridge: shutdown and cleanup on bridge unplug Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261001-drm-bridge-hotplug-v2-12-8e34986dcb68@bootlin.com> References: <20261001-drm-bridge-hotplug-v2-0-8e34986dcb68@bootlin.com> In-Reply-To: <20261001-drm-bridge-hotplug-v2-0-8e34986dcb68@bootlin.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Inki Dae , Jagan Teki , Marek Szyprowski , Jessica Zhang , Douglas Anderson , Marek Vasut , Stefan Agner , Frank Li , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Cc: Hui Pu , Ian Ray , Luca Ceresoli , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org X-Mailer: b4 0.16.0 X-Last-TLS-Session-Version: TLSv1.3 With the upcoming support for DRM bridge hot(un)plugging, bridges can be removed at any time. 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 --- 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 2a112ed69e20..c0a2f7f1ce62 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -509,9 +509,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 was attached, also shutdown CRTCs 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); -- 2.55.0