mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@barebox.org>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH 2/4] video: dw_mipi_dsi: refuse transfers while the host is powered down
Date: Sun,  8 Nov 2026 11:10:52 +0100	[thread overview]
Message-ID: <20261108101110.1270196-2-a.fatoum@barebox.org> (raw)
In-Reply-To: <20261108101110.1270196-1-a.fatoum@barebox.org>

The host is only set up between VPL_PREPARE and VPL_DISABLE. A
transfer outside that window, e.g. from a panel driver or a debug
command while the display is off, ends up with the controller held in
reset: writes are reported as successful without anything being sent
and reads time out. On SoCs whose glue doesn't keep pclk enabled, the
register accesses would hit a clock-gated block.

Track whether the host is powered and fail transfers early with
-ENETDOWN otherwise.

Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
 drivers/video/dw_mipi_dsi.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/video/dw_mipi_dsi.c b/drivers/video/dw_mipi_dsi.c
index b6a53844edec..c936463261a5 100644
--- a/drivers/video/dw_mipi_dsi.c
+++ b/drivers/video/dw_mipi_dsi.c
@@ -245,6 +245,7 @@ struct dw_mipi_dsi {
 	u32 format;
 	unsigned long mode_flags;
 	struct fb_videomode *mode;
+	bool powered;
 
 	int vpg_mode;
 
@@ -447,6 +448,11 @@ static ssize_t dw_mipi_dsi_host_transfer(struct mipi_dsi_host *host,
 	struct mipi_dsi_packet packet;
 	int ret, nb_bytes;
 
+	if (!dsi->powered) {
+		dev_dbg(dsi->dev, "transfer while host is powered down\n");
+		return -ENETDOWN;
+	}
+
 	ret = mipi_dsi_create_packet(&packet, msg);
 	if (ret) {
 		dev_err(dsi->dev, "failed to create packet: %d\n", ret);
@@ -827,6 +833,7 @@ static void dw_mipi_dsi_bridge_post_atomic_disable(struct dw_mipi_dsi *dsi)
 	 * Note: panel-bridge disable & panel disable has been called
 	 * before by the drm framework.
 	 */
+	dsi->powered = false;
 	dw_mipi_dsi_set_mode(dsi, 0);
 
 	if (phy_ops->power_off)
@@ -885,6 +892,8 @@ static void dw_mipi_dsi_mode_set(struct dw_mipi_dsi *dsi,
 
 	if (phy_ops->power_on)
 		phy_ops->power_on(dsi->plat_data->priv_data);
+
+	dsi->powered = true;
 }
 
 static int vpg_param_set(struct param_d *param, void *data)
-- 
2.47.3




  reply	other threads:[~2026-11-08 10:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-08 10:10 [PATCH 1/4] video: dw_mipi_dsi: disable the panel before powering down the host Ahmad Fatoum
2026-11-08 10:10 ` Ahmad Fatoum [this message]
2026-11-08 10:10 ` [PATCH 3/4] video: dw_mipi_dsi: give transfers in video mode a frame to complete Ahmad Fatoum
2026-11-08 10:10 ` [PATCH 4/4] commands: mipi_dsi: add command for easier DCS experimentation Ahmad Fatoum
2026-11-09  9:24   ` Sascha Hauer

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=20261108101110.1270196-2-a.fatoum@barebox.org \
    --to=a.fatoum@barebox.org \
    --cc=barebox@lists.infradead.org \
    /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