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

Commit bbe7fa4d authored by Sandeep Panda's avatar Sandeep Panda
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>
parent 3d139965
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -88,8 +88,11 @@ int dsi_display_set_backlight(void *display, u32 bl_lvl)

	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;

@@ -124,6 +127,7 @@ int dsi_display_set_backlight(void *display, u32 bl_lvl)
	}

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

+2 −5
Original line number Diff line number Diff line
/*
 * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
 * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -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)
		led_trigger_event(bl->wled, 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
@@ -68,6 +68,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;

@@ -93,10 +94,10 @@ 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->display, bl_lvl);
		rc = c_conn->ops.set_backlight(c_conn->display, bl_lvl);
	}

	return 0;
	return rc;
}

static int sde_backlight_device_get_brightness(struct backlight_device *bd)