diff options
| author | Ping Li <pingli@codeaurora.org> | 2015-05-29 18:00:51 -0700 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-23 20:47:52 -0700 |
| commit | 92409ccc31cbb8b0ebc073008eb93067849fa467 (patch) | |
| tree | ac459a8da010f12b06d41f85bfc9724acc4e371e | |
| parent | c02ceba378e54cf86401936f8e7aef2072ab1692 (diff) | |
msm: mdss: Add backlight threshold for AD
Notify user space with only backlight changes that pass the backlight
threshold check.
Change-Id: Id2fef0a2d9c883d0e68a5ad6be699858be6898ae
Signed-off-by: Ping Li <pingli@codeaurora.org>
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_mdp_pp.c | 29 | ||||
| -rw-r--r-- | include/uapi/linux/msm_mdp.h | 1 |
2 files changed, 26 insertions, 4 deletions
diff --git a/drivers/video/fbdev/msm/mdss_mdp_pp.c b/drivers/video/fbdev/msm/mdss_mdp_pp.c index 5466f68bf7e3..81ea1c988c36 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_pp.c +++ b/drivers/video/fbdev/msm/mdss_mdp_pp.c @@ -2569,6 +2569,26 @@ int mdss_mdp_pp_default_overlay_config(struct msm_fb_data_type *mfd, return ret; } +static bool pp_ad_bl_threshold_check(int al_thresh, int base, int prev_bl, + int curr_bl) +{ + int bl_thresh = 0, diff = 0; + bool ret = false; + + pr_debug("al_thresh = %d, base = %d\n", al_thresh, base); + if (base <= 0) { + pr_debug("Invalid base for threshold calculation %d\n", base); + return ret; + } + bl_thresh = (curr_bl * al_thresh) / (base * 4); + diff = (curr_bl > prev_bl) ? (curr_bl - prev_bl) : (prev_bl - curr_bl); + ret = (diff > bl_thresh) ? true : false; + pr_debug("prev_bl =%d, curr_bl = %d, bl_thresh = %d, diff = %d, ret = %d\n", + prev_bl, curr_bl, bl_thresh, diff, ret); + + return ret; +} + static int pp_ad_calc_bl(struct msm_fb_data_type *mfd, int bl_in, int *bl_out, bool *bl_out_notify) { @@ -2629,15 +2649,16 @@ static int pp_ad_calc_bl(struct msm_fb_data_type *mfd, int bl_in, int *bl_out, mutex_unlock(&ad->lock); return ret; } - *bl_out = temp; - if (ad_bl_out != mfd->ad_bl_level) { + *bl_out = temp; + if (pp_ad_bl_threshold_check(ad->init.al_thresh, ad->init.alpha_base, + mfd->ad_bl_level, ad_bl_out)) { mfd->ad_bl_level = ad_bl_out; + pr_debug("backlight send to AD block: %d\n", mfd->ad_bl_level); *bl_out_notify = true; + pp_ad_invalidate_input(mfd); } - if (*bl_out_notify) - pp_ad_invalidate_input(mfd); mutex_unlock(&ad->lock); return 0; } diff --git a/include/uapi/linux/msm_mdp.h b/include/uapi/linux/msm_mdp.h index bad7881a1b19..0de6afa03062 100644 --- a/include/uapi/linux/msm_mdp.h +++ b/include/uapi/linux/msm_mdp.h @@ -1087,6 +1087,7 @@ struct mdss_ad_init { uint8_t logo_h; uint32_t alpha; uint32_t alpha_base; + uint32_t al_thresh; uint32_t bl_lin_len; uint32_t bl_att_len; uint32_t *bl_lin; |
