diff options
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_fb.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/video/fbdev/msm/mdss_fb.c b/drivers/video/fbdev/msm/mdss_fb.c index 2442c2e577e1..b4bdcb56fc23 100644 --- a/drivers/video/fbdev/msm/mdss_fb.c +++ b/drivers/video/fbdev/msm/mdss_fb.c @@ -574,9 +574,23 @@ static int bl_level_old; static void mdss_fb_scale_bl(struct msm_fb_data_type *mfd, u32 *bl_lvl) { u32 temp = *bl_lvl; + pr_debug("input = %d, scale = %d", temp, mfd->bl_scale); if (temp >= mfd->bl_min_lvl) { - /* bl_scale is the numerator of scaling fraction (x/1024)*/ + if (temp > mfd->panel_info->bl_max) { + pr_warn("%s: invalid bl level\n", + __func__); + temp = mfd->panel_info->bl_max; + } + if (mfd->bl_scale > 1024) { + pr_warn("%s: invalid bl scale\n", + __func__); + mfd->bl_scale = 1024; + } + /* + * bl_scale is the numerator of + * scaling fraction (x/1024) + */ temp = (temp * mfd->bl_scale) / 1024; /*if less than minimum level, use min level*/ |
