msm: display: add more checking to ensure display is idle

Before execute operation on display, make sure it is complete idle
Because non-blocking display update has been introduced, need make sure
display update has finished in all entrances except the ones for
initialization.

Change-Id: I0660080262b7e5895f5f558c0a9f71aa84b9aa99
Signed-off-by: Ken Zhang <kenz@codeaurora.org>
Signed-off-by: Naseer Ahmed <naseer@codeaurora.org>
This commit is contained in:
Naseer Ahmed 2012-10-11 11:42:12 -04:00 committed by Iliyan Malchev
parent 017f1bf60d
commit c2975c4ed3

View file

@ -126,8 +126,10 @@ static ssize_t msm_fb_read(struct fb_info *info, char __user *buf,
#define MSM_FB_MAX_DBGFS 1024 #define MSM_FB_MAX_DBGFS 1024
#define MAX_BACKLIGHT_BRIGHTNESS 255 #define MAX_BACKLIGHT_BRIGHTNESS 255
/* 200 ms for time out */ /* 100 ms for fence time out */
#define WAIT_FENCE_TIMEOUT 100 #define WAIT_FENCE_TIMEOUT 100
/* 200 ms for display operation time out */
#define WAIT_DISP_OP_TIMEOUT 200
int msm_fb_debugfs_file_index; int msm_fb_debugfs_file_index;
struct dentry *msm_fb_debugfs_root; struct dentry *msm_fb_debugfs_root;
@ -444,6 +446,8 @@ static int msm_fb_remove(struct platform_device *pdev)
mfd = (struct msm_fb_data_type *)platform_get_drvdata(pdev); mfd = (struct msm_fb_data_type *)platform_get_drvdata(pdev);
msm_fb_pan_idle(mfd);
msm_fb_remove_sysfs(pdev); msm_fb_remove_sysfs(pdev);
pm_runtime_disable(mfd->fbi->dev); pm_runtime_disable(mfd->fbi->dev);
@ -511,6 +515,8 @@ static int msm_fb_suspend(struct platform_device *pdev, pm_message_t state)
if ((!mfd) || (mfd->key != MFD_KEY)) if ((!mfd) || (mfd->key != MFD_KEY))
return 0; return 0;
msm_fb_pan_idle(mfd);
console_lock(); console_lock();
fb_set_suspend(mfd->fbi, FBINFO_STATE_SUSPENDED); fb_set_suspend(mfd->fbi, FBINFO_STATE_SUSPENDED);
@ -633,6 +639,8 @@ static int msm_fb_resume(struct platform_device *pdev)
if ((!mfd) || (mfd->key != MFD_KEY)) if ((!mfd) || (mfd->key != MFD_KEY))
return 0; return 0;
msm_fb_pan_idle(mfd);
console_lock(); console_lock();
ret = msm_fb_resume_sub(mfd); ret = msm_fb_resume_sub(mfd);
pdev->dev.power.power_state = PMSG_ON; pdev->dev.power.power_state = PMSG_ON;
@ -678,6 +686,7 @@ static int msm_fb_ext_suspend(struct device *dev)
if ((!mfd) || (mfd->key != MFD_KEY)) if ((!mfd) || (mfd->key != MFD_KEY))
return 0; return 0;
msm_fb_pan_idle(mfd);
pdata = (struct msm_fb_panel_data *)mfd->pdev->dev.platform_data; pdata = (struct msm_fb_panel_data *)mfd->pdev->dev.platform_data;
if (mfd->panel_info.type == HDMI_PANEL || if (mfd->panel_info.type == HDMI_PANEL ||
@ -905,6 +914,8 @@ static int msm_fb_blank_sub(int blank_mode, struct fb_info *info,
if (!op_enable) if (!op_enable)
return -EPERM; return -EPERM;
msm_fb_pan_idle(mfd);
pdata = (struct msm_fb_panel_data *)mfd->pdev->dev.platform_data; pdata = (struct msm_fb_panel_data *)mfd->pdev->dev.platform_data;
if ((!pdata) || (!pdata->on) || (!pdata->off)) { if ((!pdata) || (!pdata->on) || (!pdata->off)) {
printk(KERN_ERR "msm_fb_blank_sub: no panel operation detected!\n"); printk(KERN_ERR "msm_fb_blank_sub: no panel operation detected!\n");
@ -1762,7 +1773,7 @@ static int msm_fb_release(struct fb_info *info, int user)
mfd->index); mfd->index);
return -EINVAL; return -EINVAL;
} }
msm_fb_pan_idle(mfd);
mfd->ref_cnt--; mfd->ref_cnt--;
if ((!mfd->ref_cnt) && (mfd->op_enable)) { if ((!mfd->ref_cnt) && (mfd->op_enable)) {
@ -1817,12 +1828,18 @@ static int msm_fb_pan_idle(struct msm_fb_data_type *mfd)
mutex_unlock(&mfd->sync_mutex); mutex_unlock(&mfd->sync_mutex);
ret = wait_for_completion_interruptible_timeout( ret = wait_for_completion_interruptible_timeout(
&mfd->commit_comp, &mfd->commit_comp,
msecs_to_jiffies(WAIT_FENCE_TIMEOUT)); msecs_to_jiffies(WAIT_DISP_OP_TIMEOUT));
if (ret < 0) if (ret < 0)
ret = -ERESTARTSYS; ret = -ERESTARTSYS;
else if (!ret) else if (!ret)
pr_err("%s wait for commit_comp timeout %d %d", pr_err("%s wait for commit_comp timeout %d %d",
__func__, ret, mfd->is_committing); __func__, ret, mfd->is_committing);
if (ret <= 0) {
mutex_lock(&mfd->sync_mutex);
mfd->is_committing = 0;
complete_all(&mfd->commit_comp);
mutex_unlock(&mfd->sync_mutex);
}
} else { } else {
mutex_unlock(&mfd->sync_mutex); mutex_unlock(&mfd->sync_mutex);
} }