Browse Source

disp:msm:sde: correct the brightness bound check

The brightness value from backlight device is OS brightness, not panel
backlight value. This change corrects the brightness bound check to
check against the OS brightness max value instead of panel backlight max
value. This change also move the bound check in dsi display to make sure
the max backlight value send to panel is within the expected range.

Change-Id: Ic9e3ba69700ae4c0e950cb665837a1f0a1317b26
Signed-off-by: Ping Li <[email protected]>
Ping Li 3 năm trước cách đây
mục cha
commit
b7506f0222
2 tập tin đã thay đổi với 5 bổ sung4 xóa
  1. 3 2
      msm/dsi/dsi_display.c
  2. 2 2
      msm/sde/sde_connector.c

+ 3 - 2
msm/dsi/dsi_display.c

@@ -245,8 +245,6 @@ int dsi_display_set_backlight(struct drm_connector *connector,
 
 	bl_scale_sv = panel->bl_config.bl_scale_sv;
 	bl_temp = (u32)bl_temp * bl_scale_sv / MAX_SV_BL_SCALE_LEVEL;
-	if (bl_temp > panel->bl_config.bl_max_level)
-		bl_temp = panel->bl_config.bl_max_level;
 
 	/* use bl_temp as index of dimming bl lut to find the dimming panel backlight */
 	if (bl_temp != 0 && panel->bl_config.dimming_bl_lut &&
@@ -256,6 +254,9 @@ int dsi_display_set_backlight(struct drm_connector *connector,
 		bl_temp = panel->bl_config.dimming_bl_lut->mapped_bl[bl_temp];
 	}
 
+	if (bl_temp > panel->bl_config.bl_max_level)
+		bl_temp = panel->bl_config.bl_max_level;
+
 	pr_debug("bl_scale = %u, bl_scale_sv = %u, bl_lvl = %u\n",
 		bl_scale, bl_scale_sv, (u32)bl_temp);
 

+ 2 - 2
msm/sde/sde_connector.c

@@ -147,8 +147,8 @@ static int sde_backlight_device_update_status(struct backlight_device *bd)
 		brightness = 0;
 
 	display = (struct dsi_display *) c_conn->display;
-	if (brightness > display->panel->bl_config.bl_max_level)
-		brightness = display->panel->bl_config.bl_max_level;
+	if (brightness > display->panel->bl_config.brightness_max_level)
+		brightness = display->panel->bl_config.brightness_max_level;
 	if (brightness > c_conn->thermal_max_brightness)
 		brightness = c_conn->thermal_max_brightness;