Merge "msm: mdss: fix conditional check for panel LP configuration"

This commit is contained in:
Linux Build Service Account 2017-03-13 11:50:02 -07:00 committed by Gerrit - the friendly Code Review server
commit ba87e6c3e7
6 changed files with 59 additions and 32 deletions

View file

@ -1576,10 +1576,12 @@ 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 (mdss_dsi_is_panel_on_lp(pdata)) {
if (ctrl_pdata->ctrl_state & CTRL_STATE_PANEL_LP) {
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);
if (!ret)
ctrl_pdata->ctrl_state &= ~CTRL_STATE_PANEL_LP;
goto error;
}
@ -1644,6 +1646,8 @@ static int mdss_dsi_blank(struct mdss_panel_data *pdata, int power_state)
pr_debug("%s: low power state requested\n", __func__);
if (ctrl_pdata->low_power_config)
ret = ctrl_pdata->low_power_config(pdata, true);
if (!ret)
ctrl_pdata->ctrl_state |= CTRL_STATE_PANEL_LP;
goto error;
}
@ -1686,7 +1690,8 @@ static int mdss_dsi_blank(struct mdss_panel_data *pdata, int power_state)
}
ATRACE_END("dsi_panel_off");
}
ctrl_pdata->ctrl_state &= ~CTRL_STATE_PANEL_INIT;
ctrl_pdata->ctrl_state &= ~(CTRL_STATE_PANEL_INIT |
CTRL_STATE_PANEL_LP);
}
error:

View file

@ -166,6 +166,7 @@ enum dsi_pm_type {
#define CTRL_STATE_PANEL_INIT BIT(0)
#define CTRL_STATE_MDP_ACTIVE BIT(1)
#define CTRL_STATE_DSI_ACTIVE BIT(2)
#define CTRL_STATE_PANEL_LP BIT(3)
#define DSI_NON_BURST_SYNCH_PULSE 0
#define DSI_NON_BURST_SYNCH_EVENT 1

View file

@ -766,6 +766,8 @@ static void mdss_dsi_ctl_phy_reset(struct mdss_dsi_ctrl_pdata *ctrl, u32 event)
u32 data0, data1, mask = 0, data_lane_en = 0;
struct mdss_dsi_ctrl_pdata *ctrl0, *ctrl1;
u32 ln0, ln1, ln_ctrl0, ln_ctrl1, i;
int rc = 0;
/*
* Add 2 ms delay suggested by HW team.
* Check clk lane stop state after every 200 us
@ -787,9 +789,15 @@ static void mdss_dsi_ctl_phy_reset(struct mdss_dsi_ctrl_pdata *ctrl, u32 event)
ctrl0 = mdss_dsi_get_ctrl_by_index(DSI_CTRL_0);
ctrl1 = mdss_dsi_get_ctrl_by_index(DSI_CTRL_1);
if (ctrl0->recovery)
ctrl0->recovery->fxn(ctrl0->recovery->data,
if (ctrl0->recovery) {
rc = ctrl0->recovery->fxn(ctrl0->recovery->data,
MDP_INTF_DSI_VIDEO_FIFO_OVERFLOW);
if (rc < 0) {
pr_debug("%s: Target is in suspend/shutdown\n",
__func__);
return;
}
}
/*
* Disable PHY contention detection and receive.
* Configure the strength ctrl 1 register.
@ -879,9 +887,15 @@ static void mdss_dsi_ctl_phy_reset(struct mdss_dsi_ctrl_pdata *ctrl, u32 event)
*/
udelay(200);
} else {
if (ctrl->recovery)
ctrl->recovery->fxn(ctrl->recovery->data,
if (ctrl->recovery) {
rc = ctrl->recovery->fxn(ctrl->recovery->data,
MDP_INTF_DSI_VIDEO_FIFO_OVERFLOW);
if (rc < 0) {
pr_debug("%s: Target is in suspend/shutdown\n",
__func__);
return;
}
}
/* Disable PHY contention detection and receive */
MIPI_OUTP((ctrl->phy_io.base) + 0x0188, 0);
@ -2134,8 +2148,8 @@ static int mdss_dsi_cmd_dma_tx(struct mdss_dsi_ctrl_pdata *ctrl,
status = reg_val & DSI_INTR_CMD_DMA_DONE;
if (status) {
reg_val &= DSI_INTR_MASK_ALL;
/* clear CMD DMA isr only */
reg_val |= DSI_INTR_CMD_DMA_DONE;
/* clear CMD DMA and BTA_DONE isr only */
reg_val |= (DSI_INTR_CMD_DMA_DONE | DSI_INTR_BTA_DONE);
MIPI_OUTP(ctrl->ctrl_base + 0x0110, reg_val);
mdss_dsi_disable_irq_nosync(ctrl, DSI_CMD_TERM);
complete(&ctrl->dma_comp);
@ -3030,6 +3044,13 @@ static bool mdss_dsi_fifo_status(struct mdss_dsi_ctrl_pdata *ctrl)
pr_err("%s: status=%x\n", __func__, status);
/*
* if DSI FIFO overflow is masked,
* do not report overflow error
*/
if (MIPI_INP(base + 0x10c) & 0xf0000)
status = status & 0xaaaaffff;
if (status & 0x44440000) {/* DLNx_HS_FIFO_OVERFLOW */
dsi_send_events(ctrl, DSI_EV_DLNx_FIFO_OVERFLOW, 0);
/* Ignore FIFO EMPTY when overflow happens */

View file

@ -1197,7 +1197,7 @@ static int mdss_mdp_cmd_wait4readptr(struct mdss_mdp_cmd_ctx *ctx)
return rc;
}
static void mdss_mdp_cmd_intf_callback(void *data, int event)
static int mdss_mdp_cmd_intf_callback(void *data, int event)
{
struct mdss_mdp_cmd_ctx *ctx = data;
struct mdss_mdp_pp_tear_check *te = NULL;
@ -1206,11 +1206,11 @@ static void mdss_mdp_cmd_intf_callback(void *data, int event)
if (!data) {
pr_err("%s: invalid ctx\n", __func__);
return;
return -EINVAL;
}
if (!ctx->ctl)
return;
return -EINVAL;
switch (event) {
case MDP_INTF_CALLBACK_DSI_WAIT:
@ -1222,7 +1222,7 @@ static void mdss_mdp_cmd_intf_callback(void *data, int event)
* just return
*/
if (ctx->intf_stopped || !is_pingpong_split(ctx->ctl->mfd))
return;
return -EINVAL;
atomic_inc(&ctx->rdptr_cnt);
/* enable clks and rd_ptr interrupt */
@ -1231,7 +1231,7 @@ static void mdss_mdp_cmd_intf_callback(void *data, int event)
mixer = mdss_mdp_mixer_get(ctx->ctl, MDSS_MDP_MIXER_MUX_LEFT);
if (!mixer) {
pr_err("%s: null mixer\n", __func__);
return;
return -EINVAL;
}
/* wait for read pointer */
@ -1255,6 +1255,7 @@ static void mdss_mdp_cmd_intf_callback(void *data, int event)
pr_debug("%s: unhandled event=%d\n", __func__, event);
break;
}
return 0;
}
static void mdss_mdp_cmd_lineptr_done(void *arg)
@ -1280,7 +1281,7 @@ static void mdss_mdp_cmd_lineptr_done(void *arg)
spin_unlock(&ctx->clk_lock);
}
static void mdss_mdp_cmd_intf_recovery(void *data, int event)
static int mdss_mdp_cmd_intf_recovery(void *data, int event)
{
struct mdss_mdp_cmd_ctx *ctx = data;
unsigned long flags;
@ -1288,11 +1289,11 @@ static void mdss_mdp_cmd_intf_recovery(void *data, int event)
if (!data) {
pr_err("%s: invalid ctx\n", __func__);
return;
return -EINVAL;
}
if (!ctx->ctl)
return;
return -EINVAL;
/*
* Currently, only intf_fifo_underflow is
@ -1302,7 +1303,7 @@ static void mdss_mdp_cmd_intf_recovery(void *data, int event)
if (event != MDP_INTF_DSI_CMD_FIFO_UNDERFLOW) {
pr_warn("%s: unsupported recovery event:%d\n",
__func__, event);
return;
return -EPERM;
}
if (atomic_read(&ctx->koff_cnt)) {
@ -1326,6 +1327,7 @@ static void mdss_mdp_cmd_intf_recovery(void *data, int event)
if (notify_frame_timeout)
mdss_mdp_ctl_notify(ctx->ctl, MDP_NOTIFY_FRAME_TIMEOUT);
return 0;
}
static void mdss_mdp_cmd_pingpong_done(void *arg)
@ -3315,7 +3317,11 @@ int mdss_mdp_cmd_stop(struct mdss_mdp_ctl *ctl, int panel_power_state)
ctx->intf_stopped = 0;
if (sctx)
sctx->intf_stopped = 0;
/*
* Tearcheck was disabled while entering LP2 state.
* Enable it back to allow updates in LP1 state.
*/
mdss_mdp_tearcheck_enable(ctl, true);
goto end;
}
}

View file

@ -315,7 +315,7 @@ int mdss_mdp_video_addr_setup(struct mdss_data_type *mdata,
return 0;
}
static void mdss_mdp_video_intf_recovery(void *data, int event)
static int mdss_mdp_video_intf_recovery(void *data, int event)
{
struct mdss_mdp_video_ctx *ctx;
struct mdss_mdp_ctl *ctl = data;
@ -327,7 +327,7 @@ static void mdss_mdp_video_intf_recovery(void *data, int event)
if (!data) {
pr_err("%s: invalid ctl\n", __func__);
return;
return -EINVAL;
}
/*
@ -338,7 +338,7 @@ static void mdss_mdp_video_intf_recovery(void *data, int event)
if (event != MDP_INTF_DSI_VIDEO_FIFO_OVERFLOW) {
pr_warn("%s: unsupported recovery event:%d\n",
__func__, event);
return;
return -EPERM;
}
ctx = ctl->intf_ctx[MASTER_CTX];
@ -353,7 +353,7 @@ static void mdss_mdp_video_intf_recovery(void *data, int event)
clk_rate = DIV_ROUND_UP_ULL(clk_rate, 1000); /* in kHz */
if (!clk_rate) {
pr_err("Unable to get proper clk_rate\n");
return;
return -EINVAL;
}
/*
* calculate clk_period as pico second to maintain good
@ -363,7 +363,7 @@ static void mdss_mdp_video_intf_recovery(void *data, int event)
clk_period = DIV_ROUND_UP_ULL(1000000000, clk_rate);
if (!clk_period) {
pr_err("Unable to calculate clock period\n");
return;
return -EINVAL;
}
min_ln_cnt = pinfo->lcdc.v_back_porch + pinfo->lcdc.v_pulse_width;
active_lns_cnt = pinfo->yres;
@ -389,7 +389,7 @@ static void mdss_mdp_video_intf_recovery(void *data, int event)
!ctx->timegen_en) {
pr_warn("Target is in suspend or shutdown pending\n");
mutex_unlock(&ctl->offlock);
return;
return -EPERM;
}
line_cnt = mdss_mdp_video_line_count(ctl);
@ -399,7 +399,7 @@ static void mdss_mdp_video_intf_recovery(void *data, int event)
pr_debug("%s, Needed lines left line_cnt=%d\n",
__func__, line_cnt);
mutex_unlock(&ctl->offlock);
return;
return 0;
} else {
pr_warn("line count is less. line_cnt = %d\n",
line_cnt);

View file

@ -111,12 +111,6 @@ enum {
MDSS_PANEL_POWER_LCD_DISABLED,
};
enum {
MDSS_PANEL_BLANK_BLANK = 0,
MDSS_PANEL_BLANK_UNBLANK,
MDSS_PANEL_BLANK_LOW_POWER,
};
enum {
MDSS_PANEL_LOW_PERSIST_MODE_OFF = 0,
MDSS_PANEL_LOW_PERSIST_MODE_ON,
@ -195,7 +189,7 @@ enum {
};
struct mdss_intf_recovery {
void (*fxn)(void *ctx, int event);
int (*fxn)(void *ctx, int event);
void *data;
};