msm: mdss: false ESD detections due to race condition

There is a race condition between ESD thread and commit thread
which causes false ESD detections. This change prevents the
condition.

Change-Id: I67a480f7251348fc86be01fe8d5414857f53bc75
Signed-off-by: Naseer Ahmed <naseer@codeaurora.org>
This commit is contained in:
Naseer Ahmed 2016-01-28 18:09:14 -05:00 committed by David Keitel
parent 40ac095b5b
commit 6b236392b5
4 changed files with 15 additions and 7 deletions

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -1000,7 +1000,7 @@ int msm_dsi_cmdlist_commit(struct mdss_dsi_ctrl_pdata *ctrl, int from_mdp)
if (from_mdp) /* from mdp kickoff */
mutex_lock(&ctrl->cmd_mutex);
req = mdss_dsi_cmdlist_get(ctrl);
req = mdss_dsi_cmdlist_get(ctrl, from_mdp);
if (!req) {
mutex_unlock(&ctrl->cmd_mutex);

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -724,7 +724,8 @@ void mdss_dsi_set_tear_off(struct mdss_dsi_ctrl_pdata *ctrl)
/*
* mdss_dsi_cmd_get: ctrl->cmd_mutex acquired by caller
*/
struct dcs_cmd_req *mdss_dsi_cmdlist_get(struct mdss_dsi_ctrl_pdata *ctrl)
struct dcs_cmd_req *mdss_dsi_cmdlist_get(struct mdss_dsi_ctrl_pdata *ctrl,
int from_mdp)
{
struct dcs_cmd_list *clist;
struct dcs_cmd_req *req = NULL;
@ -733,6 +734,12 @@ struct dcs_cmd_req *mdss_dsi_cmdlist_get(struct mdss_dsi_ctrl_pdata *ctrl)
clist = &ctrl->cmdlist;
if (clist->get != clist->put) {
req = &clist->list[clist->get];
/*dont let commit thread steal ESD thread's
command*/
if (from_mdp && (req->flags & CMD_REQ_COMMIT)) {
mutex_unlock(&ctrl->cmdlist_mutex);
return NULL;
}
clist->get++;
clist->get %= CMD_REQ_MAX;
clist->tot--;

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -133,7 +133,8 @@ int mdss_dsi_short_read2_resp(struct dsi_buf *rp);
int mdss_dsi_long_read_resp(struct dsi_buf *rp);
void mdss_dsi_set_tear_on(struct mdss_dsi_ctrl_pdata *ctrl);
void mdss_dsi_set_tear_off(struct mdss_dsi_ctrl_pdata *ctrl);
struct dcs_cmd_req *mdss_dsi_cmdlist_get(struct mdss_dsi_ctrl_pdata *ctrl);
struct dcs_cmd_req *mdss_dsi_cmdlist_get(struct mdss_dsi_ctrl_pdata *ctrl,
int from_mdp);
int mdss_dsi_cmdlist_put(struct mdss_dsi_ctrl_pdata *ctrl,
struct dcs_cmd_req *cmdreq);
#endif

View file

@ -2403,7 +2403,7 @@ int mdss_dsi_cmdlist_commit(struct mdss_dsi_ctrl_pdata *ctrl, int from_mdp)
roi = &pinfo->roi;
}
req = mdss_dsi_cmdlist_get(ctrl);
req = mdss_dsi_cmdlist_get(ctrl, from_mdp);
if (req && from_mdp && ctrl->burst_mode_enabled) {
mutex_lock(&ctrl->cmd_mutex);
cmd_mutex_acquired = true;