Skip to contentSkip to conversation

Add framebuffer support for the AMD Geode LX

GEODE Jordan Crouse 3 participants 3 messages Jul 9, 2007 – Jul 11, 2007 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

I sent this out a few weeks ago, but I didn't hear anything back - so I'll give it another shot now that .22 is in the can. This is a basic driver adding support for the AMD Geode LX framebuffer. More advanced features, such as acceleration and power management will come along later after they have had a chance to soak a little bit more in the OLPC tree.

Jordan

GEODE: Add framebuffer support for the AMD Geode LX

From: Jordan Crouse <[email protected]>

Add framebuffer support for the AMD Geode LX graphics engine.

---

 drivers/video/geode/Kconfig     |   15 +
 drivers/video/geode/Makefile    |    2 
 drivers/video/geode/lxfb.h      |  199 ++++++++++++
 drivers/video/geode/lxfb_core.c |  621 +++++++++++++++++++++++++++++++++++++++
 drivers/video/geode/lxfb_ops.c  |  536 ++++++++++++++++++++++++++++++++++
 5 files changed, 1373 insertions(+), 0 deletions(-)
drivers/video/geode/Kconfig +15 -0
index a814b6c..c45181e 100644
@@ -8,6 +8,21 @@ config FB_GEODE
 	  Say 'Y' here to allow you to select framebuffer drivers for
 	  the AMD Geode family of processors.
 
+config FB_GEODE_LX
+	tristate "AMD Geode LX framebuffer support (EXPERIMENTAL)"
+	depends on FB && FB_GEODE 
+	select FB_CFB_FILLRECT
+	select FB_CFB_COPYAREA
+	select FB_CFB_IMAGEBLIT
+	---help---
+	  Framebuffer driver for the display controller integrated into the
+	  AMD Geode LX processors.
+
+	  To compile this driver as a module, choose M here: the module will
+	  be called lxfb.
+
+	  If unsure, say N.
+
 config FB_GEODE_GX
 	tristate "AMD Geode GX framebuffer support (EXPERIMENTAL)"
 	depends on FB && FB_GEODE && EXPERIMENTAL
drivers/video/geode/Makefile +2 -0
index f896565..957304b 100644
@@ -2,6 +2,8 @@
 
 obj-$(CONFIG_FB_GEODE_GX1) += gx1fb.o
 obj-$(CONFIG_FB_GEODE_GX)  += gxfb.o
+obj-$(CONFIG_FB_GEODE_LX)  += lxfb.o
 
 gx1fb-objs := gx1fb_core.o display_gx1.o video_cs5530.o
 gxfb-objs  := gxfb_core.o display_gx.o video_gx.o
+lxfb-objs  := lxfb_core.o lxfb_ops.o
drivers/video/geode/lxfb.h new file +199 -0

199 lines not on this page · raw message

drivers/video/geode/lxfb_core.c new file +621 -0

621 lines not on this page · raw message

drivers/video/geode/lxfb_ops.c new file +536 -0

536 lines not on this page · raw message

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

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

#1 lore raw

drivers/video/geode/lxfb_core.c line 46

Quoted 10 lines · Jordan Crouse
drivers/video/geode/lxfb_core.c new file +10 -0
+const struct fb_videomode geode_modedb[] __initdata = {
+	/* 640x480-60 */
+	{ NULL, 60, 640, 480, 39682, 48, 8, 25, 2, 88, 2,
+	  FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+	  FB_VMODE_NONINTERLACED, 0 },
+	/* 640x400-70 */
+	{ NULL, 70, 640, 400, 39770, 40, 8, 28, 5, 96, 2,
+	  FB_SYNC_HOR_HIGH_ACT,
+	  FB_VMODE_NONINTERLACED, 0 },
+	/* 640x480-70 */

This looks like standard timings, is there any reason why not use modes from modedb.c?

Quoted 9 lines
drivers/video/geode/lxfb_core.c new file +9 -0
+static int lxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
+{
+	if (var->xres > 1920 || var->yres > 1440)
+		return -EINVAL;
+
+	if (var->bits_per_pixel == 32) {
+		var->red.offset   = 16; var->red.length   = 8;
+		var->green.offset =  8; var->green.length = 8;
+		var->blue.offset  =  0; var->blue.length  = 8;

drivers/video/geode/lxfb_core.c line 236

Quoted 10 lines
drivers/video/geode/lxfb_core.c new file +10 -0
+	} else if (var->bits_per_pixel == 16) {
+		var->red.offset   = 11; var->red.length   = 5;
+		var->green.offset =  5; var->green.length = 6;
+		var->blue.offset  =  0; var->blue.length  = 5;
+	} else if (var->bits_per_pixel == 8) {
+		var->red.offset   = 0; var->red.length   = 8;
+		var->green.offset = 0; var->green.length = 8;
+		var->blue.offset  = 0; var->blue.length  = 8;
+	} else
+		return -EINVAL;

Clear var->{color}.msb_right ?

If don't support panning, it should ensure that
xres_virtual == xres and yres_virtual == yres

Quoted 11 lines
drivers/video/geode/lxfb_core.c new file +11 -0
+static int __init lxfb_map_video_memory(struct fb_info *info,
+					struct pci_dev *dev)
+{
+	struct lxfb_par *par = info->par;
+	int ret;
+
+	ret = pci_enable_device(dev);
+
+	if (ret)
+		return ret;
+

drivers/video/geode/lxfb_core.c line 330

Quoted 10 lines
drivers/video/geode/lxfb_core.c new file +10 -0
+	ret = pci_request_region(dev, 0, "lxfb-framebuffer");
+
+	if (ret)
+		return ret;
+
+	ret = pci_request_region(dev, 1, "lxfb-gp");
+
+	if (ret)
+		return ret;
+

...

Free allocated regions in a case of a error?

drivers/video/geode/lxfb_core.c line 352

Quoted 8 lines
drivers/video/geode/lxfb_core.c new file +8 -0
+
+	ret = -ENOMEM;
+
+	if (info->screen_base == NULL)
+		return ret;
+
+	par->gp_regs = ioremap(pci_resource_start(dev, 1),
+				pci_resource_len(dev, 1));

pci_iomap(dev, 1, 0) ?

drivers/video/geode/lxfb_core.c line 401

Quoted 8 lines
drivers/video/geode/lxfb_core.c new file +8 -0
+static struct fb_info * __init lxfb_init_fbinfo(struct device *dev)
+{
+	struct lxfb_par *par;
+	struct fb_info *info;
+
+	/* Alloc enough space for the pseudo palette. */
+	info = framebuffer_alloc(sizeof(struct lxfb_par) + sizeof(u32) * 16,
+				 dev);

What about adding u32 pseudo_palette[16] at the end of struct lxfb_par instead of that trick?

drivers/video/geode/lxfb_core.c line 618

Quoted 5 lines
drivers/video/geode/lxfb_core.c new file +5 -0
+module_param(mode_option, charp, 0);
+MODULE_PARM_DESC(mode_option, "video mode (<x>x<y>[-<bpp>][@<refr>])");
+
+module_param(fbsize, int, 0);
+MODULE_PARM_DESC(fbsize, "video memory size");

What about adding module params for noclear, nopanel and nocrt ?

drivers/video/geode/lxfb_ops.c line 140

Quoted 6 lines
drivers/video/geode/lxfb_ops.c new file +6 -0
+static void lx_set_clock(struct fb_info *info)
+{
+	unsigned int diff, min, best = 0;
+	unsigned int freq, i;
+
+	freq = (unsigned int) (0x3b9aca00 / info->var.pixclock);

Here using 0x3b9aca00 instead of 1000000000 is obscuring.

Signature · 5 lines
Elen sila lumenn' omentielvo

Ondrej 'SanTiago' Zajicek (email: [email protected], jabber: [email protected])
OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
"To err is human -- to blame it on a computer is even more so."

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

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

#2 lore raw
Quoted 5 lines · Ondrej Zajicek

On Mon, Jul 09, 2007 at 11:32:11AM -0600, Jordan Crouse wrote:

If don't support panning, it should ensure that
xres_virtual == xres and yres_virtual == yres

There is no rule for this, but the above suggestion is preferred.

Tony

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/