Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

offb: Add palette hack for little endian

The pseudo palette color entries need to be ajusted for little
endian.

This patch byteswaps the values in the pseudo palette depending
on the host endian order and the screen depth.

Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

authored by

Cedric Le Goater and committed by
Benjamin Herrenschmidt
e1edf18b 212c0cbd

+10 -1
+10 -1
drivers/video/offb.c
··· 91 91 #define AVIVO_DC_LUTB_WHITE_OFFSET_GREEN 0x6cd4 92 92 #define AVIVO_DC_LUTB_WHITE_OFFSET_RED 0x6cd8 93 93 94 + #define FB_RIGHT_POS(p, bpp) (fb_be_math(p) ? 0 : (32 - (bpp))) 95 + 96 + static inline u32 offb_cmap_byteswap(struct fb_info *info, u32 value) 97 + { 98 + u32 bpp = info->var.bits_per_pixel; 99 + 100 + return cpu_to_be32(value) >> FB_RIGHT_POS(info, bpp); 101 + } 102 + 94 103 /* 95 104 * Set a single color register. The values supplied are already 96 105 * rounded down to the hardware's capabilities (according to the ··· 129 120 mask <<= info->var.transp.offset; 130 121 value |= mask; 131 122 } 132 - pal[regno] = value; 123 + pal[regno] = offb_cmap_byteswap(info, value); 133 124 return 0; 134 125 } 135 126