From: Ben Dooks <ben@simtec.co.uk>
To: yajin <yajinzhou@vm-kernel.org>
Cc: linux-mips@linux-mips.org
Subject: Re: [PATCH 10/12] add the sm501fb option to sm501 fb driver
Date: Wed, 05 May 2010 21:15:09 +0900 [thread overview]
Message-ID: <4BE1614D.1090008@simtec.co.uk> (raw)
In-Reply-To: <r2l180e2c241005040255mff483747jcef507aadea0cabd@mail.gmail.com>
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);
> }
>
next prev parent reply other threads:[~2010-05-05 12:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-04 9:55 [PATCH 10/12] add the sm501fb option to sm501 fb driver yajin
2010-05-05 12:15 ` Ben Dooks [this message]
2010-05-05 12:32 ` Arnaud Patard
2010-05-05 13:17 ` yajin
2010-05-05 13:31 ` Arnaud Patard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4BE1614D.1090008@simtec.co.uk \
--to=ben@simtec.co.uk \
--cc=linux-mips@linux-mips.org \
--cc=yajinzhou@vm-kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox