Skip to content

Commit 55f8bc2

Browse files
committed
drm/panel: waveshare-dsi-v2: Add DSI command retry logic for cold boot reliability
Similar to the I2C-based Waveshare panel driver, the MIPI DSI DCS-based driver (v2) can fail on cold boot when the panel controller is not ready to receive commands immediately after reset. Add defensive initialization: - 50ms stabilization delay at start of DCS command sequence - Retry logic (3 attempts, 50ms between retries) for DCS writes This ensures reliable initialization across varying cold boot timing conditions. Signed-off-by: Andrew Seredyn <[email protected]>
1 parent 7ba76a9 commit 55f8bc2

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

drivers/gpu/drm/panel/panel-waveshare-dsi-v2.c

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222

2323
#include <video/mipi_display.h>
2424

25+
#define WS_DSI_RETRIES 3 /* Number of retry attempts for DSI operations */
26+
#define WS_DSI_RETRY_DELAY_MS 50 /* Delay between retries in milliseconds */
27+
2528
struct ws_panel_desc {
2629
const struct panel_init_cmd *init;
2730
const struct drm_display_mode *mode;
@@ -1707,6 +1710,9 @@ static int ws_panel_init_dcs_cmd(struct ws_panel *ts)
17071710
struct drm_panel *panel = &ts->panel;
17081711
int i, err = 0;
17091712

1713+
/* Allow panel controller to stabilize after power-up/reset */
1714+
msleep(WS_DSI_RETRY_DELAY_MS);
1715+
17101716
if (ts->desc->init) {
17111717
const struct panel_init_cmd *init_cmds = ts->desc->init;
17121718

@@ -1720,11 +1726,20 @@ static int ws_panel_init_dcs_cmd(struct ws_panel *ts)
17201726
break;
17211727

17221728
case INIT_DCS_CMD:
1723-
err = mipi_dsi_dcs_write(
1724-
dsi, cmd->data[0],
1725-
cmd->len <= 1 ? NULL : &cmd->data[1],
1726-
cmd->len - 1);
1729+
{
1730+
int retries = WS_DSI_RETRIES;
1731+
1732+
do {
1733+
err = mipi_dsi_dcs_write(
1734+
dsi, cmd->data[0],
1735+
cmd->len <= 1 ? NULL : &cmd->data[1],
1736+
cmd->len - 1);
1737+
if (err >= 0)
1738+
break;
1739+
msleep(WS_DSI_RETRY_DELAY_MS);
1740+
} while (--retries > 0);
17271741
break;
1742+
}
17281743

17291744
default:
17301745
err = -EINVAL;

0 commit comments

Comments
 (0)