diff options
| author | Carl Vanderlip <carlv@codeaurora.org> | 2013-05-19 12:08:33 -0700 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-23 20:17:50 -0700 |
| commit | fd31eb58f844980966cfafec85e4afb8e3d9bb06 (patch) | |
| tree | ae80f9785d344d85909fd3312dd5249634733667 | |
| parent | 89d9152c0e769aa7c7763e3747a6a9108eb40cc6 (diff) | |
msm: mdss: Enable assertive display backlight calibration
Allow for assertive display to set the backlight level in calibration mode.
Change-Id: I990c4a191410614bec2d615baaae1a2a34cc48e5
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_fb.c | 4 | ||||
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_fb.h | 4 | ||||
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_mdp_pp.c | 28 | ||||
| -rw-r--r-- | include/uapi/linux/msm_mdp.h | 2 |
4 files changed, 33 insertions, 5 deletions
diff --git a/drivers/video/fbdev/msm/mdss_fb.c b/drivers/video/fbdev/msm/mdss_fb.c index ffefa39207d1..384a1c982e56 100644 --- a/drivers/video/fbdev/msm/mdss_fb.c +++ b/drivers/video/fbdev/msm/mdss_fb.c @@ -141,8 +141,8 @@ static void mdss_fb_set_bl_brightness(struct led_classdev *led_cdev, /* This maps android backlight level 0 to 255 into driver backlight level 0 to bl_max with rounding */ - bl_lvl = (2 * value * mfd->panel_info->bl_max + - MDSS_MAX_BL_BRIGHTNESS) / (2 * MDSS_MAX_BL_BRIGHTNESS); + MDSS_BRIGHT_TO_BL(bl_lvl, value, mfd->panel_info->bl_max, + MDSS_MAX_BL_BRIGHTNESS); if (!bl_lvl && value) bl_lvl = 1; diff --git a/drivers/video/fbdev/msm/mdss_fb.h b/drivers/video/fbdev/msm/mdss_fb.h index 5a87b9ad3920..c94049f0ead0 100644 --- a/drivers/video/fbdev/msm/mdss_fb.h +++ b/drivers/video/fbdev/msm/mdss_fb.h @@ -75,6 +75,10 @@ struct msm_mdp_interface { }; #define IS_CALIB_MODE_BL(mfd) (((mfd)->calib_mode) & MDSS_CALIB_MODE_BL) +#define MDSS_BRIGHT_TO_BL(out, v, bl_max, max_bright) do {\ + out = (2 * (v) * (bl_max) + max_bright)\ + / (2 * max_bright);\ + } while (0) struct msm_fb_data_type { u32 key; diff --git a/drivers/video/fbdev/msm/mdss_mdp_pp.c b/drivers/video/fbdev/msm/mdss_mdp_pp.c index f8e204bfe4be..b6f0ec2ed0ec 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_pp.c +++ b/drivers/video/fbdev/msm/mdss_mdp_pp.c @@ -2776,7 +2776,8 @@ static int pp_update_ad_input(struct msm_fb_data_type *mfd) if (!ad || ad->cfg.mode == MDSS_AD_MODE_AUTO_BL) return -EINVAL; - pr_debug("backlight level changed, trigger update to AD"); + pr_debug("backlight level changed (%d), trigger update to AD", + mfd->bl_level); input.mode = ad->cfg.mode; if (MDSS_AD_MODE_DATA_MATCH(ad->cfg.mode, MDSS_AD_INPUT_AMBIENT)) input.in.amb_light = ad->ad_data; @@ -2859,14 +2860,16 @@ int mdss_mdp_ad_input(struct msm_fb_data_type *mfd, int ret = 0; struct mdss_ad_info *ad; struct mdss_mdp_ctl *ctl; + u32 bl; ad = mdss_mdp_get_ad(mfd); if (!ad) return -EINVAL; mutex_lock(&ad->lock); - if (!PP_AD_STATE_IS_INITCFG(ad->state) && - !PP_AD_STS_IS_DIRTY(ad->sts)) { + if ((!PP_AD_STATE_IS_INITCFG(ad->state) && + !PP_AD_STS_IS_DIRTY(ad->sts)) && + !input->mode == MDSS_AD_MODE_CALIB) { pr_warn("AD not initialized or configured."); ret = -EPERM; goto error; @@ -2899,6 +2902,25 @@ int mdss_mdp_ad_input(struct msm_fb_data_type *mfd, ad->sts |= PP_AD_STS_DIRTY_VSYNC; ad->sts |= PP_AD_STS_DIRTY_DATA; break; + case MDSS_AD_MODE_CALIB: + wait = 0; + if (mfd->calib_mode) { + bl = input->in.calib_bl; + if (bl >= AD_BL_LIN_LEN) { + pr_warn("calib_bl 255 max!"); + break; + } + mutex_unlock(&ad->lock); + mutex_lock(&mfd->bl_lock); + MDSS_BRIGHT_TO_BL(bl, bl, mfd->panel_info->bl_max, + MDSS_MAX_BL_BRIGHTNESS); + mdss_fb_set_backlight(mfd, bl); + mutex_unlock(&mfd->bl_lock); + mutex_lock(&ad->lock); + } else { + pr_warn("should be in calib mode"); + } + break; default: pr_warn("invalid default %d", input->mode); ret = -EINVAL; diff --git a/include/uapi/linux/msm_mdp.h b/include/uapi/linux/msm_mdp.h index 2d6ebf68b695..b892307c61c1 100644 --- a/include/uapi/linux/msm_mdp.h +++ b/include/uapi/linux/msm_mdp.h @@ -597,6 +597,7 @@ struct mdp_calib_config_data { #define MDSS_AD_MODE_AUTO_STR 0x1 #define MDSS_AD_MODE_TARG_STR 0x3 #define MDSS_AD_MODE_MAN_STR 0x7 +#define MDSS_AD_MODE_CALIB 0xF #define MDP_PP_AD_INIT 0x10 #define MDP_PP_AD_CFG 0x20 @@ -653,6 +654,7 @@ struct mdss_ad_input { union { uint32_t amb_light; uint32_t strength; + uint32_t calib_bl; } in; uint32_t output; }; |
