mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dharma Balasubiramani <dharma.b@microchip.com>
To: Manikandan Muralidharan <manikandan.m@microchip.com>,
	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>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>
Cc: <dri-devel@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>,
	"Dharma Balasubiramani" <dharma.b@microchip.com>
Subject: [PATCH v5 3/4] drm/bridge: microchip-lvds: add atomic pre_enable() and post_disable()
Date: Wed, 25 Jun 2025 10:26:11 +0530	[thread overview]
Message-ID: <20250625-microchip-lvds-v5-3-624cf72b2651@microchip.com> (raw)
In-Reply-To: <20250625-microchip-lvds-v5-0-624cf72b2651@microchip.com>

pm_runtime_get_sync() and clk_prepare_enable() must be outside the atomic
context, hence move the sleepable operations accordingly.

- atomic_pre_enable() handles pm_runtime and clock preparation
- atomic_enable() enables the serializer based on panel format
- atomic_disable() turns off the serializer
- atomic_post_disable() disables clock and releases runtime PM

Signed-off-by: Dharma Balasubiramani <dharma.b@microchip.com>
---
 drivers/gpu/drm/bridge/microchip-lvds.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/bridge/microchip-lvds.c b/drivers/gpu/drm/bridge/microchip-lvds.c
index c40c8717f026..b1800f78008c 100644
--- a/drivers/gpu/drm/bridge/microchip-lvds.c
+++ b/drivers/gpu/drm/bridge/microchip-lvds.c
@@ -111,8 +111,8 @@ static int mchp_lvds_attach(struct drm_bridge *bridge,
 				 bridge, flags);
 }
 
-static void mchp_lvds_atomic_enable(struct drm_bridge *bridge,
-				    struct drm_atomic_state *state)
+static void mchp_lvds_atomic_pre_enable(struct drm_bridge *bridge,
+					struct drm_atomic_state *state)
 {
 	struct mchp_lvds *lvds = bridge_to_lvds(bridge);
 	int ret;
@@ -128,7 +128,12 @@ static void mchp_lvds_atomic_enable(struct drm_bridge *bridge,
 		dev_err(lvds->dev, "failed to get pm runtime: %d\n", ret);
 		return;
 	}
+}
 
+static void mchp_lvds_atomic_enable(struct drm_bridge *bridge,
+				    struct drm_atomic_state *state)
+{
+	struct mchp_lvds *lvds = bridge_to_lvds(bridge);
 	lvds_serialiser_on(lvds);
 }
 
@@ -139,6 +144,12 @@ static void mchp_lvds_atomic_disable(struct drm_bridge *bridge,
 
 	/* Turn off the serialiser */
 	lvds_writel(lvds, LVDSC_CR, 0);
+}
+
+static void mchp_lvds_atomic_post_disable(struct drm_bridge *bridge,
+					  struct drm_atomic_state *state)
+{
+	struct mchp_lvds *lvds = bridge_to_lvds(bridge);
 
 	pm_runtime_put(lvds->dev);
 	clk_disable_unprepare(lvds->pclk);
@@ -146,8 +157,10 @@ static void mchp_lvds_atomic_disable(struct drm_bridge *bridge,
 
 static const struct drm_bridge_funcs mchp_lvds_bridge_funcs = {
 	.attach = mchp_lvds_attach,
+	.atomic_pre_enable = mchp_lvds_atomic_pre_enable,
 	.atomic_enable = mchp_lvds_atomic_enable,
 	.atomic_disable = mchp_lvds_atomic_disable,
+	.atomic_post_disable = mchp_lvds_atomic_post_disable,
 };
 
 static int mchp_lvds_probe(struct platform_device *pdev)

-- 
2.43.0


  parent reply	other threads:[~2025-06-25  4:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-25  4:56 [PATCH v5 0/4] drm/bridge: microchip-lvds: clean up and fix bus formats Dharma Balasubiramani
2025-06-25  4:56 ` [PATCH v5 1/4] drm/bridge: microchip-lvds: Remove unused drm_panel and redundant port node lookup Dharma Balasubiramani
2025-06-25  6:52   ` Maxime Ripard
2025-06-25  4:56 ` [PATCH v5 2/4] drm/bridge: microchip-lvds: migrate to atomic bridge ops Dharma Balasubiramani
2025-06-25  6:54   ` Maxime Ripard
2025-06-25  8:26     ` Dharma.B
2025-06-25  4:56 ` Dharma Balasubiramani [this message]
2025-06-25  6:57   ` [PATCH v5 3/4] drm/bridge: microchip-lvds: add atomic pre_enable() and post_disable() Maxime Ripard
2025-06-25  4:56 ` [PATCH v5 4/4] drm/bridge: microchip-lvds: fix bus format mismatch with VESA displays Dharma Balasubiramani
2025-06-25  6:57   ` 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=20250625-microchip-lvds-v5-3-624cf72b2651@microchip.com \
    --to=dharma.b@microchip.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=airlied@gmail.com \
    --cc=andrzej.hajda@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=manikandan.m@microchip.com \
    --cc=mripard@kernel.org \
    --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®