diff --git a/msm/dsi/dsi_defs.h b/msm/dsi/dsi_defs.h index 1f2a6c5b5c..31f9d129fe 100644 --- a/msm/dsi/dsi_defs.h +++ b/msm/dsi/dsi_defs.h @@ -242,6 +242,8 @@ enum dsi_dyn_clk_feature_type { * enum dsi_cmd_set_type - DSI command set type * @DSI_CMD_SET_PRE_ON: Panel pre on * @DSI_CMD_SET_ON: Panel on + * @DSI_CMD_SET_VID_ON: Video mode panel on + * @DSI_CMD_SET_CMD_ON: Command mode panel on * @DSI_CMD_SET_POST_ON: Panel post on * @DSI_CMD_SET_PRE_OFF: Panel pre off * @DSI_CMD_SET_OFF: Panel off @@ -249,10 +251,10 @@ enum dsi_dyn_clk_feature_type { * @DSI_CMD_SET_PRE_RES_SWITCH: Pre resolution switch * @DSI_CMD_SET_RES_SWITCH: Resolution switch * @DSI_CMD_SET_POST_RES_SWITCH: Post resolution switch - * @DSI_CMD_SET_CMD_TO_VID_SWITCH: Cmd to video mode switch - * @DSI_CMD_SET_POST_CMD_TO_VID_SWITCH: Post cmd to vid switch - * @DSI_CMD_SET_VID_TO_CMD_SWITCH: Video to cmd mode switch - * @DSI_CMD_SET_POST_VID_TO_CMD_SWITCH: Post vid to cmd switch + * @DSI_CMD_SET_VID_SWITCH_IN: Video mode switch in + * @DSI_CMD_SET_VID_SWITCH_OUT: Video mode switch out + * @DSI_CMD_SET_CMD_SWITCH_IN: Cmd mode switch in + * @DSI_CMD_SET_CMD_SWITCH_OUT: Cmd mode switch out * @DSI_CMD_SET_PANEL_STATUS: Panel status * @DSI_CMD_SET_LP1: Low power mode 1 * @DSI_CMD_SET_LP2: Low power mode 2 @@ -268,6 +270,8 @@ enum dsi_dyn_clk_feature_type { enum dsi_cmd_set_type { DSI_CMD_SET_PRE_ON = 0, DSI_CMD_SET_ON, + DSI_CMD_SET_VID_ON, + DSI_CMD_SET_CMD_ON, DSI_CMD_SET_POST_ON, DSI_CMD_SET_PRE_OFF, DSI_CMD_SET_OFF, @@ -275,10 +279,10 @@ enum dsi_cmd_set_type { DSI_CMD_SET_PRE_RES_SWITCH, DSI_CMD_SET_RES_SWITCH, DSI_CMD_SET_POST_RES_SWITCH, - DSI_CMD_SET_CMD_TO_VID_SWITCH, - DSI_CMD_SET_POST_CMD_TO_VID_SWITCH, - DSI_CMD_SET_VID_TO_CMD_SWITCH, - DSI_CMD_SET_POST_VID_TO_CMD_SWITCH, + DSI_CMD_SET_VID_SWITCH_IN, + DSI_CMD_SET_VID_SWITCH_OUT, + DSI_CMD_SET_CMD_SWITCH_IN, + DSI_CMD_SET_CMD_SWITCH_OUT, DSI_CMD_SET_PANEL_STATUS, DSI_CMD_SET_LP1, DSI_CMD_SET_LP2, diff --git a/msm/dsi/dsi_display.c b/msm/dsi/dsi_display.c index 7af9fdeead..a242f42b58 100644 --- a/msm/dsi/dsi_display.c +++ b/msm/dsi/dsi_display.c @@ -8209,10 +8209,10 @@ int dsi_display_post_enable(struct dsi_display *display) if (display->panel->cur_mode->dsi_mode_flags & DSI_MODE_FLAG_POMS_TO_CMD) { - dsi_panel_mode_switch_to_cmd(display->panel); + dsi_panel_switch_cmd_mode_in(display->panel); } else if (display->panel->cur_mode->dsi_mode_flags & DSI_MODE_FLAG_POMS_TO_VID) - dsi_panel_mode_switch_to_vid(display->panel); + dsi_panel_switch_video_mode_in(display->panel); else { rc = dsi_panel_post_enable(display->panel); if (rc) @@ -8246,7 +8246,7 @@ int dsi_display_pre_disable(struct dsi_display *display) DSI_ALL_CLKS, DSI_CLK_ON); if (display->poms_pending) { if (display->config.panel_mode == DSI_OP_CMD_MODE) - dsi_panel_pre_mode_switch_to_video(display->panel); + dsi_panel_switch_cmd_mode_out(display->panel); if (display->config.panel_mode == DSI_OP_VIDEO_MODE) { /* @@ -8268,7 +8268,7 @@ int dsi_display_pre_disable(struct dsi_display *display) goto error_disable_clks; } - dsi_panel_pre_mode_switch_to_cmd(display->panel); + dsi_panel_switch_video_mode_out(display->panel); } } else { rc = dsi_panel_pre_disable(display->panel); diff --git a/msm/dsi/dsi_panel.c b/msm/dsi/dsi_panel.c index 057dafcf71..cbdc37fd24 100644 --- a/msm/dsi/dsi_panel.c +++ b/msm/dsi/dsi_panel.c @@ -442,7 +442,7 @@ static int dsi_panel_tx_cmd_set(struct dsi_panel *panel, if (cmds->last_command) cmds->msg.flags |= MIPI_DSI_MSG_LASTCOMMAND; - if (type == DSI_CMD_SET_VID_TO_CMD_SWITCH) + if (type == DSI_CMD_SET_VID_SWITCH_OUT) cmds->msg.flags |= MIPI_DSI_MSG_ASYNC_OVERRIDE; len = ops->transfer(panel->host, &cmds->msg); @@ -1704,6 +1704,8 @@ error: const char *cmd_set_prop_map[DSI_CMD_SET_MAX] = { "qcom,mdss-dsi-pre-on-command", "qcom,mdss-dsi-on-command", + "qcom,vid-on-commands", + "qcom,cmd-on-commands", "qcom,mdss-dsi-post-panel-on-command", "qcom,mdss-dsi-pre-off-command", "qcom,mdss-dsi-off-command", @@ -1711,10 +1713,10 @@ const char *cmd_set_prop_map[DSI_CMD_SET_MAX] = { "qcom,mdss-dsi-pre-res-switch", "qcom,mdss-dsi-res-switch", "qcom,mdss-dsi-post-res-switch", - "qcom,cmd-to-video-mode-switch-commands", - "qcom,cmd-to-video-mode-post-switch-commands", - "qcom,video-to-cmd-mode-switch-commands", - "qcom,video-to-cmd-mode-post-switch-commands", + "qcom,video-mode-switch-in-commands", + "qcom,video-mode-switch-out-commands", + "qcom,cmd-mode-switch-in-commands", + "qcom,cmd-mode-switch-out-commands", "qcom,mdss-dsi-panel-status-command", "qcom,mdss-dsi-lp1-command", "qcom,mdss-dsi-lp2-command", @@ -1730,6 +1732,8 @@ const char *cmd_set_prop_map[DSI_CMD_SET_MAX] = { const char *cmd_set_state_map[DSI_CMD_SET_MAX] = { "qcom,mdss-dsi-pre-on-command-state", "qcom,mdss-dsi-on-command-state", + "qcom,vid-on-commands-state", + "qcom,cmd-on-commands-state", "qcom,mdss-dsi-post-on-command-state", "qcom,mdss-dsi-pre-off-command-state", "qcom,mdss-dsi-off-command-state", @@ -1737,10 +1741,10 @@ const char *cmd_set_state_map[DSI_CMD_SET_MAX] = { "qcom,mdss-dsi-pre-res-switch-state", "qcom,mdss-dsi-res-switch-state", "qcom,mdss-dsi-post-res-switch-state", - "qcom,cmd-to-video-mode-switch-commands-state", - "qcom,cmd-to-video-mode-post-switch-commands-state", - "qcom,video-to-cmd-mode-switch-commands-state", - "qcom,video-to-cmd-mode-post-switch-commands-state", + "qcom,video-mode-switch-in-commands-state", + "qcom,video-mode-switch-out-commands-state", + "qcom,cmd-mode-switch-in-commands-state", + "qcom,cmd-mode-switch-out-commands-state", "qcom,mdss-dsi-panel-status-command-state", "qcom,mdss-dsi-lp1-command-state", "qcom,mdss-dsi-lp2-command-state", @@ -4479,7 +4483,7 @@ int dsi_panel_send_roi_dcs(struct dsi_panel *panel, int ctrl_idx, return rc; } -int dsi_panel_pre_mode_switch_to_video(struct dsi_panel *panel) +int dsi_panel_switch_cmd_mode_out(struct dsi_panel *panel) { int rc = 0; @@ -4490,16 +4494,16 @@ int dsi_panel_pre_mode_switch_to_video(struct dsi_panel *panel) mutex_lock(&panel->panel_lock); - rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_CMD_TO_VID_SWITCH); + rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_CMD_SWITCH_OUT); if (rc) - DSI_ERR("[%s] failed to send DSI_CMD_SET_CMD_TO_VID_SWITCH cmds, rc=%d\n", + DSI_ERR("[%s] failed to send DSI_CMD_SET_CMD_SWITCH_OUT cmds, rc=%d\n", panel->name, rc); mutex_unlock(&panel->panel_lock); return rc; } -int dsi_panel_pre_mode_switch_to_cmd(struct dsi_panel *panel) +int dsi_panel_switch_video_mode_out(struct dsi_panel *panel) { int rc = 0; @@ -4510,16 +4514,16 @@ int dsi_panel_pre_mode_switch_to_cmd(struct dsi_panel *panel) mutex_lock(&panel->panel_lock); - rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_VID_TO_CMD_SWITCH); + rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_VID_SWITCH_OUT); if (rc) - DSI_ERR("[%s] failed to send DSI_CMD_SET_CMD_TO_VID_SWITCH cmds, rc=%d\n", + DSI_ERR("[%s] failed to send DSI_CMD_SET_VID_SWITCH_OUT cmds, rc=%d\n", panel->name, rc); mutex_unlock(&panel->panel_lock); return rc; } -int dsi_panel_mode_switch_to_cmd(struct dsi_panel *panel) +int dsi_panel_switch_video_mode_in(struct dsi_panel *panel) { int rc = 0; @@ -4530,16 +4534,16 @@ int dsi_panel_mode_switch_to_cmd(struct dsi_panel *panel) mutex_lock(&panel->panel_lock); - rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_POST_VID_TO_CMD_SWITCH); + rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_VID_SWITCH_IN); if (rc) - DSI_ERR("[%s] failed to send DSI_CMD_SET_CMD_TO_VID_SWITCH cmds, rc=%d\n", + DSI_ERR("[%s] failed to send DSI_CMD_SET_VID_SWITCH_IN cmds, rc=%d\n", panel->name, rc); mutex_unlock(&panel->panel_lock); return rc; } -int dsi_panel_mode_switch_to_vid(struct dsi_panel *panel) +int dsi_panel_switch_cmd_mode_in(struct dsi_panel *panel) { int rc = 0; @@ -4550,9 +4554,9 @@ int dsi_panel_mode_switch_to_vid(struct dsi_panel *panel) mutex_lock(&panel->panel_lock); - rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_POST_CMD_TO_VID_SWITCH); + rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_CMD_SWITCH_IN); if (rc) - DSI_ERR("[%s] failed to send DSI_CMD_SET_CMD_TO_VID_SWITCH cmds, rc=%d\n", + DSI_ERR("[%s] failed to send DSI_CMD_SET_CMD_SWITCH_IN cmds, rc=%d\n", panel->name, rc); mutex_unlock(&panel->panel_lock); @@ -4611,11 +4615,30 @@ int dsi_panel_enable(struct dsi_panel *panel) mutex_lock(&panel->panel_lock); rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_ON); - if (rc) + if (rc) { DSI_ERR("[%s] failed to send DSI_CMD_SET_ON cmds, rc=%d\n", panel->name, rc); - else - panel->panel_initialized = true; + goto error; + } + + if (panel->panel_mode == DSI_OP_CMD_MODE) { + rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_CMD_ON); + if (rc) { + DSI_ERR("[%s] failed to send DSI_CMD_SET_CMD_ON cmds, rc=%d\n", + panel->name, rc); + goto error; + } + } else if (panel->panel_mode == DSI_OP_VIDEO_MODE) { + rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_VID_ON); + if (rc) { + DSI_ERR("[%s] failed to send DSI_CMD_SET_VID_ON cmds, rc=%d\n", + panel->name, rc); + goto error; + } + } + panel->panel_initialized = true; + +error: mutex_unlock(&panel->panel_lock); return rc; } diff --git a/msm/dsi/dsi_panel.h b/msm/dsi/dsi_panel.h index 994b23fc8f..365b4d4991 100644 --- a/msm/dsi/dsi_panel.h +++ b/msm/dsi/dsi_panel.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved. */ #ifndef _DSI_PANEL_H_ @@ -361,10 +361,13 @@ int dsi_panel_send_qsync_off_dcs(struct dsi_panel *panel, int dsi_panel_send_roi_dcs(struct dsi_panel *panel, int ctrl_idx, struct dsi_rect *roi); -int dsi_panel_pre_mode_switch_to_video(struct dsi_panel *panel); -int dsi_panel_pre_mode_switch_to_cmd(struct dsi_panel *panel); -int dsi_panel_mode_switch_to_cmd(struct dsi_panel *panel); -int dsi_panel_mode_switch_to_vid(struct dsi_panel *panel); +int dsi_panel_switch_video_mode_out(struct dsi_panel *panel); + +int dsi_panel_switch_cmd_mode_out(struct dsi_panel *panel); + +int dsi_panel_switch_cmd_mode_in(struct dsi_panel *panel); + +int dsi_panel_switch_video_mode_in(struct dsi_panel *panel); int dsi_panel_switch(struct dsi_panel *panel);