diff mbox series

[RFCv1,38/42] drm/omap: panel-dsi-cm: do not power on/off twice

Message ID 20191117024028.2233-39-sebastian.reichel@collabora.com (mailing list archive)
State New, archived
Headers show
Series drm/omap: Convert DSI code to use drm_mipi_dsi and drm_panel | expand

Commit Message

Sebastian Reichel Nov. 17, 2019, 2:40 a.m. UTC
Make sure, that we only power on/off the device once.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 90132d1d1f5d..7f6b1129862a 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -290,6 +290,9 @@  static int dsicm_power_on(struct panel_drv_data *ddata)
 	u8 id1, id2, id3;
 	int r;
 
+	if (ddata->enabled)
+		return 0;
+
 	r = regulator_bulk_enable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
 	if (r) {
 		dev_err(&ddata->dsi->dev, "failed to enable supplies: %d\n", r);
@@ -354,6 +357,9 @@  static int dsicm_power_off(struct panel_drv_data *ddata)
 {
 	int r;
 
+	if (!ddata->enabled)
+		return 0;
+
 	ddata->enabled = 0;
 
 	r = mipi_dsi_dcs_set_display_off(ddata->dsi);