disp: msm: dsi: Add support display 2bytes brightness.

Normal, there is a brightness level from 0-255 (1 byte), but some
panels are support 2 bytes for brightness, (0-1023).

Change-Id: I861aaa3d26e4dbe13183df92f408fdefa709fe61
Reviewed-on: https://gerrit.mot.com/1697222
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Shuo Yan <shuoyan@motorola.com>
Reviewed-by: Guobin Zhang <zhanggb@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
Bang Nguyen 2019-07-24 08:05:26 -05:00 • committed by tongkun1
commit 72ad7c669b
2 changed files with 15 additions and 1 deletions

View file

@ -543,6 +543,8 @@ static int dsi_panel_update_backlight(struct dsi_panel *panel,
int rc = 0;
unsigned long mode_flags = 0;
struct mipi_dsi_device *dsi = NULL;
struct dsi_backlight_config *bl = &panel->bl_config;
u32 bl_lvl_2bytes;
if (!panel || (bl_lvl > 0xffff)) {
DSI_ERR("invalid params\n");
@ -558,7 +560,13 @@ static int dsi_panel_update_backlight(struct dsi_panel *panel,
if (panel->bl_config.bl_inverted_dbv)
bl_lvl = (((bl_lvl & 0xff) << 8) | (bl_lvl >> 8));
rc = mipi_dsi_dcs_set_display_brightness(dsi, bl_lvl);
if (bl->bl_2bytes_enable){
bl_lvl_2bytes = ((bl_lvl & 0xff00) >> 8) | ((bl_lvl & 0xff) << 8);
rc = mipi_dsi_dcs_set_display_brightness(dsi, bl_lvl_2bytes);
}
else
rc = mipi_dsi_dcs_set_display_brightness(dsi, bl_lvl);
if (rc < 0)
DSI_ERR("failed to update dcs backlight:%d\n", bl_lvl);
@ -2455,6 +2463,11 @@ static int dsi_panel_parse_bl_config(struct dsi_panel *panel)
else
DSI_ERR("bl-dsc-cmd-state command state unrecognized-%s\n",
state);
panel->bl_config.bl_2bytes_enable = utils->read_bool(utils->data,
"qcom,bklt-dcs-2bytes-enabled");
pr_info("[%s] bl_2bytes_enable=%d\n", panel->name,
panel->bl_config.bl_2bytes_enable);
if (panel->bl_config.type == DSI_BACKLIGHT_PWM) {
rc = dsi_panel_parse_bl_pwm_config(panel);

View file

@ -118,6 +118,7 @@ struct dsi_backlight_config {
enum dsi_backlight_type type;
enum bl_update_flag bl_update;
bool bl_2bytes_enable;
u32 bl_min_level;
u32 bl_max_level;
u32 brightness_max_level;