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 <pingli@codeaurora.org>
Signed-off-by: Yuchao Ma <yuchaom@codeaurora.org>
This commit is contained in:
Ping Li
2021-10-05 17:04:25 -07:00
committed by Gerrit - the friendly Code Review server
parent 84973878ad
commit dd2e1fd03f
3 changed files with 7 additions and 1 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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,