summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2004-03-17 15:48:00 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2004-03-17 15:48:00 +0000
commit4178fafc54052e6ef54592de97c1a70cc89a3256 (patch)
tree67c58bc205b33ead8ec5807725718d33df78b0ee
parent9644ef019dd4f628919da5b1ebabbd88956371d7 (diff)
Better backlight detection on macppc, ok miod@ krw@ (a bit ago)
-rw-r--r--sys/arch/macppc/macppc/ofw_machdep.c7
-rw-r--r--sys/arch/macppc/pci/vgafb.c12
2 files changed, 12 insertions, 7 deletions
diff --git a/sys/arch/macppc/macppc/ofw_machdep.c b/sys/arch/macppc/macppc/ofw_machdep.c
index db08255a181..bd2aceb1852 100644
--- a/sys/arch/macppc/macppc/ofw_machdep.c
+++ b/sys/arch/macppc/macppc/ofw_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofw_machdep.c,v 1.23 2003/10/30 03:17:54 itojun Exp $ */
+/* $OpenBSD: ofw_machdep.c,v 1.24 2004/03/17 15:47:59 drahn Exp $ */
/* $NetBSD: ofw_machdep.c,v 1.1 1996/09/30 16:34:50 ws Exp $ */
/*
@@ -546,7 +546,7 @@ of_display_console()
}
}
- if (OF_finddevice("/backlight") != 0)
+ if (OF_getnodebyname(0, "backlight") != 0)
cons_backlight_available = 1;
memtag = ofw_make_tag(NULL, pcibus(addr[0].phys_hi),
@@ -594,7 +594,8 @@ of_display_console()
#endif
}
- of_setbrightness(DEFAULT_BRIGHTNESS);
+ if (cons_backlight_available == 1)
+ of_setbrightness(DEFAULT_BRIGHTNESS);
#endif
}
diff --git a/sys/arch/macppc/pci/vgafb.c b/sys/arch/macppc/pci/vgafb.c
index 3bfef2eba27..bd8b957b9aa 100644
--- a/sys/arch/macppc/pci/vgafb.c
+++ b/sys/arch/macppc/pci/vgafb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vgafb.c,v 1.22 2003/10/24 20:02:45 drahn Exp $ */
+/* $OpenBSD: vgafb.c,v 1.23 2004/03/17 15:47:59 drahn Exp $ */
/* $NetBSD: vga.c,v 1.3 1996/12/02 22:24:54 cgd Exp $ */
/*
@@ -303,8 +303,11 @@ vgafb_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
switch (dp->param) {
case WSDISPLAYIO_PARAM_BRIGHTNESS:
- of_setbrightness(dp->curval);
- return 0;
+ if (cons_backlight_available == 1) {
+ of_setbrightness(dp->curval);
+ return 0;
+ } else
+ return -1;
case WSDISPLAYIO_PARAM_BACKLIGHT:
if (cons_backlight_available != 0) {
vgafb_burn(vc,
@@ -505,7 +508,8 @@ vgafb_burn(void *v, u_int on, u_int flags)
{
struct vgafb_config *vc = v;
- if (vc->vc_backlight_on != on) {
+ if (cons_backlight_available == 1 &&
+ vc->vc_backlight_on != on) {
if (on == WSDISPLAYIO_VIDEO_ON) {
OF_call_method_1("backlight-on", cons_display_ofh, 0);
} else {