[PATCH]: frame buffer driver for 2700G LCD controller

STALE7408d

12 messages, 4 authors, 2006-07-11 · open the first message on its own page

[PATCH]: frame buffer driver for 2700G LCD controller

From: Mike Rapoport <hidden>
Date: 2006-07-06 14:25:54

This patch adds frame buffer driver for 2700G LCD controller present on CompuLab CM-X270 computer module.
This pacth is versus current Linus git tree.

Signed-off-by: Mike Rapoport <redacted>

-- 
Sincerely yours,
Mike Rapoport

Re: [PATCH]: frame buffer driver for 2700G LCD controller

From: "Antonino A. Daplas" <adaplas@gmail.com>
Date: 2006-07-07 02:19:48

Mike Rapoport wrote:
This patch adds frame buffer driver for 2700G LCD controller present on
CompuLab CM-X270 computer module.
This pacth is versus current Linus git tree.

Signed-off-by: Mike Rapoport <redacted>
+#include <linux/config.h>
config.h is not needed, remove that particular line.
+
+static struct fb_var_screeninfo mbxfb_default = {
__devinitdata or __initdata
+
+static struct fb_fix_screeninfo mbxfb_fix = {
__devinitdata or __initdata
quoted hunk
+	.id =		"MBX",
+	.type =		FB_TYPE_PACKED_PIXELS,
+	.visual =	FB_VISUAL_TRUECOLOR,
+	.xpanstep =	0,
+	.ypanstep =	0,
+	.ywrapstep =	0,
+	.accel =	FB_ACCEL_NONE,
+};
+
+struct pixclock_div {
+	u8 m;
+	u8 n;
+	u8 p;
+};
+
+static unsigned int mbxfb_get_pixclock(unsigned int pixclock_ps, struct pixclock_div *div)
80-column limit
quoted hunk
+{
+	u8  m, n, p;
+	unsigned int err = 0;
+	unsigned int min_err = ~0x0;
+	unsigned int clk;
+	unsigned int best_clk = 0;
+	unsigned int ref_clk = 13000; /* FIXME: take from platform data */
+	unsigned int pixclock;
+
+	/* convert pixclock to KHz */
+	pixclock = PICOS2KHZ(pixclock_ps);
+
+	for ( m = 1; m < 64; m++ ) {
Coding style, no space after "(" and before ")".
quoted hunk
+		for ( n = 1; n < 8; n++ ) {
+			for ( p = 0; p < 8; p++ ) {
+				clk = (ref_clk * m) / (n * (1 << p));
+				err = (clk > pixclock) ? (clk - pixclock) : 
+					(pixclock - clk);
+				if ( err < min_err ) {
+					min_err = err;
+					best_clk = clk;
+					div->m = m;
+					div->n = n;
+					div->p = p;
+				}
+			}
+		}
+	}
+	return KHZ2PICOS(best_clk);
+}
+
+static int
+mbxfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
+		   u_int trans, struct fb_info *info)
Coding style, "static int" and "mbxfb_setcolreg" in one line.
+{
+	uint val, ret = 1;
If you can, avoid u_int and family and just use u32 and family.
quoted hunk
+
+	if ( regno < 255 ) {
+		val = (red & 0xff) << 16;
+		val |= (green & 0xff) << 8;
+		val |= (blue & 0xff) << 0;
+		GPLUT = Gplut_Lutadr(regno) | Gplut_Lutdata(val);
+		udelay(1000);
+		ret = 0;
If you want this to work as a console driver, make sure you also
write 'val' to info->pseudo_palette (for bpp 16 and above) and only
for regno's 0-15.
+		switch ( info->var.bits_per_pixel ) {
+			case 16:
Kernel coding style. the "case" statements must begin at the same column
as the "switch", ie:

		 switch (info->var.bits_per_pixel) {
		 case 16:
			if (info->var.green.length == 5)
				GSCTRL |= GSCTRL_GPIXFMT_ARGB1555;
			else
				GSCTRL |= GSCTRL_GPIXFMT_RGB565;
			break;
quoted hunk
+static void enable_clocks(struct fb_info* fbi)
+{
+	/* enable clocks */
+	SYSCLKSRC = SYSCLKSRC_PLL_2; udelay(1000);
No multiple statements in one line.
quoted hunk
+static int mbxfb_suspend(struct platform_device *dev, pm_message_t state)
+{
+	/* make frame buffer memory enter self-refresh mode */
+	LMPWR = LMPWR_MC_PWR_SRM;
+	while ( LMPWRSTAT != LMPWRSTAT_MC_PWR_SRM );
Linus hates this style, do it like this:

	while (LMPWRSTAT != LMPWRSTAT_MC_PWR_SRM)
	      ; /* empty statement */

quoted hunk
+#include "mbxsysfs.c"
+
+#define res_size(_r) (((_r)->end - (_r)->start) + 1)
No arch-specific function/macro's to determine the resource length?
+
+static int mbxfb_probe(struct platform_device *dev)
__init or __devinit. And that includes other functions that are
called only during init.
+static int mbxfb_remove(struct platform_device *dev)
__exit or __devexit.
quoted hunk
+static struct platform_driver mbxfb_driver = {
+	.probe		= mbxfb_probe,
+	.remove		= mbxfb_remove,
+
+#ifdef CONFIG_PM
Redundant #ifdef, suspend and resume are already defined as NULL if
CONFIG_PM is false.
quoted hunk
+	.suspend	= mbxfb_suspend,
+	.resume		= mbxfb_resume,
+#endif
+	.driver		= {
+		.name	= "mbx-fb",
+	},
+};
+
diff --git a/drivers/video/mbx/mbxsysfs.c b/drivers/video/mbx/mbxsysfs.c
new file mode 100644
index 0000000..4b9571a
--- /dev/null
+++ b/drivers/video/mbx/mbxsysfs.c
@@ -0,0 +1,129 @@
Most of the attributes violate the "one file, one value" rule. GregKH won't
like it. Try using debugfs if you cannot separate them.

Tony

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

Re: [PATCH]: frame buffer driver for 2700G LCD controller

From: Mike Rapoport <hidden>
Date: 2006-07-09 13:40:13

Antonino A. Daplas wrote:
Mike Rapoport wrote:
 
quoted
This patch adds frame buffer driver for 2700G LCD controller present on
CompuLab CM-X270 computer module.
This pacth is versus current Linus git tree.

Signed-off-by: Mike Rapoport <redacted>


   
 
quoted
+
+static int
+mbxfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
+		   u_int trans, struct fb_info *info)
   
Coding style, "static int" and "mbxfb_setcolreg" in one line.

 
I've tried hard to remove all the coding styles mistakes and misprints, but some maybe still in there.
quoted
+{
+	uint val, ret = 1;
   
If you can, avoid u_int and family and just use u32 and family.

 
Done
quoted
+
+	if ( regno < 255 ) {
+		val = (red & 0xff) << 16;
+		val |= (green & 0xff) << 8;
+		val |= (blue & 0xff) << 0;
+		GPLUT = Gplut_Lutadr(regno) | Gplut_Lutdata(val);
+		udelay(1000);
+		ret = 0;
   
If you want this to work as a console driver, make sure you also
write 'val' to info->pseudo_palette (for bpp 16 and above) and only
for regno's 0-15.
 
I've tried to use this driver as console, but all I see is a blank screen. So, at least for now it cannot be used as a console :(
quoted
+#include "mbxsysfs.c"
+
+#define res_size(_r) (((_r)->end - (_r)->start) + 1)
   
No arch-specific function/macro's to determine the resource length?
 
I searched for one but in vain.
quoted
+static struct platform_driver mbxfb_driver = {
+	.probe		= mbxfb_probe,
+	.remove		= mbxfb_remove,
+
+#ifdef CONFIG_PM
   
Redundant #ifdef, suspend and resume are already defined as NULL if
CONFIG_PM is false.

 
quoted
+	},
+};
+
diff --git a/drivers/video/mbx/mbxsysfs.c b/drivers/video/mbx/mbxsysfs.c
new file mode 100644
index 0000000..4b9571a
--- /dev/null
+++ b/drivers/video/mbx/mbxsysfs.c
@@ -0,0 +1,129 @@
   
Most of the attributes violate the "one file, one value" rule. GregKH won't
like it. Try using debugfs if you cannot separate them.

 
Changed to debugfs implementation.
Tony



 

-- 
Sincerely yours,
Mike Rapoport

Re: [PATCH]: frame buffer driver for 2700G LCD controller

From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: 2006-07-09 19:38:40

On Sun, 9 Jul 2006, Mike Rapoport wrote:
Antonino A. Daplas wrote:
quoted
Mike Rapoport wrote:
quoted
+#include "mbxsysfs.c"
+
+#define res_size(_r) (((_r)->end - (_r)->start) + 1)
   
No arch-specific function/macro's to determine the resource length?
 
I searched for one but in vain.
`grep resource_len include/linux/*.h' indeed doesn't show one for generic use,
only for the PCI, Zorro, and DIO busses.

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

Re: [PATCH]: frame buffer driver for 2700G LCD controller

From: "Antonino A. Daplas" <adaplas@gmail.com>
Date: 2006-07-09 23:21:23

Mike Rapoport wrote:
Antonino A. Daplas wrote:
quoted
Mike Rapoport wrote:
 
quoted
This patch adds frame buffer driver for 2700G LCD controller present on
CompuLab CM-X270 computer module.
This pacth is versus current Linus git tree.

Signed-off-by: Mike Rapoport <redacted>


  
 
quoted
+
+static int
+mbxfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
+           u_int trans, struct fb_info *info)
  
Coding style, "static int" and "mbxfb_setcolreg" in one line.

 
I've tried hard to remove all the coding styles mistakes and misprints,
but some maybe still in there.
quoted
quoted
+{
+    uint val, ret = 1;
  
If you can, avoid u_int and family and just use u32 and family.

 
Done
quoted
quoted
+
+    if ( regno < 255 ) {
+        val = (red & 0xff) << 16;
+        val |= (green & 0xff) << 8;
+        val |= (blue & 0xff) << 0;
+        GPLUT = Gplut_Lutadr(regno) | Gplut_Lutdata(val);
+        udelay(1000);
+        ret = 0;
  
If you want this to work as a console driver, make sure you also
write 'val' to info->pseudo_palette (for bpp 16 and above) and only
for regno's 0-15.
 
I've tried to use this driver as console, but all I see is a blank
screen. So, at least for now it cannot be used as a console :(
It's because you don't have an info->pseudo_palette. And if you accidentally
load the framebuffer console, your kernel will just crash because the
drawing functions (cfb_{fillrect,imageblit}) unconditionally refers to that
array.

So you have to do either one:

1. Create a properly filled up info->pseudo_palette; or
2. Do not use the cfb_* functions, and instead write one for your
own. It can be just dummy functions that don't do anything.
quoted
quoted
+#include "mbxsysfs.c"
+
+#define res_size(_r) (((_r)->end - (_r)->start) + 1)
  
No arch-specific function/macro's to determine the resource length?
 
I searched for one but in vain.
Okay, just wondering.
quoted
quoted
+static struct platform_driver mbxfb_driver = {
+    .probe        = mbxfb_probe,
+    .remove        = mbxfb_remove,
+
+#ifdef CONFIG_PM
  
Redundant #ifdef, suspend and resume are already defined as NULL if
CONFIG_PM is false.

 
quoted
+    },
+};
+
diff --git a/drivers/video/mbx/mbxsysfs.c b/drivers/video/mbx/mbxsysfs.c
new file mode 100644
index 0000000..4b9571a
--- /dev/null
+++ b/drivers/video/mbx/mbxsysfs.c
@@ -0,0 +1,129 @@
  
Most of the attributes violate the "one file, one value" rule. GregKH
won't
like it. Try using debugfs if you cannot separate them.

 
Changed to debugfs implementation.
Great :-).
+/* extern unsigned long virt_base_2700; */
+#define __REG_2700G(x)	(*(volatile unsigned long*)((x)+virt_base_2700))
BTW, you will need to use generic accessors (readb|w|l, writeb|w|l or
__raw_readb|w|l, __raw_writeb|w|l, etc). This will entail a lot of changes.
Otherwise, this driver won't get past Andrew Morton and Rusty.

See include/asm/io.h.

Tony



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

Re: [PATCH]: frame buffer driver for 2700G LCD controller

From: Mike Rapoport <hidden>
Date: 2006-07-11 09:09:09

Antonino A. Daplas wrote:
Mike Rapoport wrote:
 
quoted
Antonino A. Daplas wrote:

   
quoted
Mike Rapoport wrote:


     
quoted
This patch adds frame buffer driver for 2700G LCD controller present on
CompuLab CM-X270 computer module.
This pacth is versus current Linus git tree.

Signed-off-by: Mike Rapoport <redacted>


       
+/* extern unsigned long virt_base_2700; */
+#define __REG_2700G(x)	(*(volatile unsigned long*)((x)+virt_base_2700))
   
BTW, you will need to use generic accessors (readb|w|l, writeb|w|l or
__raw_readb|w|l, __raw_writeb|w|l, etc). This will entail a lot of changes.
Otherwise, this driver won't get past Andrew Morton and Rusty.

See include/asm/io.h.
 
What's the better way?
{
    ...
    writel((readl(REG) | bits), REG);
    ...
}

or

{
    ...
    u32 some_reg = readl(REG);
    ...
    some_reg |= bits;
    ...
    writel(some_reg, REG)
    ...
}
Tony




 

-- 
Sincerely yours,
Mike Rapoport



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

Re: [PATCH]: frame buffer driver for 2700G LCD controller

From: "Antonino A. Daplas" <adaplas@gmail.com>
Date: 2006-07-11 09:34:04

Mike Rapoport wrote:
Antonino A. Daplas wrote:
quoted
Mike Rapoport wrote:
 
quoted
Antonino A. Daplas wrote:

  
quoted
Mike Rapoport wrote:


    
quoted
This patch adds frame buffer driver for 2700G LCD controller
present on
CompuLab CM-X270 computer module.
This pacth is versus current Linus git tree.

Signed-off-by: Mike Rapoport <redacted>


      
+/* extern unsigned long virt_base_2700; */
+#define __REG_2700G(x)    (*(volatile unsigned
long*)((x)+virt_base_2700))
  
BTW, you will need to use generic accessors (readb|w|l, writeb|w|l or
__raw_readb|w|l, __raw_writeb|w|l, etc). This will entail a lot of
changes.
Otherwise, this driver won't get past Andrew Morton and Rusty.

See include/asm/io.h.
 
What's the better way?
{
   ...
   writel((readl(REG) | bits), REG);
   ...
}

or

{
   ...
   u32 some_reg = readl(REG);
   ...
   some_reg |= bits;
   ...
   writel(some_reg, REG)
   ...
}
Both are okay, but I prefer the first one for its brevity.


Tony


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

Re: [PATCH]: frame buffer driver for 2700G LCD controller

From: Mike Rapoport <hidden>
Date: 2006-07-11 11:11:32

Antonino A. Daplas wrote:
Mike Rapoport wrote:
 
quoted
Antonino A. Daplas wrote:

   
quoted
Mike Rapoport wrote:


     
quoted
This patch adds frame buffer driver for 2700G LCD controller present on
CompuLab CM-X270 computer module.
This pacth is versus current Linus git tree.

Signed-off-by: Mike Rapoport <redacted>
       
It's because you don't have an info->pseudo_palette. And if you accidentally
load the framebuffer console, your kernel will just crash because the
drawing functions (cfb_{fillrect,imageblit}) unconditionally refers to that
array.

So you have to do either one:

1. Create a properly filled up info->pseudo_palette; or
 
I think I've succeded to make it. At least I can see tux logo and getty output at startup.
BTW, you will need to use generic accessors (readb|w|l, writeb|w|l or
__raw_readb|w|l, __raw_writeb|w|l, etc). This will entail a lot of changes.
Otherwise, this driver won't get past Andrew Morton and Rusty.

See include/asm/io.h.
 
Done.
Tony




 

-- 
Sincerely yours,
Mike Rapoport

Re: [PATCH]: frame buffer driver for 2700G LCD controller

From: "Antonino A. Daplas" <adaplas@gmail.com>
Date: 2006-07-11 12:53:55

Mike Rapoport wrote:
Antonino A. Daplas wrote:
quoted
Mike Rapoport wrote:
 
quoted
Antonino A. Daplas wrote:

  
quoted
Mike Rapoport wrote:


    
quoted
This patch adds frame buffer driver for 2700G LCD controller
present on
CompuLab CM-X270 computer module.
This pacth is versus current Linus git tree.

Signed-off-by: Mike Rapoport <redacted>       
It's because you don't have an info->pseudo_palette. And if you
accidentally
load the framebuffer console, your kernel will just crash because the
drawing functions (cfb_{fillrect,imageblit}) unconditionally refers to
that
array.

So you have to do either one:

1. Create a properly filled up info->pseudo_palette; or
 
I think I've succeded to make it. At least I can see tux logo and getty
output at startup.
quoted
BTW, you will need to use generic accessors (readb|w|l, writeb|w|l or
__raw_readb|w|l, __raw_writeb|w|l, etc). This will entail a lot of
changes.
Otherwise, this driver won't get past Andrew Morton and Rusty.

See include/asm/io.h.
 
Done.
Definitely much, much better. I'm attaching a clean-up patch. If you
approve, I'll send your patch + cleanup upstream.

Tony

mbxfb: Various fixes

From:  <>

- Add more informative help text to Kconfig
- Make DEBUG a Kconfig option as FB_MBX_DEBUG
- Remove #include mbxdebug.c, this is frowned upon
- Remove redundant casts
- Arrange #include's alphabetically
- Trivial whitespace changes

Signed-off-by: Antonino Daplas <redacted>
---

 drivers/video/Kconfig      |   12 +++++++++++-
 drivers/video/mbx/Makefile |    3 ++-
 drivers/video/mbx/mbxfb.c  |   24 +++++++++++-------------
 3 files changed, 24 insertions(+), 15 deletions(-)
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 0f4af08..153e23e 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -1547,8 +1547,18 @@ config FB_MBX
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
 	---help---
+	  Framebuffer driver for the Intel 2700G (Marathon) Graphics
+	  Accelerator
 
-	  If unsure, say N.
+config FB_MBX_DEBUG
+       bool "Enable debugging info via debugfs"
+       depends on FB_MBX && DEBUG_FS
+       default n
+       ---help---
+         Enable this if you want debugging information using the debug
+         filesystem (debugfs)
+
+         If unsure, say N.
 
 config FB_W100
 	tristate "W100 frame buffer support"
diff --git a/drivers/video/mbx/Makefile b/drivers/video/mbx/Makefile
index ad042f5..16c1165 100644
--- a/drivers/video/mbx/Makefile
+++ b/drivers/video/mbx/Makefile
@@ -1,3 +1,4 @@
 # Makefile for the 2700G controller driver.
 
-obj-$(CONFIG_FB_MBX)	+= mbxfb.o
+obj-$(CONFIG_FB_MBX)	   += mbxfb.o
+obj-$(CONFIG_FB_MBX_DEBUG) += mbxfbdebugfs.o
diff --git a/drivers/video/mbx/mbxfb.c b/drivers/video/mbx/mbxfb.c
index 7834586..a5836b5 100644
--- a/drivers/video/mbx/mbxfb.c
+++ b/drivers/video/mbx/mbxfb.c
@@ -14,22 +14,21 @@
  *
  */
 
-#include <linux/module.h>
-#include <linux/fb.h>
 #include <linux/delay.h>
+#include <linux/fb.h>
 #include <linux/init.h>
+#include <linux/module.h>
 #include <linux/platform_device.h>
 
-#include <video/mbxfb.h>
-
 #include <asm/io.h>
 
-#undef DEBUG
+#include <video/mbxfb.h>
 
-static unsigned long virt_base_2700;
 #include "regs.h"
 #include "reg_bits.h"
 
+static unsigned long virt_base_2700;
+
 #define MIN_XRES	16
 #define MIN_YRES	16
 #define MAX_XRES	2048
@@ -59,7 +58,7 @@ struct mbxfb_info {
 	int (*platform_probe) (struct fb_info * fb);
 	int (*platform_remove) (struct fb_info * fb);
 
-#if defined(CONFIG_DEBUG_FS) && defined(DEBUG)
+#ifdef CONFIG_FB_MBX_DEBUG
 	void *debugfs_data;
 #endif
 
@@ -145,7 +144,8 @@ static int mbxfb_setcolreg(u_int regno, 
 	if (regno < MAX_PALETTES) {
 		u32 *pal = info->pseudo_palette;
 
-		val = (red & 0xf800) | ((green & 0xfc00) >> 5) | ((blue & 0xf800) >> 11);
+		val = (red & 0xf800) | ((green & 0xfc00) >> 5) |
+			((blue & 0xf800) >> 11);
 		pal[regno] = val;
 		ret = 0;
 	}
@@ -477,7 +477,7 @@ static int mbxfb_suspend(struct platform
 
 static int mbxfb_resume(struct platform_device *dev)
 {
-	struct fb_info *fbi = (struct fb_info *)platform_get_drvdata(dev);
+	struct fb_info *fbi = platform_get_drvdata(dev);
 
 	enable_clocks(fbi);
 /* 	setup_graphics(fbi); */
@@ -492,9 +492,7 @@ #define mbxfb_resume	NULL
 #endif
 
 /* debugfs entries */
-#if defined(CONFIG_DEBUG_FS) && defined(DEBUG)
-#include "mbxdebugfs.c"
-#else
+#ifndef CONFIG_FB_MBX_DEBUG
 #define mbxfb_debugfs_init(x)	do {} while(0)
 #define mbxfb_debugfs_remove(x)	do {} while(0)
 #endif
@@ -632,7 +630,7 @@ err1:
 
 static int __devexit mbxfb_remove(struct platform_device *dev)
 {
-	struct fb_info *fbi = (struct fb_info *)platform_get_drvdata(dev);
+	struct fb_info *fbi = platform_get_drvdata(dev);
 
 	writel(SYSRST_RST, SYSRST);
 	udelay(1000);


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

Re: [PATCH]: frame buffer driver for 2700G LCD controller

From: Mike Rapoport <hidden>
Date: 2006-07-11 13:14:30

Antonino A. Daplas wrote:
Mike Rapoport wrote:
 
quoted
Antonino A. Daplas wrote:
   
quoted
Mike Rapoport wrote:
     
quoted
Antonino A. Daplas wrote:
       
quoted
Mike Rapoport wrote:
         
quoted
This patch adds frame buffer driver for 2700G LCD controller
present on
CompuLab CM-X270 computer module.
This pacth is versus current Linus git tree.

Signed-off-by: Mike Rapoport <redacted>       
           
Definitely much, much better. I'm attaching a clean-up patch. If you
approve, I'll send your patch + cleanup upstream.

 
It's Ok with me, thanks.
quoted hunk
Tony

mbxfb: Various fixes

From:  <>

- Add more informative help text to Kconfig
- Make DEBUG a Kconfig option as FB_MBX_DEBUG
- Remove #include mbxdebug.c, this is frowned upon
- Remove redundant casts
- Arrange #include's alphabetically
- Trivial whitespace changes

Signed-off-by: Antonino Daplas <redacted>
---

drivers/video/Kconfig      |   12 +++++++++++-
drivers/video/mbx/Makefile |    3 ++-
drivers/video/mbx/mbxfb.c  |   24 +++++++++++-------------
3 files changed, 24 insertions(+), 15 deletions(-)
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 0f4af08..153e23e 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -1547,8 +1547,18 @@ config FB_MBX
	select FB_CFB_COPYAREA
	select FB_CFB_IMAGEBLIT
	---help---
+	  Framebuffer driver for the Intel 2700G (Marathon) Graphics
+	  Accelerator

-	  If unsure, say N.
+config FB_MBX_DEBUG
+       bool "Enable debugging info via debugfs"
+       depends on FB_MBX && DEBUG_FS
+       default n
+       ---help---
+         Enable this if you want debugging information using the debug
+         filesystem (debugfs)
+
+         If unsure, say N.

config FB_W100
	tristate "W100 frame buffer support"
diff --git a/drivers/video/mbx/Makefile b/drivers/video/mbx/Makefile
index ad042f5..16c1165 100644
--- a/drivers/video/mbx/Makefile
+++ b/drivers/video/mbx/Makefile
@@ -1,3 +1,4 @@
# Makefile for the 2700G controller driver.

-obj-$(CONFIG_FB_MBX)	+= mbxfb.o
+obj-$(CONFIG_FB_MBX)	   += mbxfb.o
+obj-$(CONFIG_FB_MBX_DEBUG) += mbxfbdebugfs.o
diff --git a/drivers/video/mbx/mbxfb.c b/drivers/video/mbx/mbxfb.c
index 7834586..a5836b5 100644
--- a/drivers/video/mbx/mbxfb.c
+++ b/drivers/video/mbx/mbxfb.c
@@ -14,22 +14,21 @@
 *
 */

-#include <linux/module.h>
-#include <linux/fb.h>
#include <linux/delay.h>
+#include <linux/fb.h>
#include <linux/init.h>
+#include <linux/module.h>
#include <linux/platform_device.h>

-#include <video/mbxfb.h>
-
#include <asm/io.h>

-#undef DEBUG
+#include <video/mbxfb.h>

-static unsigned long virt_base_2700;
#include "regs.h"
#include "reg_bits.h"

+static unsigned long virt_base_2700;
+
#define MIN_XRES	16
#define MIN_YRES	16
#define MAX_XRES	2048
@@ -59,7 +58,7 @@ struct mbxfb_info {
	int (*platform_probe) (struct fb_info * fb);
	int (*platform_remove) (struct fb_info * fb);

-#if defined(CONFIG_DEBUG_FS) && defined(DEBUG)
+#ifdef CONFIG_FB_MBX_DEBUG
	void *debugfs_data;
#endif
@@ -145,7 +144,8 @@ static int mbxfb_setcolreg(u_int regno, 
	if (regno < MAX_PALETTES) {
		u32 *pal = info->pseudo_palette;

-		val = (red & 0xf800) | ((green & 0xfc00) >> 5) | ((blue & 0xf800) >> 11);
+		val = (red & 0xf800) | ((green & 0xfc00) >> 5) |
+			((blue & 0xf800) >> 11);
		pal[regno] = val;
		ret = 0;
	}
@@ -477,7 +477,7 @@ static int mbxfb_suspend(struct platform
static int mbxfb_resume(struct platform_device *dev)
{
-	struct fb_info *fbi = (struct fb_info *)platform_get_drvdata(dev);
+	struct fb_info *fbi = platform_get_drvdata(dev);

	enable_clocks(fbi);
/* 	setup_graphics(fbi); */
@@ -492,9 +492,7 @@ #define mbxfb_resume	NULL
#endif

/* debugfs entries */
-#if defined(CONFIG_DEBUG_FS) && defined(DEBUG)
-#include "mbxdebugfs.c"
-#else
+#ifndef CONFIG_FB_MBX_DEBUG
#define mbxfb_debugfs_init(x)	do {} while(0)
#define mbxfb_debugfs_remove(x)	do {} while(0)
#endif
@@ -632,7 +630,7 @@ err1:
static int __devexit mbxfb_remove(struct platform_device *dev)
{
-	struct fb_info *fbi = (struct fb_info *)platform_get_drvdata(dev);
+	struct fb_info *fbi = platform_get_drvdata(dev);

	writel(SYSRST_RST, SYSRST);
	udelay(1000);



 

-- 
Sincerely yours,
Mike Rapoport



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

Re: [PATCH]: frame buffer driver for 2700G LCD controller

From: Bernhard Fischer <hidden>
Date: 2006-07-11 13:24:12

Could some kind soul do a recursive s/timming/timing/g in
drivers/video, please? TIA.

A few cosmetic remarks regarding the mbx driver below..

On Tue, Jul 11, 2006 at 02:10:53PM +0200, Mike Rapoport wrote:
quoted hunk
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -1518,6 +1518,16 @@ config FB_PXA_PARAMETERS
	  <file:Documentation/fb/pxafb.txt> describes the available parameters.

+config FB_MBX
+	tristate "2700G LCD framebuffer support"
+	depends on FB && ARCH_PXA
+	select FB_CFB_FILLRECT
+	select FB_CFB_COPYAREA
+	select FB_CFB_IMAGEBLIT
+	---help---
+
A tad more description would be nice:
	  Intel 2700G (Marathon) Graphics Accelerator Frame Buffer
	  Driver
+	  If unsure, say N.
+
config FB_W100
	tristate "W100 frame buffer support"
	depends on FB && PXA_SHARPSL
quoted hunk
diff --git a/drivers/video/mbx/mbxfb.c b/drivers/video/mbx/mbxfb.c
new file mode 100644
index 0000000..c41a678
--- /dev/null
+++ b/drivers/video/mbx/mbxfb.c
quoted hunk
+#define MAX_PALETTES	16
+
+/* FIXME: take care of different chip reivsions with different sizes
s/reivsions/revisions/
quoted hunk
+#ifdef CONFIG_PM
+/*
+ * Power management hooks.  Note that we won't be called from IRQ context,
+ * unlike the blank functions above, so we may sleep.
+ */
+static int mbxfb_suspend(struct platform_device *dev, pm_message_t state)
+{
+	/* make frame buffer memory enter self-refresh mode */
+	writel(LMPWR_MC_PWR_SRM, LMPWR);
+	while (LMPWRSTAT != LMPWRSTAT_MC_PWR_SRM)
+		; /* empty statement */
+
+	/* reset the device, since it's initial state is 'mostly sleeping' */
+	writel(SYSRST_RST, SYSRST);
+	return 0;
+}
+
+static int mbxfb_resume(struct platform_device *dev)
+{
+	struct fb_info *fbi = (struct fb_info *)platform_get_drvdata(dev);
+
+	enable_clocks(fbi);
+/* 	setup_graphics(fbi); */
+/* 	setup_display(fbi); */
+
+	writel((readl(DSCTRL) | DSCTRL_SYNCGEN_EN), DSCTRL);
+	return 0;
+}
IIRC it was already stated that it is better to only set the .suspend
and .resume ops depending on CONFIG_PM (see below instead of the #if
#else #endif stanza here).
quoted hunk
+#else
+#define mbxfb_suspend	NULL
+#define mbxfb_resume	NULL
+#endif
quoted hunk
+static struct platform_driver mbxfb_driver = {
+	.probe = mbxfb_probe,
+	.remove = mbxfb_remove,
#ifdef CONFIG_PM
+	.suspend = mbxfb_suspend,
+	.resume = mbxfb_resume,
#endif /* CONFIG_PM */
quoted hunk
+	.driver = {
+		.name = "mbx-fb",
+	},
+};
cheers,


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

Re: [PATCH]: frame buffer driver for 2700G LCD controller

From: "Antonino A. Daplas" <adaplas@gmail.com>
Date: 2006-07-11 13:46:55

Bernhard Fischer wrote:
Could some kind soul do a recursive s/timming/timing/g in
drivers/video, please? TIA.
IIRC it was already stated that it is better to only set the .suspend
and .resume ops depending on CONFIG_PM (see below instead of the #if
#else #endif stanza here).
quoted
+#else
+#define mbxfb_suspend	NULL
+#define mbxfb_resume	NULL
+#endif
No, this is preferred. If possible, we want to avoid ifdef's within
functions or structures.

Tony



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help