public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* Fix for dispc's error "omapfb omapfb: irq error status 4020"
@ 2008-11-07 20:55 Rick Bronson
  2008-11-07 21:37 ` Koen Kooi
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Rick Bronson @ 2008-11-07 20:55 UTC (permalink / raw)
  To: imre.deak, aam, juha.yrjola, dirk.behme; +Cc: linux-omap

Folks,

  Please take a look at this change to drivers/video/omap/dispc.c.  It
addresses a problem seen on some boots of OMAP's.  On about 1 in 30
boots one gets an endless stream of interrupts from the
DISPC_IRQ_SYNC_LOST bit in the DISPC_IRQSTATUS register.  The
following messages are printed.

 omapfb omapfb: irq error status 4020

  The correct solution to this problem is to perform a "soft reset"
but that requires a bit of re-architecturing of the code as the init
routine would have to be split up, etc.  See the OMAP pdf, search for
"To clear a synchronization lost interrupt".

  This patch allows the above error message to get printed once and
then disables further DISPC_IRQ_SYNC_LOST interrups.

  Comments?

  Thanks,

 Rick

--- linux-omap-2.6/drivers/video/omap/dispc.c.~1~	2008-11-04 14:23:38.000000000 -0800
+++ linux-omap-2.6/drivers/video/omap/dispc.c	2008-11-07 12:34:54.000000000 -0800
@@ -157,7 +157,7 @@ struct resmap {
 
 #define MAX_IRQ_HANDLERS            4
 
-static struct {
+static struct omapfb_dispc {
 	void __iomem	*base;
 
 	struct omapfb_mem_desc	mem_desc;
@@ -169,6 +169,7 @@ static struct {
 
 	int		ext_mode;
 
+	u32	irq_error_mask;  /* mask used for errors */
 	struct {
 		u32	irq_mask;
 		void	(*callback)(void *);
@@ -812,16 +813,16 @@ static void set_lcd_timings(void)
 	panel->pixel_clock = fck / lck_div / pck_div / 1000;
 }
 
-static void recalc_irq_mask(void)
+static void recalc_irq_mask(struct omapfb_dispc *p_dispc)
 {
 	int i;
-	unsigned long irq_mask = DISPC_IRQ_MASK_ERROR;
+	unsigned long irq_mask = p_dispc->irq_error_mask;
 
 	for (i = 0; i < MAX_IRQ_HANDLERS; i++) {
-		if (!dispc.irq_handlers[i].callback)
+		if (!p_dispc->irq_handlers[i].callback)
 			continue;
 
-		irq_mask |= dispc.irq_handlers[i].irq_mask;
+		irq_mask |= p_dispc->irq_handlers[i].irq_mask;
 	}
 
 	enable_lcd_clocks(1);
@@ -843,7 +844,7 @@ int omap_dispc_request_irq(unsigned long
 		dispc.irq_handlers[i].irq_mask = irq_mask;
 		dispc.irq_handlers[i].callback = callback;
 		dispc.irq_handlers[i].data = data;
-		recalc_irq_mask();
+		recalc_irq_mask(&dispc);
 
 		return 0;
 	}
@@ -863,7 +864,7 @@ void omap_dispc_free_irq(unsigned long i
 			dispc.irq_handlers[i].irq_mask = 0;
 			dispc.irq_handlers[i].callback = NULL;
 			dispc.irq_handlers[i].data = NULL;
-			recalc_irq_mask();
+			recalc_irq_mask(&dispc);
 			return;
 		}
 	}
@@ -884,6 +885,10 @@ static irqreturn_t omap_dispc_irq_handle
 		complete(&dispc.frame_done);
 
 	if (stat & DISPC_IRQ_MASK_ERROR) {
+		if (stat & DISPC_IRQ_SYNC_LOST) {  /* only allow sync lost once or we end up... */
+			dispc.irq_error_mask &= ~DISPC_IRQ_SYNC_LOST;  /* with a barrage of interrupts */
+			recalc_irq_mask(&dispc);
+			}
 		if (printk_ratelimit()) {
 			dev_err(dispc.fbdev->dev, "irq error status %04x\n",
 				stat & 0x7fff);
@@ -897,6 +902,7 @@ static irqreturn_t omap_dispc_irq_handle
 	}
 
 	dispc_write_reg(DISPC_IRQSTATUS, stat);
+	stat = dispc_read_reg(DISPC_IRQSTATUS);
 
 	enable_lcd_clocks(0);
 
@@ -1432,7 +1438,8 @@ static int omap_dispc_init(struct omapfb
 	l = dispc_read_reg(DISPC_IRQSTATUS);
 	dispc_write_reg(DISPC_IRQSTATUS, l);
 
-	recalc_irq_mask();
+	dispc.irq_error_mask = DISPC_IRQ_MASK_ERROR;  /* init error mask */
+	recalc_irq_mask(&dispc);
 
 	if ((r = request_irq(INT_24XX_DSS_IRQ, omap_dispc_irq_handler,
 			   0, MODULE_NAME, fbdev)) < 0) {


^ permalink raw reply	[flat|nested] 8+ messages in thread
* Re: Fix for dispc's error "omapfb omapfb: irq error status 4020"
@ 2008-11-11 17:25 Rick Bronson
  0 siblings, 0 replies; 8+ messages in thread
From: Rick Bronson @ 2008-11-11 17:25 UTC (permalink / raw)
  To: hvaibhav, tomi.valkeinen; +Cc: linux-omap

Tomi,

  I agree with both of you.  My patch is a bandaid at best.  I spend a
fair amount of time trying to find out what's causing the sync lost
interrupts in the first place, mostly be doing peripheral memory space
comparisons of good/bad boots.  This let to nothing, all of the
registers off the DSS were the same except for the interrupt pending.

  This led me to implementing the "soft reset" mentioned in the OMAP3
pdf.  But this would be a big change and I'm not too familiar with
that code.  Plus I didn't even have a DVI display until yesterday...

  Rick

> I think the correct solution would be to find out why we get sync lost
> errors and fix that. Your patch just hides the problem. 
> 
> However, I agree that it's not good to just keep spamming the error,
> possibly making the board freeze. The new DSS turns the display off
> after 100 error messages. But I don't think just hiding the interrupt
> is a good change.
> 
> [Hiremath, Vaibhav] Yes, it is not a good practice to hide any
> interrupts. But I think even instead of turning of the DSS, you should
> reset the DSS and reconfigure it with default values or preserve the
> state before resetting and configure it again.  I agree to the point
> that, it requires lot of re-architectureing to the current driver. But
> I believe it should be possible with new omap2 version.
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-01-09 21:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-07 20:55 Fix for dispc's error "omapfb omapfb: irq error status 4020" Rick Bronson
2008-11-07 21:37 ` Koen Kooi
2008-11-10  8:30 ` Tomi Valkeinen
2008-11-10  8:39   ` Hiremath, Vaibhav
2008-11-13 14:06 ` Tomi Valkeinen
2008-11-26 17:32   ` Tony Lindgren
2009-01-09 21:57   ` Grazvydas Ignotas
  -- strict thread matches above, loose matches on Subject: below --
2008-11-11 17:25 Rick Bronson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox