* [PATCH] cirrusfb: use modedb and add mode_option parameter
@ 2008-08-31 14:00 Krzysztof Helt
2008-08-31 18:10 ` Geert Uytterhoeven
0 siblings, 1 reply; 5+ messages in thread
From: Krzysztof Helt @ 2008-08-31 14:00 UTC (permalink / raw)
To: Linux-fbdev-devel; +Cc: Andrew Morton
From: Krzysztof Helt <krzysztof.h1@wp.pl>
Use modedb for initial mode instead of a table
of few predefined modes. Leave 640x480@60 mode
in case the modedb failed.
Add mode_option module parameter as a step toward
unification of frame buffers' parameters.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
---
This is patch against the current -mm tree.
drivers/video/cirrusfb.c | 141 ++++++++++++++--------------------------------
1 files changed, 42 insertions(+), 99 deletions(-)
diff --git a/drivers/video/cirrusfb.c b/drivers/video/cirrusfb.c
index 0eb429a..7344005 100644
--- a/drivers/video/cirrusfb.c
+++ b/drivers/video/cirrusfb.c
@@ -372,99 +372,36 @@ struct cirrusfb_info {
void (*unmap)(struct fb_info *info);
};
-static unsigned cirrusfb_def_mode = 1;
static int noaccel;
+static char *mode_option __devinitdata;
/*
* Predefined Video Modes
*/
-static const struct {
- const char *name;
- struct fb_var_screeninfo var;
-} cirrusfb_predefined[] = {
- {
- /* autodetect mode */
- .name = "Autodetect",
- }, {
- /* 640x480, 31.25 kHz, 60 Hz, 25 MHz PixClock */
- .name = "640x480",
- .var = {
- .xres = 640,
- .yres = 480,
- .xres_virtual = 640,
- .yres_virtual = 480,
- .bits_per_pixel = 8,
- .red = { .length = 8 },
- .green = { .length = 8 },
- .blue = { .length = 8 },
- .width = -1,
- .height = -1,
- .pixclock = 40000,
- .left_margin = 48,
- .right_margin = 16,
- .upper_margin = 32,
- .lower_margin = 8,
- .hsync_len = 96,
- .vsync_len = 4,
- .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
- .vmode = FB_VMODE_NONINTERLACED
- }
- }, {
- /* 800x600, 48 kHz, 76 Hz, 50 MHz PixClock */
- .name = "800x600",
- .var = {
- .xres = 800,
- .yres = 600,
- .xres_virtual = 800,
- .yres_virtual = 600,
- .bits_per_pixel = 8,
- .red = { .length = 8 },
- .green = { .length = 8 },
- .blue = { .length = 8 },
- .width = -1,
- .height = -1,
- .pixclock = 20000,
- .left_margin = 128,
- .right_margin = 16,
- .upper_margin = 24,
- .lower_margin = 2,
- .hsync_len = 96,
- .vsync_len = 6,
- .vmode = FB_VMODE_NONINTERLACED
- }
- }, {
- /*
- * Modeline from XF86Config:
- * Mode "1024x768" 80 1024 1136 1340 1432 768 770 774 805
- */
- /* 1024x768, 55.8 kHz, 70 Hz, 80 MHz PixClock */
- .name = "1024x768",
- .var = {
- .xres = 1024,
- .yres = 768,
- .xres_virtual = 1024,
- .yres_virtual = 768,
- .bits_per_pixel = 8,
- .red = { .length = 8 },
- .green = { .length = 8 },
- .blue = { .length = 8 },
- .width = -1,
- .height = -1,
- .pixclock = 12500,
- .left_margin = 144,
- .right_margin = 32,
- .upper_margin = 30,
- .lower_margin = 2,
- .hsync_len = 192,
- .vsync_len = 6,
- .vmode = FB_VMODE_NONINTERLACED
- }
- }
+static struct fb_var_screeninfo cirrusfb_var __devinitdata = {
+ /* 640x480, 31.25 kHz, 60 Hz, 25 MHz PixClock */
+ .xres = 640,
+ .yres = 480,
+ .xres_virtual = 640,
+ .yres_virtual = 480,
+ .bits_per_pixel = 8,
+ .red = { .length = 8 },
+ .green = { .length = 8 },
+ .blue = { .length = 8 },
+ .width = -1,
+ .height = -1,
+ .pixclock = 40000,
+ .left_margin = 48,
+ .right_margin = 16,
+ .upper_margin = 32,
+ .lower_margin = 8,
+ .hsync_len = 96,
+ .vsync_len = 4,
+ .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+ .vmode = FB_VMODE_NONINTERLACED
};
-#define NUM_TOTAL_MODES ARRAY_SIZE(cirrusfb_predefined)
-
/****************************************************************************/
/**** BEGIN PROTOTYPES ******************************************************/
@@ -2267,23 +2204,27 @@ static int cirrusfb_register(struct fb_info *info)
/* sanity checks */
assert(btype != BT_NONE);
+ /* set all the vital stuff */
+ cirrusfb_set_fbinfo(info);
+
DPRINTK("cirrusfb: (RAM start set to: 0x%p)\n", info->screen_base);
- /* Make pretend we've set the var so our structures are in a "good" */
- /* state, even though we haven't written the mode to the hw yet... */
- info->var = cirrusfb_predefined[cirrusfb_def_mode].var;
+ if (!mode_option)
+ mode_option = "640x480@60";
+
+ err = fb_find_mode(&info->var, info, mode_option, NULL, 0, NULL, 8);
+ if (!err || err == 4)
+ info->var = cirrusfb_var;
+
info->var.activate = FB_ACTIVATE_NOW;
err = cirrusfb_decode_var(&info->var, &cinfo->currentmode, info);
if (err < 0) {
/* should never happen */
DPRINTK("choking on default var... umm, no good.\n");
- goto err_unmap_cirrusfb;
+ goto err_dealloc_cmap;
}
- /* set all the vital stuff */
- cirrusfb_set_fbinfo(info);
-
err = register_framebuffer(info);
if (err < 0) {
printk(KERN_ERR "cirrusfb: could not register "
@@ -2296,7 +2237,6 @@ static int cirrusfb_register(struct fb_info *info)
err_dealloc_cmap:
fb_dealloc_cmap(&info->cmap);
-err_unmap_cirrusfb:
cinfo->unmap(info);
framebuffer_release(info);
return err;
@@ -2608,17 +2548,17 @@ static int __init cirrusfb_setup(char *options) {
return 0;
while ((this_opt = strsep(&options, ",")) != NULL) {
- if (!*this_opt) continue;
+ if (!*this_opt)
+ continue;
DPRINTK("cirrusfb_setup: option '%s'\n", this_opt);
- for (i = 0; i < NUM_TOTAL_MODES; i++) {
- sprintf(s, "mode:%s", cirrusfb_predefined[i].name);
- if (strcmp(this_opt, s) == 0)
- cirrusfb_def_mode = i;
- }
if (!strcmp(this_opt, "noaccel"))
noaccel = 1;
+ else if (!strncmp(this_opt, "mode:", 5))
+ mode_option = this_opt + 5;
+ else
+ mode_option = this_opt;
}
return 0;
}
@@ -2644,6 +2584,9 @@ static void __exit cirrusfb_exit(void)
module_init(cirrusfb_init);
+module_param(mode_option, charp, 0);
+MODULE_PARM_DESC(mode_option, "Initial video mode e.g. '648x480-8@60'");
+
#ifdef MODULE
module_exit(cirrusfb_exit);
#endif
--
1.5.2.2
----------------------------------------------------------------------
Nie szukam kochanka!
>> http://link.interia.pl/f1eeb
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] cirrusfb: use modedb and add mode_option parameter
2008-08-31 14:00 [PATCH] cirrusfb: use modedb and add mode_option parameter Krzysztof Helt
@ 2008-08-31 18:10 ` Geert Uytterhoeven
2008-08-31 20:01 ` Krzysztof Helt
0 siblings, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2008-08-31 18:10 UTC (permalink / raw)
To: Krzysztof Helt; +Cc: Andrew Morton, Linux-fbdev-devel
On Sun, 31 Aug 2008, Krzysztof Helt wrote:
> From: Krzysztof Helt <krzysztof.h1@wp.pl>
>
> Use modedb for initial mode instead of a table
> of few predefined modes. Leave 640x480@60 mode
> in case the modedb failed.
Any specific reason you left the 640x480@60 mode?
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
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] cirrusfb: use modedb and add mode_option parameter
2008-08-31 18:10 ` Geert Uytterhoeven
@ 2008-08-31 20:01 ` Krzysztof Helt
2008-08-31 20:52 ` Geert Uytterhoeven
0 siblings, 1 reply; 5+ messages in thread
From: Krzysztof Helt @ 2008-08-31 20:01 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: Andrew Morton, Linux-fbdev-devel
On Sun, 31 Aug 2008 20:10:20 +0200 (CEST)
Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> On Sun, 31 Aug 2008, Krzysztof Helt wrote:
> > From: Krzysztof Helt <krzysztof.h1@wp.pl>
> >
> > Use modedb for initial mode instead of a table
> > of few predefined modes. Leave 640x480@60 mode
> > in case the modedb failed.
>
> Any specific reason you left the 640x480@60 mode?
>
I left the lowest one to have a safe setting in case the
modedb does not match specified one.
If you have a better way, let me know.
Regards,
Krzysztof
----------------------------------------------------------------------
>> Sprawdz, czy do siebie pasujecie!
>> http://link.interia.pl/f1eea
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] cirrusfb: use modedb and add mode_option parameter
2008-08-31 20:01 ` Krzysztof Helt
@ 2008-08-31 20:52 ` Geert Uytterhoeven
2008-08-31 21:36 ` Krzysztof Helt
0 siblings, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2008-08-31 20:52 UTC (permalink / raw)
To: Krzysztof Helt; +Cc: Andrew Morton, Linux-fbdev-devel
On Sun, 31 Aug 2008, Krzysztof Helt wrote:
> On Sun, 31 Aug 2008 20:10:20 +0200 (CEST)
> Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > On Sun, 31 Aug 2008, Krzysztof Helt wrote:
> > > From: Krzysztof Helt <krzysztof.h1@wp.pl>
> > >
> > > Use modedb for initial mode instead of a table
> > > of few predefined modes. Leave 640x480@60 mode
> > > in case the modedb failed.
> >
> > Any specific reason you left the 640x480@60 mode?
>
> I left the lowest one to have a safe setting in case the
> modedb does not match specified one.
> If you have a better way, let me know.
It's almost the same as the `640x480 @ 60 Hz, 31.5 kHz hsync' and the
`640x480-60 VESA' mode in the modedb, so I think it's safe to rely on
modedb only.
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
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] cirrusfb: use modedb and add mode_option parameter
2008-08-31 20:52 ` Geert Uytterhoeven
@ 2008-08-31 21:36 ` Krzysztof Helt
0 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Helt @ 2008-08-31 21:36 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: Andrew Morton, Linux-fbdev-devel
On Sun, 31 Aug 2008 22:52:37 +0200 (CEST)
Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> On Sun, 31 Aug 2008, Krzysztof Helt wrote:
> > On Sun, 31 Aug 2008 20:10:20 +0200 (CEST)
> > Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > > On Sun, 31 Aug 2008, Krzysztof Helt wrote:
> > > > From: Krzysztof Helt <krzysztof.h1@wp.pl>
> > > >
> > > > Use modedb for initial mode instead of a table
> > > > of few predefined modes. Leave 640x480@60 mode
> > > > in case the modedb failed.
> > >
> > > Any specific reason you left the 640x480@60 mode?
> >
> > I left the lowest one to have a safe setting in case the
> > modedb does not match specified one.
> > If you have a better way, let me know.
>
> It's almost the same as the `640x480 @ 60 Hz, 31.5 kHz hsync' and the
> `640x480-60 VESA' mode in the modedb, so I think it's safe to rely on
> modedb only.
>
Ok. I'll fix it.
Regards,
Krzysztof
----------------------------------------------------------------------
Tani telefon!
Sprawdz >>> http://link.interia.pl/f1ef5
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-08-31 21:29 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-31 14:00 [PATCH] cirrusfb: use modedb and add mode_option parameter Krzysztof Helt
2008-08-31 18:10 ` Geert Uytterhoeven
2008-08-31 20:01 ` Krzysztof Helt
2008-08-31 20:52 ` Geert Uytterhoeven
2008-08-31 21:36 ` Krzysztof Helt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).