msm: mdss: mdp: fix to prevent early wake up if panel is off

Current code request the power transition during the
early wake up event even if the panel is off.
This is can cause problems due ctl is not valid at this
time or in some other race conditions it prevents the
bandwidth requests. This fix prevents that early wake up
is called during power off, fixing the null pointer
dereferences and mdp busy timouts errors.

Change-Id: Idc51d02aa34d794a38f6e3a82ae80d5afa3d58f4
Signed-off-by: Vinu Deokaran <vinud@codeaurora.org>
Signed-off-by: Ingrid Gallardo <ingridg@codeaurora.org>
This commit is contained in:
Vinu Deokaran 2015-08-13 09:55:23 -07:00 committed by David Keitel
parent 94c0a0e5ca
commit ba55276d8c
3 changed files with 11 additions and 6 deletions

View file

@ -808,7 +808,7 @@ static void mdss_fb_input_event_handler(struct input_handle *handle,
struct msm_fb_data_type *mfd = handle->handler->private;
int rc;
if (type != EV_ABS)
if ((type != EV_ABS) || !mdss_fb_is_power_on(mfd))
return;
if (mfd->mdp.input_event_handler) {

View file

@ -690,6 +690,12 @@ int mdss_mdp_resource_control(struct mdss_mdp_ctl *ctl, u32 sw_event)
* 3. If the current state is POWER-OFF, Schedule a work item to
* POWER-ON.
*/
/* if panels are off, do not process early wake up */
if ((ctx && __mdss_mdp_cmd_is_panel_power_off(ctx)) ||
(sctx && __mdss_mdp_cmd_is_panel_power_off(sctx)))
break;
mutex_lock(&ctl->rsrc_lock);
if (mdp5_data->resources_state != MDP_RSRC_CTL_STATE_OFF) {
if (cancel_work_sync(&ctx->gate_clk_work))
@ -741,9 +747,6 @@ static inline void mdss_mdp_cmd_clk_on(struct mdss_mdp_cmd_ctx *ctx)
{
struct mdss_data_type *mdata = mdss_mdp_get_mdata();
if (__mdss_mdp_cmd_is_panel_power_off(ctx))
return;
mutex_lock(&ctx->clk_mtx);
MDSS_XLOG(ctx->pp_num, atomic_read(&ctx->koff_cnt));
@ -2005,7 +2008,8 @@ static int mdss_mdp_cmd_early_wake_up(struct mdss_mdp_ctl *ctl)
* involves cancelling queued work items. So this will be
* scheduled in a work item.
*/
schedule_work(&ctx->early_wakeup_clk_work);
if (ctx)
schedule_work(&ctx->early_wakeup_clk_work);
return 0;
}

View file

@ -4909,7 +4909,8 @@ int mdss_mdp_input_event_handler(struct msm_fb_data_type *mfd)
int rc = 0;
struct mdss_mdp_ctl *ctl = mfd_to_ctl(mfd);
if (ctl->ops.early_wake_up_fnc)
if (ctl && mdss_panel_is_power_on(ctl->power_state) &&
ctl->ops.early_wake_up_fnc)
rc = ctl->ops.early_wake_up_fnc(ctl);
return rc;