dsi: send command to notify panel when switch FPS

Some panel need send command to DDIC.
That TP can get the current refresh rate.

Change-Id: Iecd1e4675729d1f74461f8d56f8115e4808fa8e2
Signed-off-by: houdz1 <[email protected]>
Reviewed-on: https://gerrit.mot.com/1831813
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Yeqing Wang <[email protected]>
Reviewed-by: Shanshan Dai <[email protected]>
Reviewed-by: Hua Tan <[email protected]>
Reviewed-by: Dezhen Hou <[email protected]>
Reviewed-by: Huosheng Liao <[email protected]>
Submit-Approved: Jira Key
This commit is contained in:
houdz1 2020-12-18 15:25:17 +08:00 • committed by tongkun1
commit 10928a3277
4 changed files with 54 additions and 0 deletions

View file

@ -271,6 +271,8 @@ enum dsi_dyn_clk_feature_type {
* @DSI_CMD_SET_CABC_UI: CABC UI mode
* @DSI_CMD_SET_CABC_MV: CABC MV mode
* @DSI_CMD_SET_CABC_DIS: CABC DIS mode
* @DSI_CMD_SET_DFPS_CMD_90: DFPS switch to 90
* @DSI_CMD_SET_DFPS_CMD_60: DFPS switch to 60
* @DSI_CMD_SET_MAX
*/
@ -307,6 +309,8 @@ enum dsi_cmd_set_type {
DSI_CMD_SET_CABC_UI,
DSI_CMD_SET_CABC_MV,
DSI_CMD_SET_CABC_DIS,
DSI_CMD_SET_DFPS_CMD_90,
DSI_CMD_SET_DFPS_CMD_60,
DSI_CMD_SET_MAX
};

View file

@ -5732,6 +5732,10 @@ static int dsi_display_set_mode_sub(struct dsi_display *display,
DSI_ERR("Fail to add timing params\n");
}
}
if (display->panel->dfps_caps.dfps_send_cmd_support)
dsi_panel_dfps_send_cmd(display->panel);
if (!(mode->dsi_mode_flags & DSI_MODE_FLAG_DYN_CLK))
return rc;
}

View file

@ -1882,6 +1882,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_support = utils->read_bool(utils->data,
"qcom,mdss-dsi-pan-dpfs-send-command");
error:
return rc;
}
@ -2164,6 +2167,8 @@ const char *cmd_set_prop_map[DSI_CMD_SET_MAX] = {
"qcom,mdss-dsi-cabc-ui-command",
"qcom,mdss-dsi-cabc-mv-command",
"qcom,mdss-dsi-cabc-dis-command",
"qcom,mdss-dsi-dfps-90-command",
"qcom,mdss-dsi-dfps-60-command",
};
const char *cmd_set_state_map[DSI_CMD_SET_MAX] = {
@ -2199,6 +2204,8 @@ const char *cmd_set_state_map[DSI_CMD_SET_MAX] = {
"qcom,mdss-dsi-cabc-ui-command-state",
"qcom,mdss-dsi-cabc-mv-command-state",
"qcom,mdss-dsi-cabc-dis-command-state",
"qcom,mdss-dsi-dfps-90-command-state",
"qcom,mdss-dsi-dfps-60-command-state",
};
int dsi_panel_get_cmd_pkt_count(const char *data, u32 length, u32 *cnt)
@ -5720,3 +5727,40 @@ error:
mutex_unlock(&panel->panel_lock);
return rc;
}
int dsi_panel_dfps_send_cmd(struct dsi_panel *panel)
{
struct dsi_display_mode *mode;
u32 refresh_rate = 60;
u32 i;
enum dsi_cmd_set_type type = DSI_CMD_SET_DFPS_CMD_60;
char cmd_set_prop[64];
int rc = 0;
if (!panel || !panel->cur_mode)
return -EINVAL;
mutex_lock(&panel->panel_lock);
mode = panel->cur_mode;
refresh_rate = panel->cur_mode->timing.refresh_rate;
snprintf(cmd_set_prop, sizeof(cmd_set_prop), "qcom,mdss-dsi-dfps-%d-command", refresh_rate);
for (i = DSI_CMD_SET_PRE_ON; i < DSI_CMD_SET_MAX; i++) {
if (!strcmp(cmd_set_prop, cmd_set_prop_map[i])) {
type = i;
break;
}
}
DSI_INFO("prop %s refresh_rate %d type %d\n", cmd_set_prop, refresh_rate, type);
rc = dsi_panel_tx_cmd_set(panel, type);
if (rc) {
DSI_ERR("[%s] failed to send %s cmds, rc=%d\n",
panel->name, cmd_set_prop_map[type], rc);
}
mutex_unlock(&panel->panel_lock);
return rc;
}

View file

@ -117,6 +117,7 @@ struct dsi_dfps_capabilities {
u32 *dfps_list;
u32 dfps_list_len;
bool dfps_support;
bool dfps_send_cmd_support;
};
struct dsi_qsync_capabilities {
@ -523,5 +524,6 @@ int dsi_panel_get_elvss_data(struct dsi_panel *panel);
int dsi_panel_get_elvss_data_1(struct dsi_panel *panel);
int dsi_panel_set_elvss_dim_off(struct dsi_panel *panel, u8 val);
int dsi_panel_parse_elvss_config(struct dsi_panel *panel, u8 elv_vl);
int dsi_panel_dfps_send_cmd(struct dsi_panel *panel);
#endif /* _DSI_PANEL_H_ */