diff options
author | Jordan Hargrave <jordan@cvs.openbsd.org> | 2006-02-22 17:21:34 +0000 |
---|---|---|
committer | Jordan Hargrave <jordan@cvs.openbsd.org> | 2006-02-22 17:21:34 +0000 |
commit | 0b1953b8e5af849c83ee8ecc360dbf3b9c1a2980 (patch) | |
tree | b21189eb98bd4e4ce08e9a3cf2c02eaab534e993 /sys/dev | |
parent | 23b49a8ff45c1b8b287f587df5db45c2c40f9311 (diff) |
Added notify callback for A/C device
ok marco@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/acpi/acpiac.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/sys/dev/acpi/acpiac.c b/sys/dev/acpi/acpiac.c index 48b4d5106ef..dff63b2301d 100644 --- a/sys/dev/acpi/acpiac.c +++ b/sys/dev/acpi/acpiac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpiac.c,v 1.5 2006/02/17 07:33:40 marco Exp $ */ +/* $OpenBSD: acpiac.c,v 1.6 2006/02/22 17:21:33 jordan Exp $ */ /* * Copyright (c) 2005 Marco Peereboom <marco@openbsd.org> * @@ -30,8 +30,9 @@ #include <sys/sensors.h> -int acpiac_match(struct device *, void *, void *); +int acpiac_match(struct device *, void *, void *); void acpiac_attach(struct device *, struct device *, void *); +int acpiac_notify(struct aml_node *, int, void *); struct acpiac_softc { struct device sc_dev; @@ -82,6 +83,8 @@ acpiac_attach(struct device *parent, struct device *self, void *aux) sc->sc_acpi = (struct acpi_softc *)parent; sc->sc_devnode = aa->aaa_node->child; + aml_register_notify(sc->sc_devnode->parent, acpiac_notify, sc); + acpiac_getsta(sc); printf(": "); @@ -129,7 +132,6 @@ acpiac_getsta(struct acpiac_softc *sc) if (aml_eval_name(sc->sc_acpi, sc->sc_devnode, "_STA", &res, &env)) { dnprintf(10, "%s: no _STA\n", DEVNAME(sc)); - return (1); } if (aml_eval_name(sc->sc_acpi, sc->sc_devnode, "_PSR", &res, &env)) { @@ -142,3 +144,23 @@ acpiac_getsta(struct acpiac_softc *sc) return (0); } + +int +acpiac_notify(struct aml_node *node, int notify_type, void *arg) +{ + struct acpiac_softc *sc = arg; + int oldstat; + + dnprintf(10, "acpiac_notify: %.2x %s\n", notify_type, + sc->sc_devnode->parent->name); + + switch (notify_type) { + case 0x80: + oldstat = sc->sc_ac_stat; + acpiac_getsta(sc); + dnprintf(10, "A/C status: old:%d new:%d\n", oldstat, + sc->sc_ac_stat); + break; + } + return (0); +} |