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>,
	 Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Subject: [PATCH v6 14/16] drm/bridge: tc358768: Stop disabling when failing to enable
Date: Thu, 13 Mar 2025 13:00:08 +0100	[thread overview]
Message-ID: <20250313-bridge-connector-v6-14-511c54a604fb@kernel.org> (raw)
In-Reply-To: <20250313-bridge-connector-v6-0-511c54a604fb@kernel.org>

The tc358768 bridge driver, if enabling it fails, tries to disable it.
This is pretty uncommon in bridge drivers, and also stands in the way
for further reworks.

Worse, since pre_enable and enable aren't expected to fail, disable and
post_disable might be called twice: once to handle the failure, and once
to actually disable the bridge.

Since post_disable uses regulators and clocks, this would lead to enable
count imbalances.

In order to prevent that imbalance, and to allow further reworks, let's
drop the calls to disable and post_disable, but keep the warning to let
users know about what's going on.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/bridge/tc358768.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/bridge/tc358768.c b/drivers/gpu/drm/bridge/tc358768.c
index 6db18d1e8824dd7d387211d6d1e668645cf88bbe..6b65ba8aed86012bc0f464bd5ee44325dae677c6 100644
--- a/drivers/gpu/drm/bridge/tc358768.c
+++ b/drivers/gpu/drm/bridge/tc358768.c
@@ -1075,15 +1075,12 @@ static void tc358768_bridge_pre_enable(struct drm_bridge *bridge)
 	val = TC358768_DSI_CONFW_MODE_CLR | TC358768_DSI_CONFW_ADDR_DSI_CONTROL;
 	val |= TC358768_DSI_CONTROL_DIS_MODE; /* DSI mode */
 	tc358768_write(priv, TC358768_DSI_CONFW, val);
 
 	ret = tc358768_clear_error(priv);
-	if (ret) {
+	if (ret)
 		dev_err(dev, "Bridge pre_enable failed: %d\n", ret);
-		tc358768_bridge_disable(bridge);
-		tc358768_bridge_post_disable(bridge);
-	}
 }
 
 static void tc358768_bridge_enable(struct drm_bridge *bridge)
 {
 	struct tc358768_priv *priv = bridge_to_tc358768(bridge);
@@ -1099,15 +1096,12 @@ static void tc358768_bridge_enable(struct drm_bridge *bridge)
 
 	/* set PP_en */
 	tc358768_update_bits(priv, TC358768_CONFCTL, BIT(6), BIT(6));
 
 	ret = tc358768_clear_error(priv);
-	if (ret) {
+	if (ret)
 		dev_err(priv->dev, "Bridge enable failed: %d\n", ret);
-		tc358768_bridge_disable(bridge);
-		tc358768_bridge_post_disable(bridge);
-	}
 }
 
 #define MAX_INPUT_SEL_FORMATS	1
 
 static u32 *

-- 
2.48.1


  parent reply	other threads:[~2025-03-13 12:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-13 11:59 [PATCH v6 00/16] drm/bridge: Various quality of life improvements Maxime Ripard
2025-03-13 11:59 ` [PATCH v6 01/16] drm/bridge: Add encoder parameter to drm_bridge_funcs.attach Maxime Ripard
2025-03-13 11:59 ` [PATCH v6 02/16] drm/bridge: Provide a helper to retrieve current bridge state Maxime Ripard
2025-03-13 11:59 ` [PATCH v6 03/16] drm/tests: Add kunit tests for bridges Maxime Ripard
2025-03-13 11:59 ` [PATCH v6 04/16] drm/atomic: Introduce helper to lookup connector by encoder Maxime Ripard
2025-03-13 11:59 ` [PATCH v6 05/16] drm/tests: helpers: Create new helper to enable output Maxime Ripard
2025-03-13 12:00 ` [PATCH v6 06/16] drm/tests: hdmi_state_helpers: Switch to new helper Maxime Ripard
2025-03-13 12:00 ` [PATCH v6 07/16] drm/tests: Create tests for drm_atomic Maxime Ripard
2025-03-13 12:00 ` [PATCH v6 08/16] drm/bridge: Add helper to reset bridge pipeline Maxime Ripard
2025-03-13 12:00 ` [PATCH v6 09/16] drm/tests: bridge: Provide tests for drm_bridge_helper_reset_crtc Maxime Ripard
2025-03-13 12:00 ` [PATCH v6 10/16] drm/bridge: ti-sn65dsi83: Switch to drm_bridge_helper_reset_crtc Maxime Ripard
2025-03-13 12:00 ` [PATCH v6 11/16] drm/bridge: Introduce drm_bridge_is_atomic() helper Maxime Ripard
2025-03-13 12:00 ` [PATCH v6 12/16] drm/bridge: cdns-csi: Switch to atomic helpers Maxime Ripard
2025-03-13 12:00 ` [PATCH v6 13/16] drm/bridge: tc358775: Switch to atomic commit Maxime Ripard
2025-03-13 12:00 ` Maxime Ripard [this message]
2025-03-13 12:00 ` [PATCH v6 15/16] drm/bridge: tc358768: Convert to atomic helpers Maxime Ripard
2025-03-13 12:00 ` [PATCH v6 16/16] drm/bridge: ti-sn65dsi86: Remove drm_encoder->crtc use Maxime Ripard
2025-03-20 13:50 ` [PATCH v6 00/16] drm/bridge: Various quality of life improvements 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=20250313-bridge-connector-v6-14-511c54a604fb@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=dmitry.baryshkov@linaro.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®