Module Name: src
Committed By: macallan
Date: Mon Nov 15 23:19:33 UTC 2010
Modified Files:
src/sys/dev/pci: r128fb.c
Log Message:
explicitly set and clear the backlight on bit, just in case someone messes
with it while we're not looking
To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pci/r128fb.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/pci/r128fb.c
diff -u src/sys/dev/pci/r128fb.c:1.15 src/sys/dev/pci/r128fb.c:1.16
--- src/sys/dev/pci/r128fb.c:1.15 Sat Nov 13 13:52:08 2010
+++ src/sys/dev/pci/r128fb.c Mon Nov 15 23:19:33 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: r128fb.c,v 1.15 2010/11/13 13:52:08 uebayasi Exp $ */
+/* $NetBSD: r128fb.c,v 1.16 2010/11/15 23:19:33 macallan Exp $ */
/*
* Copyright (c) 2007 Michael Lorenz
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: r128fb.c,v 1.15 2010/11/13 13:52:08 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: r128fb.c,v 1.16 2010/11/15 23:19:33 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -306,8 +306,9 @@
/* no suspend/resume support yet */
pmf_device_register(sc->sc_dev, NULL, NULL);
+
reg = bus_space_read_4(sc->sc_memt, sc->sc_regh, R128_LVDS_GEN_CNTL);
- DPRINTF("reg: %08x\n", reg);
+ DPRINTF("R128_LVDS_GEN_CNTL: %08x\n", reg);
if (reg & R128_LVDS_ON) {
sc->sc_have_backlight = 1;
sc->sc_bl_on = 1;
@@ -381,6 +382,7 @@
if (new_mode != sc->sc_mode) {
sc->sc_mode = new_mode;
if(new_mode == WSDISPLAYIO_MODE_EMUL) {
+ r128fb_init(sc);
r128fb_restore_palette(sc);
vcons_redraw_screen(ms);
}
@@ -957,7 +959,8 @@
level = 255 - level;
reg = bus_space_read_4(sc->sc_memt, sc->sc_regh, R128_LVDS_GEN_CNTL);
reg &= ~R128_LEVEL_MASK;
- reg |= level << R128_LEVEL_SHIFT;
+ reg |= (level << R128_LEVEL_SHIFT) |
+ (level != 255 ? R128_LVDS_BLON : 0);
bus_space_write_4(sc->sc_memt, sc->sc_regh, R128_LVDS_GEN_CNTL, reg);
DPRINTF("backlight level: %d reg %08x\n", level, reg);
}
@@ -973,6 +976,10 @@
sc->sc_bl_on = on;
reg = bus_space_read_4(sc->sc_memt, sc->sc_regh, R128_LVDS_GEN_CNTL);
reg &= ~R128_LEVEL_MASK;
+ if (on) {
+ reg |= R128_LVDS_BLON;
+ } else
+ reg &= ~R128_LVDS_BLON;
level = on ? 255 - sc->sc_bl_level : 255;
reg |= level << R128_LEVEL_SHIFT;
bus_space_write_4(sc->sc_memt, sc->sc_regh, R128_LVDS_GEN_CNTL, reg);