* Geode now shows up in sysfs.
@ 2005-07-01 23:37 James Simmons
2005-07-04 10:09 ` David Vrabel
0 siblings, 1 reply; 6+ messages in thread
From: James Simmons @ 2005-07-01 23:37 UTC (permalink / raw)
To: Linux Fbdev development list
Cc: Antonino A. Daplas, Geert Uytterhoeven, nat.ersoz
Going through the drivers I noticed two drivers using framebuffer_alloc
without a sturct device, Mach64 for atari and geode. Here is a patch for
geode. The mach64 will take a bit longer to figure. Please test. Thank
you.
diff -urN -X /home/jsimmons/dontdiff linus-2.6/drivers/video/geode/gx1fb_core.c fbdev-2.6/drivers/video/geode/gx1fb_core.c
--- linus-2.6/drivers/video/geode/gx1fb_core.c 2005-05-10 08:39:33.000000000 -0700
+++ fbdev-2.6/drivers/video/geode/gx1fb_core.c 2005-07-01 09:18:25.000000000 -0700
@@ -216,13 +216,13 @@
.fb_cursor = soft_cursor,
};
-static struct fb_info * __init gx1fb_init_fbinfo(void)
+static struct fb_info * __init gx1fb_init_fbinfo(struct device *dev)
{
- struct fb_info *info;
struct geodefb_par *par;
-
+ struct fb_info *info;
+
/* Alloc enough space for the pseudo palette. */
- info = framebuffer_alloc(sizeof(struct geodefb_par) + sizeof(u32) * 16, NULL);
+ info = framebuffer_alloc(sizeof(struct geodefb_par) + sizeof(u32) * 16, dev);
if (!info)
return NULL;
@@ -263,25 +263,16 @@
return info;
}
-
-static struct fb_info *gx1fb_info;
-
-static int __init gx1fb_init(void)
+static int __init gx1fb_probe(struct device *device)
{
+ struct platform_device *dev = to_platform_device(device);
+ struct geodefb_par *par;
struct fb_info *info;
- struct geodefb_par *par;
int ret;
-#ifndef MODULE
- if (fb_get_options("gx1fb", NULL))
- return -ENODEV;
-#endif
-
- info = gx1fb_init_fbinfo();
+ info = gx1fb_init_fbinfo(&dev->dev);
if (!info)
return -ENOMEM;
- gx1fb_info = info;
-
par = info->par;
/* GX1 display controller and CS5530 video device */
@@ -310,6 +301,7 @@
ret = -EINVAL;
goto err;
}
+ dev_set_drvdata(&dev->dev, info);
printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, info->fix.id);
return 0;
@@ -327,10 +319,10 @@
return ret;
}
-static void __exit gx1fb_cleanup(void)
+static int gx1fb_remove(struct device *device)
{
- struct fb_info *info = gx1fb_info;
- struct geodefb_par *par = gx1fb_info->par;
+ struct fb_info *info = dev_get_drvdata(device);
+ struct geodefb_par *par = info->par;
unregister_framebuffer(info);
@@ -341,6 +333,40 @@
pci_dev_put(par->vid_dev);
framebuffer_release(info);
+ return 0;
+}
+
+static struct platform_device *gx1fb_device;
+
+static struct device_driver gx1fb_driver = {
+ .name = "geodefb",
+ .bus = &platform_bus_type,
+ .probe = gx1fb_probe,
+ .remove = gx1fb_remove,
+};
+
+static int __init gx1fb_init(void)
+{
+ int ret = 0;
+
+#ifndef MODULE
+ if (fb_get_options("gx1fb", NULL))
+ return -ENODEV;
+#endif
+ gx1fb_device = platform_device_register_simple("geodefb", -1, NULL, 0);
+ if (IS_ERR(gx1fb_device))
+ return PTR_ERR(gx1fb_device);
+
+ ret = driver_register(&gx1fb_driver);
+ if (ret < 0)
+ platform_device_unregister(gx1fb_device);
+ return ret;
+}
+
+static void __exit gx1fb_cleanup(void)
+{
+ platform_device_unregister(gx1fb_device);
+ driver_unregister(&gx1fb_driver);
}
module_init(gx1fb_init);
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Geode now shows up in sysfs.
2005-07-01 23:37 Geode now shows up in sysfs James Simmons
@ 2005-07-04 10:09 ` David Vrabel
2005-07-06 22:31 ` James Simmons
0 siblings, 1 reply; 6+ messages in thread
From: David Vrabel @ 2005-07-04 10:09 UTC (permalink / raw)
To: linux-fbdev-devel
Cc: Antonino A. Daplas, Geert Uytterhoeven, nat.ersoz, jsimmons
[-- Attachment #1: Type: text/plain, Size: 445 bytes --]
James Simmons wrote:
> Going through the drivers I noticed two drivers using framebuffer_alloc
> without a sturct device, Mach64 for atari and geode. Here is a patch for
> geode.
Thanks. It looks fine.
I've merged this patch with some other updates I had. Please apply.
David Vrabel
--
David Vrabel, Design Engineer
Arcom, Clifton Road Tel: +44 (0)1223 411200 ext. 3233
Cambridge CB1 7EA, UK Web: http://www.arcom.com/
[-- Attachment #2: geodefb-fixes --]
[-- Type: text/plain, Size: 9500 bytes --]
Geode framebuffer driver updates:
- Local mode list (taken from modedb.c) containing only relevant modes. This
also makes the driver work as a module.
- Use pci_enable_device()/pci_disable_device().
- Request resources.
- Make it a platform_device and device_driver (from James Simmons
<jsimmons@infradead.org>).
- A few other minor, cosmetic bits and pieces.
Signed-off-by: David Vrabel <dvrabel@arcom.com>
Index: linux-2.6-working/drivers/video/geode/Kconfig
===================================================================
--- linux-2.6-working.orig/drivers/video/geode/Kconfig 2005-07-04 10:38:17.000000000 +0100
+++ linux-2.6-working/drivers/video/geode/Kconfig 2005-07-04 10:38:56.000000000 +0100
@@ -21,9 +21,7 @@
Framebuffer driver for the display controller integrated into the
AMD Geode GX1 processor.
- This driver is also available as a module ( = code which can be
- inserted and removed from the running kernel whenever you want). The
- module will be called gx1fb. If you want to compile it as a module,
- say M here and read <file:Documentation/modules.txt>.
+ To compile this driver as a module, choose M here: the module will be
+ called gx1fb.
If unsure, say N.
Index: linux-2.6-working/drivers/video/geode/gx1fb_core.c
===================================================================
--- linux-2.6-working.orig/drivers/video/geode/gx1fb_core.c 2005-07-04 10:38:17.000000000 +0100
+++ linux-2.6-working/drivers/video/geode/gx1fb_core.c 2005-07-04 10:39:01.000000000 +0100
@@ -30,6 +30,62 @@
static int crt_option = 1;
static char panel_option[32] = "";
+/* Modes relevant to the GX1 (taken from modedb.c) */
+static const struct fb_videomode __initdata gx1_modedb[] = {
+ /* 640x480-60 VESA */
+ { NULL, 60, 640, 480, 39682, 48, 16, 33, 10, 96, 2,
+ 0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
+ /* 640x480-75 VESA */
+ { NULL, 75, 640, 480, 31746, 120, 16, 16, 01, 64, 3,
+ 0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
+ /* 640x480-85 VESA */
+ { NULL, 85, 640, 480, 27777, 80, 56, 25, 01, 56, 3,
+ 0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
+ /* 800x600-60 VESA */
+ { NULL, 60, 800, 600, 25000, 88, 40, 23, 01, 128, 4,
+ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+ FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
+ /* 800x600-75 VESA */
+ { NULL, 75, 800, 600, 20202, 160, 16, 21, 01, 80, 3,
+ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+ FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
+ /* 800x600-85 VESA */
+ { NULL, 85, 800, 600, 17761, 152, 32, 27, 01, 64, 3,
+ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+ FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
+ /* 1024x768-60 VESA */
+ { NULL, 60, 1024, 768, 15384, 160, 24, 29, 3, 136, 6,
+ 0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
+ /* 1024x768-75 VESA */
+ { NULL, 75, 1024, 768, 12690, 176, 16, 28, 1, 96, 3,
+ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+ FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
+ /* 1024x768-85 VESA */
+ { NULL, 85, 1024, 768, 10582, 208, 48, 36, 1, 96, 3,
+ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+ FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
+ /* 1280x960-60 VESA */
+ { NULL, 60, 1280, 960, 9259, 312, 96, 36, 1, 112, 3,
+ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+ FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
+ /* 1280x960-85 VESA */
+ { NULL, 85, 1280, 960, 6734, 224, 64, 47, 1, 160, 3,
+ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+ FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
+ /* 1280x1024-60 VESA */
+ { NULL, 60, 1280, 1024, 9259, 248, 48, 38, 1, 112, 3,
+ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+ FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
+ /* 1280x1024-75 VESA */
+ { NULL, 75, 1280, 1024, 7407, 248, 16, 38, 1, 144, 3,
+ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+ FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
+ /* 1280x1024-85 VESA */
+ { NULL, 85, 1280, 1024, 6349, 224, 64, 44, 1, 160, 3,
+ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+ FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
+};
+
static int gx1_line_delta(int xres, int bpp)
{
int line_delta = xres * (bpp >> 3);
@@ -47,8 +103,6 @@
{
struct geodefb_par *par = info->par;
- printk(KERN_DEBUG "%s()\n", __FUNCTION__);
-
/* Maximum resolution is 1280x1024. */
if (var->xres > 1280 || var->yres > 1024)
return -EINVAL;
@@ -151,6 +205,7 @@
struct geodefb_par *par = info->par;
unsigned gx_base;
int fb_len;
+ int ret;
gx_base = gx1_gx_base();
if (!gx_base)
@@ -161,11 +216,20 @@
if (!par->vid_dev)
return -ENODEV;
+ ret = pci_enable_device(par->vid_dev);
+ if (ret < 0)
+ return ret;
+
+ ret = pci_request_region(par->vid_dev, 1, "gx1fb (video)");
+ if (ret < 0)
+ return ret;
par->vid_regs = ioremap(pci_resource_start(par->vid_dev, 1),
pci_resource_len(par->vid_dev, 1));
if (!par->vid_regs)
return -ENOMEM;
+ if (!request_mem_region(gx_base + 0x8300, 0x100, "gx1fb (display controller)"))
+ return -EBUSY;
par->dc_regs = ioremap(gx_base + 0x8300, 0x100);
if (!par->dc_regs)
return -ENOMEM;
@@ -216,13 +280,13 @@
.fb_cursor = soft_cursor,
};
-static struct fb_info * __init gx1fb_init_fbinfo(void)
+static struct fb_info * __init gx1fb_init_fbinfo(struct device *dev)
{
- struct fb_info *info;
struct geodefb_par *par;
-
+ struct fb_info *info;
+
/* Alloc enough space for the pseudo palette. */
- info = framebuffer_alloc(sizeof(struct geodefb_par) + sizeof(u32) * 16, NULL);
+ info = framebuffer_alloc(sizeof(struct geodefb_par) + sizeof(u32) * 16, dev);
if (!info)
return NULL;
@@ -263,25 +327,16 @@
return info;
}
-
-static struct fb_info *gx1fb_info;
-
-static int __init gx1fb_init(void)
+static int __init gx1fb_probe(struct device *device)
{
+ struct platform_device *dev = to_platform_device(device);
+ struct geodefb_par *par;
struct fb_info *info;
- struct geodefb_par *par;
int ret;
-#ifndef MODULE
- if (fb_get_options("gx1fb", NULL))
- return -ENODEV;
-#endif
-
- info = gx1fb_init_fbinfo();
+ info = gx1fb_init_fbinfo(&dev->dev);
if (!info)
return -ENOMEM;
- gx1fb_info = info;
-
par = info->par;
/* GX1 display controller and CS5530 video device */
@@ -293,7 +348,8 @@
goto err;
}
- ret = fb_find_mode(&info->var, info, mode_option, NULL, 0, NULL, 16);
+ ret = fb_find_mode(&info->var, info, mode_option,
+ gx1_modedb, ARRAY_SIZE(gx1_modedb), NULL, 16);
if (ret == 0 || ret == 4) {
printk(KERN_ERR "%s: could not find valid video mode\n", info->fix.id);
ret = -EINVAL;
@@ -310,37 +366,81 @@
ret = -EINVAL;
goto err;
}
+ dev_set_drvdata(&dev->dev, info);
printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, info->fix.id);
return 0;
err:
if (info->screen_base)
iounmap(info->screen_base);
- if (par->vid_regs)
+ if (par->vid_regs) {
iounmap(par->vid_regs);
- if (par->dc_regs)
+ pci_release_region(par->vid_dev, 1);
+ }
+ if (par->dc_regs) {
iounmap(par->dc_regs);
- if (par->vid_dev)
+ release_mem_region(gx1_gx_base() + 0x8300, 0x100);
+ }
+ if (par->vid_dev) {
+ pci_disable_device(par->vid_dev);
pci_dev_put(par->vid_dev);
+ }
if (info)
framebuffer_release(info);
return ret;
}
-static void __exit gx1fb_cleanup(void)
+static int gx1fb_remove(struct device *device)
{
- struct fb_info *info = gx1fb_info;
- struct geodefb_par *par = gx1fb_info->par;
+ struct fb_info *info = dev_get_drvdata(device);
+ struct geodefb_par *par = info->par;
unregister_framebuffer(info);
iounmap((void __iomem *)info->screen_base);
iounmap(par->vid_regs);
+ pci_release_region(par->vid_dev, 1);
iounmap(par->dc_regs);
+ release_mem_region(gx1_gx_base() + 0x8300, 0x100);
+ pci_disable_device(par->vid_dev);
pci_dev_put(par->vid_dev);
framebuffer_release(info);
+ return 0;
+}
+
+static struct platform_device *gx1fb_device;
+
+static struct device_driver gx1fb_driver = {
+ .name = "geodefb",
+ .bus = &platform_bus_type,
+ .probe = gx1fb_probe,
+ .remove = gx1fb_remove,
+};
+
+static int __init gx1fb_init(void)
+{
+ int ret = 0;
+
+#ifndef MODULE
+ if (fb_get_options("gx1fb", NULL))
+ return -ENODEV;
+#endif
+ gx1fb_device = platform_device_register_simple("geodefb", -1, NULL, 0);
+ if (IS_ERR(gx1fb_device))
+ return PTR_ERR(gx1fb_device);
+
+ ret = driver_register(&gx1fb_driver);
+ if (ret < 0)
+ platform_device_unregister(gx1fb_device);
+ return ret;
+}
+
+static void __exit gx1fb_cleanup(void)
+{
+ platform_device_unregister(gx1fb_device);
+ driver_unregister(&gx1fb_driver);
}
module_init(gx1fb_init);
Index: linux-2.6-working/drivers/video/geode/video_cs5530.c
===================================================================
--- linux-2.6-working.orig/drivers/video/geode/video_cs5530.c 2005-07-04 10:38:17.000000000 +0100
+++ linux-2.6-working/drivers/video/geode/video_cs5530.c 2005-07-04 10:38:56.000000000 +0100
@@ -69,8 +69,6 @@
{ 4310, 0x2FB1B802, }, /* 232.0000 */
};
-#define NUM_CS5530_FREQUENCIES sizeof(cs5530_pll_table)/sizeof(struct cs5530_pll_entry)
-
static void cs5530_set_dclk_frequency(struct fb_info *info)
{
struct geodefb_par *par = info->par;
@@ -82,7 +80,7 @@
value = cs5530_pll_table[0].pll_value;
min = cs5530_pll_table[0].pixclock - info->var.pixclock;
if (min < 0) min = -min;
- for (i = 1; i < NUM_CS5530_FREQUENCIES; i++) {
+ for (i = 1; i < ARRAY_SIZE(cs5530_pll_table); i++) {
diff = cs5530_pll_table[i].pixclock - info->var.pixclock;
if (diff < 0L) diff = -diff;
if (diff < min) {
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Geode now shows up in sysfs.
2005-07-04 10:09 ` David Vrabel
@ 2005-07-06 22:31 ` James Simmons
2005-07-06 23:04 ` James Simmons
2005-07-07 16:09 ` David Vrabel
0 siblings, 2 replies; 6+ messages in thread
From: James Simmons @ 2005-07-06 22:31 UTC (permalink / raw)
To: linux-fbdev-devel
Cc: Antonino A. Daplas, Geert Uytterhoeven, nat.ersoz, jsimmons
It is a pci device. I will send another patch to convert it to a pci
device.
On Mon, 4 Jul 2005, David Vrabel wrote:
> James Simmons wrote:
> > Going through the drivers I noticed two drivers using framebuffer_alloc
> > without a sturct device, Mach64 for atari and geode. Here is a patch for
> > geode.
>
> Thanks. It looks fine.
>
> I've merged this patch with some other updates I had. Please apply.
>
> David Vrabel
> --
> David Vrabel, Design Engineer
>
> Arcom, Clifton Road Tel: +44 (0)1223 411200 ext. 3233
> Cambridge CB1 7EA, UK Web: http://www.arcom.com/
>
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Geode now shows up in sysfs.
2005-07-06 22:31 ` James Simmons
@ 2005-07-06 23:04 ` James Simmons
2005-07-07 16:09 ` David Vrabel
1 sibling, 0 replies; 6+ messages in thread
From: James Simmons @ 2005-07-06 23:04 UTC (permalink / raw)
To: Linux Fbdev development list
Cc: Antonino A. Daplas, Geert Uytterhoeven, nat.ersoz
Can you try this? If it works I will send it to Andrew ASAP.
diff -urN -X /home/jsimmons/dontdiff linus-2.6/drivers/video/geode/geodefb.h fbdev-2.6/drivers/video/geode/geodefb.h
--- linus-2.6/drivers/video/geode/geodefb.h 2005-05-10 08:39:33.000000000 -0700
+++ fbdev-2.6/drivers/video/geode/geodefb.h 2005-07-06 15:50:37.000000000 -0700
@@ -29,7 +29,6 @@
int enable_crt;
int panel_x; /* dimensions of an attached flat panel, non-zero => enable panel */
int panel_y;
- struct pci_dev *vid_dev;
void __iomem *dc_regs;
void __iomem *vid_regs;
struct geode_dc_ops *dc_ops;
diff -urN -X /home/jsimmons/dontdiff linus-2.6/drivers/video/geode/gx1fb_core.c fbdev-2.6/drivers/video/geode/gx1fb_core.c
--- linus-2.6/drivers/video/geode/gx1fb_core.c 2005-05-10 08:39:33.000000000 -0700
+++ fbdev-2.6/drivers/video/geode/gx1fb_core.c 2005-07-06 15:55:58.000000000 -0700
@@ -30,6 +30,62 @@
static int crt_option = 1;
static char panel_option[32] = "";
+/* Modes relevant to the GX1 (taken from modedb.c) */
+static const struct fb_videomode __initdata gx1_modedb[] = {
+ /* 640x480-60 VESA */
+ { NULL, 60, 640, 480, 39682, 48, 16, 33, 10, 96, 2,
+ 0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
+ /* 640x480-75 VESA */
+ { NULL, 75, 640, 480, 31746, 120, 16, 16, 01, 64, 3,
+ 0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
+ /* 640x480-85 VESA */
+ { NULL, 85, 640, 480, 27777, 80, 56, 25, 01, 56, 3,
+ 0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
+ /* 800x600-60 VESA */
+ { NULL, 60, 800, 600, 25000, 88, 40, 23, 01, 128, 4,
+ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+ FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
+ /* 800x600-75 VESA */
+ { NULL, 75, 800, 600, 20202, 160, 16, 21, 01, 80, 3,
+ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+ FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
+ /* 800x600-85 VESA */
+ { NULL, 85, 800, 600, 17761, 152, 32, 27, 01, 64, 3,
+ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+ FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
+ /* 1024x768-60 VESA */
+ { NULL, 60, 1024, 768, 15384, 160, 24, 29, 3, 136, 6,
+ 0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
+ /* 1024x768-75 VESA */
+ { NULL, 75, 1024, 768, 12690, 176, 16, 28, 1, 96, 3,
+ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+ FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
+ /* 1024x768-85 VESA */
+ { NULL, 85, 1024, 768, 10582, 208, 48, 36, 1, 96, 3,
+ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+ FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
+ /* 1280x960-60 VESA */
+ { NULL, 60, 1280, 960, 9259, 312, 96, 36, 1, 112, 3,
+ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+ FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
+ /* 1280x960-85 VESA */
+ { NULL, 85, 1280, 960, 6734, 224, 64, 47, 1, 160, 3,
+ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+ FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
+ /* 1280x1024-60 VESA */
+ { NULL, 60, 1280, 1024, 9259, 248, 48, 38, 1, 112, 3,
+ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+ FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
+ /* 1280x1024-75 VESA */
+ { NULL, 75, 1280, 1024, 7407, 248, 16, 38, 1, 144, 3,
+ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+ FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
+ /* 1280x1024-85 VESA */
+ { NULL, 85, 1280, 1024, 6349, 224, 64, 44, 1, 160, 3,
+ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+ FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
+};
+
static int gx1_line_delta(int xres, int bpp)
{
int line_delta = xres * (bpp >> 3);
@@ -47,8 +103,6 @@
{
struct geodefb_par *par = info->par;
- printk(KERN_DEBUG "%s()\n", __FUNCTION__);
-
/* Maximum resolution is 1280x1024. */
if (var->xres > 1280 || var->yres > 1024)
return -EINVAL;
@@ -146,26 +200,31 @@
return par->vid_ops->blank_display(info, blank_mode);
}
-static int __init gx1fb_map_video_memory(struct fb_info *info)
+static int __init gx1fb_map_video_memory(struct fb_info *info, struct pci_dev *dev)
{
struct geodefb_par *par = info->par;
unsigned gx_base;
int fb_len;
+ int ret;
gx_base = gx1_gx_base();
if (!gx_base)
return -ENODEV;
- par->vid_dev = pci_get_device(PCI_VENDOR_ID_CYRIX,
- PCI_DEVICE_ID_CYRIX_5530_VIDEO, NULL);
- if (!par->vid_dev)
- return -ENODEV;
-
- par->vid_regs = ioremap(pci_resource_start(par->vid_dev, 1),
- pci_resource_len(par->vid_dev, 1));
+ ret = pci_enable_device(dev);
+ if (ret < 0)
+ return ret;
+
+ ret = pci_request_region(dev, 1, "gx1fb (video)");
+ if (ret < 0)
+ return ret;
+ par->vid_regs = ioremap(pci_resource_start(dev, 1),
+ pci_resource_len(dev, 1));
if (!par->vid_regs)
return -ENOMEM;
+ if (!request_mem_region(gx_base + 0x8300, 0x100, "gx1fb (display controller)"))
+ return -EBUSY;
par->dc_regs = ioremap(gx_base + 0x8300, 0x100);
if (!par->dc_regs)
return -ENOMEM;
@@ -216,13 +275,13 @@
.fb_cursor = soft_cursor,
};
-static struct fb_info * __init gx1fb_init_fbinfo(void)
+static struct fb_info * __init gx1fb_init_fbinfo(struct device *dev)
{
- struct fb_info *info;
struct geodefb_par *par;
-
+ struct fb_info *info;
+
/* Alloc enough space for the pseudo palette. */
- info = framebuffer_alloc(sizeof(struct geodefb_par) + sizeof(u32) * 16, NULL);
+ info = framebuffer_alloc(sizeof(struct geodefb_par) + sizeof(u32) * 16, dev);
if (!info)
return NULL;
@@ -263,37 +322,28 @@
return info;
}
-
-static struct fb_info *gx1fb_info;
-
-static int __init gx1fb_init(void)
+static int __init gx1fb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{
+ struct geodefb_par *par;
struct fb_info *info;
- struct geodefb_par *par;
int ret;
-#ifndef MODULE
- if (fb_get_options("gx1fb", NULL))
- return -ENODEV;
-#endif
-
- info = gx1fb_init_fbinfo();
+ info = gx1fb_init_fbinfo(&pdev->dev);
if (!info)
return -ENOMEM;
- gx1fb_info = info;
-
par = info->par;
/* GX1 display controller and CS5530 video device */
par->dc_ops = &gx1_dc_ops;
par->vid_ops = &cs5530_vid_ops;
- if ((ret = gx1fb_map_video_memory(info)) < 0) {
+ if ((ret = gx1fb_map_video_memory(info, pdev)) < 0) {
printk(KERN_ERR "%s: gx1fb_map_video_memory() failed\n", info->fix.id);
goto err;
}
- ret = fb_find_mode(&info->var, info, mode_option, NULL, 0, NULL, 16);
+ ret = fb_find_mode(&info->var, info, mode_option,
+ gx1_modedb, ARRAY_SIZE(gx1_modedb), NULL, 16);
if (ret == 0 || ret == 4) {
printk(KERN_ERR "%s: could not find valid video mode\n", info->fix.id);
ret = -EINVAL;
@@ -310,37 +360,76 @@
ret = -EINVAL;
goto err;
}
+ pci_set_drvdata(pdev, info);
printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, info->fix.id);
return 0;
err:
if (info->screen_base)
iounmap(info->screen_base);
- if (par->vid_regs)
+ if (par->vid_regs) {
iounmap(par->vid_regs);
- if (par->dc_regs)
+ pci_release_region(pdev, 1);
+ }
+ if (par->dc_regs) {
iounmap(par->dc_regs);
- if (par->vid_dev)
- pci_dev_put(par->vid_dev);
+ release_mem_region(gx1_gx_base() + 0x8300, 0x100);
+ }
+
+ pci_disable_device(pdev);
+ pci_dev_put(pdev);
+
if (info)
framebuffer_release(info);
return ret;
}
-static void __exit gx1fb_cleanup(void)
+static void gx1fb_remove(struct pci_dev *pdev)
{
- struct fb_info *info = gx1fb_info;
- struct geodefb_par *par = gx1fb_info->par;
+ struct fb_info *info = pci_get_drvdata(pdev);
+ struct geodefb_par *par = info->par;
unregister_framebuffer(info);
iounmap((void __iomem *)info->screen_base);
iounmap(par->vid_regs);
+ pci_release_region(pdev, 1);
iounmap(par->dc_regs);
+ release_mem_region(gx1_gx_base() + 0x8300, 0x100);
+ pci_set_drvdata(pdev, NULL);
+ pci_disable_device(pdev);
+ pci_dev_put(pdev);
+ framebuffer_release(info);
+}
- pci_dev_put(par->vid_dev);
+static struct pci_device_id gx1fb_id_table[] = {
+ { PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_VIDEO,
+ PCI_ANY_ID, PCI_ANY_ID, PCI_BASE_CLASS_DISPLAY << 16,
+ 0xff0000, 0 },
+ { 0, }
+};
- framebuffer_release(info);
+MODULE_DEVICE_TABLE(pci, geodefb_id_table);
+
+static struct pci_driver gx1fb_driver = {
+ .name = "geodefb",
+ .id_table = gx1fb_id_table,
+ .probe = gx1fb_probe,
+ .remove = gx1fb_remove,
+};
+
+static int __init gx1fb_init(void)
+{
+#ifndef MODULE
+ if (fb_get_options("gx1fb", NULL))
+ return -ENODEV;
+#endif
+ return pci_register_driver(&gx1fb_driver);
+}
+
+static void __exit gx1fb_cleanup(void)
+{
+ pci_unregister_driver(&gx1fb_driver);
}
module_init(gx1fb_init);
diff -urN -X /home/jsimmons/dontdiff linus-2.6/drivers/video/geode/Kconfig fbdev-2.6/drivers/video/geode/Kconfig
--- linus-2.6/drivers/video/geode/Kconfig 2005-05-10 08:39:33.000000000 -0700
+++ fbdev-2.6/drivers/video/geode/Kconfig 2005-07-06 15:33:32.000000000 -0700
@@ -21,9 +21,7 @@
Framebuffer driver for the display controller integrated into the
AMD Geode GX1 processor.
- This driver is also available as a module ( = code which can be
- inserted and removed from the running kernel whenever you want). The
- module will be called gx1fb. If you want to compile it as a module,
- say M here and read <file:Documentation/modules.txt>.
+ To compile this driver as a module, choose M here: the module will be
+ called gx1fb.
If unsure, say N.
diff -urN -X /home/jsimmons/dontdiff linus-2.6/drivers/video/geode/video_cs5530.c fbdev-2.6/drivers/video/geode/video_cs5530.c
--- linus-2.6/drivers/video/geode/video_cs5530.c 2005-05-10 08:39:33.000000000 -0700
+++ fbdev-2.6/drivers/video/geode/video_cs5530.c 2005-07-06 15:33:32.000000000 -0700
@@ -69,8 +69,6 @@
{ 4310, 0x2FB1B802, }, /* 232.0000 */
};
-#define NUM_CS5530_FREQUENCIES sizeof(cs5530_pll_table)/sizeof(struct cs5530_pll_entry)
-
static void cs5530_set_dclk_frequency(struct fb_info *info)
{
struct geodefb_par *par = info->par;
@@ -82,7 +80,7 @@
value = cs5530_pll_table[0].pll_value;
min = cs5530_pll_table[0].pixclock - info->var.pixclock;
if (min < 0) min = -min;
- for (i = 1; i < NUM_CS5530_FREQUENCIES; i++) {
+ for (i = 1; i < ARRAY_SIZE(cs5530_pll_table); i++) {
diff = cs5530_pll_table[i].pixclock - info->var.pixclock;
if (diff < 0L) diff = -diff;
if (diff < min) {
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Geode now shows up in sysfs.
2005-07-06 22:31 ` James Simmons
2005-07-06 23:04 ` James Simmons
@ 2005-07-07 16:09 ` David Vrabel
2005-07-07 19:55 ` James Simmons
1 sibling, 1 reply; 6+ messages in thread
From: David Vrabel @ 2005-07-07 16:09 UTC (permalink / raw)
To: linux-fbdev-devel
Cc: Antonino A. Daplas, Geert Uytterhoeven, nat.ersoz, jsimmons
James Simmons wrote:
> It is a pci device. I will send another patch to convert it to a pci
> device.
I think it should remain as a platform device because the principle
device involved (the display controller which does all the framebuffer
stuff) is not a PCI device.
David Vrabel
--
David Vrabel, Design Engineer
Arcom, Clifton Road Tel: +44 (0)1223 411200 ext. 3233
Cambridge CB1 7EA, UK Web: http://www.arcom.com/
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Geode now shows up in sysfs.
2005-07-07 16:09 ` David Vrabel
@ 2005-07-07 19:55 ` James Simmons
0 siblings, 0 replies; 6+ messages in thread
From: James Simmons @ 2005-07-07 19:55 UTC (permalink / raw)
To: David Vrabel
Cc: linux-fbdev-devel, Antonino A. Daplas, Geert Uytterhoeven,
nat.ersoz, jsimmons
What would the pci device part be classifed as then?
On Thu, 7 Jul 2005, David Vrabel wrote:
> James Simmons wrote:
> > It is a pci device. I will send another patch to convert it to a pci
> > device.
>
> I think it should remain as a platform device because the principle
> device involved (the display controller which does all the framebuffer
> stuff) is not a PCI device.
>
> David Vrabel
> --
> David Vrabel, Design Engineer
>
> Arcom, Clifton Road Tel: +44 (0)1223 411200 ext. 3233
> Cambridge CB1 7EA, UK Web: http://www.arcom.com/
>
-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA. To register visit http://www.hp.com/go/dualwebinar
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-07-07 19:56 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-01 23:37 Geode now shows up in sysfs James Simmons
2005-07-04 10:09 ` David Vrabel
2005-07-06 22:31 ` James Simmons
2005-07-06 23:04 ` James Simmons
2005-07-07 16:09 ` David Vrabel
2005-07-07 19:55 ` James Simmons
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.