浏览代码

disp: msm: sde: add check for sunlight visibility scale

Add check to clip the sunlight visibility scale to an upper limit of
MAX_SV_BL_SCALE_LEVEL * 4.

Change-Id: I8cc7bf8fba90e115d046ec030983801ce6d93c1d
Signed-off-by: Ping Li <[email protected]>
Signed-off-by: Yuchao Ma <[email protected]>
Ping Li 3 年之前
父节点
当前提交
dd2e1fd03f
共有 3 个文件被更改,包括 7 次插入1 次删除
  1. 2 0
      include/uapi/display/drm/msm_drm_pp.h
  2. 1 0
      msm/dsi/dsi_panel.h
  3. 4 1
      msm/sde/sde_connector.c

+ 2 - 0
include/uapi/display/drm/msm_drm_pp.h

@@ -732,6 +732,8 @@ struct drm_msm_backlight_info {
 	__u32 bl_scale_sv;
 	__u32 status;
 	__u32 min_bl;
+	__u32 bl_scale_max;
+	__u32 bl_scale_sv_max;
 };
 
 #define DIMMING_BL_LUT_LEN 8192

+ 1 - 0
msm/dsi/dsi_panel.h

@@ -25,6 +25,7 @@
 #define MAX_BL_LEVEL 4096
 #define MAX_BL_SCALE_LEVEL 1024
 #define MAX_SV_BL_SCALE_LEVEL 65535
+#define SV_BL_SCALE_CAP (MAX_SV_BL_SCALE_LEVEL * 4)
 #define DSI_CMD_PPS_SIZE 135
 
 #define DSI_CMD_PPS_HDR_SIZE 7

+ 4 - 1
msm/sde/sde_connector.c

@@ -120,6 +120,8 @@ static void sde_dimming_bl_notify(struct sde_connector *conn, struct dsi_backlig
 	bl_info.bl_scale_sv = config->bl_scale_sv;
 	bl_info.status = config->dimming_status;
 	bl_info.min_bl = config->dimming_min_bl;
+	bl_info.bl_scale_max = MAX_BL_SCALE_LEVEL;
+	bl_info.bl_scale_sv_max = SV_BL_SCALE_CAP;
 	event.type = DRM_EVENT_DIMMING_BL;
 	event.length = sizeof(bl_info);
 	SDE_DEBUG("dimming BL event bl_level %d bl_scale %d, bl_scale_sv = %d "
@@ -833,7 +835,8 @@ static int _sde_connector_update_bl_scale(struct sde_connector *c_conn)
 
 	bl_config->bl_scale = c_conn->bl_scale > MAX_BL_SCALE_LEVEL ?
 			MAX_BL_SCALE_LEVEL : c_conn->bl_scale;
-	bl_config->bl_scale_sv = c_conn->bl_scale_sv;
+	bl_config->bl_scale_sv = c_conn->bl_scale_sv > SV_BL_SCALE_CAP ?
+			SV_BL_SCALE_CAP : c_conn->bl_scale_sv;
 
 	SDE_DEBUG("bl_scale = %u, bl_scale_sv = %u, bl_level = %u\n",
 		bl_config->bl_scale, bl_config->bl_scale_sv,