Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 50186726 authored by Sandeep Panda's avatar Sandeep Panda Committed by Gerrit - the friendly Code Review server
Browse files

drm/msm/dsi-staging: fix backlight update and dsi off race condition



In the current implementation there can be a scenario where in one
thread dsi shutdown sequence is taking place and at the same time
in another thread backlight update request might have come. This may
result dsi in a bad state when dsi off sequence is happening in one
thread and in the other thread backlight update will try to enable
dsi pll. So fix the race condition between dsi off and dcs backlight
update by making them mutually exclusive.

Change-Id: I8cecb007117893091aacc7ebe3c93cc0e2c59b13
Signed-off-by: default avatarSandeep Panda <spanda@codeaurora.org>
Signed-off-by: default avatarLakshmi Narayana Kalavala <lkalaval@codeaurora.org>
parent 62c70b32
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -125,8 +125,11 @@ int dsi_display_set_backlight(struct drm_connector *connector,

	panel = dsi_display->panel;

	if (!dsi_panel_initialized(panel))
		return -EINVAL;
	mutex_lock(&panel->panel_lock);
	if (!dsi_panel_initialized(panel)) {
		rc = -EINVAL;
		goto error;
	}

	panel->bl_config.bl_level = bl_lvl;

@@ -161,6 +164,7 @@ int dsi_display_set_backlight(struct drm_connector *connector,
	}

error:
	mutex_unlock(&panel->panel_lock);
	return rc;
}

+1 −4
Original line number Diff line number Diff line
@@ -610,13 +610,10 @@ static int dsi_panel_update_backlight(struct dsi_panel *panel,

	dsi = &panel->mipi_device;

	mutex_lock(&panel->panel_lock);

	rc = mipi_dsi_dcs_set_display_brightness(dsi, bl_lvl);
	if (rc < 0)
		pr_err("failed to update dcs backlight:%d\n", bl_lvl);

	mutex_unlock(&panel->panel_lock);
	return rc;
}

@@ -631,7 +628,7 @@ int dsi_panel_set_backlight(struct dsi_panel *panel, u32 bl_lvl)
		rc = backlight_device_set_brightness(bl->raw_bd, bl_lvl);
		break;
	case DSI_BACKLIGHT_DCS:
		dsi_panel_update_backlight(panel, bl_lvl);
		rc = dsi_panel_update_backlight(panel, bl_lvl);
		break;
	default:
		pr_err("Backlight type(%d) not supported\n", bl->type);
+3 −2
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ static int sde_backlight_device_update_status(struct backlight_device *bd)
	struct sde_connector *c_conn;
	int bl_lvl;
	struct drm_event event;
	int rc = 0;

	brightness = bd->props.brightness;

@@ -97,11 +98,11 @@ static int sde_backlight_device_update_status(struct backlight_device *bd)
		event.length = sizeof(u32);
		msm_mode_object_event_notify(&c_conn->base.base,
				c_conn->base.dev, &event, (u8 *)&brightness);
		c_conn->ops.set_backlight(&c_conn->base,
		rc = c_conn->ops.set_backlight(&c_conn->base,
				c_conn->display, bl_lvl);
	}

	return 0;
	return rc;
}

static int sde_backlight_device_get_brightness(struct backlight_device *bd)