Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/hpcmips/vr * vrc4172pwm_get_light() return the valu...



details:   https://anonhg.NetBSD.org/src/rev/e5d93e054892
branches:  trunk
changeset: 507040:e5d93e054892
user:      sato <sato%NetBSD.org@localhost>
date:      Mon Mar 12 08:46:27 2001 +0000

description:
* vrc4172pwm_get_light() return the value masked by VRC2_PWM_LCDEN_MASK.
* when resume from suepend, restore saved value instead of always on.

diffstat:

 sys/arch/hpcmips/vr/vrc4172pwm.c    |  13 ++++++++-----
 sys/arch/hpcmips/vr/vrc4172pwmvar.h |  10 ++++++----
 2 files changed, 14 insertions(+), 9 deletions(-)

diffs (76 lines):

diff -r bb2ea0a7507d -r e5d93e054892 sys/arch/hpcmips/vr/vrc4172pwm.c
--- a/sys/arch/hpcmips/vr/vrc4172pwm.c  Mon Mar 12 05:56:15 2001 +0000
+++ b/sys/arch/hpcmips/vr/vrc4172pwm.c  Mon Mar 12 08:46:27 2001 +0000
@@ -1,4 +1,4 @@
-/*     $Id: vrc4172pwm.c,v 1.9 2001/03/06 03:14:39 sato Exp $  */
+/*     $Id: vrc4172pwm.c,v 1.10 2001/03/12 08:46:27 sato Exp $ */
 
 /*
  * Copyright (c) 2000,2001 SATO Kazumi. All rights reserved.
@@ -270,7 +270,8 @@
        sc->sc_raw_freq = vrc4172pwm_read(sc, VRC2_PWM_LCDFREQ);
        sc->sc_raw_duty = vrc4172pwm_read(sc, VRC2_PWM_LCDDUTY);
        sc->sc_brightness = vrc4172pwm_rawduty2brightness(sc);
-       DPRINTF(("vrc4172pwm_init_brightness: param=0x%x, freq=0x%x, duty=0x%x, blightness=%d\n", (int)sc->sc_param, sc->sc_raw_freq, sc->sc_raw_duty, sc->sc_brightness));
+       sc->sc_light = vrc4172pwm_get_light(sc);
+       DPRINTF(("vrc4172pwm_init_brightness: param=0x%x, freq=0x%x, duty=0x%x, blightness=%d light=%d\n", (int)sc->sc_param, sc->sc_raw_freq, sc->sc_raw_duty, sc->sc_brightness, sc->sc_light));
 }
 /*
  * backlight on/off
@@ -293,16 +294,17 @@
                sc->sc_brightness = brightness; /* resume */
                vrc4172pwm_write(sc, VRC2_PWM_LCDDUTYEN, VRC2_PWM_LCD_DIS);
        }
+       sc->sc_light = on;
 }
 
 /*
  * get backlight on/off
  */
-inline int
+int
 vrc4172pwm_get_light(sc)
        struct vrc4172pwm_softc *sc;
 {
-       return vrc4172pwm_read(sc, VRC2_PWM_LCDDUTYEN);
+       return VRC2_PWM_LCDEN_MASK&vrc4172pwm_read(sc, VRC2_PWM_LCDDUTYEN);
 }
 
 /*
@@ -442,10 +444,11 @@
         switch (why) {
        case PWR_STANDBY:
        case PWR_SUSPEND:
+               sc->sc_light_save = sc->sc_light;
                vrc4172pwm_light(sc, 0);
                break;
        case PWR_RESUME:
-               vrc4172pwm_light(sc, 1);
+               vrc4172pwm_light(sc, sc->sc_light_save);
                break;
        default:
                return 1;
diff -r bb2ea0a7507d -r e5d93e054892 sys/arch/hpcmips/vr/vrc4172pwmvar.h
--- a/sys/arch/hpcmips/vr/vrc4172pwmvar.h       Mon Mar 12 05:56:15 2001 +0000
+++ b/sys/arch/hpcmips/vr/vrc4172pwmvar.h       Mon Mar 12 08:46:27 2001 +0000
@@ -1,4 +1,4 @@
-/*     $Id: vrc4172pwmvar.h,v 1.5 2001/02/27 08:48:38 sato Exp $       */
+/*     $Id: vrc4172pwmvar.h,v 1.6 2001/03/12 08:46:27 sato Exp $       */
 
 /*
  * Copyright (c) 2000,2001 SATO Kazumi.  All rights reserved.
@@ -49,9 +49,11 @@
        config_hook_tag sc_getmaxhook;
        config_hook_tag sc_sethook;
        config_hook_tag sc_pmhook;
-       int sc_brightness;
-       int sc_raw_duty;
-       int sc_raw_freq;
+       int sc_light;                   /* backlight on/off */
+       int sc_light_save;              /* backlight on/off value when suspend*/
+       int sc_brightness;              /* backlight brightness */
+       int sc_raw_duty;                /* backlight plus gen. duty */
+       int sc_raw_freq;                /* backligjy plus gen. freq. */
        struct vrc4172pwm_param *sc_param;
 };
 



Home | Main Index | Thread Index | Old Index