From: Paul Geurts <paul.geurts@prodrive-technologies.com>
To: <andrzej.hajda@intel.com>, <neil.armstrong@linaro.org>,
<rfoss@kernel.org>, <Laurent.pinchart@ideasonboard.com>,
<jonas@kwiboo.se>, <jernej.skrabec@gmail.com>,
<maarten.lankhorst@linux.intel.com>, <mripard@kernel.org>,
<tzimmermann@suse.de>, <airlied@gmail.com>, <simona@ffwll.ch>,
<frieder.schrempf@kontron.de>, <dri-devel@lists.freedesktop.org>,
<linux-kernel@vger.kernel.org>
Cc: Paul Geurts <paul.geurts@prodrive-technologies.com>
Subject: [PATCH] drm/bridge: ti-sn65dsi83: Move PLL initialization to atomic_enable
Date: Thu, 30 Apr 2026 16:35:42 +0200 [thread overview]
Message-ID: <20260430143542.2279584-1-paul.geurts@prodrive-technologies.com> (raw)
Some MIPI DSI encoder drivers, like the Samsung DSI controller found in
i.MX8M Mini, enable the DSI clock on encoder enable. The sn65dsi83
pre_enable is executed before the DSIM encoder enable. As the DSI input
clock is the PLL input clock, the PLL cannot be locked in pre_enable.
Enable and lock the PLL in enable instead of pre_enable, to make sure
the input clock is available.
Fixes: dd9e329af723 ("drm/bridge: ti-sn65dsi83: Fix enable/disable flow to meet spec")
Signed-off-by: Paul Geurts <paul.geurts@prodrive-technologies.com>
---
drivers/gpu/drm/bridge/ti-sn65dsi83.c | 35 +++++++++++++--------------
1 file changed, 17 insertions(+), 18 deletions(-)
diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
index 17a885244e1e..018e524c473c 100644
--- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c
+++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
@@ -525,7 +525,6 @@ static void sn65dsi83_atomic_pre_enable(struct drm_bridge *bridge,
struct drm_crtc *crtc;
bool lvds_format_24bpp;
bool lvds_format_jeida;
- unsigned int pval;
__le16 le16val;
u16 val;
int ret;
@@ -670,6 +669,21 @@ static void sn65dsi83_atomic_pre_enable(struct drm_bridge *bridge,
mode->vsync_start - mode->vdisplay);
regmap_write(ctx->regmap, REG_VID_CHA_TEST_PATTERN, 0x00);
+ devm_add_action(ctx->dev, sn65dsi83_release_resources, ctx);
+err_exit:
+ drm_bridge_exit(idx);
+}
+
+static void sn65dsi83_atomic_enable(struct drm_bridge *bridge,
+ struct drm_atomic_state *state)
+{
+ struct sn65dsi83 *ctx = bridge_to_sn65dsi83(bridge);
+ unsigned int pval;
+ int idx, ret;
+
+ if (!drm_bridge_enter(bridge, &idx))
+ return;
+
/* Enable PLL */
regmap_write(ctx->regmap, REG_RC_PLL_EN, REG_RC_PLL_EN_PLL_EN);
usleep_range(3000, 4000);
@@ -680,7 +694,7 @@ static void sn65dsi83_atomic_pre_enable(struct drm_bridge *bridge,
dev_err(ctx->dev, "failed to lock PLL, ret=%i\n", ret);
/* On failure, disable PLL again and exit. */
regmap_write(ctx->regmap, REG_RC_PLL_EN, 0x00);
- goto err_add_action;
+ goto out;
}
/* Trigger reset after CSR register update. */
@@ -689,22 +703,6 @@ static void sn65dsi83_atomic_pre_enable(struct drm_bridge *bridge,
/* Wait for 10ms after soft reset as specified in datasheet */
usleep_range(10000, 12000);
-err_add_action:
- devm_add_action(ctx->dev, sn65dsi83_release_resources, ctx);
-err_exit:
- drm_bridge_exit(idx);
-}
-
-static void sn65dsi83_atomic_enable(struct drm_bridge *bridge,
- struct drm_atomic_state *state)
-{
- struct sn65dsi83 *ctx = bridge_to_sn65dsi83(bridge);
- unsigned int pval;
- int idx;
-
- if (!drm_bridge_enter(bridge, &idx))
- return;
-
/* Clear all errors that got asserted during initialization. */
regmap_read(ctx->regmap, REG_IRQ_STAT, &pval);
regmap_write(ctx->regmap, REG_IRQ_STAT, pval);
@@ -724,6 +722,7 @@ static void sn65dsi83_atomic_enable(struct drm_bridge *bridge,
sn65dsi83_monitor_start(ctx);
}
+out:
drm_bridge_exit(idx);
}
--
2.39.2
next reply other threads:[~2026-04-30 17:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-30 14:35 Paul Geurts [this message]
2026-05-05 0:20 ` Claude review: drm/bridge: ti-sn65dsi83: Move PLL initialization to atomic_enable Claude Code Review Bot
2026-05-05 0:20 ` Claude Code Review Bot
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=20260430143542.2279584-1-paul.geurts@prodrive-technologies.com \
--to=paul.geurts@prodrive-technologies.com \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=andrzej.hajda@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=frieder.schrempf@kontron.de \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.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