From 8d013ab5ea7031d9e2111cc51ff1fab4c2733e75 Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Mon, 16 Nov 2026 14:07:17 +1100 Subject: [PATCH 1/2] fixup! drm: panel: Yousee YX070AMSHA01 panel driver Restore MIPI_DSI_MODE_LPM when the brightness write fails, so later commands are not sent in HS mode. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01SGwDLVZnjT6gSC7cpS5fzP --- drivers/gpu/drm/panel/panel-yousee-yx070amsha01.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-yousee-yx070amsha01.c b/drivers/gpu/drm/panel/panel-yousee-yx070amsha01.c index 2f4e434e921b80..e7721952d7fb09 100644 --- a/drivers/gpu/drm/panel/panel-yousee-yx070amsha01.c +++ b/drivers/gpu/drm/panel/panel-yousee-yx070amsha01.c @@ -45,12 +45,10 @@ static int yx070amsha01_update_status(struct backlight_device *bl) /* brightness on the hardware is 1-4096 */ ret = mipi_dsi_dcs_set_display_brightness_large(dsi, brightness + 1); - if (ret < 0) - return ret; dsi->mode_flags |= MIPI_DSI_MODE_LPM; - return 0; + return ret; } static const struct backlight_ops yx070amsha01_bl_ops = { From 0b04e57267fef25a6c3a04635f3593595a0df541 Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Mon, 16 Nov 2026 13:51:47 +1100 Subject: [PATCH 2/2] drm/vc4: dsi: re-arm stuck command packets instead of resetting FIFOs in video mode With video mode running, the DSI1 controller occasionally leaves a queued command packet pending in TXPKT1C with CMD_EN set and never transmits it (~2% of brightness writes on a 1080x1920 panel with LP_STOP_PERFRAME). The transfer then times out after 500 ms and the recovery path resets the FIFOs while video is still being streamed, which corrupts the panel's image (static, colour shift, blanking). Clearing and setting CMD_EN again sends the stuck packet almost immediately. When video is enabled, wait 50 ms (several frames) for a TX-only packet, and if CMD_EN is still set, re-arm it up to four times before falling back to the existing FIFO reset. Link: https://github.com/PADL/meta-xebros/issues/98 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01SGwDLVZnjT6gSC7cpS5fzP --- drivers/gpu/drm/vc4/vc4_dsi.c | 51 ++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c index 94eece45a049a0..61d9f9c169ccc7 100644 --- a/drivers/gpu/drm/vc4/vc4_dsi.c +++ b/drivers/gpu/drm/vc4/vc4_dsi.c @@ -1215,6 +1215,26 @@ static int vc4_dsi_bridge_attach(struct drm_bridge *bridge, &dsi->bridge, flags); } +/* + * With video running, the controller occasionally leaves a queued packet + * pending with CMD_EN set and never sends it. Clearing and setting CMD_EN + * again sends it straight away, whereas the FIFO reset done on failure + * corrupts the video stream, so re-arm the packet a few times first. A + * queued packet is normally sent within a frame. + */ +#define VC4_DSI_XFER_TIMEOUT_MS 500 +#define VC4_DSI_VIDEO_XFER_TIMEOUT_MS 50 +#define VC4_DSI_VIDEO_XFER_REARMS 4 + +static int vc4_dsi_wait_xfer(struct vc4_dsi *dsi, unsigned int timeout_ms) +{ + if (!wait_for_completion_timeout(&dsi->xfer_completion, + msecs_to_jiffies(timeout_ms))) + return -ETIMEDOUT; + + return dsi->xfer_result; +} + static ssize_t vc4_dsi_transfer(struct vc4_dsi *dsi, const struct mipi_dsi_msg *msg, bool log_error) { @@ -1223,6 +1243,8 @@ static ssize_t vc4_dsi_transfer(struct vc4_dsi *dsi, u32 pkth = 0, pktc = 0; int i, ret; bool is_long = mipi_dsi_packet_format_is_long(msg->type); + bool video = !msg->rx_len && + (DSI_PORT_READ(DISP0_CTRL) & DSI_DISP0_ENABLE); u32 cmd_fifo_len = 0, pix_fifo_len = 0; mipi_dsi_create_packet(&packet, msg); @@ -1337,16 +1359,25 @@ static ssize_t vc4_dsi_transfer(struct vc4_dsi *dsi, DSI_PORT_WRITE(TXPKT1H, pkth); DSI_PORT_WRITE(TXPKT1C, pktc); - if (!wait_for_completion_timeout(&dsi->xfer_completion, - msecs_to_jiffies(500))) { - if (log_error) { - dev_err(&dsi->pdev->dev, "transfer interrupt wait timeout"); - dev_err(&dsi->pdev->dev, "instat: 0x%08x, stat: 0x%08x\n", - DSI_PORT_READ(INT_STAT), DSI_PORT_READ(INT_STAT)); - } - ret = -ETIMEDOUT; - } else { - ret = dsi->xfer_result; + ret = vc4_dsi_wait_xfer(dsi, video ? VC4_DSI_VIDEO_XFER_TIMEOUT_MS : + VC4_DSI_XFER_TIMEOUT_MS); + + for (i = 0; video && ret == -ETIMEDOUT && + i < VC4_DSI_VIDEO_XFER_REARMS && + (DSI_PORT_READ(TXPKT1C) & DSI_TXPKT1C_CMD_EN); i++) { + drm_dbg_kms(drm, "DSI packet stuck, re-arming (%d)\n", i + 1); + dsi->xfer_result = 0; + reinit_completion(&dsi->xfer_completion); + DSI_PORT_WRITE(TXPKT1C, pktc & ~DSI_TXPKT1C_CMD_EN); + udelay(1); + DSI_PORT_WRITE(TXPKT1C, pktc); + ret = vc4_dsi_wait_xfer(dsi, VC4_DSI_VIDEO_XFER_TIMEOUT_MS); + } + + if (ret == -ETIMEDOUT && log_error) { + dev_err(&dsi->pdev->dev, "transfer interrupt wait timeout"); + dev_err(&dsi->pdev->dev, "instat: 0x%08x, stat: 0x%08x\n", + DSI_PORT_READ(INT_STAT), DSI_PORT_READ(INT_STAT)); } DSI_PORT_WRITE(INT_EN, DSI_PORT_BIT(INTERRUPTS_ALWAYS_ENABLED));