Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci explicitly set and clear the backlight on bit, j...



details:   https://anonhg.NetBSD.org/src/rev/0e26541ebd97
branches:  trunk
changeset: 758806:0e26541ebd97
user:      macallan <macallan%NetBSD.org@localhost>
date:      Mon Nov 15 23:19:33 2010 +0000

description:
explicitly set and clear the backlight on bit, just in case someone messes
with it while we're not looking

diffstat:

 sys/dev/pci/r128fb.c |  15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diffs (58 lines):

diff -r a5b542481875 -r 0e26541ebd97 sys/dev/pci/r128fb.c
--- a/sys/dev/pci/r128fb.c      Mon Nov 15 23:10:51 2010 +0000
+++ b/sys/dev/pci/r128fb.c      Mon Nov 15 23:19:33 2010 +0000
@@ -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);



Home | Main Index | Thread Index | Old Index