The commit 007ac0262b0d ("drm/msm/dsi: switch to DRM_PANEL_BRIDGE") breaks panels which send DSI commands in their .unprepare callbacks. Migrate to using .disable for that for some SDM845 panels. Co-developed-by: Joel Selvaraj <joelselvaraj.oss@xxxxxxxxx> Signed-off-by: Joel Selvaraj <joelselvaraj.oss@xxxxxxxxx> Signed-off-by: Caleb Connolly <caleb.connolly@xxxxxxxxxx> --- base-commit: 858fd168a95c5b9669aac8db6c14a9aeab446375 // Caleb (they/them) --- drivers/gpu/drm/panel/panel-ebbg-ft8719.c | 18 +++++++----------- drivers/gpu/drm/panel/panel-novatek-nt36672a.c | 11 ++++++++++- drivers/gpu/drm/panel/panel-visionox-rm69299.c | 11 ++++++++++- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-ebbg-ft8719.c b/drivers/gpu/drm/panel/panel-ebbg-ft8719.c index e85d63a176d0..b40a27558e7c 100644 --- a/drivers/gpu/drm/panel/panel-ebbg-ft8719.c +++ b/drivers/gpu/drm/panel/panel-ebbg-ft8719.c @@ -87,22 +87,22 @@ static int ebbg_ft8719_on(struct ebbg_ft8719 *ctx) return 0; } -static int ebbg_ft8719_off(struct ebbg_ft8719 *ctx) +static int ebbg_ft8719_disable(struct drm_panel *panel) { - struct mipi_dsi_device *dsi = ctx->dsi; - struct device *dev = &dsi->dev; + struct ebbg_ft8719 *ctx = to_ebbg_ft8719(panel); + struct device *dev = &ctx->dsi->dev; int ret; - dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; + ctx->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; - ret = mipi_dsi_dcs_set_display_off(dsi); + ret = mipi_dsi_dcs_set_display_off(ctx->dsi); if (ret < 0) { dev_err(dev, "Failed to set display off: %d\n", ret); return ret; } usleep_range(10000, 11000); - ret = mipi_dsi_dcs_enter_sleep_mode(dsi); + ret = mipi_dsi_dcs_enter_sleep_mode(ctx->dsi); if (ret < 0) { dev_err(dev, "Failed to enter sleep mode: %d\n", ret); return ret; @@ -137,13 +137,8 @@ static int ebbg_ft8719_prepare(struct drm_panel *panel) static int ebbg_ft8719_unprepare(struct drm_panel *panel) { struct ebbg_ft8719 *ctx = to_ebbg_ft8719(panel); - struct device *dev = &ctx->dsi->dev; int ret; - ret = ebbg_ft8719_off(ctx); - if (ret < 0) - dev_err(dev, "Failed to un-initialize panel: %d\n", ret); - gpiod_set_value_cansleep(ctx->reset_gpio, 1); ret = regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); @@ -188,6 +183,7 @@ static int ebbg_ft8719_get_modes(struct drm_panel *panel, static const struct drm_panel_funcs ebbg_ft8719_panel_funcs = { .prepare = ebbg_ft8719_prepare, + .disable = ebbg_ft8719_disable, .unprepare = ebbg_ft8719_unprepare, .get_modes = ebbg_ft8719_get_modes, }; diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36672a.c b/drivers/gpu/drm/panel/panel-novatek-nt36672a.c index 73bcffa1e0c1..2e1a87001479 100644 --- a/drivers/gpu/drm/panel/panel-novatek-nt36672a.c +++ b/drivers/gpu/drm/panel/panel-novatek-nt36672a.c @@ -115,7 +115,7 @@ static int nt36672a_panel_power_off(struct drm_panel *panel) return ret; } -static int nt36672a_panel_unprepare(struct drm_panel *panel) +static int nt36672a_panel_disable(struct drm_panel *panel) { struct nt36672a_panel *pinfo = to_nt36672a_panel(panel); int ret; @@ -144,6 +144,14 @@ static int nt36672a_panel_unprepare(struct drm_panel *panel) /* 0x3C = 60ms delay */ msleep(60); + return ret; +} + +static int nt36672a_panel_unprepare(struct drm_panel *panel) +{ + struct nt36672a_panel *pinfo = to_nt36672a_panel(panel); + int ret; + ret = nt36672a_panel_power_off(panel); if (ret < 0) dev_err(panel->dev, "power_off failed ret = %d\n", ret); @@ -255,6 +263,7 @@ static int nt36672a_panel_get_modes(struct drm_panel *panel, } static const struct drm_panel_funcs panel_funcs = { + .disable = nt36672a_panel_disable, .unprepare = nt36672a_panel_unprepare, .prepare = nt36672a_panel_prepare, .get_modes = nt36672a_panel_get_modes, diff --git a/drivers/gpu/drm/panel/panel-visionox-rm69299.c b/drivers/gpu/drm/panel/panel-visionox-rm69299.c index ec228c269146..9dc17afbe540 100644 --- a/drivers/gpu/drm/panel/panel-visionox-rm69299.c +++ b/drivers/gpu/drm/panel/panel-visionox-rm69299.c @@ -59,7 +59,7 @@ static int visionox_rm69299_power_off(struct visionox_rm69299 *ctx) return regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); } -static int visionox_rm69299_unprepare(struct drm_panel *panel) +static int visionox_rm69299_disable(struct drm_panel *panel) { struct visionox_rm69299 *ctx = panel_to_ctx(panel); int ret; @@ -78,6 +78,14 @@ static int visionox_rm69299_unprepare(struct drm_panel *panel) dev_err(ctx->panel.dev, "enter_sleep cmd failed ret = %d\n", ret); } + return ret; +} + +static int visionox_rm69299_unprepare(struct drm_panel *panel) +{ + struct visionox_rm69299 *ctx = panel_to_ctx(panel); + int ret; + ret = visionox_rm69299_power_off(ctx); ctx->prepared = false; @@ -184,6 +192,7 @@ static int visionox_rm69299_get_modes(struct drm_panel *panel, } static const struct drm_panel_funcs visionox_rm69299_drm_funcs = { + .disable = visionox_rm69299_disable, .unprepare = visionox_rm69299_unprepare, .prepare = visionox_rm69299_prepare, .get_modes = visionox_rm69299_get_modes,