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

drivers/video/ssd1307fb.c: fix bit order bug in the byte translation function

This was leading to a strange behaviour when using the fbcon driver on
top of this one: the letters were in the right order, but each letter
had a vertical symmetry.

This was because the addressing was right for the byte, but the
addressing of each individual bit was inverted.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Brian Lilly <brian@crystalfontz.com>
Cc: Greg Kroah-Hartman <gregkh@linux-foundation.org>
Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Thomas Petazzoni <thomas@free-electrons.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Maxime Ripard and committed by
Linus Torvalds
552f0cc7 04fa5d6a

+2 -2
+2 -2
drivers/video/ssd1307fb.c
··· 145 145 u32 page_length = SSD1307FB_WIDTH * i; 146 146 u32 index = page_length + (SSD1307FB_WIDTH * k + j) / 8; 147 147 u8 byte = *(vmem + index); 148 - u8 bit = byte & (1 << (7 - (j % 8))); 149 - bit = bit >> (7 - (j % 8)); 148 + u8 bit = byte & (1 << (j % 8)); 149 + bit = bit >> (j % 8); 150 150 buf |= bit << k; 151 151 } 152 152 ssd1307fb_write_data(par->client, buf);