Эх сурвалжийг харах

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 <[email protected]>
Yuan Zhao 5 жил өмнө
parent
commit
c810238fb4

+ 13 - 2
msm/dsi/dsi_display.c

@@ -8021,7 +8021,8 @@ static void dsi_display_handle_poms_te(struct work_struct *work)
 {
 	struct dsi_display *display = NULL;
 	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;
 
 	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;
 	}
 
-	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);
+
+error:
+	mutex_unlock(&panel->panel_lock);
 	if (rc < 0)
 		DSI_ERR("failed to set tear off\n");
 }

+ 22 - 4
msm/dsi/dsi_panel.c

@@ -509,7 +509,8 @@ static int dsi_panel_update_backlight(struct dsi_panel *panel,
 	u32 bl_lvl)
 {
 	int rc = 0;
-	struct mipi_dsi_device *dsi;
+	unsigned long mode_flags = 0;
+	struct mipi_dsi_device *dsi = NULL;
 
 	if (!panel || (bl_lvl > 0xffff)) {
 		DSI_ERR("invalid params\n");
@@ -517,6 +518,10 @@ static int dsi_panel_update_backlight(struct dsi_panel *panel,
 	}
 
 	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)
 		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)
 		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;
 }
 
@@ -2144,10 +2152,11 @@ static int dsi_panel_parse_bl_config(struct dsi_panel *panel)
 {
 	int rc = 0;
 	u32 val = 0;
-	const char *bl_type;
-	const char *data;
+	const char *bl_type = NULL;
+	const char *data = NULL;
+	const char *state = NULL;
 	struct dsi_parser_utils *utils = &panel->utils;
-	char *bl_name;
+	char *bl_name = NULL;
 
 	if (!strcmp(panel->type, "primary"))
 		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,
 		"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) {
 		rc = dsi_panel_parse_bl_pwm_config(panel);
 		if (rc) {

+ 3 - 0
msm/dsi/dsi_panel.h

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