diff options
| author | Andriy Gapon <avg@FreeBSD.org> | 2018-05-03 15:33:18 +0000 |
|---|---|---|
| committer | Andriy Gapon <avg@FreeBSD.org> | 2018-05-03 15:33:18 +0000 |
| commit | 9a042dbc6e7b60c934b60955ae73c120449c3705 (patch) | |
| tree | de394b559351c2bf867a9790fae6953bc5ddce9e /sys/dev/amdsbwd | |
| parent | 68ff29affa74c572554899737999cf50830746c4 (diff) | |
Notes
Diffstat (limited to 'sys/dev/amdsbwd')
| -rw-r--r-- | sys/dev/amdsbwd/amdsbwd.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/sys/dev/amdsbwd/amdsbwd.c b/sys/dev/amdsbwd/amdsbwd.c index 16466627abe1..4676d9f6ba31 100644 --- a/sys/dev/amdsbwd/amdsbwd.c +++ b/sys/dev/amdsbwd/amdsbwd.c @@ -104,12 +104,16 @@ static void amdsbwd_identify(driver_t *driver, device_t parent); static int amdsbwd_probe(device_t dev); static int amdsbwd_attach(device_t dev); static int amdsbwd_detach(device_t dev); +static int amdsbwd_suspend(device_t dev); +static int amdsbwd_resume(device_t dev); static device_method_t amdsbwd_methods[] = { DEVMETHOD(device_identify, amdsbwd_identify), DEVMETHOD(device_probe, amdsbwd_probe), DEVMETHOD(device_attach, amdsbwd_attach), DEVMETHOD(device_detach, amdsbwd_detach), + DEVMETHOD(device_suspend, amdsbwd_suspend), + DEVMETHOD(device_resume, amdsbwd_resume), #if 0 DEVMETHOD(device_shutdown, amdsbwd_detach), #endif @@ -553,3 +557,30 @@ amdsbwd_detach(device_t dev) return (0); } +static int +amdsbwd_suspend(device_t dev) +{ + struct amdsbwd_softc *sc; + uint32_t val; + + sc = device_get_softc(dev); + val = wdctrl_read(sc); + val &= ~AMDSB_WD_RUN; + wdctrl_write(sc, val); + return (0); +} + +static int +amdsbwd_resume(device_t dev) +{ + struct amdsbwd_softc *sc; + + sc = device_get_softc(dev); + wdctrl_write(sc, AMDSB_WD_FIRED); + if (sc->active) { + amdsbwd_tmr_set(sc, sc->timeout); + amdsbwd_tmr_enable(sc); + amdsbwd_tmr_reload(sc); + } + return (0); +} |
