[PATCH 2/4] video: dw_mipi_dsi: refuse transfers while the host is powered down
Ahmad Fatoum
a.fatoum at barebox.org
Sun Nov 8 02:10:52 PST 2026
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 at 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
More information about the barebox
mailing list