All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: dri-devel@lists.freedesktop.org
Cc: Tony Lindgren <tony@atomide.com>,
	Tomi Valkeinen <tomi.valkeinen@ti.com>,
	linux-omap@vger.kernel.org
Subject: [PATCH v2 4/4] drm/omap: Work around missing DISPC in runtime PM handlers
Date: Mon,  5 Nov 2018 17:10:28 +0200	[thread overview]
Message-ID: <20181105151028.4091-5-laurent.pinchart@ideasonboard.com> (raw)
In-Reply-To: <20181105151028.4091-1-laurent.pinchart@ideasonboard.com>

The runtime suspend and resume callbacks for the DSI, HDMI4, HDMI5 and
VENC try to manage the runtime PM state of the DISPC, which can be
unavailable at probe time (due to the DSS probe being deferred for
instance) and remove time (due to the DISPC being removed already). The
proper fix is to move DISPC runtime PM handling out of the encoders
runtime PM handlers, but that will require more development and testing
that would be reasonable for an -rc bug fix.

Fixes: edb715dffdee ("drm/omap: dss: dsi: Move initialization code from bind to probe")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/gpu/drm/omapdrm/dss/dsi.c   | 22 ++++++++++++++++++----
 drivers/gpu/drm/omapdrm/dss/hdmi4.c | 19 +++++++++++++++----
 drivers/gpu/drm/omapdrm/dss/hdmi5.c | 19 +++++++++++++++----
 drivers/gpu/drm/omapdrm/dss/venc.c  | 19 +++++++++++++++----
 4 files changed, 63 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index b9d5ad7e67d8..a1b9e6659b1e 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -5473,7 +5473,12 @@ static int dsi_runtime_suspend(struct device *dev)
 	/* wait for current handler to finish before turning the DSI off */
 	synchronize_irq(dsi->irq);
 
-	dispc_runtime_put(dsi->dss->dispc);
+	/*
+	 * FIXME: DISPC runtime PM handling should be controlled from omapdrm,
+	 * see dsi_runtime_resume().
+	 */
+	if (dsi->dss && dsi->dss->dispc)
+		dispc_runtime_put(dsi->dss->dispc);
 
 	return 0;
 }
@@ -5483,9 +5488,18 @@ static int dsi_runtime_resume(struct device *dev)
 	struct dsi_data *dsi = dev_get_drvdata(dev);
 	int r;
 
-	r = dispc_runtime_get(dsi->dss->dispc);
-	if (r)
-		return r;
+	/*
+	 * FIXME: The device is resumed from the probe function before the dss
+	 * is available, in order to read a hardware configuration register.
+	 * This doesn't require resuming the DISPC, so make it conditional. The
+	 * DISPC runtime PM handling should instead be controlled from omapdrm,
+	 * which is already partly the case, but needs additional testing.
+	 */
+	if (dsi->dss && dsi->dss->dispc) {
+		r = dispc_runtime_get(dsi->dss->dispc);
+		if (r)
+			return r;
+	}
 
 	dsi->is_enabled = true;
 	/* ensure the irq handler sees the is_enabled value */
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
index 36be9a36d664..21d1147c0827 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
@@ -845,7 +845,12 @@ static int hdmi_runtime_suspend(struct device *dev)
 {
 	struct omap_hdmi *hdmi = dev_get_drvdata(dev);
 
-	dispc_runtime_put(hdmi->dss->dispc);
+	/*
+	 * FIXME: DISPC runtime PM handling should be controlled from omapdrm,
+	 * see dsi_runtime_resume().
+	 */
+	if (hdmi->dss && hdmi->dss->dispc)
+		dispc_runtime_put(hdmi->dss->dispc);
 
 	return 0;
 }
@@ -855,9 +860,15 @@ static int hdmi_runtime_resume(struct device *dev)
 	struct omap_hdmi *hdmi = dev_get_drvdata(dev);
 	int r;
 
-	r = dispc_runtime_get(hdmi->dss->dispc);
-	if (r < 0)
-		return r;
+	/*
+	 * FIXME: DISPC runtime PM handling should be controlled from omapdrm,
+	 * see dsi_runtime_resume().
+	 */
+	if (hdmi->dss && hdmi->dss->dispc) {
+		r = dispc_runtime_get(hdmi->dss->dispc);
+		if (r < 0)
+			return r;
+	}
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5.c b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
index b0e4a7463f8c..75e2cb74a66c 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi5.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
@@ -829,7 +829,12 @@ static int hdmi_runtime_suspend(struct device *dev)
 {
 	struct omap_hdmi *hdmi = dev_get_drvdata(dev);
 
-	dispc_runtime_put(hdmi->dss->dispc);
+	/*
+	 * FIXME: DISPC runtime PM handling should be controlled from omapdrm,
+	 * see dsi_runtime_resume().
+	 */
+	if (hdmi->dss && hdmi->dss->dispc)
+		dispc_runtime_put(hdmi->dss->dispc);
 
 	return 0;
 }
@@ -839,9 +844,15 @@ static int hdmi_runtime_resume(struct device *dev)
 	struct omap_hdmi *hdmi = dev_get_drvdata(dev);
 	int r;
 
-	r = dispc_runtime_get(hdmi->dss->dispc);
-	if (r < 0)
-		return r;
+	/*
+	 * FIXME: DISPC runtime PM handling should be controlled from omapdrm,
+	 * see dsi_runtime_resume().
+	 */
+	if (hdmi->dss && hdmi->dss->dispc) {
+		r = dispc_runtime_get(hdmi->dss->dispc);
+		if (r < 0)
+			return r;
+	}
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c b/drivers/gpu/drm/omapdrm/dss/venc.c
index ff0b18c8e4ac..c39ad81fbc54 100644
--- a/drivers/gpu/drm/omapdrm/dss/venc.c
+++ b/drivers/gpu/drm/omapdrm/dss/venc.c
@@ -946,7 +946,12 @@ static int venc_runtime_suspend(struct device *dev)
 	if (venc->tv_dac_clk)
 		clk_disable_unprepare(venc->tv_dac_clk);
 
-	dispc_runtime_put(venc->dss->dispc);
+	/*
+	 * FIXME: DISPC runtime PM handling should be controlled from omapdrm,
+	 * see dsi_runtime_resume().
+	 */
+	if (venc->dss && venc->dss->dispc)
+		dispc_runtime_put(venc->dss->dispc);
 
 	return 0;
 }
@@ -956,9 +961,15 @@ static int venc_runtime_resume(struct device *dev)
 	struct venc_device *venc = dev_get_drvdata(dev);
 	int r;
 
-	r = dispc_runtime_get(venc->dss->dispc);
-	if (r < 0)
-		return r;
+	/*
+	 * FIXME: DISPC runtime PM handling should be controlled from omapdrm,
+	 * see dsi_runtime_resume().
+	 */
+	if (venc->dss && venc->dss->dispc) {
+		r = dispc_runtime_get(venc->dss->dispc);
+		if (r < 0)
+			return r;
+	}
 
 	if (venc->tv_dac_clk)
 		clk_prepare_enable(venc->tv_dac_clk);
-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2018-11-05 15:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-05 15:10 [PATCH v2 0/4] omapdrm: Fix runtime PM issues at module load and unload time Laurent Pinchart
2018-11-05 15:10 ` [PATCH v2 1/4] drm/omap: Populate DSS children in omapdss driver Laurent Pinchart
2018-11-05 20:00   ` Tony Lindgren
2018-11-05 15:10 ` [PATCH v2 2/4] drm/omap: hdmi4: Ensure the device is active during bind Laurent Pinchart
2018-11-05 20:02   ` Tony Lindgren
2018-11-05 21:45     ` Laurent Pinchart
2018-11-05 15:10 ` [PATCH v2 3/4] drm/omap: dsi: Ensure the device is active during probe Laurent Pinchart
2018-11-05 20:11   ` Tony Lindgren
2018-11-05 15:10 ` Laurent Pinchart [this message]
2018-11-05 19:23 ` [RFC/PATCH] drm/omap: Move DISPC runtime PM handling to omapdrm Laurent Pinchart
2018-11-05 20:14   ` Tony Lindgren
2018-11-05 21:46     ` Laurent Pinchart
2018-11-06  9:22       ` Tomi Valkeinen
2018-11-06 12:47         ` Tomi Valkeinen
2018-11-07 13:27           ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181105151028.4091-5-laurent.pinchart@ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=tomi.valkeinen@ti.com \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.