Skip to contentSkip to conversation

: frame buffer driver for 2700G LCD controller

PATCH In review Mike Rapoport 4 participants 12 messages Jul 6, 2006 – Jul 11, 2006 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : frame buffer driver for 2700G LCD controller

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.

Signature · 2 lines
Sincerely yours,
Mike Rapoport
 drivers/video/Kconfig        |   10 +
 drivers/video/Makefile       |    1 
 drivers/video/mbx/Makefile   |    3 
 drivers/video/mbx/mbxfb.c    |  646 ++++++++++++++++++++++++++++++++++++++++++
 drivers/video/mbx/mbxsysfs.c |  129 ++++++++
 drivers/video/mbx/reg_bits.h |  489 ++++++++++++++++++++++++++++++++
 drivers/video/mbx/regs.h     |  192 ++++++++++++
 include/linux/mbxfb.h        |   28 ++
 8 files changed, 1498 insertions(+), 0 deletions(-)
drivers/video/Kconfig +10 -0
index 17de4c8..3f472d4 100644
@@ -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---
+
+	  If unsure, say N.
+
 config FB_W100
 	tristate "W100 frame buffer support"
 	depends on FB && PXA_SHARPSL
drivers/video/Makefile +1 -0
index c335e9b..eabb5be 100644
@@ -38,6 +38,7 @@ obj-$(CONFIG_FB_SIS)		  += sis/
 obj-$(CONFIG_FB_KYRO)             += kyro/
 obj-$(CONFIG_FB_SAVAGE)		  += savage/
 obj-$(CONFIG_FB_GEODE)		  += geode/
+obj-$(CONFIG_FB_MBX)		  += mbx/
 obj-$(CONFIG_FB_I810)             += vgastate.o
 obj-$(CONFIG_FB_NEOMAGIC)         += neofb.o vgastate.o
 obj-$(CONFIG_FB_VIRGE)            += virgefb.o
drivers/video/mbx/Makefile new file +3 -0
new file mode 100644
index 0000000..ad042f5
@@ -0,0 +1,3 @@
+# Makefile for the 2700G controller driver.
+
+obj-$(CONFIG_FB_MBX)	+= mbxfb.o
drivers/video/mbx/mbxfb.c new file +646 -0

646 lines not on this page · raw message

drivers/video/mbx/mbxsysfs.c new file +129 -0

129 lines not on this page · raw message

drivers/video/mbx/reg_bits.h new file +489 -0

489 lines not on this page · raw message

drivers/video/mbx/regs.h new file +192 -0

192 lines not on this page · raw message

include/linux/mbxfb.h new file +28 -0
new file mode 100644
index 0000000..3bde0f5
@@ -0,0 +1,28 @@
+#ifndef __MBX_FB_H
+#define __MBX_FB_H
+
+struct mbxfb_val {
+	unsigned int	defval;
+	unsigned int	min;
+	unsigned int	max;
+};
+
+struct fb_info;
+
+struct mbxfb_platform_data {
+		/* Screen info */
+		struct mbxfb_val xres;
+		struct mbxfb_val yres;
+		struct mbxfb_val bpp;
+
+		/* Memory info */
+		unsigned long memsize; /* if 0 use ODFB? */
+		unsigned long timings1;
+		unsigned long timings2;
+		unsigned long timings3;
+
+		int (*probe)(struct fb_info *fb);
+		int (*remove)(struct fb_info *fb);
+};
+
+#endif /* __MBX_FB_H */

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

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

#1 lore raw
Quoted 9 lines · Mike Rapoport

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.

+#include <linux/config.h>

config.h is not needed, remove that particular line.

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+static struct fb_var_screeninfo mbxfb_default = {

__devinitdata or __initdata

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+static struct fb_fix_screeninfo mbxfb_fix = {

__devinitdata or __initdata

Quoted 6 lines
drivers/video/mbx/mbxfb.c new file +6 -0
+	.id =		"MBX",
+	.type =		FB_TYPE_PACKED_PIXELS,
+	.visual =	FB_VISUAL_TRUECOLOR,
+	.xpanstep =	0,
+	.ypanstep =	0,
+	.ywrapstep =	0,

drivers/video/mbx/mbxfb.c line 108

Quoted 10 lines
drivers/video/mbx/mbxfb.c new file +10 -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

drivers/video/mbx/mbxfb.c line 121

Quoted 13 lines
drivers/video/mbx/mbxfb.c new file +13 -0
+{
+	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 11 lines
drivers/video/mbx/mbxfb.c new file +11 -0
+		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;

drivers/video/mbx/mbxfb.c line 142

Quoted 10 lines
drivers/video/mbx/mbxfb.c new file +10 -0
+				}
+			}
+		}
+	}
+	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.

Review

Quoted 2 lines
(quoted diff) +2 -0
+{
+	uint val, ret = 1;

If you can, avoid u_int and family and just use u32 and family.

drivers/video/mbx/mbxfb.c line 152

Quoted 8 lines
drivers/video/mbx/mbxfb.c new file +8 -0
+
+	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.

drivers/video/mbx/mbxfb.c line 234

Quoted 2 lines
drivers/video/mbx/mbxfb.c new file +2 -0
+		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;

drivers/video/mbx/mbxfb.c line 362

Quoted 4 lines
drivers/video/mbx/mbxfb.c new file +4 -0
+static void enable_clocks(struct fb_info* fbi)
+{
+	/* enable clocks */
+	SYSCLKSRC = SYSCLKSRC_PLL_2; udelay(1000);

No multiple statements in one line.

drivers/video/mbx/mbxfb.c line 436

Quoted 5 lines
drivers/video/mbx/mbxfb.c new file +5 -0
+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 */

drivers/video/mbx/mbxfb.c line 461

Quoted 3 lines
drivers/video/mbx/mbxfb.c new file +3 -0
+#include "mbxsysfs.c"
+
+#define res_size(_r) (((_r)->end - (_r)->start) + 1)

No arch-specific function/macro's to determine the resource length?

drivers/video/mbx/mbxfb.c line 463

Quoted 2 lines
drivers/video/mbx/mbxfb.c new file +2 -0
+
+static int mbxfb_probe(struct platform_device *dev)

__init or __devinit. And that includes other functions that are called only during init.

Quoted 1 line

+static int mbxfb_remove(struct platform_device *dev)

__exit or __devexit.

drivers/video/mbx/mbxfb.c line 622

Quoted 5 lines
drivers/video/mbx/mbxfb.c new file +5 -0
+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.

drivers/video/mbx/mbxsysfs.c

Quoted 14 lines
drivers/video/mbx/mbxfb.c new file +8 -0
+	.suspend	= mbxfb_suspend,
+	.resume		= mbxfb_resume,
+#endif
+	.driver		= {
+		.name	= "mbx-fb",
+	},
+};
+
drivers/video/mbx/mbxsysfs.c new file +0 -0
new file mode 100644
index 0000000..4b9571a
@@ -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

#2 lore raw
Quoted 15 lines · Antonino A. Daplas
Quoted 9 lines · Mike Rapoport

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.

Quoted 11 lines

Review

Quoted 6 lines
(quoted diff) +4 -0
+
+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 9 lines

Review

Quoted 4 lines
(quoted diff) +2 -0
+{
+	uint val, ret = 1;

If you can, avoid u_int and family and just use u32 and family.

Done

Quoted 6 lines
Quoted 6 lines
(quoted diff) +6 -0
+
+	if ( regno < 255 ) {
+		val = (red & 0xff) << 16;
+		val |= (green & 0xff) << 8;
+		val |= (blue & 0xff) << 0;
+		GPLUT = Gplut_Lutadr(regno) | Gplut_Lutdata(val);
Quoted 11 lines

Review

Quoted 4 lines
(quoted diff) +2 -0
+		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 9 lines

Review

Quoted 5 lines
(quoted diff) +3 -0
+#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 13 lines

Review

Quoted 7 lines
(quoted diff) +5 -0
+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 17 lines

drivers/video/mbx/mbxsysfs.c

Quoted 11 lines
(quoted diff) +3 -0
+	},
+};
+
drivers/video/mbx/mbxsysfs.c new file +0 -0
new file mode 100644
index 0000000..4b9571a
@@ -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.

Quoted 6 lines

Tony

Signature · 2 lines
Sincerely yours,
Mike Rapoport
 drivers/video/Kconfig          |   10 +
 drivers/video/Makefile         |    1 
 drivers/video/mbx/Makefile     |    3 
 drivers/video/mbx/mbxdebugfs.c |  188 +++++++++++
 drivers/video/mbx/mbxfb.c      |  680 ++++++++++++++++++++++++++++++++++++++++
 drivers/video/mbx/reg_bits.h   |  418 +++++++++++++++++++++++++
 drivers/video/mbx/regs.h       |  192 +++++++++++
 include/video/mbxfb.h          |   28 ++
 8 files changed, 1520 insertions(+), 0 deletions(-)
drivers/video/Kconfig +10 -0
index 17de4c8..3f472d4 100644
@@ -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---
+
+	  If unsure, say N.
+
 config FB_W100
 	tristate "W100 frame buffer support"
 	depends on FB && PXA_SHARPSL
drivers/video/Makefile +1 -0
index c335e9b..eabb5be 100644
@@ -38,6 +38,7 @@ obj-$(CONFIG_FB_SIS)		  += sis/
 obj-$(CONFIG_FB_KYRO)             += kyro/
 obj-$(CONFIG_FB_SAVAGE)		  += savage/
 obj-$(CONFIG_FB_GEODE)		  += geode/
+obj-$(CONFIG_FB_MBX)		  += mbx/
 obj-$(CONFIG_FB_I810)             += vgastate.o
 obj-$(CONFIG_FB_NEOMAGIC)         += neofb.o vgastate.o
 obj-$(CONFIG_FB_VIRGE)            += virgefb.o
drivers/video/mbx/Makefile new file +3 -0
new file mode 100644
index 0000000..ad042f5
@@ -0,0 +1,3 @@
+# Makefile for the 2700G controller driver.
+
+obj-$(CONFIG_FB_MBX)	+= mbxfb.o
drivers/video/mbx/mbxdebugfs.c new file +188 -0

188 lines not on this page · raw message

drivers/video/mbx/mbxfb.c new file +680 -0

680 lines not on this page · raw message

drivers/video/mbx/reg_bits.h new file +418 -0

418 lines not on this page · raw message

drivers/video/mbx/regs.h new file +192 -0

192 lines not on this page · raw message

include/video/mbxfb.h new file +28 -0
new file mode 100644
index 0000000..3bde0f5
@@ -0,0 +1,28 @@
+#ifndef __MBX_FB_H
+#define __MBX_FB_H
+
+struct mbxfb_val {
+	unsigned int	defval;
+	unsigned int	min;
+	unsigned int	max;
+};
+
+struct fb_info;
+
+struct mbxfb_platform_data {
+		/* Screen info */
+		struct mbxfb_val xres;
+		struct mbxfb_val yres;
+		struct mbxfb_val bpp;
+
+		/* Memory info */
+		unsigned long memsize; /* if 0 use ODFB? */
+		unsigned long timings1;
+		unsigned long timings2;
+		unsigned long timings3;
+
+		int (*probe)(struct fb_info *fb);
+		int (*remove)(struct fb_info *fb);
+};
+
+#endif /* __MBX_FB_H */

-------------------------------------------------------------------------
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

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

#3 lore raw
Quoted 10 lines · Mike Rapoport
Quoted 8 lines · Antonino A. Daplas

drivers/video/mbx/mbxfb.c line 499

Quoted 4 lines · Mike Rapoport
drivers/video/mbx/mbxfb.c new file +3 -0
+#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 -- [email protected]

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

#4 lore raw
In reply to Mike Rapoport
Quoted 49 lines · Mike Rapoport
Quoted 14 lines · Antonino A. Daplas
Quoted 8 lines · Mike Rapoport

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.

Quoted 10 lines

drivers/video/mbx/mbxfb.c line 139

Quoted 5 lines
drivers/video/mbx/mbxfb.c new file +4 -0
+
+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 8 lines

Review

Quoted 3 lines
(quoted diff) +2 -0
+{
+    uint val, ret = 1;

If you can, avoid u_int and family and just use u32 and family.

Done

Quoted 10 lines
Quoted 9 lines
drivers/video/mbx/mbxfb.c new file +8 -0
+
+    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;
Quoted 8 lines
Quoted 6 lines

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 10 lines
Quoted 9 lines

drivers/video/mbx/mbxfb.c line 499

Quoted 5 lines
drivers/video/mbx/mbxfb.c new file +3 -0
+#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 30 lines
Quoted 13 lines

drivers/video/mbx/mbxfb.c

Quoted 7 lines
drivers/video/mbx/mbxfb.c new file +5 -0
+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 17 lines

drivers/video/mbx/mbxsysfs.c

Quoted 10 lines
drivers/video/mbx/mbxfb.c new file +3 -0
+    },
+};
+
drivers/video/mbx/mbxsysfs.c new file +0 -0
new file mode 100644
index 0000000..4b9571a
@@ -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.

Quoted 1 line

Changed to debugfs implementation.

Great :-).

drivers/video/mbx/regs.h line 5

Quoted 2 lines
drivers/video/mbx/regs.h new file +2 -0
+/* 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

#5 lore raw
Quoted 30 lines · Antonino A. Daplas
Quoted 20 lines · Mike Rapoport
Quoted 14 lines · Antonino A. Daplas
Quoted 9 lines · Mike Rapoport

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.

drivers/video/mbx/regs.h line 5

Quoted 2 lines
drivers/video/mbx/regs.h new file +2 -0
+/* 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.

Quoted 3 lines

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)
    ...
}
Quoted 7 lines

Tony

Signature · 10 lines
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
#6 lore raw
Quoted 43 lines · Mike Rapoport
Quoted 29 lines · Antonino A. Daplas
Quoted 18 lines · Mike Rapoport
Quoted 13 lines · Antonino A. Daplas
Quoted 9 lines · Mike Rapoport

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.

(quoted diff) +2 -0
+/* extern unsigned long virt_base_2700; */
+#define __REG_2700G(x)    (*(volatile unsigned
Quoted 2 lines

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.

Quoted 3 lines

See include/asm/io.h.

What's the better way?

{
   ...
   writel((readl(REG) | bits), REG);
   ...
}

or

Quoted 9 lines
{
   ...
   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

#7 lore raw
In reply to Antonino A. Daplas
Quoted 19 lines · Antonino A. Daplas
Quoted 9 lines · Mike Rapoport
Quoted 5 lines · Antonino A. Daplas

Mike Rapoport wrote:

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

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.

Quoted 10 lines

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 7 lines

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.

Quoted 7 lines

Tony

Signature · 2 lines
Sincerely yours,
Mike Rapoport
 drivers/video/Kconfig          |   10 +
 drivers/video/Makefile         |    1 
 drivers/video/mbx/Makefile     |    3 
 drivers/video/mbx/mbxdebugfs.c |  188 +++++++++++
 drivers/video/mbx/mbxfb.c      |  693 ++++++++++++++++++++++++++++++++++++++++
 drivers/video/mbx/reg_bits.h   |  418 ++++++++++++++++++++++++
 drivers/video/mbx/regs.h       |  195 +++++++++++
 include/video/mbxfb.h          |   28 ++
 8 files changed, 1536 insertions(+), 0 deletions(-)
drivers/video/Kconfig +10 -0
index 17de4c8..3f472d4 100644
@@ -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---
+
+	  If unsure, say N.
+
 config FB_W100
 	tristate "W100 frame buffer support"
 	depends on FB && PXA_SHARPSL
drivers/video/Makefile +1 -0
index c335e9b..eabb5be 100644
@@ -38,6 +38,7 @@ obj-$(CONFIG_FB_SIS)		  += sis/
 obj-$(CONFIG_FB_KYRO)             += kyro/
 obj-$(CONFIG_FB_SAVAGE)		  += savage/
 obj-$(CONFIG_FB_GEODE)		  += geode/
+obj-$(CONFIG_FB_MBX)		  += mbx/
 obj-$(CONFIG_FB_I810)             += vgastate.o
 obj-$(CONFIG_FB_NEOMAGIC)         += neofb.o vgastate.o
 obj-$(CONFIG_FB_VIRGE)            += virgefb.o
drivers/video/mbx/Makefile new file +3 -0
new file mode 100644
index 0000000..ad042f5
@@ -0,0 +1,3 @@
+# Makefile for the 2700G controller driver.
+
+obj-$(CONFIG_FB_MBX)	+= mbxfb.o
drivers/video/mbx/mbxdebugfs.c new file +188 -0

188 lines not on this page · raw message

drivers/video/mbx/mbxfb.c new file +693 -0

693 lines not on this page · raw message

drivers/video/mbx/reg_bits.h new file +418 -0

418 lines not on this page · raw message

drivers/video/mbx/regs.h new file +195 -0

195 lines not on this page · raw message

include/video/mbxfb.h new file +28 -0
new file mode 100644
index 0000000..3bde0f5
@@ -0,0 +1,28 @@
+#ifndef __MBX_FB_H
+#define __MBX_FB_H
+
+struct mbxfb_val {
+	unsigned int	defval;
+	unsigned int	min;
+	unsigned int	max;
+};
+
+struct fb_info;
+
+struct mbxfb_platform_data {
+		/* Screen info */
+		struct mbxfb_val xres;
+		struct mbxfb_val yres;
+		struct mbxfb_val bpp;
+
+		/* Memory info */
+		unsigned long memsize; /* if 0 use ODFB? */
+		unsigned long timings1;
+		unsigned long timings2;
+		unsigned long timings3;
+
+		int (*probe)(struct fb_info *fb);
+		int (*remove)(struct fb_info *fb);
+};
+
+#endif /* __MBX_FB_H */

-------------------------------------------------------------------------
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

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

#8 lore raw
Quoted 38 lines · Mike Rapoport
Quoted 23 lines · Antonino A. Daplas
Quoted 7 lines · Mike Rapoport
Quoted 4 lines · Antonino A. Daplas

Mike Rapoport wrote:

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

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.

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.

Quoted 5 lines

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 5 lines

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.

Quoted 4 lines
Quoted 3 lines

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

---

 drivers/video/Kconfig      |   12 +++++++++++-
 drivers/video/mbx/Makefile |    3 ++-
 drivers/video/mbx/mbxfb.c  |   24 +++++++++++-------------
 3 files changed, 24 insertions(+), 15 deletions(-)
drivers/video/Kconfig +11 -1
index 0f4af08..153e23e 100644
@@ -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"
drivers/video/mbx/Makefile +2 -1
index ad042f5..16c1165 100644
@@ -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
drivers/video/mbx/mbxfb.c +11 -13
index 7834586..a5836b5 100644
@@ -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

#9 lore raw
Quoted 20 lines · Antonino A. Daplas
Quoted 17 lines · Mike Rapoport
Quoted 14 lines · Antonino A. Daplas
Quoted 11 lines · Mike Rapoport
Quoted 8 lines · Antonino A. Daplas
Quoted 5 lines · Mike Rapoport

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.

Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

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 140 lines

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

---

drivers/video/Kconfig      |   12 +++++++++++-
drivers/video/mbx/Makefile |    3 ++-
drivers/video/mbx/mbxfb.c  |   24 +++++++++++-------------
3 files changed, 24 insertions(+), 15 deletions(-)
drivers/video/Kconfig +11 -1
index 0f4af08..153e23e 100644
@@ -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"

drivers/video/mbx/Makefile +2 -1
index ad042f5..16c1165 100644
@@ -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
drivers/video/mbx/mbxfb.c +11 -13
index 7834586..a5836b5 100644
@@ -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);
Signature · 10 lines
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
#10 lore raw
In reply to Mike Rapoport

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..

Quoted 4 lines · Mike Rapoport
drivers/video/Kconfig +0 -0
@@ -1518,6 +1518,16 @@ config FB_PXA_PARAMETERS
 

drivers/video/Kconfig config FB_PXA_PARAMETERS · line 1528

Quoted 10 lines
drivers/video/Kconfig +8 -0
 	  <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

Quoted 11 lines
drivers/video/Kconfig +2 -0
+	  If unsure, say N.
+

config FB_W100

	tristate "W100 frame buffer support"
	depends on FB && PXA_SHARPSL
drivers/video/mbx/mbxfb.c new file +0 -0
new file mode 100644
index 0000000..c41a678

drivers/video/mbx/mbxfb.c line 40

Quoted 4 lines
drivers/video/mbx/mbxfb.c new file +3 -0
 
+#define MAX_PALETTES	16
+
+/* FIXME: take care of different chip reivsions with different sizes

s/reivsions/revisions/

Quoted 18 lines
drivers/video/mbx/mbxfb.c new file +18 -0
+#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)

drivers/video/mbx/mbxfb.c line 488

Quoted 10 lines
drivers/video/mbx/mbxfb.c new file +10 -0
+{
+	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).

drivers/video/mbx/mbxfb.c

Quoted 8 lines
drivers/video/mbx/mbxfb.c new file +7 -0
+#else
+#define mbxfb_suspend	NULL
+#define mbxfb_resume	NULL
+#endif
 
+static struct platform_driver mbxfb_driver = {
+	.probe = mbxfb_probe,
+	.remove = mbxfb_remove,

#ifdef CONFIG_PM

drivers/video/mbx/mbxfb.c line 672

Quoted 2 lines
drivers/video/mbx/mbxfb.c new file +2 -0
+	.suspend = mbxfb_suspend,
+	.resume = mbxfb_resume,

#endif /* CONFIG_PM */

drivers/video/mbx/mbxfb.c line 676

Quoted 4 lines
drivers/video/mbx/mbxfb.c new file +4 -0
+	.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

#11 lore raw
Quoted 5 lines · Bernhard Fischer

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

Quoted 8 lines

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).

drivers/video/mbx/mbxfb.c line 492

Quoted 4 lines
drivers/video/mbx/mbxfb.c new file +4 -0
+#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