Skip to contentSkip to conversation

Add Fujitsu CoralP 8 bits per pixel support

PATCH New Igor Luri 1 participant 1 message May 2, 2006 Framebuffer layer

lore
Share & tools
lore

Igor Luri

author
#0 lore raw

PATCH 1/1 Add Fujitsu CoralP 8 bits per pixel support

Hi all,

Denx linux kernel 2.4.25 Fujitsu CoralP driver is configured with 16 bits per pixel color depth. This patch adds support to configure it with 8 bits per pixel.

Best regards.

drivers/video/Config.in +10 -0
@@ -11,6 +11,16 @@
    define_bool CONFIG_DUMMY_CONSOLE y
    bool '  Silicon Motion VOYAGER support (on TQM5200)' CONFIG_FB_VOYAGER
    bool '  Fujitsu CoralP support' CONFIG_FB_MB86290
+   if [ "$CONFIG_FB_MB86290" = "y" ]; then
+   	choice 'Bits per pixel'	\
+          "8		CONFIG_MB86290FB_8BPP \
+           16		CONFIG_MB86290FB_16BPP"   16  
+   	if [ "$CONFIG_INKA4X0" = "n" ]; then
+   		choice 'Screen resolution'	\
+		"1024x768	CONFIG_MB86290FB_RES_1024x768 \
+		640x480	CONFIG_MB86290FB_RES_640x480"   1024x768
+	fi  
+   fi
    if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
       if [ "$CONFIG_PCI" = "y" ]; then
          tristate '  nVidia Riva support (EXPERIMENTAL)' CONFIG_FB_RIVA
drivers/video/mb86290/mb86290fb.c +23 -6
@@ -20,6 +20,7 @@
 
 #include <linux/fb.h>
 #include <video/fbcon.h>
+#include <video/fbcon-cfb8.h>
 #include <video/fbcon-cfb16.h>
 
 #include "mb86290fbdev.h"
@@ -54,8 +55,7 @@
     /* display definition */
     pdisp->screen_base 	= (char*)mb86290fb_pInfo->gdcsysinfo.gdcbase;
     /* virtual address */
-    pdisp->visual 	= FB_VISUAL_TRUECOLOR;
-    pdisp->type 	= FB_TYPE_PACKED_PIXELS;
+    pdisp->type 	= FB_TYPE_PACKED_PIXELS;    
     pdisp->type_aux 	= 0;
     pdisp->ypanstep 	= 0;			/* no hardware support */
     pdisp->ywrapstep 	= 0;			/* no hardware support */
@@ -63,7 +63,16 @@
     pdisp->line_length  = MB86290FB_DFLT_SI_XRES * MB86290FB_DFLT_SI_BITS_PER_PIXEL / 8;
     pdisp->can_soft_blank= 1;
     pdisp->inverse 	= 0;
-    pdisp->dispsw	= &fbcon_cfb16;
+    if(MB86290FB_DFLT_SI_BITS_PER_PIXEL == 8)
+    {
+    	    pdisp->dispsw	= &fbcon_cfb8; 
+    	    pdisp->visual 	= FB_VISUAL_PSEUDOCOLOR;
+    }
+	else
+	{
+    	    pdisp->dispsw	= &fbcon_cfb16;	
+    	    pdisp->visual 	= FB_VISUAL_TRUECOLOR;
+    }
     pdisp->dispsw_data	= &mb86290fb_pInfo->cmap;
     pdisp->fb_info	= &mb86290fb_pInfo->fb_info;
     pdisp->scrollmode	= SCROLL_YREDRAW;	/* no hardware support */
@@ -87,11 +96,14 @@
     mb86290fb_pInfo->palette[regno].red   = red;
     mb86290fb_pInfo->palette[regno].green = green;
     mb86290fb_pInfo->palette[regno].blue  = blue;
-    
+      
     if (regno<16){
 	mb86290fb_pInfo->cmap[regno] = ((red & 0xf8) << 7)
 			| ((green & 0xf8) << 2) | ((blue & 0xf8) >> 3);
     }
+    
+    MB86290FB_WRITE_DISP_REGISTER((GDC_DISP_REG_PALLET_0 + (regno*4)), (((red & 0xfc) << 16) | ((green & 0xfc)<< 8) | ((blue & 0xfc))));
+    
     return 0;
 }
 
@@ -469,9 +481,14 @@
 	
     /* DispDimension */
     MB86290FB_WRITE_DISP_REGISTER(GDC_DISP_REG_C_MODE_W_H, 
-		    (1 << 31) | 
 		    ((MB86290FB_DFLT_SI_XRES * MB86290FB_DFLT_SI_BITS_PER_PIXEL / 8 / 64) << 16) | 
-		    (MB86290FB_DFLT_SI_YRES - 1));
+		    (MB86290FB_DFLT_SI_YRES - 1));		    
+    if(MB86290FB_DFLT_SI_BITS_PER_PIXEL == 16)
+    {
+    	reg = MB86290FB_READ_DISP_REGISTER(GDC_DISP_REG_C_MODE_W_H);
+    	MB86290FB_WRITE_DISP_REGISTER(GDC_DISP_REG_C_MODE_W_H, reg | (1 << 31));
+    }
+    
     MB86290FB_WRITE_DISP_REGISTER(GDC_DISP_REG_C_ORG_ADR, 0);
     MB86290FB_WRITE_DISP_REGISTER(GDC_DISP_REG_C_DISP_ADR, 0);
 	
drivers/video/mb86290/mb86290fbsys.h +20 -8
@@ -75,7 +75,7 @@
 
 /* Screen information of frame buffer */
 #ifndef CONFIG_INKA4X0
-#if 1
+#if CONFIG_MB86290FB_RES_640x480
 #define	MB86290FB_DFLT_SI_XRES			640
 #define	MB86290FB_DFLT_SI_YRES			480
 #define	MB86290FB_DFLT_SI_XRES_VIRTUAL		640
@@ -94,16 +94,28 @@
 #endif
 #define	MB86290FB_DFLT_SI_XOFFSET		0
 #define	MB86290FB_DFLT_SI_YOFFSET		0
-#define	MB86290FB_DFLT_SI_BITS_PER_PIXEL	16
+	
+#if CONFIG_MB86290FB_8BPP
+#	define MB86290FB_DFLT_SI_BITS_PER_PIXEL		8
+#	define	MB86290FB_DFLT_SI_RED_OFFSET		0
+#	define	MB86290FB_DFLT_SI_RED_LENGTH		6
+#	define	MB86290FB_DFLT_SI_GREEN_OFFSET		0
+#	define	MB86290FB_DFLT_SI_GREEN_LENGTH		6
+#	define	MB86290FB_DFLT_SI_BLUE_OFFSET		0
+#	define	MB86290FB_DFLT_SI_BLUE_LENGTH		6
+#endif
+#if CONFIG_MB86290FB_16BPP
+#	define MB86290FB_DFLT_SI_BITS_PER_PIXEL     16
+#	define	MB86290FB_DFLT_SI_RED_OFFSET		10
+#	define	MB86290FB_DFLT_SI_RED_LENGTH		5
+#	define	MB86290FB_DFLT_SI_GREEN_OFFSET		5
+#	define	MB86290FB_DFLT_SI_GREEN_LENGTH		5
+#	define	MB86290FB_DFLT_SI_BLUE_OFFSET		0
+#	define	MB86290FB_DFLT_SI_BLUE_LENGTH		5
+#endif
 #define	MB86290FB_DFLT_SI_GRAYSCALE		0
-#define	MB86290FB_DFLT_SI_RED_OFFSET		10
-#define	MB86290FB_DFLT_SI_RED_LENGTH		5
 #define	MB86290FB_DFLT_SI_RED_RIGHT		0
-#define	MB86290FB_DFLT_SI_GREEN_OFFSET		5
-#define	MB86290FB_DFLT_SI_GREEN_LENGTH		5
 #define	MB86290FB_DFLT_SI_GREEN_RIGHT		0
-#define	MB86290FB_DFLT_SI_BLUE_OFFSET		0
-#define	MB86290FB_DFLT_SI_BLUE_LENGTH		5
 #define	MB86290FB_DFLT_SI_BLUE_RIGHT		0
 #define	MB86290FB_DFLT_SI_TRANSP_OFFSET		0
 #define	MB86290FB_DFLT_SI_TRANSP_LENGTH		1
include/video/fbcon.h +5 -3
@@ -229,11 +229,13 @@
 #endif
 #define fb_writeb(b,addr) (*(volatile u8 *) (addr) = (b))
 #if defined(CONFIG_FB_MB86290) && defined(__BIG_ENDIAN)
-#define fb_writew(b,addr) (*(volatile u16 *) (addr) = cpu_to_le16(b))
-#define fb_writel(b,addr) (*(volatile u32 *) (addr) = cpu_to_le16((u16)b) | (cpu_to_le16(((u32)b) >> 16) << 16))
-#else
+#if CONFIG_MB86290FB_8BPP
 #define fb_writew(b,addr) (*(volatile u16 *) (addr) = (b))
 #define fb_writel(b,addr) (*(volatile u32 *) (addr) = (b))
+#else
+#define fb_writew(b,addr) (*(volatile u16 *) (addr) = cpu_to_le16(b))
+#define fb_writel(b,addr) (*(volatile u32 *) (addr) = cpu_to_le16((u16)b) | (cpu_to_le16(((u32)b) >> 16) << 16))
+#endif
 #endif
 #define fb_memset memset
 
arch/ppc/configs/icecube_5200_CoralP_defconfig +4 -0
@@ -509,6 +509,10 @@
 CONFIG_DUMMY_CONSOLE=y
 # CONFIG_FB_VOYAGER is not set
 CONFIG_FB_MB86290=y
+# CONFIG_MB86290FB_8BPP is not set
+CONFIG_MB86290FB_16BPP=y 
+CONFIG_MB86290FB_RES_1024x768=y 
+# CONFIG_MB86290FB_RES_640x480 is not set
 # CONFIG_FB_RIVA is not set
 # CONFIG_FB_CLGEN is not set
 # CONFIG_FB_PM2 is not set