Skip to contentSkip to conversation

s3c2410fb: byte ordering fixes

PATCH In review Krzysztof Helt 3 participants 5 messages Aug 14, 2007 – Sep 15, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s3c2410fb: byte ordering fixes

From: Krzysztof Helt <[email protected]>

This patch sets correct bits related to the byte ordering of the framebuffer. This was tested on little endian kernel only. The big endian kernel may require different settings.

The patch also adds 32 bpp mode which is called 24 bpp by Samsung. One pixel takes 32 bits but only 24 bits are used in this mode.

---

This patch requires all s3c2410fb patches sent to this list.

The patch was tested on iPAQ rx1950 (TFT display only). The 1, 2 and 4 bpp modes do not work on little endian kernel (wrong order of pixels in byte). 1bpp is not stable for unknown reason.

diff -urp linux-2.6.23.old/drivers/video/s3c2410fb.c linux-2.6. 23/drivers/video/s3c2410fb.c
--- linux-2.6.23.old/drivers/video/s3c2410fb.c 2007-08-13 20:
21:57.000000000 +0200
+++ linux-2.6.23/drivers/video/s3c2410fb.c 2007-08-13 20:46:
18.000000000 +0200
@@ -270,8 +270,8 @@ static int s3c2410fb_check_var(struct fb
var->blue.length = 5;
}
break;
- case 24:
- /* 24 bpp 888 */
+ case 32:
+ /* 24 bpp 888 and 8 dummy */
var->red.length = 8;
var->red.offset = 16;
var->green.length = 8;
@@ -279,8 +279,6 @@ static int s3c2410fb_check_var(struct fb
var->blue.length = 8;
var->blue.offset = 0;
break;
-
-
}
return 0;
}
@@ -379,11 +377,21 @@ static void s3c2410fb_calculate_tft_lcd_
break;
case 8:
regs->lcdcon1 |= S3C2410_LCDCON1_TFT8BPP;
+ regs->lcdcon5 |= S3C2410_LCDCON5_BSWP |
+ S3C2410_LCDCON5_FRM565;
+ regs->lcdcon5 &= ~S3C2410_LCDCON5_HWSWP;
break;
case 16:
regs->lcdcon1 |= S3C2410_LCDCON1_TFT16BPP;
+ regs->lcdcon5 &= ~S3C2410_LCDCON5_BSWP;
+ regs->lcdcon5 |= S3C2410_LCDCON5_HWSWP;
+ break;
+ case 32:
+ regs->lcdcon1 |= S3C2410_LCDCON1_TFT24BPP;
+ regs->lcdcon5 &= ~(S3C2410_LCDCON5_BSWP |
+ S3C2410_LCDCON5_HWSWP |
+ S3C2410_LCDCON5_BPP24BL);
break;
-
default:
/* invalid pixel depth */ dev_err(fbi->dev, "invalid bpp %d\n",
@@ -475,7 +483,9 @@ static int s3c2410fb_set_par(struct fb_i
struct fb_var_screeninfo *var = &info->var;

switch (var->bits_per_pixel) {
+ case 32:
case 16:
+ case 12:
info->fix.visual = FB_VISUAL_TRUECOLOR; break;
case 1:

----------------------------------------------------
Obudź w sobie Wilka Morskiego i weź udział w żeglarskiej
imprezie: regaty NIVEA Błękitne Żagle, Miasteczko Piratów, koncerty. Sopot, molo 18-19 sierpnia!
http://klik.wp.pl/?adr=http%3A%2F%2Fadv.reklama.wp.pl%2Fas%2Fnivea.html&sid=1261

From: Krzysztof Helt <[email protected]>

This patch sets correct bits related to the byte ordering of the framebuffer. This was tested on little endian kernel only. The big endian kernel may require different settings.

The patch also adds 32 bpp mode which is called 24 bpp by Samsung. One pixel takes 32 bits but only 24 bits are used in this mode.

---

This patch requires all s3c2410fb patches sent to this list.

The patch was tested on iPAQ rx1950 (TFT display only). The 1, 2 and 4 bpp modes do not work on little endian kernel (wrong order of pixels in byte).

drivers/video/s3c2410fb.c +15 -5
diff -urp linux-2.6.23.old/drivers/video/s3c2410fb.c linux-2.6.23/drivers/video/s3c2410fb.c
@@ -270,8 +270,8 @@ static int s3c2410fb_check_var(struct fb
 			var->blue.length	= 5;
 		}
 		break;
-	case 24:
-		/* 24 bpp 888 */
+	case 32:
+		/* 24 bpp 888 and 8 dummy */
 		var->red.length		= 8;
 		var->red.offset		= 16;
 		var->green.length	= 8;
@@ -279,8 +279,6 @@ static int s3c2410fb_check_var(struct fb
 		var->blue.length	= 8;
 		var->blue.offset	= 0;
 		break;
-
-
 	}
 	return 0;
 }
@@ -379,11 +377,21 @@ static void s3c2410fb_calculate_tft_lcd_
 		break;
 	case 8:
 		regs->lcdcon1 |= S3C2410_LCDCON1_TFT8BPP;
+		regs->lcdcon5 |= S3C2410_LCDCON5_BSWP |
+				 S3C2410_LCDCON5_FRM565;
+		regs->lcdcon5 &= ~S3C2410_LCDCON5_HWSWP;
 		break;
 	case 16:
 		regs->lcdcon1 |= S3C2410_LCDCON1_TFT16BPP;
+		regs->lcdcon5 &= ~S3C2410_LCDCON5_BSWP;
+		regs->lcdcon5 |= S3C2410_LCDCON5_HWSWP;
+		break;
+	case 32:
+		regs->lcdcon1 |= S3C2410_LCDCON1_TFT24BPP;
+		regs->lcdcon5 &= ~(S3C2410_LCDCON5_BSWP |
+				   S3C2410_LCDCON5_HWSWP |
+				   S3C2410_LCDCON5_BPP24BL);
 		break;
-
 	default:
 		/* invalid pixel depth */
 		dev_err(fbi->dev, "invalid bpp %d\n",
@@ -475,7 +483,9 @@ static int s3c2410fb_set_par(struct fb_i
 	struct fb_var_screeninfo *var = &info->var;
 
 	switch (var->bits_per_pixel) {
+	case 32:
 	case 16:
+	case 12:
 		info->fix.visual = FB_VISUAL_TRUECOLOR;
 		break;
 	case 1:

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/

_______________________________________________
Linux-fbdev-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel

#1 lore raw
Quoted 10 lines · On Tue, 14 Aug 2007 18:26:38 +0200 "Krzysztof Helt" <[email protected]> wrote:

From: Krzysztof Helt <[email protected]>

This patch sets correct bits related to the byte ordering of the framebuffer. This was tested on little endian kernel only. The big endian kernel may require different settings.

The patch also adds 32 bpp mode which is called 24 bpp by Samsung. One pixel takes 32 bits but only 24 bits are used in this mode.

Tony,

This patch didn't make into the -mm tree with other s3c2410fb patches. Please look into it.

Regards,
Krzysztof

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

#2 lore raw
Quoted 14 lines · Krzysztof Helt
Quoted 10 lines · On Tue, 14 Aug 2007 18:26:38 +0200 "Krzysztof Helt" <[email protected]> wrote:

From: Krzysztof Helt <[email protected]>

This patch sets correct bits related to the byte ordering of the framebuffer. This was tested on little endian kernel only. The big endian kernel may require different settings.

The patch also adds 32 bpp mode which is called 24 bpp by Samsung. One pixel takes 32 bits but only 24 bits are used in this mode.

Quoted 4 lines

Tony,

This patch didn't make into the -mm tree with other s3c2410fb patches. Please look into it.

Sorry, I was a bit busy for the last couple of weeks so I wasn't able to send your patches until now.

Anyway, what s3c2410fb patches did not make it to the -mm tree?

Tony

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

#3 lore raw
Quoted 8 lines · On Sat, 15 Sep 2007 08:17:30 +0800 "Antonino A. Daplas" <[email protected]>…
Quoted 4 lines

Tony,

This patch didn't make into the -mm tree with other s3c2410fb patches. Please look into it.

Sorry, I was a bit busy for the last couple of weeks so I wasn't able to send your patches until now.

Not a problem. I understand.

Quoted 2 lines

Anyway, what s3c2410fb patches did not make it to the -mm tree?

Only the one (byte ordering patch):

http://marc.info/?l=linux-fbdev-devel&m=118710882602191&w=2

Regards,
Krzysztof
PS. I can repost if you want.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

#4 lore raw
Quoted 10 lines · Krzysztof Helt
Quoted 2 lines · On Sat, 15 Sep 2007 08:17:30 +0800 "Antonino A. Daplas" <[email protected]>…

Anyway, what s3c2410fb patches did not make it to the -mm tree?

Only the one (byte ordering patch):

http://marc.info/?l=linux-fbdev-devel&m=118710882602191&w=2

Strangely, I did not get this patch. Fortunately, it's still archived by gmail.

Tony

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/