* vrc4172pwm_light(): workaround when brightness is max.
if light turn off, brightness must be minimum. * more DPRINTF().
This commit is contained in:
parent
36db62c9dc
commit
ed219529f5
|
@ -1,4 +1,4 @@
|
|||
/* $Id: vrc4172pwm.c,v 1.5 2001/02/15 03:20:10 sato Exp $ */
|
||||
/* $Id: vrc4172pwm.c,v 1.6 2001/02/16 12:31:46 sato Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000 SATO Kazumi. All rights reserved.
|
||||
|
@ -248,11 +248,19 @@ vrc4172pwm_light(sc, on)
|
|||
struct vrc4172pwm_softc *sc;
|
||||
int on;
|
||||
{
|
||||
int brightness;
|
||||
|
||||
DPRINTF(("vrc4172pwm_light: %s\n", on?"ON":"OFF"));
|
||||
if (on)
|
||||
if (on) {
|
||||
vrc4172pwm_set_brightness(sc, sc->sc_brightness);
|
||||
vrc4172pwm_write(sc, VRC2_PWM_LCDDUTYEN, VRC2_PWM_LCD_EN);
|
||||
else
|
||||
} else {
|
||||
brightness = sc->sc_brightness; /* save */
|
||||
vrc4172pwm_set_brightness(sc, 0);
|
||||
/* need this, break sc->sc_brightness */
|
||||
sc->sc_brightness = brightness; /* resume */
|
||||
vrc4172pwm_write(sc, VRC2_PWM_LCDDUTYEN, VRC2_PWM_LCD_DIS);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -352,24 +360,31 @@ vrc4172pwm_event(ctx, type, id, msg)
|
|||
|
||||
if (type == CONFIG_HOOK_POWERCONTROL
|
||||
&& id == CONFIG_HOOK_POWERCONTROL_LCDLIGHT) {
|
||||
VPRINTF(("vrc4172pwm:POWERCONTROL_LCDLIGHT: %d\n", why));
|
||||
vrc4172pwm_light(sc, why);
|
||||
} else if (type == CONFIG_HOOK_GET
|
||||
&& id == CONFIG_HOOK_POWER_LCDLIGHT) {
|
||||
*(int *)msg = vrc4172pwm_get_light(sc);
|
||||
VPRINTF(("vrc4172pwm:GET LCDLIGHT: %d\n", *(int *)msg));
|
||||
} else if (type == CONFIG_HOOK_GET
|
||||
&& id == CONFIG_HOOK_BRIGHTNESS) {
|
||||
*(int *)msg = vrc4172pwm_get_brightness(sc);
|
||||
VPRINTF(("vrc4172pwm:GET BRIGHTNESS: %d\n", *(int *)msg));
|
||||
} else if (type == CONFIG_HOOK_GET
|
||||
&& id == CONFIG_HOOK_BRIGHTNESS_MAX) {
|
||||
if (sc->sc_param == NULL)
|
||||
*(int *)msg = VRC2_PWM_MAX_BRIGHTNESS;
|
||||
else
|
||||
*(int *)msg = sc->sc_param->n_brightness-1;
|
||||
VPRINTF(("vrc4172pwm:GET MAX BRIGHTNESS: %d\n", *(int *)msg));
|
||||
} else if (type == CONFIG_HOOK_SET
|
||||
&& id == CONFIG_HOOK_BRIGHTNESS) {
|
||||
VPRINTF(("vrc4172pwm:SET BRIGHTNESS: %d\n", *(int *)msg));
|
||||
vrc4172pwm_set_brightness(sc, *(int *)msg);
|
||||
} else
|
||||
} else {
|
||||
VPRINTF(("vrc4172pwm:unknown event: type %d id %ld\n", type, id));
|
||||
return 1;
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue