summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiarhei Siamashka <siarhei.siamashka@gmail.com>2013-01-03 11:53:15 +0400
committerAlejandro Mery <amery@geeks.cl>2013-01-06 18:45:03 +0400
commitbd9725272fabd96e4f79c5e1a5bf1771caa65ce9 (patch)
tree7a6ba68f51ad0becf27b49cb3074d7fdd69c881d
parentaf908788cc2201cd3269fcf51b0220027f4378ba (diff)
downloadlinux-sunxi-bd9725272fabd96e4f79c5e1a5bf1771caa65ce9.tar.xz
video: sunxi: fix green text in RGB565 framebuffer console
When the framebuffer is configured to use RGB565 format, the default text color was showing up green instead of gray. This was caused by incorrectly taking low bits instead of high bits when reducing color components from 8 bits to anything lower. === before === [ 42.610000] Fb_setcolreg,regno= 7,a=FF,r=AA,g=AA,b=AA, result=0000554A (0x554A = 01010 101010 01010) === after === [ 37.260000] Fb_setcolreg,regno= 7,a=FF,r=AA,g=AA,b=AA, result=0000AD55 (0xAD55 = 10101 101010 10101) Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com> Acked-by: Jari Helaakoski <tekkuli@gmail.com>
-rw-r--r--drivers/video/sunxi/disp/dev_fb.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/video/sunxi/disp/dev_fb.c b/drivers/video/sunxi/disp/dev_fb.c
index dc0bd4942213..66a89d013570 100644
--- a/drivers/video/sunxi/disp/dev_fb.c
+++ b/drivers/video/sunxi/disp/dev_fb.c
@@ -1122,7 +1122,7 @@ static int Fb_set_par(struct fb_info *info)
static inline __u32 convert_bitfield(int val, struct fb_bitfield *bf)
{
__u32 mask = ((1 << bf->length) - 1) << bf->offset;
- return (val << bf->offset) & mask;
+ return ((val >> (8 - bf->length)) << bf->offset) & mask;
}
static int Fb_setcolreg(unsigned regno, unsigned red, unsigned green,