diff --git a/sys/arch/i386/acpi/spic_acpi.c b/sys/arch/i386/acpi/spic_acpi.c index f7e5a4bd75a3..c1ae4296223c 100644 --- a/sys/arch/i386/acpi/spic_acpi.c +++ b/sys/arch/i386/acpi/spic_acpi.c @@ -1,4 +1,4 @@ -/* $NetBSD: spic_acpi.c,v 1.16 2006/11/16 01:32:38 christos Exp $ */ +/* $NetBSD: spic_acpi.c,v 1.17 2007/12/17 19:51:09 christos Exp $ */ /* * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: spic_acpi.c,v 1.16 2006/11/16 01:32:38 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: spic_acpi.c,v 1.17 2007/12/17 19:51:09 christos Exp $"); #include #include @@ -132,6 +132,11 @@ spic_acpi_attach(struct device *parent, struct device *self, void *aux) IST_EDGE, IPL_TTY, spic_intr, sc); #endif + if (!pmf_device_register(self, spic_suspend, spic_resume)) + aprint_error_dev(self, "couldn't establish power handler\n"); + else + pmf_class_input_register(self); + spic_attach(&sc->sc_spic); out: acpi_resource_cleanup(&res); diff --git a/sys/dev/ic/spic.c b/sys/dev/ic/spic.c index a9732c0f33c1..45bd7d1a92e5 100644 --- a/sys/dev/ic/spic.c +++ b/sys/dev/ic/spic.c @@ -1,4 +1,4 @@ -/* $NetBSD: spic.c,v 1.10 2007/12/09 20:28:00 jmcneill Exp $ */ +/* $NetBSD: spic.c,v 1.11 2007/12/17 19:51:10 christos Exp $ */ /* * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -56,7 +56,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: spic.c,v 1.10 2007/12/09 20:28:00 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: spic.c,v 1.11 2007/12/17 19:51:10 christos Exp $"); #include #include @@ -298,6 +298,28 @@ spic_attach(struct spic_softc *sc) return; } +bool +spic_suspend(device_t dev) +{ + struct spic_softc *sc = device_private(dev); + + callout_stop(&sc->sc_poll); + + return true; +} + +bool +spic_resume(device_t dev) +{ + struct spic_softc *sc = device_private(dev); + + spic_call1(sc, 0x82); + spic_call2(sc, 0x81, 0xff); + spic_call1(sc, 0x92); /* or 0x82 */ + + callout_reset(&sc->sc_poll, POLLRATE, spictimeout, sc); + return true; +} static int spic_enable(void *v) diff --git a/sys/dev/ic/spicvar.h b/sys/dev/ic/spicvar.h index 063a594ddb02..3b44f9bcd955 100644 --- a/sys/dev/ic/spicvar.h +++ b/sys/dev/ic/spicvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: spicvar.h,v 1.2 2006/06/20 15:35:11 jmcneill Exp $ */ +/* $NetBSD: spicvar.h,v 1.3 2007/12/17 19:51:10 christos Exp $ */ #include @@ -23,5 +23,7 @@ struct spic_softc { }; void spic_attach(struct spic_softc *); +bool spic_suspend(device_t); +bool spic_resume(device_t); int spic_intr(void *);