Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5f00c060 authored by Clarence Ip's avatar Clarence Ip
Browse files

drm/msm/dsi-staging: add lp1/lp2 command support



Add support for DSI panel-specific "LP1" and "LP2" command
strings. These are optional commands that request DSI
panels to enter low power (LP1) and very low power (LP2)
display modes.

CRs-Fixed: 2073016
Change-Id: I20c6796acca465359838377d72d631ae7eb0aa53
Signed-off-by: default avatarClarence Ip <cip@codeaurora.org>
parent 89628139
Loading
Loading
Loading
Loading
+18 −0
Original line number Original line Diff line number Diff line
@@ -401,6 +401,24 @@ Optional properties:
					String that specifies the ctrl state for reading the panel status.
					String that specifies the ctrl state for reading the panel status.
					"dsi_lp_mode" = DSI low power mode
					"dsi_lp_mode" = DSI low power mode
					"dsi_hs_mode" = DSI high speed mode
					"dsi_hs_mode" = DSI high speed mode
- qcom,mdss-dsi-lp1-command:		An optional byte stream to request low
					power mode on a panel
- qcom,mdss-dsi-lp1-command-mode:	String that specifies the ctrl state for
					setting the panel power mode.
					"dsi_lp_mode" = DSI low power mode
					"dsi_hs_mode" = DSI high speed mode
- qcom,mdss-dsi-lp2-command:		An optional byte stream to request ultra
					low power mode on a panel
- qcom,mdss-dsi-lp2-command-mode:	String that specifies the ctrl state for
					setting the panel power mode.
					"dsi_lp_mode" = DSI low power mode
					"dsi_hs_mode" = DSI high speed mode
- qcom,mdss-dsi-nolp-command:		An optional byte stream to disable low
					power and ultra low power panel modes
- qcom,mdss-dsi-nolp-command-mode:	String that specifies the ctrl state for
					setting the panel power mode.
					"dsi_lp_mode" = DSI low power mode
					"dsi_hs_mode" = DSI high speed mode
- qcom,mdss-dsi-panel-status-check-mode:Specifies the panel status check method for ESD recovery.
- qcom,mdss-dsi-panel-status-check-mode:Specifies the panel status check method for ESD recovery.
					"bta_check" = Uses BTA to check the panel status
					"bta_check" = Uses BTA to check the panel status
					"reg_read" = Reads panel status register to check the panel status
					"reg_read" = Reads panel status register to check the panel status
+25 −0
Original line number Original line Diff line number Diff line
@@ -141,6 +141,31 @@ static void _dsi_display_setup_misr(struct dsi_display *display)
	}
	}
}
}


int dsi_display_set_power(struct drm_connector *connector,
		int power_mode, void *disp)
{
	struct dsi_display *display = disp;
	int rc = 0;

	if (!display || !display->panel) {
		pr_err("invalid display/panel\n");
		return -EINVAL;
	}

	switch (power_mode) {
	case SDE_MODE_DPMS_LP1:
		rc = dsi_panel_set_lp1(display->panel);
		break;
	case SDE_MODE_DPMS_LP2:
		rc = dsi_panel_set_lp2(display->panel);
		break;
	default:
		rc = dsi_panel_set_nolp(display->panel);
		break;
	}
	return rc;
}

static ssize_t debugfs_dump_info_read(struct file *file,
static ssize_t debugfs_dump_info_read(struct file *file,
				      char __user *user_buf,
				      char __user *user_buf,
				      size_t user_len,
				      size_t user_len,
+16 −0
Original line number Original line Diff line number Diff line
@@ -477,6 +477,22 @@ int dsi_display_set_backlight(void *display, u32 bl_lvl);
 */
 */
int dsi_display_soft_reset(void *display);
int dsi_display_soft_reset(void *display);


/**
 * dsi_display_set_power - update power/dpms setting
 * @connector: Pointer to drm connector structure
 * @power_mode: One of the following,
 *              SDE_MODE_DPMS_ON
 *              SDE_MODE_DPMS_LP1
 *              SDE_MODE_DPMS_LP2
 *              SDE_MODE_DPMS_STANDBY
 *              SDE_MODE_DPMS_SUSPEND
 *              SDE_MODE_DPMS_OFF
 * @display: Pointer to private display structure
 * Returns: Zero on success
 */
int dsi_display_set_power(struct drm_connector *connector,
		int power_mode, void *display);

/*
/*
 * dsi_display_pre_kickoff - program kickoff-time features
 * dsi_display_pre_kickoff - program kickoff-time features
 * @display: Pointer to private display structure
 * @display: Pointer to private display structure
+60 −0
Original line number Original line Diff line number Diff line
@@ -1333,6 +1333,9 @@ const char *cmd_set_prop_map[DSI_CMD_SET_MAX] = {
	"qcom,video-to-cmd-mode-switch-commands",
	"qcom,video-to-cmd-mode-switch-commands",
	"qcom,video-to-cmd-mode-post-switch-commands",
	"qcom,video-to-cmd-mode-post-switch-commands",
	"qcom,mdss-dsi-panel-status-command",
	"qcom,mdss-dsi-panel-status-command",
	"qcom,mdss-dsi-lp1-command",
	"qcom,mdss-dsi-lp2-command",
	"qcom,mdss-dsi-nolp-command",
	"PPS not parsed from DTSI, generated dynamically",
	"PPS not parsed from DTSI, generated dynamically",
	"ROI not parsed from DTSI, generated dynamically",
	"ROI not parsed from DTSI, generated dynamically",
};
};
@@ -1352,6 +1355,9 @@ const char *cmd_set_state_map[DSI_CMD_SET_MAX] = {
	"qcom,video-to-cmd-mode-switch-commands-state",
	"qcom,video-to-cmd-mode-switch-commands-state",
	"qcom,video-to-cmd-mode-post-switch-commands-state",
	"qcom,video-to-cmd-mode-post-switch-commands-state",
	"qcom,mdss-dsi-panel-status-command-state",
	"qcom,mdss-dsi-panel-status-command-state",
	"qcom,mdss-dsi-lp1-command-state",
	"qcom,mdss-dsi-lp2-command-state",
	"qcom,mdss-dsi-nolp-command-state",
	"PPS not parsed from DTSI, generated dynamically",
	"PPS not parsed from DTSI, generated dynamically",
	"ROI not parsed from DTSI, generated dynamically",
	"ROI not parsed from DTSI, generated dynamically",
};
};
@@ -2745,6 +2751,60 @@ int dsi_panel_update_pps(struct dsi_panel *panel)
	return rc;
	return rc;
}
}


int dsi_panel_set_lp1(struct dsi_panel *panel)
{
	int rc = 0;

	if (!panel) {
		pr_err("invalid params\n");
		return -EINVAL;
	}

	mutex_lock(&panel->panel_lock);
	rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_LP1);
	if (rc)
		pr_err("[%s] failed to send DSI_CMD_SET_LP1 cmd, rc=%d\n",
		       panel->name, rc);
	mutex_unlock(&panel->panel_lock);
	return rc;
}

int dsi_panel_set_lp2(struct dsi_panel *panel)
{
	int rc = 0;

	if (!panel) {
		pr_err("invalid params\n");
		return -EINVAL;
	}

	mutex_lock(&panel->panel_lock);
	rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_LP2);
	if (rc)
		pr_err("[%s] failed to send DSI_CMD_SET_LP2 cmd, rc=%d\n",
		       panel->name, rc);
	mutex_unlock(&panel->panel_lock);
	return rc;
}

int dsi_panel_set_nolp(struct dsi_panel *panel)
{
	int rc = 0;

	if (!panel) {
		pr_err("invalid params\n");
		return -EINVAL;
	}

	mutex_lock(&panel->panel_lock);
	rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_NOLP);
	if (rc)
		pr_err("[%s] failed to send DSI_CMD_SET_NOLP cmd, rc=%d\n",
		       panel->name, rc);
	mutex_unlock(&panel->panel_lock);
	return rc;
}

int dsi_panel_prepare(struct dsi_panel *panel)
int dsi_panel_prepare(struct dsi_panel *panel)
{
{
	int rc = 0;
	int rc = 0;
+9 −0
Original line number Original line Diff line number Diff line
@@ -55,6 +55,9 @@ enum dsi_cmd_set_type {
	DSI_CMD_SET_VID_TO_CMD_SWITCH,
	DSI_CMD_SET_VID_TO_CMD_SWITCH,
	DSI_CMD_SET_POST_VID_TO_CMD_SWITCH,
	DSI_CMD_SET_POST_VID_TO_CMD_SWITCH,
	DSI_CMD_SET_PANEL_STATUS,
	DSI_CMD_SET_PANEL_STATUS,
	DSI_CMD_SET_LP1,
	DSI_CMD_SET_LP2,
	DSI_CMD_SET_NOLP,
	DSI_CMD_SET_PPS,
	DSI_CMD_SET_PPS,
	DSI_CMD_SET_ROI,
	DSI_CMD_SET_ROI,
	DSI_CMD_SET_MAX
	DSI_CMD_SET_MAX
@@ -230,6 +233,12 @@ int dsi_panel_get_dfps_caps(struct dsi_panel *panel,


int dsi_panel_pre_prepare(struct dsi_panel *panel);
int dsi_panel_pre_prepare(struct dsi_panel *panel);


int dsi_panel_set_lp1(struct dsi_panel *panel);

int dsi_panel_set_lp2(struct dsi_panel *panel);

int dsi_panel_set_nolp(struct dsi_panel *panel);

int dsi_panel_prepare(struct dsi_panel *panel);
int dsi_panel_prepare(struct dsi_panel *panel);


int dsi_panel_enable(struct dsi_panel *panel);
int dsi_panel_enable(struct dsi_panel *panel);