git: adf77cb48e4c - releng/14.3 - snd_hda: Add shutdown method
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 21 May 2025 23:22:47 UTC
The branch releng/14.3 has been updated by christos:
URL: https://cgit.FreeBSD.org/src/commit/?id=adf77cb48e4c265f366fb0f290b597fdd0dfdc68
commit adf77cb48e4c265f366fb0f290b597fdd0dfdc68
Author: Tijl Coosemans <tijl@FreeBSD.org>
AuthorDate: 2025-05-18 13:38:02 +0000
Commit: Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2025-05-21 23:21:42 +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
(cherry picked from commit d9900b9ea2b27f7a0c2eda97841b9499e02e3ea7)
(cherry picked from commit 77521692f4c71213c5419268657e696532c28325)
Approved by: re (cperciva)
---
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 904e3b2001c7..25e320aae3dc 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)
*
@@ -2155,6 +2184,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 */