mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Maxime Ripard <mripard@kernel.org>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	 Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>,
	 Simona Vetter <simona@ffwll.ch>,
	Andrzej Hajda <andrzej.hajda@intel.com>,
	 Neil Armstrong <neil.armstrong@linaro.org>,
	Robert Foss <rfoss@kernel.org>,
	 Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	 Jonas Karlman <jonas@kwiboo.se>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	 Douglas Anderson <dianders@chromium.org>
Cc: Herve Codina <herve.codina@bootlin.com>,
	 dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	 Maxime Ripard <mripard@kernel.org>
Subject: [PATCH v4 09/15] drm/bridge: ti-sn65dsi83: Switch to drm_bridge_reset_crtc
Date: Tue, 25 Feb 2025 17:43:57 +0100	[thread overview]
Message-ID: <20250225-bridge-connector-v4-9-7ecb07b09cad@kernel.org> (raw)
In-Reply-To: <20250225-bridge-connector-v4-0-7ecb07b09cad@kernel.org>

Now that we have a helper for bridge drivers to call to reset the output
pipeline, let's use it.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/bridge/ti-sn65dsi83.c | 26 ++++++++++----------------
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
index 817ce33968d110799581b3d1f30df16c3ddf0f83..9aca91a4536ec5073c8424f10c092c19be957d99 100644
--- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c
+++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
@@ -369,11 +369,10 @@ static u8 sn65dsi83_get_dsi_div(struct sn65dsi83 *ctx)
 	return dsi_div - 1;
 }
 
 static int sn65dsi83_reset_pipe(struct sn65dsi83 *sn65dsi83)
 {
-	struct drm_device *dev = sn65dsi83->bridge.dev;
 	struct drm_modeset_acquire_ctx ctx;
 	int err;
 
 	/*
 	 * Reset active outputs of the related CRTC.
@@ -384,30 +383,25 @@ static int sn65dsi83_reset_pipe(struct sn65dsi83 *sn65dsi83)
 	 * bridge.
 	 *
 	 * Keep the lock during the whole operation to be atomic.
 	 */
 
-	DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, err);
-
-	if (!sn65dsi83->bridge.encoder->crtc) {
-		/*
-		 * No CRTC attached -> No CRTC active outputs to reset
-		 * This can happen when the SN65DSI83 is reset. Simply do
-		 * nothing without returning any errors.
-		 */
-		err = 0;
-		goto end;
-	}
+	drm_modeset_acquire_init(&ctx, 0);
 
 	dev_warn(sn65dsi83->dev, "reset the pipe\n");
 
-	err = drm_atomic_helper_reset_crtc(sn65dsi83->bridge.encoder->crtc, &ctx);
+retry:
+	err = drm_bridge_reset_crtc(&sn65dsi83->bridge, &ctx);
+	if (err == -EDEADLK) {
+		drm_modeset_backoff(&ctx);
+		goto retry;
+	}
 
-end:
-	DRM_MODESET_LOCK_ALL_END(dev, ctx, err);
+	drm_modeset_drop_locks(&ctx);
+	drm_modeset_acquire_fini(&ctx);
 
-	return err;
+	return 0;
 }
 
 static void sn65dsi83_reset_work(struct work_struct *ws)
 {
 	struct sn65dsi83 *ctx = container_of(ws, struct sn65dsi83, reset_work);

-- 
2.48.1


  parent reply	other threads:[~2025-02-25 16:44 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-25 16:43 [PATCH v4 00/15] drm/bridge: Various quality of life improvements Maxime Ripard
2025-02-25 16:43 ` [PATCH v4 01/15] drm/bridge: Add encoder parameter to drm_bridge_funcs.attach Maxime Ripard
2025-02-25 16:43 ` [PATCH v4 02/15] drm/bridge: Provide a helper to retrieve current bridge state Maxime Ripard
2025-02-25 16:43 ` [PATCH v4 03/15] drm/tests: Add kunit tests for bridges Maxime Ripard
2025-02-26  6:40   ` Dmitry Baryshkov
2025-02-25 16:43 ` [PATCH v4 04/15] drm/atomic: Introduce helper to lookup connector by encoder Maxime Ripard
2025-02-26  6:17   ` Dmitry Baryshkov
2025-02-26  6:38   ` Dmitry Baryshkov
2025-02-25 16:43 ` [PATCH v4 05/15] drm/tests: helpers: Create new helper to enable output Maxime Ripard
2025-02-26  6:38   ` Dmitry Baryshkov
2025-02-25 16:43 ` [PATCH v4 06/15] drm/tests: Create tests for drm_atomic Maxime Ripard
2025-02-26  6:40   ` Dmitry Baryshkov
2025-02-25 16:43 ` [PATCH v4 07/15] drm/bridge: Add helper to reset bridge pipeline Maxime Ripard
2025-02-26  6:41   ` Dmitry Baryshkov
2025-02-25 16:43 ` [PATCH v4 08/15] drm/tests: bridge: Provide tests for drm_bridge_reset_crtc Maxime Ripard
2025-02-26  6:43   ` Dmitry Baryshkov
2025-02-26  6:46   ` Dmitry Baryshkov
2025-02-25 16:43 ` Maxime Ripard [this message]
2025-02-26  6:46   ` [PATCH v4 09/15] drm/bridge: ti-sn65dsi83: Switch to drm_bridge_reset_crtc Dmitry Baryshkov
2025-02-25 16:43 ` [PATCH v4 10/15] drm/bridge: Introduce drm_bridge_is_atomic() helper Maxime Ripard
2025-02-25 16:43 ` [PATCH v4 11/15] drm/bridge: cdns-csi: Switch to atomic helpers Maxime Ripard
2025-02-26  6:12   ` Dmitry Baryshkov
2025-02-25 16:44 ` [PATCH v4 12/15] drm/bridge: tc358775: Switch to atomic commit Maxime Ripard
2025-02-25 16:44 ` [PATCH v4 13/15] drm/bridge: tc358768: Stop disabling when failing to enable Maxime Ripard
2025-02-25 16:44 ` [PATCH v4 14/15] drm/bridge: tc358768: Convert to atomic helpers Maxime Ripard
2025-02-25 16:44 ` [PATCH v4 15/15] drm/bridge: ti-sn65dsi86: Use bridge_state crtc pointer Maxime Ripard
2025-02-28 22:29   ` Doug Anderson
2025-02-27 11:00 ` [PATCH v4 00/15] drm/bridge: Various quality of life improvements Herve Codina
2025-03-03 13:11   ` Maxime Ripard
2025-03-03 13:34     ` Herve Codina
2025-03-03 13:34       ` Herve Codina
2025-03-03 15:00       ` Maxime Ripard
2025-03-03 16:50         ` Herve Codina
2025-03-04 11:11           ` Maxime Ripard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250225-bridge-connector-v4-9-7ecb07b09cad@kernel.org \
    --to=mripard@kernel.org \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=airlied@gmail.com \
    --cc=andrzej.hajda@intel.com \
    --cc=dianders@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=herve.codina@bootlin.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=neil.armstrong@linaro.org \
    --cc=rfoss@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®