All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jyri Sarha <jsarha@ti.com>
To: dri-devel@lists.freedesktop.org
Cc: khilman@baylibre.com, Jyri Sarha <jsarha@ti.com>,
	bgolaszewski@baylibre.com, tomi.valkeinen@ti.com,
	laurent.pinchart@ideasonboard.com
Subject: [PATCH v3 01/11] drm/tilcdc: Enable sync lost error and recovery handling for rev 1 LCDC
Date: Tue, 22 Nov 2016 18:54:00 +0200	[thread overview]
Message-ID: <a268ea847c79aa39628664d491ec8213b85d50ca.1479832733.git.jsarha@ti.com> (raw)
In-Reply-To: <cover.1479832733.git.jsarha@ti.com>

Revision 1 LCDC support also sync lost errors and can benefit from
sync lost recovery routine.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
 drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 33 +++++++++++++++++----------------
 drivers/gpu/drm/tilcdc/tilcdc_regs.h |  1 +
 2 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
index c787349..5260eb2 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
@@ -113,6 +113,7 @@ static void tilcdc_crtc_enable_irqs(struct drm_device *dev)
 
 	if (priv->rev == 1) {
 		tilcdc_set(dev, LCDC_RASTER_CTRL_REG,
+			LCDC_V1_SYNC_LOST_ENA |
 			LCDC_V1_UNDERFLOW_INT_ENA);
 		tilcdc_set(dev, LCDC_DMA_CTRL_REG,
 			LCDC_V1_END_OF_FRAME_INT_ENA);
@@ -130,7 +131,7 @@ static void tilcdc_crtc_disable_irqs(struct drm_device *dev)
 
 	/* disable irqs that we might have enabled: */
 	if (priv->rev == 1) {
-		tilcdc_clear(dev, LCDC_RASTER_CTRL_REG,
+		tilcdc_clear(dev, LCDC_RASTER_CTRL_REG, LCDC_V1_SYNC_LOST_ENA |
 			LCDC_V1_UNDERFLOW_INT_ENA | LCDC_V1_PL_INT_ENA);
 		tilcdc_clear(dev, LCDC_DMA_CTRL_REG,
 			LCDC_V1_END_OF_FRAME_INT_ENA);
@@ -845,6 +846,21 @@ irqreturn_t tilcdc_crtc_irq(struct drm_crtc *crtc)
 		dev_err_ratelimited(dev->dev, "%s(0x%08x): FIFO underflow",
 				    __func__, stat);
 
+	if (stat & LCDC_SYNC_LOST) {
+		dev_err_ratelimited(dev->dev, "%s(0x%08x): Sync lost",
+				    __func__, stat);
+		tilcdc_crtc->frame_intact = false;
+		if (tilcdc_crtc->sync_lost_count++ >
+		    SYNC_LOST_COUNT_LIMIT) {
+			dev_err(dev->dev, "%s(0x%08x): Sync lost flood detected, recovering", __func__, stat);
+			queue_work(system_wq,
+				   &tilcdc_crtc->recover_work);
+			tilcdc_write(dev, LCDC_INT_ENABLE_CLR_REG,
+				     LCDC_SYNC_LOST);
+			tilcdc_crtc->sync_lost_count = 0;
+		}
+	}
+
 	/* For revision 2 only */
 	if (priv->rev == 2) {
 		if (stat & LCDC_FRAME_DONE) {
@@ -852,21 +868,6 @@ irqreturn_t tilcdc_crtc_irq(struct drm_crtc *crtc)
 			wake_up(&tilcdc_crtc->frame_done_wq);
 		}
 
-		if (stat & LCDC_SYNC_LOST) {
-			dev_err_ratelimited(dev->dev, "%s(0x%08x): Sync lost",
-					    __func__, stat);
-			tilcdc_crtc->frame_intact = false;
-			if (tilcdc_crtc->sync_lost_count++ >
-			    SYNC_LOST_COUNT_LIMIT) {
-				dev_err(dev->dev, "%s(0x%08x): Sync lost flood detected, recovering", __func__, stat);
-				queue_work(system_wq,
-					   &tilcdc_crtc->recover_work);
-				tilcdc_write(dev, LCDC_INT_ENABLE_CLR_REG,
-					     LCDC_SYNC_LOST);
-				tilcdc_crtc->sync_lost_count = 0;
-			}
-		}
-
 		/* Indicate to LCDC that the interrupt service routine has
 		 * completed, see 13.3.6.1.6 in AM335x TRM.
 		 */
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_regs.h b/drivers/gpu/drm/tilcdc/tilcdc_regs.h
index f57c0d6..beb8c21 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_regs.h
+++ b/drivers/gpu/drm/tilcdc/tilcdc_regs.h
@@ -61,6 +61,7 @@
 #define LCDC_V2_UNDERFLOW_INT_ENA                BIT(5)
 #define LCDC_V1_PL_INT_ENA                       BIT(4)
 #define LCDC_V2_PL_INT_ENA                       BIT(6)
+#define LCDC_V1_SYNC_LOST_ENA                    BIT(5)
 #define LCDC_MONOCHROME_MODE                     BIT(1)
 #define LCDC_RASTER_ENABLE                       BIT(0)
 #define LCDC_TFT_ALT_ENABLE                      BIT(23)
-- 
1.9.1

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

  reply	other threads:[~2016-11-22 16:54 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-22 16:53 [PATCH v3 00/11] drm/tilcdc: LCDC Revision 1 related fixes Jyri Sarha
2016-11-22 16:54 ` Jyri Sarha [this message]
2016-11-23 13:24   ` [PATCH v3 01/11] drm/tilcdc: Enable sync lost error and recovery handling for rev 1 LCDC Bartosz Golaszewski
2016-11-22 16:54 ` [PATCH v3 02/11] drm/tilcdc: implement palette loading for rev1 Jyri Sarha
2016-11-24  9:29   ` Tomi Valkeinen
2016-11-24  9:39     ` Jyri Sarha
2016-11-24  9:43       ` Tomi Valkeinen
2016-11-24 10:03         ` Jyri Sarha
2016-11-24 10:25           ` Tomi Valkeinen
2016-11-24 10:38             ` Jyri Sarha
2016-11-24 11:10               ` Tomi Valkeinen
2016-11-24 12:03                 ` Jyri Sarha
2016-11-24 12:56                   ` Tomi Valkeinen
2016-11-24 20:32                     ` Jyri Sarha
2016-11-25  6:42                       ` Daniel Vetter
2016-11-22 16:54 ` [PATCH v3 03/11] drm/tilcdc: Fix tilcdc_crtc_create() return value handling Jyri Sarha
2016-11-24  9:34   ` Tomi Valkeinen
2016-11-22 16:54 ` [PATCH v3 04/11] drm/tilcdc: Add tilcdc_write_mask() to tilcdc_regs.h Jyri Sarha
2016-11-22 16:54 ` [PATCH v3 05/11] drm/tilcdc: Fix load mode bit-field setting in tilcdc_crtc_enable() Jyri Sarha
2016-11-22 16:54 ` [PATCH v3 06/11] drm/tilcdc: Enable palette loading for revision 2 LCDC too Jyri Sarha
2016-11-23 15:12   ` Bartosz Golaszewski
2016-11-24  9:37   ` Tomi Valkeinen
2016-11-24  9:40     ` Jyri Sarha
2016-11-22 16:54 ` [PATCH v3 07/11] drm/tilcdc: Add timeout wait for palette loading to complete Jyri Sarha
2016-11-24  9:38   ` Tomi Valkeinen
2016-11-22 16:54 ` [PATCH v3 08/11] drm/tilcdc: Call reset() before loading the palette Jyri Sarha
2016-11-22 16:54 ` [PATCH v3 09/11] drm/tilcdc: Use complete_all() to indicate completed palette loading Jyri Sarha
2016-11-22 16:54 ` [PATCH v3 10/11] drm/tilcdc: Load palette at the end of mode_set_nofb() Jyri Sarha
2016-11-22 16:54 ` [PATCH v3 11/11] drm/tilcdc: Enable frame done irq and functionality for LCDC rev 1 Jyri Sarha
2016-11-23 17:19   ` Bartosz Golaszewski

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=a268ea847c79aa39628664d491ec8213b85d50ca.1479832733.git.jsarha@ti.com \
    --to=jsarha@ti.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=khilman@baylibre.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=tomi.valkeinen@ti.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.