dsi/dfps: update the dfps code to support "OLED+vid mode"

1.send cmd with async mode to switch fps
2.start to update timing when get TE signal

refer to https://gerrit.mot.com/#/c/2405274/

Change-Id: I027ac0c07fc6eb8a49a4072ad65aeac5f6de4289
Signed-off-by: tinno64 <tinno64@motorola.com>
Reviewed-on: https://gerrit.mot.com/2603801
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
tinno64 2023-05-11 16:02:04 +08:00
commit c7427915c7
3 changed files with 73 additions and 2 deletions

View file

@ -5705,6 +5705,11 @@ static int dsi_display_set_mode_sub(struct dsi_display *display,
true);
}
}
if (display->panel->dfps_caps.dfps_send_cmd_with_te_async) {
if ((display->panel->dfps_caps.current_fps != 60)&&(display->panel->dfps_caps.current_fps != 90))
dsi_display_status_check_te(display,1);
}
rc = dsi_display_dfps_update(display, mode);
if (rc) {
DSI_ERR("[%s]DSI dfps update failed, rc=%d\n",

View file

@ -630,6 +630,58 @@ error:
return rc;
}
static int dsi_panel_dfps_tx_cmd_set(struct dsi_panel *panel,
enum dsi_cmd_set_type type, bool async)
{
int rc = 0, i = 0;
ssize_t len;
struct dsi_cmd_desc *cmds;
u32 count;
enum dsi_cmd_set_state state;
struct dsi_display_mode *mode;
const struct mipi_dsi_host_ops *ops = panel->host->ops;
if (!panel || !panel->cur_mode)
return -EINVAL;
mode = panel->cur_mode;
cmds = mode->priv_info->cmd_sets[type].cmds;
count = mode->priv_info->cmd_sets[type].count;
state = mode->priv_info->cmd_sets[type].state;
SDE_EVT32(type, state, count);
if (count == 0) {
DSI_DEBUG("[%s] No commands to be sent for state(%d)\n",
panel->name, type);
goto error;
}
for (i = 0; i < count; i++) {
if (state == DSI_CMD_SET_STATE_LP)
cmds->msg.flags |= MIPI_DSI_MSG_USE_LPM;
if (cmds->last_command)
cmds->msg.flags |= MIPI_DSI_MSG_LASTCOMMAND;
if (async) cmds->msg.flags |= MIPI_DSI_MSG_ASYNC_OVERRIDE;
else cmds->msg.flags &= ~MIPI_DSI_MSG_ASYNC_OVERRIDE;
len = ops->transfer(panel->host, &cmds->msg);
if (len < 0) {
rc = len;
DSI_ERR("failed to set cmds(%d), rc=%d\n", type, rc);
goto error;
}
if (cmds->post_wait_ms)
usleep_range(cmds->post_wait_ms*1000,
((cmds->post_wait_ms*1000)+10));
cmds++;
}
error:
return rc;
}
static int dsi_panel_pinctrl_deinit(struct dsi_panel *panel)
{
int rc = 0;
@ -2167,6 +2219,9 @@ static int dsi_panel_parse_dfps_caps(struct dsi_panel *panel)
dfps_caps->max_refresh_rate = dfps_caps->dfps_list[i];
}
dfps_caps->dfps_send_cmd_with_te_async = utils->read_bool(utils->data,
"qcom,mdss-dsi-pan-dfps-send-command-with-te-async");
dfps_caps->dfps_send_cmd_support = utils->read_bool(utils->data,
"qcom,mdss-dsi-pan-dpfs-send-command");
if(dfps_caps->dfps_send_cmd_support) {
@ -6212,6 +6267,7 @@ int dsi_panel_dfps_send_cmd(struct dsi_panel *panel)
enum dsi_cmd_set_type type = DSI_CMD_SET_DFPS_CMD_60;
char cmd_set_prop[64];
int rc = 0;
bool async = false;
if (!panel || !panel->cur_mode)
return -EINVAL;
@ -6229,13 +6285,22 @@ int dsi_panel_dfps_send_cmd(struct dsi_panel *panel)
}
}
DSI_INFO("prop %s refresh_rate %d type %d\n", cmd_set_prop, refresh_rate, type);
//DSI_INFO("prop %s refresh_rate %d type %d\n", cmd_set_prop, refresh_rate, type);
if (panel->dfps_caps.dfps_send_cmd_with_te_async) {
if ((panel->dfps_caps.current_fps == 60)||(panel->dfps_caps.current_fps == 90)) async = false;
else async = true;
}
rc = dsi_panel_tx_cmd_set(panel, type);
DSI_INFO("fps switch %d to %d , async %d\n",panel->dfps_caps.current_fps, refresh_rate, async);
rc = dsi_panel_dfps_tx_cmd_set(panel, type, async);
if (rc) {
DSI_ERR("[%s] failed to send %s cmds, rc=%d\n",
panel->name, cmd_set_prop_map[type], rc);
} else {
panel->dfps_caps.current_fps= refresh_rate;
}
mutex_unlock(&panel->panel_lock);
return rc;

View file

@ -125,6 +125,7 @@ struct dsi_dfps_capabilities {
u32 dfps_list_len;
bool dfps_support;
bool dfps_send_cmd_support;
bool dfps_send_cmd_with_te_async;
u32 panel_on_fps;
u32 current_fps;
};