diff options
author | Anton Vorontsov <avorontsov@ru.mvista.com> | 2008-04-28 05:14:49 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-28 11:58:35 -0400 |
commit | e4c690e061b909127ab0f12e929f82f3f39ec953 (patch) | |
tree | b798bbda541f615cd4830cad96ed3f58db1fd19c /drivers/video/fbmem.c | |
parent | 6b745b6fd02213f4b2fef2f2635985929fc5b8cc (diff) |
fb: add support for foreign endianness
Add support for the framebuffers with non-native endianness. This is done via
FBINFO_FOREIGN_ENDIAN flag that will be used by the drivers. Depending on the
host endianness this flag will be overwritten by FBINFO_BE_MATH internal flag,
or cleared.
Tested to work on MPC8360E-RDK (BE) + Fujitsu MINT framebuffer (LE).
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: <Valdis.Kletnieks@vt.edu>
Cc: Clemens Koller <clemens.koller@anagramm.de>
Cc: Krzysztof Helt <krzysztof.h1@poczta.fm>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/fbmem.c')
-rw-r--r-- | drivers/video/fbmem.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 01072f4b3e8f..279c2dbef8f8 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c | |||
@@ -1352,6 +1352,32 @@ static const struct file_operations fb_fops = { | |||
1352 | 1352 | ||
1353 | struct class *fb_class; | 1353 | struct class *fb_class; |
1354 | EXPORT_SYMBOL(fb_class); | 1354 | EXPORT_SYMBOL(fb_class); |
1355 | |||
1356 | static int fb_check_foreignness(struct fb_info *fi) | ||
1357 | { | ||
1358 | const bool foreign_endian = fi->flags & FBINFO_FOREIGN_ENDIAN; | ||
1359 | |||
1360 | fi->flags &= ~FBINFO_FOREIGN_ENDIAN; | ||
1361 | |||
1362 | #ifdef __BIG_ENDIAN | ||
1363 | fi->flags |= foreign_endian ? 0 : FBINFO_BE_MATH; | ||
1364 | #else | ||
1365 | fi->flags |= foreign_endian ? FBINFO_BE_MATH : 0; | ||
1366 | #endif /* __BIG_ENDIAN */ | ||
1367 | |||
1368 | if (fi->flags & FBINFO_BE_MATH && !fb_be_math(fi)) { | ||
1369 | pr_err("%s: enable CONFIG_FB_BIG_ENDIAN to " | ||
1370 | "support this framebuffer\n", fi->fix.id); | ||
1371 | return -ENOSYS; | ||
1372 | } else if (!(fi->flags & FBINFO_BE_MATH) && fb_be_math(fi)) { | ||
1373 | pr_err("%s: enable CONFIG_FB_LITTLE_ENDIAN to " | ||
1374 | "support this framebuffer\n", fi->fix.id); | ||
1375 | return -ENOSYS; | ||
1376 | } | ||
1377 | |||
1378 | return 0; | ||
1379 | } | ||
1380 | |||
1355 | /** | 1381 | /** |
1356 | * register_framebuffer - registers a frame buffer device | 1382 | * register_framebuffer - registers a frame buffer device |
1357 | * @fb_info: frame buffer info structure | 1383 | * @fb_info: frame buffer info structure |
@@ -1371,6 +1397,10 @@ register_framebuffer(struct fb_info *fb_info) | |||
1371 | 1397 | ||
1372 | if (num_registered_fb == FB_MAX) | 1398 | if (num_registered_fb == FB_MAX) |
1373 | return -ENXIO; | 1399 | return -ENXIO; |
1400 | |||
1401 | if (fb_check_foreignness(fb_info)) | ||
1402 | return -ENOSYS; | ||
1403 | |||
1374 | num_registered_fb++; | 1404 | num_registered_fb++; |
1375 | for (i = 0 ; i < FB_MAX; i++) | 1405 | for (i = 0 ; i < FB_MAX; i++) |
1376 | if (!registered_fb[i]) | 1406 | if (!registered_fb[i]) |