disp: msm: dsi: support LP mode for DCS brightness setting

DCS brightness settng can only use HS mode. Add a new
DT property for LP mode choose for DCS brightness setting.

Change-Id: Ibe5867fe344776871eb3a410a8d79d347775f3d4
Signed-off-by: Yuan Zhao <yzhao@codeaurora.org>
This commit is contained in:
Yuan Zhao
2020-07-31 12:09:03 +08:00
committed by Gerrit - the friendly Code Review server
parent f11da41a6e
commit c810238fb4
3 changed files with 38 additions and 6 deletions

View File

@@ -8021,7 +8021,8 @@ static void dsi_display_handle_poms_te(struct work_struct *work)
{ {
struct dsi_display *display = NULL; struct dsi_display *display = NULL;
struct delayed_work *dw = to_delayed_work(work); struct delayed_work *dw = to_delayed_work(work);
struct mipi_dsi_device *dsi; struct mipi_dsi_device *dsi = NULL;
struct dsi_panel *panel = NULL;
int rc = 0; int rc = 0;
display = container_of(dw, struct dsi_display, poms_te_work); display = container_of(dw, struct dsi_display, poms_te_work);
@@ -8030,8 +8031,18 @@ static void dsi_display_handle_poms_te(struct work_struct *work)
return; return;
} }
dsi = &display->panel->mipi_device; panel = display->panel;
mutex_lock(&panel->panel_lock);
if (!dsi_panel_initialized(panel)) {
rc = -EINVAL;
goto error;
}
dsi = &panel->mipi_device;
rc = mipi_dsi_dcs_set_tear_off(dsi); rc = mipi_dsi_dcs_set_tear_off(dsi);
error:
mutex_unlock(&panel->panel_lock);
if (rc < 0) if (rc < 0)
DSI_ERR("failed to set tear off\n"); DSI_ERR("failed to set tear off\n");
} }

View File

@@ -509,7 +509,8 @@ static int dsi_panel_update_backlight(struct dsi_panel *panel,
u32 bl_lvl) u32 bl_lvl)
{ {
int rc = 0; int rc = 0;
struct mipi_dsi_device *dsi; unsigned long mode_flags = 0;
struct mipi_dsi_device *dsi = NULL;
if (!panel || (bl_lvl > 0xffff)) { if (!panel || (bl_lvl > 0xffff)) {
DSI_ERR("invalid params\n"); DSI_ERR("invalid params\n");
@@ -517,6 +518,10 @@ static int dsi_panel_update_backlight(struct dsi_panel *panel,
} }
dsi = &panel->mipi_device; dsi = &panel->mipi_device;
if (unlikely(panel->bl_config.lp_mode)) {
mode_flags = dsi->mode_flags;
dsi->mode_flags |= MIPI_DSI_MODE_LPM;
}
if (panel->bl_config.bl_inverted_dbv) if (panel->bl_config.bl_inverted_dbv)
bl_lvl = (((bl_lvl & 0xff) << 8) | (bl_lvl >> 8)); bl_lvl = (((bl_lvl & 0xff) << 8) | (bl_lvl >> 8));
@@ -525,6 +530,9 @@ static int dsi_panel_update_backlight(struct dsi_panel *panel,
if (rc < 0) if (rc < 0)
DSI_ERR("failed to update dcs backlight:%d\n", bl_lvl); DSI_ERR("failed to update dcs backlight:%d\n", bl_lvl);
if (unlikely(panel->bl_config.lp_mode))
dsi->mode_flags = mode_flags;
return rc; return rc;
} }
@@ -2144,10 +2152,11 @@ static int dsi_panel_parse_bl_config(struct dsi_panel *panel)
{ {
int rc = 0; int rc = 0;
u32 val = 0; u32 val = 0;
const char *bl_type; const char *bl_type = NULL;
const char *data; const char *data = NULL;
const char *state = NULL;
struct dsi_parser_utils *utils = &panel->utils; struct dsi_parser_utils *utils = &panel->utils;
char *bl_name; char *bl_name = NULL;
if (!strcmp(panel->type, "primary")) if (!strcmp(panel->type, "primary"))
bl_name = "qcom,mdss-dsi-bl-pmic-control-type"; bl_name = "qcom,mdss-dsi-bl-pmic-control-type";
@@ -2217,6 +2226,15 @@ static int dsi_panel_parse_bl_config(struct dsi_panel *panel)
panel->bl_config.bl_inverted_dbv = utils->read_bool(utils->data, panel->bl_config.bl_inverted_dbv = utils->read_bool(utils->data,
"qcom,mdss-dsi-bl-inverted-dbv"); "qcom,mdss-dsi-bl-inverted-dbv");
state = utils->get_property(utils->data, "qcom,bl-dsc-cmd-state", NULL);
if (!state || !strcmp(state, "dsi_hs_mode"))
panel->bl_config.lp_mode = false;
else if (!strcmp(state, "dsi_lp_mode"))
panel->bl_config.lp_mode = true;
else
DSI_ERR("bl-dsc-cmd-state command state unrecognized-%s\n",
state);
if (panel->bl_config.type == DSI_BACKLIGHT_PWM) { if (panel->bl_config.type == DSI_BACKLIGHT_PWM) {
rc = dsi_panel_parse_bl_pwm_config(panel); rc = dsi_panel_parse_bl_pwm_config(panel);
if (rc) { if (rc) {

View File

@@ -128,6 +128,9 @@ struct dsi_backlight_config {
/* WLED params */ /* WLED params */
struct led_trigger *wled; struct led_trigger *wled;
struct backlight_device *raw_bd; struct backlight_device *raw_bd;
/* DCS params */
bool lp_mode;
}; };
struct dsi_reset_seq { struct dsi_reset_seq {