Skip to contentSkip to conversation

OMAP FB code to set DISPC_TIMING_{H,V} doesn't match TRM

PATCH In review Zygo Blaxell 4 participants 5 messages Jun 16, 2010 – Jun 22, 2010 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 OMAP FB code to set DISPC_TIMING_{H,V} doesn't match TRM

The TRM and the OMAP FB driver have different ideas about the widths of various bit fields in the DISPC_TIMING_{H,V} registers. This patch is based on what the TRM (TI document SPRUF98G) says.

Note: this patch changes the meanings of the vertical timing values by one scan line. It still works with my display, but it might break things for other people.

---

drivers/video/omap/dispc.c +8 -8
index c7c6455..e58574b 100644
@@ -795,17 +795,17 @@ static void set_lcd_timings(void)
 	unsigned long fck;
 
 	l = dispc_read_reg(DISPC_TIMING_H);
-	l &= ~(FLD_MASK(0, 6) | FLD_MASK(8, 8) | FLD_MASK(20, 8));
-	l |= ( max(1, (min(64,  panel->hsw))) - 1 ) << 0;
-	l |= ( max(1, (min(256, panel->hfp))) - 1 ) << 8;
-	l |= ( max(1, (min(256, panel->hbp))) - 1 ) << 20;
+	l &= ~(FLD_MASK(0, 8) | FLD_MASK(8, 12) | FLD_MASK(20, 12));
+	l |= ( max(1, (min(256, panel->hsw))) - 1 ) << 0;
+	l |= ( max(1, (min(4096, panel->hfp))) - 1 ) << 8;
+	l |= ( max(1, (min(4096, panel->hbp))) - 1 ) << 20;
 	dispc_write_reg(DISPC_TIMING_H, l);
 
 	l = dispc_read_reg(DISPC_TIMING_V);
-	l &= ~(FLD_MASK(0, 6) | FLD_MASK(8, 8) | FLD_MASK(20, 8));
-	l |= ( max(1, (min(64,  panel->vsw))) - 1 ) << 0;
-	l |= ( max(0, (min(255, panel->vfp))) - 0 ) << 8;
-	l |= ( max(0, (min(255, panel->vbp))) - 0 ) << 20;
+	l &= ~(FLD_MASK(0, 8) | FLD_MASK(8, 12) | FLD_MASK(20, 12));
+	l |= ( max(1, (min(256, panel->vsw))) - 1 ) << 0;
+	l |= ( max(1, (min(4096, panel->vfp))) - 1 ) << 8;
+	l |= ( max(1, (min(4096, panel->vbp))) - 1 ) << 20;
 	dispc_write_reg(DISPC_TIMING_V, l);
 
 	l = dispc_read_reg(DISPC_POL_FREQ);
#1 lore raw

(CC Tomi)

Quoted 7 lines · Zygo Blaxell

The TRM and the OMAP FB driver have different ideas about the widths of various bit fields in the DISPC_TIMING_{H,V} registers.  This patch is based on what the TRM (TI document SPRUF98G) says.

Note:  this patch changes the meanings of the vertical timing values by one scan line.  It still works with my display, but it might break things for other people.

Why? The TRM doesn't say VFP, VBP have to be programmed with value -1.

Quoted 34 lines

---

drivers/video/omap/dispc.c +8 -9
index c7c6455..e58574b 100644
@@ -795,17 +795,17 @@ static void set_lcd_timings(void)
        unsigned long fck;
 
        l = dispc_read_reg(DISPC_TIMING_H);
-       l &= ~(FLD_MASK(0, 6) | FLD_MASK(8, 8) | FLD_MASK(20, 8));
-       l |= ( max(1, (min(64,  panel->hsw))) - 1 ) << 0;
-       l |= ( max(1, (min(256, panel->hfp))) - 1 ) << 8;
-       l |= ( max(1, (min(256, panel->hbp))) - 1 ) << 20;
+       l &= ~(FLD_MASK(0, 8) | FLD_MASK(8, 12) | FLD_MASK(20, 12));
+       l |= ( max(1, (min(256, panel->hsw))) - 1 ) << 0;
+       l |= ( max(1, (min(4096, panel->hfp))) - 1 ) << 8;
+       l |= ( max(1, (min(4096, panel->hbp))) - 1 ) << 20;
        dispc_write_reg(DISPC_TIMING_H, l);
 
        l = dispc_read_reg(DISPC_TIMING_V);
-       l &= ~(FLD_MASK(0, 6) | FLD_MASK(8, 8) | FLD_MASK(20, 8));
-       l |= ( max(1, (min(64,  panel->vsw))) - 1 ) << 0;
-       l |= ( max(0, (min(255, panel->vfp))) - 0 ) << 8;
-       l |= ( max(0, (min(255, panel->vbp))) - 0 ) << 20;
+       l &= ~(FLD_MASK(0, 8) | FLD_MASK(8, 12) | FLD_MASK(20, 12));
+       l |= ( max(1, (min(256, panel->vsw))) - 1 ) << 0;
+       l |= ( max(1, (min(4096, panel->vfp))) - 1 ) << 8;
+       l |= ( max(1, (min(4096, panel->vbp))) - 1 ) << 20;
        dispc_write_reg(DISPC_TIMING_V, l);
 
        l = dispc_read_reg(DISPC_POL_FREQ);
--
Quoted 4 lines

To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 8 lines · Grazvydas Ignotas

(CC Tomi)

Quoted 4 lines · Zygo Blaxell

The TRM and the OMAP FB driver have different ideas about the widths of various bit fields in the DISPC_TIMING_{H,V} registers.  This patch is based on what the TRM (TI document SPRUF98G) says.

Quoted 5 lines
Quoted 3 lines

Note:  this patch changes the meanings of the vertical timing values by one scan line.  It still works with my display, but it might break things for other people.

Why? The TRM doesn't say VFP, VBP have to be programmed with value -1.

Hmmm...that's correct. Only VSW in DISPC_TIMING_V needs -1. Sorry, my bad.

On the other hand, I've since found the equivalent code in the DSS driver, and it looks like this:

        if (cpu_is_omap24xx() || omap_rev() < OMAP3430_REV_ES3_0) {
                timing_h = FLD_VAL(hsw-1, 5, 0) | FLD_VAL(hfp-1, 15, 8) |
                        FLD_VAL(hbp-1, 27, 20);

                timing_v = FLD_VAL(vsw-1, 5, 0) | FLD_VAL(vfp, 15, 8) |
                        FLD_VAL(vbp, 27, 20);
        } else {
                timing_h = FLD_VAL(hsw-1, 7, 0) | FLD_VAL(hfp-1, 19, 8) |
                        FLD_VAL(hbp-1, 31, 20);

                timing_v = FLD_VAL(vsw-1, 7, 0) | FLD_VAL(vfp, 19, 8) |
                        FLD_VAL(vbp, 31, 20);
        }

so it would seem that the wider field widths are only available on newer hardware than the old omapfb code was intended to support?

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 35 lines · ext Zygo Blaxell
Quoted 8 lines · Grazvydas Ignotas

(CC Tomi)

Quoted 4 lines · Zygo Blaxell

The TRM and the OMAP FB driver have different ideas about the widths of various bit fields in the DISPC_TIMING_{H,V} registers.  This patch is based on what the TRM (TI document SPRUF98G) says.

Quoted 5 lines
Quoted 3 lines

Note:  this patch changes the meanings of the vertical timing values by one scan line.  It still works with my display, but it might break things for other people.

Why? The TRM doesn't say VFP, VBP have to be programmed with value -1.

Hmmm...that's correct. Only VSW in DISPC_TIMING_V needs -1. Sorry, my bad.

On the other hand, I've since found the equivalent code in the DSS driver, and it looks like this:

       if (cpu_is_omap24xx() || omap_rev() < OMAP3430_REV_ES3_0) {
               timing_h = FLD_VAL(hsw-1, 5, 0) | FLD_VAL(hfp-1, 15, 8) |
                       FLD_VAL(hbp-1, 27, 20);

               timing_v = FLD_VAL(vsw-1, 5, 0) | FLD_VAL(vfp, 15, 8) |
                       FLD_VAL(vbp, 27, 20);
       } else {
               timing_h = FLD_VAL(hsw-1, 7, 0) | FLD_VAL(hfp-1, 19, 8) |
                       FLD_VAL(hbp-1, 31, 20);

               timing_v = FLD_VAL(vsw-1, 7, 0) | FLD_VAL(vfp, 19, 8) |
                       FLD_VAL(vbp, 31, 20);
       }
Quoted 2 lines

so it would seem that the wider field widths are only available on newer hardware than the old omapfb code was intended to support?

I would suggest to use the new driver, and fix any possible bugs on that one. The older driver is not really maintained anymore.

Of course if there's a critical bug in the old driver that appears on a board supported in the mainline kernel, the bug should be fixed.

Tomi

#4 lore raw
In reply to Zygo Blaxell

Op 21 jun 2010, om 23:31 heeft Zygo Blaxell het volgende geschreven:

Quoted 35 lines · Grazvydas Ignotas
Quoted 8 lines

(CC Tomi)

Quoted 4 lines · Zygo Blaxell

The TRM and the OMAP FB driver have different ideas about the widths of various bit fields in the DISPC_TIMING_{H,V} registers. This patch is based on what the TRM (TI document SPRUF98G) says.

Quoted 5 lines
Quoted 3 lines

Note: this patch changes the meanings of the vertical timing values by one scan line. It still works with my display, but it might break things for other people.

Why? The TRM doesn't say VFP, VBP have to be programmed with value -1.

Hmmm...that's correct. Only VSW in DISPC_TIMING_V needs -1. Sorry, my bad.

On the other hand, I've since found the equivalent code in the DSS driver, and it looks like this:

       if (cpu_is_omap24xx() || omap_rev() < OMAP3430_REV_ES3_0) {
               timing_h = FLD_VAL(hsw-1, 5, 0) | FLD_VAL(hfp-1, 15, 8) |
                       FLD_VAL(hbp-1, 27, 20);

               timing_v = FLD_VAL(vsw-1, 5, 0) | FLD_VAL(vfp, 15, 8) |
                       FLD_VAL(vbp, 27, 20);
       } else {
               timing_h = FLD_VAL(hsw-1, 7, 0) | FLD_VAL(hfp-1, 19, 8) |
                       FLD_VAL(hbp-1, 31, 20);

               timing_v = FLD_VAL(vsw-1, 7, 0) | FLD_VAL(vfp, 19, 8) |
                       FLD_VAL(vbp, 31, 20);
       }
Quoted 2 lines

so it would seem that the wider field widths are only available on newer hardware than the old omapfb code was intended to support?

It is unclear when the wider registers were introduced. According to the TRM it's ES3.0, but all my ES2.1 SoCs already have them.

regards,

Koen