]> err.no Git - linux-2.6/blobdiff - drivers/video/geode/lxfb_core.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux...
[linux-2.6] / drivers / video / geode / lxfb_core.c
index b565882eee3797f02c95d570d26080836d6ddea3..2cd9b74d222545ea771d653cf1d558be43c2173b 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/console.h>
 #include <linux/mm.h>
 #include <linux/slab.h>
+#include <linux/suspend.h>
 #include <linux/delay.h>
 #include <linux/fb.h>
 #include <linux/init.h>
 
 static char *mode_option;
 static int noclear, nopanel, nocrt;
-static int fbsize;
+static int vram;
+static int vt_switch;
 
 /* Most of these modes are sorted in ascending order, but
  * since the first entry in this table is the "default" mode,
  * we try to make it something sane - 640x480-60 is sane
  */
 
-static const struct fb_videomode geode_modedb[] __initdata = {
+static 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,
@@ -215,6 +217,35 @@ static const struct fb_videomode geode_modedb[] __initdata = {
          0, FB_VMODE_NONINTERLACED, 0 },
 };
 
+#ifdef CONFIG_OLPC
+#include <asm/olpc.h>
+
+static struct fb_videomode olpc_dcon_modedb[] __initdata = {
+       /* The only mode the DCON has is 1200x900 */
+       { NULL, 50, 1200, 900, 17460, 24, 8, 4, 5, 8, 3,
+         FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+         FB_VMODE_NONINTERLACED, 0 }
+};
+
+static void __init get_modedb(struct fb_videomode **modedb, unsigned int *size)
+{
+       if (olpc_has_dcon()) {
+               *modedb = (struct fb_videomode *) olpc_dcon_modedb;
+               *size = ARRAY_SIZE(olpc_dcon_modedb);
+       } else {
+               *modedb = (struct fb_videomode *) geode_modedb;
+               *size = ARRAY_SIZE(geode_modedb);
+       }
+}
+
+#else
+static void __init get_modedb(struct fb_videomode **modedb, unsigned int *size)
+{
+       *modedb = (struct fb_videomode *) geode_modedb;
+       *size = ARRAY_SIZE(geode_modedb);
+}
+#endif
+
 static int lxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
 {
        if (var->xres > 1920 || var->yres > 1440)
@@ -339,7 +370,7 @@ static int __init lxfb_map_video_memory(struct fb_info *info,
                return ret;
 
        info->fix.smem_start = pci_resource_start(dev, 0);
-       info->fix.smem_len = fbsize ? fbsize : lx_framebuffer_size();
+       info->fix.smem_len = vram ? vram : lx_framebuffer_size();
 
        info->screen_base = ioremap(info->fix.smem_start, info->fix.smem_len);
 
@@ -475,7 +506,7 @@ static int __init lxfb_probe(struct pci_dev *pdev,
        int ret;
 
        struct fb_videomode *modedb_ptr;
-       int modedb_size;
+       unsigned int modedb_size;
 
        info = lxfb_init_fbinfo(&pdev->dev);
 
@@ -500,9 +531,7 @@ static int __init lxfb_probe(struct pci_dev *pdev,
 
        /* Set up the mode database */
 
-       modedb_ptr = (struct fb_videomode *) geode_modedb;
-       modedb_size = ARRAY_SIZE(geode_modedb);
-
+       get_modedb(&modedb_ptr, &modedb_size);
        ret = fb_find_mode(&info->var, info, mode_option,
                           modedb_ptr, modedb_size, NULL, 16);
 
@@ -523,6 +552,8 @@ static int __init lxfb_probe(struct pci_dev *pdev,
        lxfb_check_var(&info->var, info);
        lxfb_set_par(info);
 
+       pm_set_vt_switch(vt_switch);
+
        if (register_framebuffer(info) < 0) {
                ret = -EINVAL;
                goto err;
@@ -608,9 +639,7 @@ static int __init lxfb_setup(char *options)
                if (!*opt)
                        continue;
 
-               if (!strncmp(opt, "fbsize:", 7))
-                       fbsize = simple_strtoul(opt+7, NULL, 0);
-               else if (!strcmp(opt, "noclear"))
+               if (!strcmp(opt, "noclear"))
                        noclear = 1;
                else if (!strcmp(opt, "nopanel"))
                        nopanel = 1;
@@ -647,8 +676,11 @@ module_exit(lxfb_cleanup);
 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");
+module_param(vram, int, 0);
+MODULE_PARM_DESC(vram, "video memory size");
+
+module_param(vt_switch, int, 0);
+MODULE_PARM_DESC(vt_switch, "enable VT switch during suspend/resume");
 
 MODULE_DESCRIPTION("Framebuffer driver for the AMD Geode LX");
 MODULE_LICENSE("GPL");