from jmcneill: suspend and resume handlers for spic.

This commit is contained in:
christos 2007-12-17 19:51:09 +00:00
parent 8797c0442b
commit 6d8587f061
3 changed files with 34 additions and 5 deletions

View File

@ -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 <sys/cdefs.h>
__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 <sys/param.h>
#include <sys/systm.h>
@ -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);

View File

@ -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 <sys/cdefs.h>
__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 <sys/param.h>
#include <sys/systm.h>
@ -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)

View File

@ -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 <dev/sysmon/sysmonvar.h>
@ -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 *);