msm: mdss: add return values to MDSS recovery events

When the target is in suspend or when shutdown is pending,
the DSI recovery need not be taken care of. Add change to
handle this case based on the return value of the MDSS
recovery events.

Change-Id: I5a5cd6743c15cca7ca42a40db7dcd552c95b20b6
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
Signed-off-by: Ashish Garg <ashigarg@codeaurora.org>
Signed-off-by: Vishnuvardhan Prodduturi <vproddut@codeaurora.org>
This commit is contained in:
Vishnuvardhan Prodduturi 2017-01-20 10:47:41 +05:30 committed by Sandeep Panda
parent 45e7053482
commit 9dda3223bc
4 changed files with 37 additions and 21 deletions

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);

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)

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

@ -195,7 +195,7 @@ enum {
};
struct mdss_intf_recovery {
void (*fxn)(void *ctx, int event);
int (*fxn)(void *ctx, int event);
void *data;
};