Date: Fri, 22 Jun 2018 09:20:51 +0000 (UTC) From: Andriy Gapon <avg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r335538 - stable/10/sys/dev/amdsbwd Message-ID: <201806220920.w5M9KpXL030716@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: avg Date: Fri Jun 22 09:20:50 2018 New Revision: 335538 URL: https://svnweb.freebsd.org/changeset/base/335538 Log: MFC r333212: amdsbwd: add suspend and resume methods Modified: stable/10/sys/dev/amdsbwd/amdsbwd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/amdsbwd/amdsbwd.c ============================================================================== --- stable/10/sys/dev/amdsbwd/amdsbwd.c Fri Jun 22 09:20:00 2018 (r335537) +++ stable/10/sys/dev/amdsbwd/amdsbwd.c Fri Jun 22 09:20:50 2018 (r335538) @@ -100,12 +100,16 @@ static void amdsbwd_identify(driver_t *driver, device_ 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 @@ -549,3 +553,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); +}
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806220920.w5M9KpXL030716>