From b55a29b194ab50ca6b451dfd1e2c35a693eb7a00 Mon Sep 17 00:00:00 2001 From: Wenjun Zhang Date: Mon, 20 Apr 2020 16:52:45 +0800 Subject: [PATCH] disp: msm: add inverted display brightness value property In general the brightness value, the first parameter is low byte and the second is high byte, but some DDIC invert, so add inverted display brightness value property. Change-Id: I8bf5631bb66096bd28529c53643e358afffce18e Signed-off-by: Wenjun Zhang --- msm/dsi/dsi_panel.c | 6 ++++++ msm/dsi/dsi_panel.h | 1 + 2 files changed, 7 insertions(+) diff --git a/msm/dsi/dsi_panel.c b/msm/dsi/dsi_panel.c index 277bebd68a..eb8983919b 100644 --- a/msm/dsi/dsi_panel.c +++ b/msm/dsi/dsi_panel.c @@ -506,6 +506,9 @@ static int dsi_panel_update_backlight(struct dsi_panel *panel, dsi = &panel->mipi_device; + 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 (rc < 0) DSI_ERR("failed to update dcs backlight:%d\n", bl_lvl); @@ -2183,6 +2186,9 @@ static int dsi_panel_parse_bl_config(struct dsi_panel *panel) panel->bl_config.brightness_max_level = val; } + panel->bl_config.bl_inverted_dbv = utils->read_bool(utils->data, + "qcom,mdss-dsi-bl-inverted-dbv"); + if (panel->bl_config.type == DSI_BACKLIGHT_PWM) { rc = dsi_panel_parse_bl_pwm_config(panel); if (rc) { diff --git a/msm/dsi/dsi_panel.h b/msm/dsi/dsi_panel.h index 8ecb346b10..e6831c5e1c 100644 --- a/msm/dsi/dsi_panel.h +++ b/msm/dsi/dsi_panel.h @@ -115,6 +115,7 @@ struct dsi_backlight_config { u32 bl_level; u32 bl_scale; u32 bl_scale_sv; + bool bl_inverted_dbv; int en_gpio; /* PWM params */