From dd2ed22017f283a6c591e47e1117c90da93aced0 Mon Sep 17 00:00:00 2001 From: Richard Acayan Date: Fri, 2 Feb 2024 20:04:41 -0500 Subject: [PATCH 1/2] drm/panel: samsung-s6e3fa7: move dsi commands to disable callback again Putting DSI commands in the unprepare function does not prevent the display from turning off, but there is a dmesg error clearly indicating that something is wrong with it. Move the DSI commands back to the disable callback so the panel turns off properly. Amends: drm/panel: add samsung s6e3fa7 panel driver Signed-off-by: Richard Acayan --- drivers/gpu/drm/panel/panel-samsung-s6e3fa7.c | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e3fa7.c b/drivers/gpu/drm/panel/panel-samsung-s6e3fa7.c index a3ca05d2aec9..ba6af2364052 100644 --- a/drivers/gpu/drm/panel/panel-samsung-s6e3fa7.c +++ b/drivers/gpu/drm/panel/panel-samsung-s6e3fa7.c @@ -73,42 +73,43 @@ static int s6e3fa7_sdc_on(struct s6e3fa7_sdc *ctx) return 0; } -static int s6e3fa7_sdc_off(struct s6e3fa7_sdc *ctx) +static int s6e3fa7_sdc_prepare(struct drm_panel *panel) { - struct mipi_dsi_device *dsi = ctx->dsi; - struct device *dev = &dsi->dev; + struct s6e3fa7_sdc *ctx = to_s6e3fa7_sdc(panel); + struct device *dev = &ctx->dsi->dev; int ret; - ret = mipi_dsi_dcs_set_display_off(dsi); - if (ret < 0) { - dev_err(dev, "Failed to set display off: %d\n", ret); - return ret; - } + s6e3fa7_sdc_reset(ctx); - ret = mipi_dsi_dcs_enter_sleep_mode(dsi); + ret = s6e3fa7_sdc_on(ctx); if (ret < 0) { - dev_err(dev, "Failed to enter sleep mode: %d\n", ret); + dev_err(dev, "Failed to initialize panel: %d\n", ret); + gpiod_set_value_cansleep(ctx->reset_gpio, 1); return ret; } - msleep(120); return 0; } -static int s6e3fa7_sdc_prepare(struct drm_panel *panel) +static int s6e3fa7_sdc_disable(struct s6e3fa7_sdc *ctx) { struct s6e3fa7_sdc *ctx = to_s6e3fa7_sdc(panel); - struct device *dev = &ctx->dsi->dev; + struct mipi_dsi_device *dsi = ctx->dsi; + struct device *dev = &dsi->dev; int ret; - s6e3fa7_sdc_reset(ctx); + ret = mipi_dsi_dcs_set_display_off(dsi); + if (ret < 0) { + dev_err(dev, "Failed to set display off: %d\n", ret); + return ret; + } - ret = s6e3fa7_sdc_on(ctx); + ret = mipi_dsi_dcs_enter_sleep_mode(dsi); if (ret < 0) { - dev_err(dev, "Failed to initialize panel: %d\n", ret); - gpiod_set_value_cansleep(ctx->reset_gpio, 1); + dev_err(dev, "Failed to enter sleep mode: %d\n", ret); return ret; } + msleep(120); return 0; } @@ -163,6 +164,7 @@ static int s6e3fa7_sdc_get_modes(struct drm_panel *panel, static const struct drm_panel_funcs s6e3fa7_sdc_panel_funcs = { .prepare = s6e3fa7_sdc_prepare, + .disable = s6e3fa7_sdc_disable, .unprepare = s6e3fa7_sdc_unprepare, .get_modes = s6e3fa7_sdc_get_modes, }; -- 2.43.0