From 72ad7c669ba7f818a2c6fa0baca9876071f577dc Mon Sep 17 00:00:00 2001 From: Bang Nguyen Date: Wed, 24 Jul 2019 08:05:26 -0500 Subject: [PATCH] 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 Reviewed-by: Guobin Zhang Submit-Approved: Jira Key --- msm/dsi/dsi_panel.c | 15 ++++++++++++++- msm/dsi/dsi_panel.h | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/msm/dsi/dsi_panel.c b/msm/dsi/dsi_panel.c index b98447056ce3..2b8a53819195 100644 --- a/msm/dsi/dsi_panel.c +++ b/msm/dsi/dsi_panel.c @@ -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); diff --git a/msm/dsi/dsi_panel.h b/msm/dsi/dsi_panel.h index 3fc6baf9fd13..baa82d2f7fbf 100644 --- a/msm/dsi/dsi_panel.h +++ b/msm/dsi/dsi_panel.h @@ -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;