Date: Sun, 18 May 2025 13:39:58 GMT From: Tijl Coosemans <tijl@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: d9900b9ea2b2 - main - snd_hda: Add shutdown method Message-ID: <202505181339.54IDdwQ5081573@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by tijl: URL: https://cgit.FreeBSD.org/src/commit/?id=d9900b9ea2b27f7a0c2eda97841b9499e02e3ea7 commit d9900b9ea2b27f7a0c2eda97841b9499e02e3ea7 Author: Tijl Coosemans <tijl@FreeBSD.org> AuthorDate: 2025-05-18 13:38:02 +0000 Commit: Tijl Coosemans <tijl@FreeBSD.org> CommitDate: 2025-05-18 13:38:02 +0000 snd_hda: Add shutdown method Power down the device on shutdown similar to what is done in the case of suspend. The device may fail to attach on next boot without this. PR: 286385 Reviewed by: christos, adrian Differential Revision: https://reviews.freebsd.org/D50306 --- sys/dev/sound/pci/hda/hdac.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/sys/dev/sound/pci/hda/hdac.c b/sys/dev/sound/pci/hda/hdac.c index 602f5df93648..8714f615f846 100644 --- a/sys/dev/sound/pci/hda/hdac.c +++ b/sys/dev/sound/pci/hda/hdac.c @@ -1638,6 +1638,35 @@ hdac_attach2(void *arg) sizeof(sc->dev), sysctl_hdac_polling, "I", "Enable polling mode"); } +/**************************************************************************** + * int hdac_shutdown(device_t) + * + * Power down HDA bus and codecs. + ****************************************************************************/ +static int +hdac_shutdown(device_t dev) +{ + struct hdac_softc *sc = device_get_softc(dev); + + HDA_BOOTHVERBOSE( + device_printf(dev, "Shutdown...\n"); + ); + callout_drain(&sc->poll_callout); + taskqueue_drain(taskqueue_thread, &sc->unsolq_task); + bus_generic_shutdown(dev); + + hdac_lock(sc); + HDA_BOOTHVERBOSE( + device_printf(dev, "Reset controller...\n"); + ); + hdac_reset(sc, false); + hdac_unlock(sc); + HDA_BOOTHVERBOSE( + device_printf(dev, "Shutdown done\n"); + ); + return (0); +} + /**************************************************************************** * int hdac_suspend(device_t) * @@ -2148,6 +2177,7 @@ static device_method_t hdac_methods[] = { DEVMETHOD(device_probe, hdac_probe), DEVMETHOD(device_attach, hdac_attach), DEVMETHOD(device_detach, hdac_detach), + DEVMETHOD(device_shutdown, hdac_shutdown), DEVMETHOD(device_suspend, hdac_suspend), DEVMETHOD(device_resume, hdac_resume), /* Bus interface */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202505181339.54IDdwQ5081573>