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

sm501fb: clear framebuffer memory and palette

Avoid displaying garbage on unused framebuffers. For most users a single
framebuffer is used together with fbcon. sm501fb supports two framebuffers
where one often is assigned to fbcon and the other one is left unused during
the boot.

The problem here is that framebuffers not in use by fbcon happen to display
garbage. This can easily be solved by making sure that framebuffer memory and
palette ram are cleared.

The problem can be observed by using looking at the panel output (fb1) after
booting the kernel with fbcon on crt (fb0). This is the default
configuration. It's also possible to watch the garbage on the crt framebuffer
by passing "fbcon=map:1" on the kernel cmdline. This will assign fbcon to the
panel (fb1) and leave the crt (fb0) unused.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Magnus Damm and committed by
Linus Torvalds
b1230ee5 dfcffa46

+8
+8
drivers/video/sm501fb.c
··· 1276 1276 { 1277 1277 struct resource *res; 1278 1278 struct device *dev; 1279 + int k; 1279 1280 int ret; 1280 1281 1281 1282 info->dev = dev = &pdev->dev; ··· 1337 1336 } 1338 1337 1339 1338 info->fbmem_len = (res->end - res->start)+1; 1339 + 1340 + /* clear framebuffer memory - avoids garbage data on unused fb */ 1341 + memset(info->fbmem, 0, info->fbmem_len); 1342 + 1343 + /* clear palette ram - undefined at power on */ 1344 + for (k = 0; k < (256 * 3); k++) 1345 + writel(0, info->regs + SM501_DC_PANEL_PALETTE + (k * 4)); 1340 1346 1341 1347 /* enable display controller */ 1342 1348 sm501_unit_power(dev->parent, SM501_GATE_DISPLAY, 1);