techpack: display: protect setting fod doze status by allow_bl_update

In the current implementation the doze status command might set the backlight
of the panel before receiving a frame from the driver during the first commit.
There is chance for garbage content to be shown onto the panel.
This change imposes a condition to delay the fod hbm command until the
first frame is received from the HW.
This commit is contained in:
Cosmin Tanislav 2021-09-26 08:57:32 +03:00 committed by Giovanni Ricca
parent 34124ea0df
commit a48ba78367
No known key found for this signature in database
2 changed files with 25 additions and 2 deletions

View File

@ -623,7 +623,7 @@ error:
return rc; return rc;
} }
int dsi_panel_update_doze(struct dsi_panel *panel) { static int dsi_panel_update_doze(struct dsi_panel *panel) {
int rc = 0; int rc = 0;
if (panel->fod_hbm_enabled) { if (panel->fod_hbm_enabled) {
@ -646,11 +646,27 @@ int dsi_panel_update_doze(struct dsi_panel *panel) {
return rc; return rc;
} }
int dsi_panel_set_doze_status(struct dsi_panel *panel, bool status) { static int dsi_panel_set_doze_status(struct dsi_panel *panel, bool status) {
if (status == panel->doze_enabled) if (status == panel->doze_enabled)
return 0; return 0;
if (!panel->bl_config.allow_bl_update && status) {
panel->doze_requested = status;
return 0;
}
panel->doze_enabled = status; panel->doze_enabled = status;
panel->doze_requested = status;
return dsi_panel_update_doze(panel);
}
static int dsi_panel_apply_doze_status(struct dsi_panel *panel)
{
if (panel->doze_requested == panel->doze_enabled)
return 0;
panel->doze_enabled = panel->doze_requested;
return dsi_panel_update_doze(panel); return dsi_panel_update_doze(panel);
} }
@ -812,6 +828,10 @@ int dsi_panel_set_backlight(struct dsi_panel *panel, u32 bl_lvl)
rc = -ENOTSUPP; rc = -ENOTSUPP;
} }
rc = dsi_panel_apply_doze_status(panel);
if (rc)
DSI_ERR("[%s] unable to apply doze on, rc=%d\n", panel->name, rc);
bl->real_bl_level = bl_lvl; bl->real_bl_level = bl_lvl;
return rc; return rc;
@ -3910,6 +3930,7 @@ struct dsi_panel *dsi_panel_get(struct device *parent,
panel->drm_panel.dev = &panel->mipi_device.dev; panel->drm_panel.dev = &panel->mipi_device.dev;
panel->mipi_device.dev.of_node = of_node; panel->mipi_device.dev.of_node = of_node;
panel->doze_enabled = false; panel->doze_enabled = false;
panel->doze_requested = false;
panel->fod_ui = false; panel->fod_ui = false;
panel->fod_hbm_enabled = false; panel->fod_hbm_enabled = false;
panel->fod_hbm_requested = false; panel->fod_hbm_requested = false;
@ -5104,6 +5125,7 @@ int dsi_panel_disable(struct dsi_panel *panel)
panel->panel_initialized = false; panel->panel_initialized = false;
panel->power_mode = SDE_MODE_DPMS_OFF; panel->power_mode = SDE_MODE_DPMS_OFF;
panel->doze_enabled = false; panel->doze_enabled = false;
panel->doze_requested = false;
mutex_unlock(&panel->panel_lock); mutex_unlock(&panel->panel_lock);
return rc; return rc;

View File

@ -272,6 +272,7 @@ struct dsi_panel {
struct dsi_panel_ops panel_ops; struct dsi_panel_ops panel_ops;
bool doze_enabled; bool doze_enabled;
bool doze_requested;
bool fod_hbm_enabled; bool fod_hbm_enabled;
bool fod_hbm_requested; bool fod_hbm_requested;