[PATCH v3 3/5] drm/panel: lg-sw43408: split enable/disable from prepare/unprepare
From: David Heidelberg via B4 Relay
Date: Wed Nov 25 2026 - 08:08:45 EST
From: David Heidelberg <david@xxxxxxx>
Separate display blanking (enable/disable) from panel power sequencing
(prepare/unprepare), matching DRM panel conventions and other SDM845
AMOLED panel drivers:
- Move MIPI_DCS_SET_DISPLAY_OFF, MIPI_DCS_ENTER_SLEEP_MODE, and the
100 ms sleep into sw43408_disable(), leaving sw43408_unprepare() to
handle panel power-down.
- Move MIPI_DCS_SET_DISPLAY_ON and the 50 ms delay into sw43408_enable().
Signed-off-by: David Heidelberg <david@xxxxxxx>
---
drivers/gpu/drm/panel/panel-lg-sw43408.c | 32 +++++++++++++++++++++++---------
1 file changed, 23 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-lg-sw43408.c b/drivers/gpu/drm/panel/panel-lg-sw43408.c
index 7f7d7b6b17f61..7123ad18744cf 100644
--- a/drivers/gpu/drm/panel/panel-lg-sw43408.c
+++ b/drivers/gpu/drm/panel/panel-lg-sw43408.c
@@ -38,33 +38,38 @@ struct sw43408_panel {
struct drm_dsc_config dsc;
};
static inline struct sw43408_panel *to_panel_info(struct drm_panel *panel)
{
return container_of(panel, struct sw43408_panel, base);
}
-static int sw43408_unprepare(struct drm_panel *panel)
+static int sw43408_disable(struct drm_panel *panel)
{
struct sw43408_panel *sw43408 = to_panel_info(panel);
struct mipi_dsi_multi_context ctx = { .dsi = sw43408->link };
- int ret;
mipi_dsi_dcs_set_display_off_multi(&ctx);
mipi_dsi_dcs_enter_sleep_mode_multi(&ctx);
mipi_dsi_msleep(&ctx, 100);
- gpiod_set_value(sw43408->reset_gpio, 1);
+ return ctx.accum_err;
+}
+
+static int sw43408_unprepare(struct drm_panel *panel)
+{
+ struct sw43408_panel *sw43408 = to_panel_info(panel);
- ret = regulator_bulk_disable(ARRAY_SIZE(sw43408_supplies), sw43408->supplies);
+ gpiod_set_value(sw43408->reset_gpio, 1);
- return ret ? : ctx.accum_err;
+ return regulator_bulk_disable(ARRAY_SIZE(sw43408_supplies),
+ sw43408->supplies);
}
static int sw43408_program(struct drm_panel *panel)
{
struct sw43408_panel *sw43408 = to_panel_info(panel);
struct mipi_dsi_multi_context ctx = { .dsi = sw43408->link };
struct drm_dsc_picture_parameter_set pps;
@@ -97,20 +102,16 @@ static int sw43408_program(struct drm_panel *panel)
0x00, 0x00, 0x00, 0x19, 0x19, 0x19, 0x19, 0x19,
0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19,
0x16, 0x16);
mipi_dsi_dcs_write_seq_multi(&ctx, 0xcb, 0x80, 0x5c, 0x07, 0x03, 0x28);
mipi_dsi_dcs_write_seq_multi(&ctx, 0xc0, 0x02, 0x02, 0x0f);
mipi_dsi_dcs_write_seq_multi(&ctx, 0x55, 0x04, 0x61, 0xdb, 0x04, 0x70, 0xdb);
mipi_dsi_dcs_write_seq_multi(&ctx, 0xb0, 0xca);
- mipi_dsi_dcs_set_display_on_multi(&ctx);
-
- mipi_dsi_msleep(&ctx, 50);
-
sw43408->link->mode_flags &= ~MIPI_DSI_MODE_LPM;
drm_dsc_pps_payload_pack(&pps, sw43408->link->dsc);
mipi_dsi_picture_parameter_set_multi(&ctx, &pps);
sw43408->link->mode_flags |= MIPI_DSI_MODE_LPM;
@@ -119,16 +120,27 @@ static int sw43408_program(struct drm_panel *panel)
* PPS 1 if pps_identifier is 0
* PPS 2 if pps_identifier is 1
*/
mipi_dsi_compression_mode_ext_multi(&ctx, true,
MIPI_DSI_COMPRESSION_DSC, 1);
return ctx.accum_err;
}
+static int sw43408_enable(struct drm_panel *panel)
+{
+ struct sw43408_panel *sw43408 = to_panel_info(panel);
+ struct mipi_dsi_multi_context ctx = { .dsi = sw43408->link };
+
+ mipi_dsi_dcs_set_display_on_multi(&ctx);
+ mipi_dsi_msleep(&ctx, 50);
+
+ return ctx.accum_err;
+}
+
static void sw43408_reset(struct sw43408_panel *ctx)
{
gpiod_set_value(ctx->reset_gpio, 0);
usleep_range(9000, 10000);
gpiod_set_value(ctx->reset_gpio, 1);
usleep_range(1000, 2000);
gpiod_set_value(ctx->reset_gpio, 0);
usleep_range(9000, 10000);
@@ -217,18 +229,20 @@ static int sw43408_backlight_init(struct sw43408_panel *ctx)
if (IS_ERR(ctx->base.backlight))
return dev_err_probe(dev, PTR_ERR(ctx->base.backlight),
"Failed to create backlight\n");
return 0;
}
static const struct drm_panel_funcs sw43408_funcs = {
+ .disable = sw43408_disable,
.unprepare = sw43408_unprepare,
.prepare = sw43408_prepare,
+ .enable = sw43408_enable,
.get_modes = sw43408_get_modes,
};
static const struct of_device_id sw43408_of_match[] = {
{ .compatible = "lg,sw43408", }, /* legacy */
{ .compatible = "lg,sw43408-lh546wf1-ed01", },
{ /* sentinel */ }
};
--
2.55.0