diff options
| author | Manoj Rao <manojraj@codeaurora.org> | 2013-07-26 22:45:25 -0700 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-23 20:19:31 -0700 |
| commit | 66e2cc009aee78ccbd181a4ac311656271bf63a2 (patch) | |
| tree | 0350fc371cc330ee02464dcb3c5c9f93f195608e | |
| parent | fd9f00f45874cd5c41120dc73f4503901687685a (diff) | |
msm: mdss: validate fb backlight inputs
Ensure backlight level is less than the max backlight
brightness and the backlight scaling factor is at most
1.
Change-Id: I424ed22af48ecae46371291fe88a114cf3fc7c31
CRs-Fixed: 516699
Signed-off-by: Manoj Rao <manojraj@codeaurora.org>
| -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*/ |
