[PATCH 3/4] drm/panel: st7701: let a panel provide its own init sequence and DSI flags

From: Romain TISSERAND

Date: Thu Nov 26 2026 - 21:08:32 EST


Every DSI panel handled by the driver gets its init sequence from
st7701_init_sequence(), which encodes the Command2 BK0/BK1 settings from
the panel timings and descriptor fields, followed by a panel specific
GIP sequence. All of them also run in burst video mode.

Some vendor init tables don't fit that encoding, and some panels don't
work in burst mode. Add two optional descriptor fields:

- init_sequence: sent instead of the generic sequence and the GIP
sequence;
- mode_flags: DSI mode flags to use instead of the default ones.

No change for the existing panels, which set neither.

Signed-off-by: Romain TISSERAND <romain.tisserand@xxxxxxxxx>
---
drivers/gpu/drm/panel/panel-sitronix-st7701.c | 27 +++++++++++++++----
1 file changed, 22 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7701.c b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
index 31c56eadda12..f288c8c8aab8 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7701.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
@@ -128,6 +128,16 @@ struct st7701_panel_desc {

/* GIP sequence, fully custom and undocumented. */
void (*gip_sequence)(struct st7701 *st7701);
+
+ /*
+ * Complete vendor init sequence, sent instead of the generic one and
+ * the GIP sequence, for panels whose vendor table does not fit the
+ * generic encoding.
+ */
+ void (*init_sequence)(struct st7701 *st7701);
+
+ /* DSI mode flags, when the default burst mode does not suit the panel */
+ unsigned long mode_flags;
};

struct st7701 {
@@ -559,10 +569,14 @@ static int st7701_prepare(struct drm_panel *panel)
gpiod_set_value(st7701->reset, 1);
msleep(150);

- st7701_init_sequence(st7701);
+ if (st7701->desc->init_sequence) {
+ st7701->desc->init_sequence(st7701);
+ } else {
+ st7701_init_sequence(st7701);

- if (st7701->desc->gip_sequence)
- st7701->desc->gip_sequence(st7701);
+ if (st7701->desc->gip_sequence)
+ st7701->desc->gip_sequence(st7701);
+ }

/* Disable Command2 */
st7701_switch_cmd_bkx(st7701, false, 0);
@@ -1343,8 +1357,11 @@ static int st7701_dsi_probe(struct mipi_dsi_device *dsi)
if (!st7701->desc->lanes)
return dev_err_probe(&dsi->dev, -EINVAL, "This panel is not for MIPI DSI\n");

- dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
- MIPI_DSI_MODE_LPM | MIPI_DSI_CLOCK_NON_CONTINUOUS;
+ if (st7701->desc->mode_flags)
+ dsi->mode_flags = st7701->desc->mode_flags;
+ else
+ dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
+ MIPI_DSI_MODE_LPM | MIPI_DSI_CLOCK_NON_CONTINUOUS;
dsi->format = st7701->desc->format;
dsi->lanes = st7701->desc->lanes;

--
2.43.0