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

Commit e5a5b9e6 authored by Padmanabhan Komanduru's avatar Padmanabhan Komanduru
Browse files

msm: mdss: handle DSI ctrl/PHY regulator control properly



Power on/off of the DSI regulators is currently tied to the state
of the DSI Panel as part of DSI clock control API. During
mdss_dsi_on(), the panel will still be blanked but DSI is powered
on. Due to the current logic, we will end up powering down the DSI
ctrl/PHY regulators at the end of mdss_dsi_on() for command mode
panels when we turn off the DSI core and link clocks. This might
cause an abnormal waveform during resume on DSI clock/data lanes
until we power ON back the DSI regulators as part of DSI panel
unblank. Fix this by using the DSI controller state variable instead
of DSI panel state.

Change-Id: Icfa3910f7204c3db63e21a9c9ba082430c0fdf56
Signed-off-by: default avatarPadmanabhan Komanduru <pkomandu@codeaurora.org>
parent ec7db6c5
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -1086,6 +1086,8 @@ static int mdss_dsi_off(struct mdss_panel_data *pdata, int power_state)
		/* disable DSI phy */
		mdss_dsi_phy_disable(ctrl_pdata);
	}
	ctrl_pdata->ctrl_state &= ~CTRL_STATE_DSI_ACTIVE;

	mdss_dsi_clk_ctrl(ctrl_pdata, ctrl_pdata->dsi_clk_handle,
			  MDSS_DSI_CORE_CLK, MDSS_DSI_CLK_OFF);

@@ -1289,6 +1291,7 @@ int mdss_dsi_on(struct mdss_panel_data *pdata)
		mdss_dsi_phy_init(ctrl_pdata);
		mdss_dsi_ctrl_setup(ctrl_pdata);
	}
	ctrl_pdata->ctrl_state |= CTRL_STATE_DSI_ACTIVE;

	/* DSI link clocks need to be on prior to ctrl sw reset */
	mdss_dsi_clk_ctrl(ctrl_pdata, ctrl_pdata->dsi_clk_handle,
@@ -1403,9 +1406,9 @@ static int mdss_dsi_unblank(struct mdss_panel_data *pdata)
				panel_data);
	mipi  = &pdata->panel_info.mipi;

	pr_debug("%s+: ctrl=%p ndx=%d cur_blank_state=%d ctrl_state=%x\n",
	pr_debug("%s+: ctrl=%p ndx=%d cur_power_state=%d ctrl_state=%x\n",
			__func__, ctrl_pdata, ctrl_pdata->ndx,
			pdata->panel_info.blank_state, ctrl_pdata->ctrl_state);
		pdata->panel_info.panel_power_state, ctrl_pdata->ctrl_state);

	if (mdss_dsi_is_ctrl_clk_master(ctrl_pdata))
		sctrl = mdss_dsi_get_ctrl_clk_slave();
@@ -1416,7 +1419,7 @@ static int mdss_dsi_unblank(struct mdss_panel_data *pdata)
		mdss_dsi_clk_ctrl(sctrl, sctrl->dsi_clk_handle,
				  MDSS_DSI_ALL_CLKS, MDSS_DSI_CLK_ON);

	if (pdata->panel_info.blank_state == MDSS_PANEL_BLANK_LOW_POWER) {
	if (mdss_dsi_is_panel_on_lp(pdata)) {
		pr_debug("%s: dsi_unblank with panel always on\n", __func__);
		if (ctrl_pdata->low_power_config)
			ret = ctrl_pdata->low_power_config(pdata, false);
@@ -2531,7 +2534,8 @@ static int mdss_dsi_cont_splash_config(struct mdss_panel_info *pinfo,
		}
		if (ctrl_pdata->bklt_ctrl == BL_PWM)
			mdss_dsi_panel_pwm_enable(ctrl_pdata);
		pinfo->blank_state = MDSS_PANEL_BLANK_UNBLANK;
		ctrl_pdata->ctrl_state |= (CTRL_STATE_PANEL_INIT |
			CTRL_STATE_MDP_ACTIVE | CTRL_STATE_DSI_ACTIVE);
		if (ctrl_pdata->panel_data.panel_info.type == MIPI_CMD_PANEL)
			clk_handle = ctrl_pdata->mdp_clk_handle;
		else
@@ -2547,8 +2551,6 @@ static int mdss_dsi_cont_splash_config(struct mdss_panel_info *pinfo,
			if (data & BIT(16))
				ctrl_pdata->burst_mode_enabled = true;
		}
		ctrl_pdata->ctrl_state |=
			(CTRL_STATE_PANEL_INIT | CTRL_STATE_MDP_ACTIVE);
	} else {
		pinfo->panel_power_state = MDSS_PANEL_POWER_OFF;
	}
+10 −0
Original line number Diff line number Diff line
@@ -134,9 +134,19 @@ enum dsi_pm_type {
	DSI_MAX_PM
};

/*
 * DSI controller states.
 *	CTRL_STATE_UNKNOWN - Unknown state of DSI controller.
 *	CTRL_STATE_PANEL_INIT - State specifies that the panel is initialized.
 *	CTRL_STATE_MDP_ACTIVE - State specifies that MDP is ready to send
 *				data to DSI.
 *	CTRL_STATE_DSI_ACTIVE - State specifies that DSI controller/PHY is
 *				initialized.
 */
#define CTRL_STATE_UNKNOWN		0x00
#define CTRL_STATE_PANEL_INIT		BIT(0)
#define CTRL_STATE_MDP_ACTIVE		BIT(1)
#define CTRL_STATE_DSI_ACTIVE		BIT(2)

#define DSI_NON_BURST_SYNCH_PULSE	0
#define DSI_NON_BURST_SYNCH_EVENT	1
+0 −6
Original line number Diff line number Diff line
@@ -723,7 +723,6 @@ static int mdss_dsi_panel_on(struct mdss_panel_data *pdata)
	}

end:
	pinfo->blank_state = MDSS_PANEL_BLANK_UNBLANK;
	pr_debug("%s:-\n", __func__);
	return ret;
}
@@ -784,7 +783,6 @@ static int mdss_dsi_panel_off(struct mdss_panel_data *pdata)
		mdss_dsi_panel_cmds_send(ctrl, &ctrl->off_cmds, CMD_REQ_COMMIT);

end:
	pinfo->blank_state = MDSS_PANEL_BLANK_BLANK;
	pr_debug("%s:-\n", __func__);
	return 0;
}
@@ -808,10 +806,6 @@ static int mdss_dsi_panel_low_power_config(struct mdss_panel_data *pdata,
		enable);

	/* Any panel specific low power commands/config */
	if (enable)
		pinfo->blank_state = MDSS_PANEL_BLANK_LOW_POWER;
	else
		pinfo->blank_state = MDSS_PANEL_BLANK_UNBLANK;

	pr_debug("%s:-\n", __func__);
	return 0;
+0 −1
Original line number Diff line number Diff line
@@ -584,7 +584,6 @@ struct mdss_panel_info {
	u32 partial_update_roi_merge;
	struct ion_handle *splash_ihdl;
	int panel_power_state;
	int blank_state;
	int compression_mode;

	uint32_t panel_dead;
+4 −7
Original line number Diff line number Diff line
@@ -1457,8 +1457,7 @@ int mdss_dsi_pre_clkoff_cb(void *priv,
		 * However, when blanking the panel, we should enter ULPS
		 * only if ULPS during suspend feature is enabled.
		 */
		if (pdata->panel_info.blank_state ==
			MDSS_PANEL_BLANK_BLANK) {
		if (!(ctrl->ctrl_state & CTRL_STATE_DSI_ACTIVE)) {
			if (pdata->panel_info.ulps_suspend_enabled)
				mdss_dsi_ulps_config(ctrl, 1);
		} else if (mdss_dsi_ulps_feature_enabled(pdata)) {
@@ -1476,7 +1475,7 @@ int mdss_dsi_pre_clkoff_cb(void *priv,
		 * Enable DSI clamps only if entering idle power collapse or
		 * when ULPS during suspend is enabled.
		 */
		if ((pdata->panel_info.blank_state != MDSS_PANEL_BLANK_BLANK) ||
		if ((ctrl->ctrl_state & CTRL_STATE_DSI_ACTIVE) ||
			pdata->panel_info.ulps_suspend_enabled) {
			rc = mdss_dsi_clamp_ctrl(ctrl, 1);
			if (rc)
@@ -1578,8 +1577,7 @@ int mdss_dsi_post_clkoff_cb(void *priv,

		for (i = DSI_MAX_PM - 1; i >= DSI_CORE_PM; i--) {
			if ((i != DSI_CORE_PM) &&
			    (pdata->panel_info.blank_state !=
			     MDSS_PANEL_BLANK_BLANK))
			    (ctrl->ctrl_state & CTRL_STATE_DSI_ACTIVE))
				continue;
			rc = msm_dss_enable_vreg(
				sdata->power_data[i].vreg_config,
@@ -1628,8 +1626,7 @@ int mdss_dsi_pre_clkon_cb(void *priv,
		pr_debug("%s: Enable DSI core power\n", __func__);
		for (i = DSI_CORE_PM; i < DSI_MAX_PM; i++) {
			if ((i != DSI_CORE_PM) &&
			    (pdata->panel_info.blank_state !=
				MDSS_PANEL_BLANK_BLANK) &&
			    (ctrl->ctrl_state & CTRL_STATE_DSI_ACTIVE) &&
				!pdata->panel_info.cont_splash_enabled)
				continue;
			rc = msm_dss_enable_vreg(