fb: SM501 framebuffer driver
PATCH 1/1 fb: SM501 framebuffer driver
Framebuffer support for the Silicon Motion SM501 multi-function chip.
This driver provides a pair of framebuffer interfaces for the CRT and LCD panel interfaces, and some basic acceleration for the cursor.
The patch has been updated slightly from the previous version to including being able to pass an initial video mode through via the platform data.
drivers/video/Kconfig +18 -0
@@ -1600,6 +1600,24 @@ config FB_S3C2410_DEBUG Turn on debugging messages. Note that you can set/unset at run time through sysfs +config FB_SM501 + tristate "Silicon Motion SM501 framebuffer support" + depends on FB && MFD_SM501 + select FB_CFB_FILLRECT + select FB_CFB_COPYAREA + select FB_CFB_IMAGEBLIT + ---help--- + Frame buffer driver for the CRT and LCD controllers in the Silicon + Motion SM501. + + 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 sm501fb. If you want to compile it as a module, + say M here and read <file:Documentation/modules.txt>. + + If unsure, say N. + + config FB_PNX4008_DUM tristate "Display Update Module support on Philips PNX4008 board" depends on FB && ARCH_PNX4008
drivers/video/Makefile +1 -0
@@ -100,6 +100,7 @@ obj-$(CONFIG_FB_S3C2410) += s3c2410fb. obj-$(CONFIG_FB_PNX4008_DUM) += pnx4008/ obj-$(CONFIG_FB_PNX4008_DUM_RGB) += pnx4008/ obj-$(CONFIG_FB_IBM_GXT4500) += gxt4500.o +obj-$(CONFIG_FB_SM501) += sm501fb.o # Platform or fallback drivers go here obj-$(CONFIG_FB_VESA) += vesafb.o
drivers/video/sm501fb.c +1809 -0
1,809 lines not on this page · raw message
Quoted 24 lines
Framebuffer support for the Silicon Motion SM501 multi-function chip.
This driver provides a pair of framebuffer interfaces for the CRT and LCD panel interfaces, and some basic acceleration for the cursor.
The patch has been updated slightly from the previous version to including being able to pass an initial video mode through via the platform data.
Signed-off-by Ben Dooks <[email protected]>Signed-off-by Vincent Sanders <[email protected]>+ *
+ * Converts a period in picoseconds to Hz.
+ *
+ * Note, we try to keep this in Hz to minimise rounding with
+ * the limited PLL settings on the SM501.drivers/video/sm501fb.c +4
-0+*/ + +static unsigned long sm501fb_ps_to_hz (unsigned long psvalue) +{
drivers/video/sm501fb.c line 202
Quoted 10 lines
drivers/video/sm501fb.c +10
-0+unsigned long long numerator=1000000000000ULL ; + +/* 10^12 / picosecond period gives frequency in Hz */ +do_div (numerator, psvalue); +return (unsigned long )numerator; +} + +/* sm501fb_hz_to_ps is identical to the oposite transform */ + +#define sm501fb_hz_to_ps (x) sm501fb_ps_to_hz(x)
You really need it down to the Hz?
Quoted 6 lines
drivers/video/sm501fb.c +6
-0+/* sm501fb_validate_pan +* +* check panning on a var +*/ + +static inline int sm501fb_validate_pan (struct fb_var_screeninfo *var)
drivers/video/sm501fb.c line 514
Quoted 10 lines
drivers/video/sm501fb.c +10
-0+{ +if (var->xoffset <0 || var->yoffset <0 ) +return 0 ; + +if (var->xoffset > (var->xres_virtual - var->xres) || + var->yoffset > (var->yres_virtual - var->yres)) +return 0 ; + +return 1 ; +}
Not needed. fb_pan_display in fbmem.c does this check for you :-)
Quoted 17 lines
drivers/video/sm501fb.c +17
-0+/* framebuffer ops */ + +static struct fb_ops sm501fb_ops_crt = { + .owner =THIS_MODULE , + .fb_check_var = sm501fb_check_var_crt, + .fb_set_par = sm501fb_set_par_crt, + .fb_blank = sm501fb_blank_crt, + .fb_setcolreg = sm501fb_setcolreg, + .fb_pan_display = sm501fb_pan_crt, + .fb_cursor = sm501fb_cursor, + .fb_fillrect = cfb_fillrect, + .fb_copyarea = cfb_copyarea, + .fb_imageblit = cfb_imageblit, +}; + +static struct fb_ops sm501fb_ops_pnl = { + .owner =THIS_MODULE ,
drivers/video/sm501fb.c line 1211
Quoted 10 lines
drivers/video/sm501fb.c +10
-0+ .fb_check_var = sm501fb_check_var_pnl, + .fb_set_par = sm501fb_set_par_pnl, + .fb_pan_display = sm501fb_pan_pnl, + .fb_blank = sm501fb_blank_pnl, + .fb_setcolreg = sm501fb_setcolreg, + .fb_cursor = sm501fb_cursor, + .fb_fillrect = cfb_fillrect, + .fb_copyarea = cfb_copyarea, + .fb_imageblit = cfb_imageblit, +};
Many cards require a fb_sync function after/before they do a drawing operation. I notice you don't have one. Is sm501fb_sync_regs equivalent to that?
Other than that the driver looks great. Thank you.
Quoted 28 lines · James Simmons
Quoted 28 lines
Framebuffer support for the Silicon Motion SM501 multi-function chip.
This driver provides a pair of framebuffer interfaces for the CRT and LCD panel interfaces, and some basic acceleration for the cursor.
The patch has been updated slightly from the previous version to including being able to pass an initial video mode through via the platform data.
Signed-off-by Ben Dooks <[email protected]>Signed-off-by Vincent Sanders <[email protected]>+ *
+ * Converts a period in picoseconds to Hz.
+ *
+ * Note, we try to keep this in Hz to minimise rounding with
+ * the limited PLL settings on the SM501.drivers/video/sm501fb.c +8
-0+*/ + +static unsigned long sm501fb_ps_to_hz (unsigned long psvalue) +{ +unsigned long long numerator=1000000000000ULL ; + +/* 10^12 / picosecond period gives frequency in Hz */ +do_div (numerator, psvalue);
Quoted 8 lines
drivers/video/sm501fb.c line 202
Quoted 6 lines
drivers/video/sm501fb.c +6
-0+return (unsigned long )numerator; +} + +/* sm501fb_hz_to_ps is identical to the oposite transform */ + +#define sm501fb_hz_to_ps (x) sm501fb_ps_to_hz(x)You really need it down to the Hz?
My feeling is that we lose enough with the rather fixed nature of the frequency selection that we should keep the calculations as accurate as possible. It isn't a big loss to have 64bit calcs as we don't change mode that often.
Quoted 10 lines
Quoted 10 lines
drivers/video/sm501fb.c +10
-0+/* sm501fb_validate_pan +* +* check panning on a var +*/ + +static inline int sm501fb_validate_pan (struct fb_var_screeninfo *var) +{ +if (var->xoffset <0 || var->yoffset <0 ) +return 0 ; +
Quoted 8 lines
drivers/video/sm501fb.c line 514
Quoted 6 lines
drivers/video/sm501fb.c +6
-0+if (var->xoffset > (var->xres_virtual - var->xres) || + var->yoffset > (var->yres_virtual - var->yres)) +return 0 ; + +return 1 ; +}Not needed.
fb_pan_displayinfbmem.cdoes this check for you :-)
Ok, will look at removing
Quoted 23 lines
Quoted 23 lines
drivers/video/sm501fb.c +23
-0+/* framebuffer ops */ + +static struct fb_ops sm501fb_ops_crt = { + .owner =THIS_MODULE , + .fb_check_var = sm501fb_check_var_crt, + .fb_set_par = sm501fb_set_par_crt, + .fb_blank = sm501fb_blank_crt, + .fb_setcolreg = sm501fb_setcolreg, + .fb_pan_display = sm501fb_pan_crt, + .fb_cursor = sm501fb_cursor, + .fb_fillrect = cfb_fillrect, + .fb_copyarea = cfb_copyarea, + .fb_imageblit = cfb_imageblit, +}; + +static struct fb_ops sm501fb_ops_pnl = { + .owner =THIS_MODULE , + .fb_check_var = sm501fb_check_var_pnl, + .fb_set_par = sm501fb_set_par_pnl, + .fb_pan_display = sm501fb_pan_pnl, + .fb_blank = sm501fb_blank_pnl, + .fb_setcolreg = sm501fb_setcolreg, + .fb_cursor = sm501fb_cursor,
Quoted 8 lines
drivers/video/sm501fb.c line 1198
Quoted 4 lines
drivers/video/sm501fb.c +4
-0+ .fb_fillrect = cfb_fillrect, + .fb_copyarea = cfb_copyarea, + .fb_imageblit = cfb_imageblit, +};Many cards require a
fb_syncfunction after/before they do a drawing operation. I notice you don't have one. Issm501fb_sync_regsequivalent to that?
That, iirc, is only needed for acceleration functions that may change the fb data before any of the non-accelerated ops happen. Basically, it is for the card to hold off any non-accelerated drawing until the acceleration unit has finished.
Quoted 1 line
Other than that the driver looks great. Thank you.
I really hope we can get this merged this kernel release.
Signature · 9 lines
Ben ([email protected], http://www.fluff.org/) 'a smiley only costs 4 bytes' ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642