* [PATCH 10/12] add the sm501fb option to sm501 fb driver
@ 2010-05-04 9:55 yajin
2010-05-05 12:15 ` Ben Dooks
0 siblings, 1 reply; 5+ messages in thread
From: yajin @ 2010-05-04 9:55 UTC (permalink / raw)
To: linux-mips, loongson-dev, wuzhangjin, apatard, vince, ben
Currently the sm501 mode can only be fetched from modedb.c.
Unfortunately the modes in modedb.c are not complete. For example it
lacks the resolution of 1024x600. So the sm501 fb driver should have
the ability to accept the mode option from linux command line.
Signed-off-by: yajin <yajin@vm-kernel.org>
---
drivers/video/sm501fb.c | 67 +++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 65 insertions(+), 2 deletions(-)
diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c
index b7dc180..f2c69ca 100644
--- a/drivers/video/sm501fb.c
+++ b/drivers/video/sm501fb.c
@@ -43,6 +43,37 @@
#define NR_PALETTE 256
+static char *mode_option;
+module_param_named(mode, mode_option, charp, 0);
+MODULE_PARM_DESC(mode, "Initial mode");
+
+/*
+ * SM501 Mode
+ * 1024X600 is not defined in default mode(modedb.c).
+ */
+static const struct fb_videomode sm501_modedb[] __initdata = {
+ {
+ /* 1024x600-60 */
+ NULL, 60, 1024, 600, 20423, 144, 40, 18, 1, 104, 3,
+ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
+ },
+ {
+ /* 1024x600-70 */
+ NULL, 70, 1024, 600, 17211, 152, 48, 21, 1, 104, 3,
+ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
+ },
+ {
+ /* 1024x600-75 */
+ NULL, 75, 1024, 600, 15822, 160, 56, 23, 1, 104, 3,
+ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
+ },
+ {
+ /* 1024x600-85 */
+ NULL, 85, 1024, 600, 13730, 168, 56, 26, 1, 112, 3,
+ FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
+ }
+};
+
enum sm501_controller {
HEAD_CRT = 0,
HEAD_PANEL = 1,
@@ -1729,8 +1760,16 @@ static int sm501fb_init_fb(struct fb_info *fb,
fb->var.xres_virtual = fb->var.xres;
fb->var.yres_virtual = fb->var.yres;
} else {
- ret = fb_find_mode(&fb->var, fb,
- NULL, NULL, 0, NULL, 8);
+ if (mode_option) {
+ dev_info(info->dev, "using user defined mode:"
+ " %s\n", mode_option);
+ ret = fb_find_mode(&fb->var, fb,
+ mode_option, sm501_modedb,
+ ARRAY_SIZE(sm501_modedb),
+ NULL, fb->var.bits_per_pixel);
+ } else
+ ret = fb_find_mode(&fb->var, fb,
+ NULL, NULL, 0, NULL, 8);
if (ret == 0 || ret == 4) {
dev_err(info->dev,
@@ -2136,8 +2175,32 @@ static struct platform_driver sm501fb_driver = {
},
};
+#ifndef MODULE
+static int __devinit sm501fb_setup(char *options)
+{
+ char *this_opt;
+
+ if (!options || !*options)
+ return 0;
+
+ while ((this_opt = strsep(&options, ",")) != NULL) {
+ if (!*this_opt)
+ continue;
+ mode_option = this_opt;
+ }
+ return 0;
+}
+#endif
+
static int __devinit sm501fb_init(void)
{
+#ifndef MODULE
+ char *option = NULL;
+
+ if (fb_get_options("sm501fb", &option))
+ return -ENODEV;
+ sm501fb_setup(option);
+#endif
return platform_driver_register(&sm501fb_driver);
}
--
1.5.6.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 10/12] add the sm501fb option to sm501 fb driver
2010-05-04 9:55 [PATCH 10/12] add the sm501fb option to sm501 fb driver yajin
@ 2010-05-05 12:15 ` Ben Dooks
2010-05-05 12:32 ` Arnaud Patard
0 siblings, 1 reply; 5+ messages in thread
From: Ben Dooks @ 2010-05-05 12:15 UTC (permalink / raw)
To: yajin; +Cc: linux-mips
On 04/05/10 18:55, yajin wrote:
> Currently the sm501 mode can only be fetched from modedb.c.
> Unfortunately the modes in modedb.c are not complete. For example it
> lacks the resolution of 1024x600. So the sm501 fb driver should have
> the ability to accept the mode option from linux command line.
Why not get this added to the main mode database instead of
adding a new one into the sm501 driver?
Secondly, why isn't this on the framebuffer list or linux-kernel?
> Signed-off-by: yajin <yajin@vm-kernel.org>
> ---
> drivers/video/sm501fb.c | 67 +++++++++++++++++++++++++++++++++++++++++++++-
> 1 files changed, 65 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c
> index b7dc180..f2c69ca 100644
> --- a/drivers/video/sm501fb.c
> +++ b/drivers/video/sm501fb.c
> @@ -43,6 +43,37 @@
>
> #define NR_PALETTE 256
>
> +static char *mode_option;
> +module_param_named(mode, mode_option, charp, 0);
> +MODULE_PARM_DESC(mode, "Initial mode");
> +
> +/*
> + * SM501 Mode
> + * 1024X600 is not defined in default mode(modedb.c).
> + */
> +static const struct fb_videomode sm501_modedb[] __initdata = {
> + {
> + /* 1024x600-60 */
> + NULL, 60, 1024, 600, 20423, 144, 40, 18, 1, 104, 3,
> + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
> + },
> + {
> + /* 1024x600-70 */
> + NULL, 70, 1024, 600, 17211, 152, 48, 21, 1, 104, 3,
> + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
> + },
> + {
> + /* 1024x600-75 */
> + NULL, 75, 1024, 600, 15822, 160, 56, 23, 1, 104, 3,
> + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
> + },
> + {
> + /* 1024x600-85 */
> + NULL, 85, 1024, 600, 13730, 168, 56, 26, 1, 112, 3,
> + FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
> + }
> +};
> +
> enum sm501_controller {
> HEAD_CRT = 0,
> HEAD_PANEL = 1,
> @@ -1729,8 +1760,16 @@ static int sm501fb_init_fb(struct fb_info *fb,
> fb->var.xres_virtual = fb->var.xres;
> fb->var.yres_virtual = fb->var.yres;
> } else {
> - ret = fb_find_mode(&fb->var, fb,
> - NULL, NULL, 0, NULL, 8);
> + if (mode_option) {
> + dev_info(info->dev, "using user defined mode:"
> + " %s\n", mode_option);
> + ret = fb_find_mode(&fb->var, fb,
> + mode_option, sm501_modedb,
> + ARRAY_SIZE(sm501_modedb),
> + NULL, fb->var.bits_per_pixel);
> + } else
> + ret = fb_find_mode(&fb->var, fb,
> + NULL, NULL, 0, NULL, 8);
>
> if (ret == 0 || ret == 4) {
> dev_err(info->dev,
> @@ -2136,8 +2175,32 @@ static struct platform_driver sm501fb_driver = {
> },
> };
>
> +#ifndef MODULE
> +static int __devinit sm501fb_setup(char *options)
> +{
> + char *this_opt;
> +
> + if (!options || !*options)
> + return 0;
> +
> + while ((this_opt = strsep(&options, ",")) != NULL) {
> + if (!*this_opt)
> + continue;
> + mode_option = this_opt;
> + }
> + return 0;
> +}
> +#endif
> +
> static int __devinit sm501fb_init(void)
> {
> +#ifndef MODULE
> + char *option = NULL;
> +
> + if (fb_get_options("sm501fb", &option))
> + return -ENODEV;
> + sm501fb_setup(option);
> +#endif
> return platform_driver_register(&sm501fb_driver);
> }
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 10/12] add the sm501fb option to sm501 fb driver
2010-05-05 12:15 ` Ben Dooks
@ 2010-05-05 12:32 ` Arnaud Patard
2010-05-05 13:17 ` yajin
0 siblings, 1 reply; 5+ messages in thread
From: Arnaud Patard @ 2010-05-05 12:32 UTC (permalink / raw)
To: Ben Dooks; +Cc: yajin, linux-mips
Ben Dooks <ben@simtec.co.uk> writes:
Hi,
> On 04/05/10 18:55, yajin wrote:
>> Currently the sm501 mode can only be fetched from modedb.c.
>> Unfortunately the modes in modedb.c are not complete. For example it
>> lacks the resolution of 1024x600. So the sm501 fb driver should have
>> the ability to accept the mode option from linux command line.
>
> Why not get this added to the main mode database instead of
> adding a new one into the sm501 driver?
fwiw, the original patch is putting it in the main database. Please
wait that all this stuff is sorted out. Theses patches are based on the
patches I'm working on and are adding some bugs in them.
Arnaud
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 10/12] add the sm501fb option to sm501 fb driver
2010-05-05 12:32 ` Arnaud Patard
@ 2010-05-05 13:17 ` yajin
2010-05-05 13:31 ` Arnaud Patard
0 siblings, 1 reply; 5+ messages in thread
From: yajin @ 2010-05-05 13:17 UTC (permalink / raw)
To: Arnaud Patard; +Cc: Ben Dooks, linux-mips
Hi,
>> Why not get this added to the main mode database instead of
>> adding a new one into the sm501 driver?
> fwiw, the original patch is putting it in the main database.
According to the Documentation/fb/modedb.txt, that's because the
modedb.c provides one generic video mode database with a fair amount
of standard videomodes. Yes, 1024x600 can be added to maindb, but I am
wondering whether it is a generic video mode. If so, there should be
1024x600 in main database already.
yajin
http://vm-kernel.org
2010/5/5 Arnaud Patard <apatard@mandriva.com>:
> Ben Dooks <ben@simtec.co.uk> writes:
>
> Hi,
>
>> On 04/05/10 18:55, yajin wrote:
>>> Currently the sm501 mode can only be fetched from modedb.c.
>>> Unfortunately the modes in modedb.c are not complete. For example it
>>> lacks the resolution of 1024x600. So the sm501 fb driver should have
>>> the ability to accept the mode option from linux command line.
>>
>> Why not get this added to the main mode database instead of
>> adding a new one into the sm501 driver?
>
> fwiw, the original patch is putting it in the main database. Please
> wait that all this stuff is sorted out. Theses patches are based on the
> patches I'm working on and are adding some bugs in them.
>
> Arnaud
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 10/12] add the sm501fb option to sm501 fb driver
2010-05-05 13:17 ` yajin
@ 2010-05-05 13:31 ` Arnaud Patard
0 siblings, 0 replies; 5+ messages in thread
From: Arnaud Patard @ 2010-05-05 13:31 UTC (permalink / raw)
To: yajin; +Cc: Ben Dooks, linux-mips
yajin <yajinzhou@vm-kernel.org> writes:
> Hi,
>
>>> Why not get this added to the main mode database instead of
>>> adding a new one into the sm501 driver?
>
>> fwiw, the original patch is putting it in the main database.
>
> According to the Documentation/fb/modedb.txt, that's because the
> modedb.c provides one generic video mode database with a fair amount
> of standard videomodes. Yes, 1024x600 can be added to maindb, but I am
> wondering whether it is a generic video mode. If so, there should be
afair it is fairly generic
> 1024x600 in main database already.
Not seeing a mode is the database doesn't mean it shouldn't go
there. It may only mean that nobody needed it before.
Arnaud
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-05-05 13:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-04 9:55 [PATCH 10/12] add the sm501fb option to sm501 fb driver yajin
2010-05-05 12:15 ` Ben Dooks
2010-05-05 12:32 ` Arnaud Patard
2010-05-05 13:17 ` yajin
2010-05-05 13:31 ` Arnaud Patard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox