msm: mdss: Correctly reset the ad_events count

Reset the ad_events count in the AD ioctl instead of ad_setup().
There are some time delay between AD ioctl and ad_setup, which is
part of the display commit path, so if we reset the ad_event count
in ad_setup, then it is possible that user space reads the ad_events
sysfs node after the AD ioctl but before the ad_setup(). In that
case, user space may get the incorrect ad_events count, and cause
the gradual AD off fail.

Change-Id: I13f2043a6a21be7e49b44a964b00b0aa4315dc17
Signed-off-by: Ping Li <pingli@codeaurora.org>
This commit is contained in:
Ping Li 2015-12-15 19:27:57 -08:00 committed by David Keitel
parent 1f05cf89cf
commit 207a40bd09

View file

@ -5124,6 +5124,7 @@ int mdss_mdp_ad_config(struct msm_fb_data_type *mfd,
struct msm_fb_data_type *bl_mfd;
int lin_ret = -1, inv_ret = -1, att_ret = -1, ret = 0;
u32 last_ops;
struct mdss_overlay_private *mdp5_data;
ret = mdss_mdp_get_ad(mfd, &ad);
if (ret == -ENODEV || ret == -EPERM) {
@ -5195,6 +5196,9 @@ int mdss_mdp_ad_config(struct msm_fb_data_type *mfd,
sizeof(struct mdss_ad_cfg));
ad->cfg.backlight_scale = MDSS_MDP_AD_BL_SCALE;
ad->sts |= PP_AD_STS_DIRTY_CFG;
mdp5_data = mfd_to_mdp5_data(mfd);
if (mdp5_data)
mdp5_data->ad_events = 0;
}
last_ops = ad->ops & MDSS_PP_SPLIT_MASK;
@ -5235,6 +5239,7 @@ int mdss_mdp_ad_input(struct msm_fb_data_type *mfd,
int ret = 0;
struct mdss_ad_info *ad;
u32 bl;
struct mdss_overlay_private *mdp5_data;
ret = mdss_mdp_get_ad(mfd, &ad);
if (ret == -ENODEV || ret == -EPERM) {
@ -5274,6 +5279,9 @@ int mdss_mdp_ad_input(struct msm_fb_data_type *mfd,
ad->calc_itr = ad->cfg.stab_itr;
ad->sts |= PP_AD_STS_DIRTY_VSYNC;
ad->sts |= PP_AD_STS_DIRTY_DATA;
mdp5_data = mfd_to_mdp5_data(mfd);
if (mdp5_data)
mdp5_data->ad_events = 0;
break;
case MDSS_AD_MODE_TARG_STR:
case MDSS_AD_MODE_MAN_STR:
@ -5555,7 +5563,6 @@ static int mdss_mdp_ad_setup(struct msm_fb_data_type *mfd)
struct mdss_data_type *mdata;
u32 bypass = MDSS_PP_AD_BYPASS_DEF, bl;
u32 width;
struct mdss_overlay_private *mdp5_data;
if (!mfd) {
pr_err("mfd = 0x%p\n", mfd);
@ -5622,9 +5629,6 @@ static int mdss_mdp_ad_setup(struct msm_fb_data_type *mfd)
ad->calc_itr = ad->cfg.stab_itr;
ad->sts |= PP_AD_STS_DIRTY_VSYNC;
ad->reg_sts |= PP_AD_STS_DIRTY_DATA;
mdp5_data = mfd_to_mdp5_data(mfd);
if (mdp5_data)
mdp5_data->ad_events = 0;
}
if (ad->sts & PP_AD_STS_DIRTY_CFG) {