Most audio drivers were incorrectly (or not at all) informing their children
authorderaadt <deraadt@openbsd.org>
Sun, 18 Aug 2024 14:42:56 +0000 (14:42 +0000)
committerderaadt <deraadt@openbsd.org>
Sun, 18 Aug 2024 14:42:56 +0000 (14:42 +0000)
about suspend/resume related events, and they all have audio.c as a child,
which definately needs to know!
ok ratchov

sys/dev/pci/auixp.c
sys/dev/pci/azalia.c
sys/dev/pci/cs4280.c
sys/dev/pci/cs4281.c
sys/dev/pci/esa.c
sys/dev/pci/eso.c
sys/dev/pci/maestro.c
sys/dev/pci/yds.c

index 8d46f85..9cd5493 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: auixp.c,v 1.53 2024/05/24 06:02:53 jsg Exp $ */
+/* $OpenBSD: auixp.c,v 1.54 2024/08/18 14:42:56 deraadt Exp $ */
 /* $NetBSD: auixp.c,v 1.9 2005/06/27 21:13:09 thorpej Exp $ */
 
 /*
@@ -911,6 +911,7 @@ auixp_activate(struct device *self, int act)
 
        switch (act) {
        case DVACT_SUSPEND:
+               rv = config_activate_children(self, act);
                auixp_disable_interrupts(sc);
                break;
        case DVACT_RESUME:
index c1731e5..ff4a436 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: azalia.c,v 1.289 2024/08/18 14:35:14 deraadt Exp $    */
+/*     $OpenBSD: azalia.c,v 1.290 2024/08/18 14:42:56 deraadt Exp $    */
 /*     $NetBSD: azalia.c,v 1.20 2006/05/07 08:31:44 kent Exp $ */
 
 /*-
@@ -611,15 +611,17 @@ azalia_pci_activate(struct device *self, int act)
                (void) AZ_READ_4(sc, INTSTS);
                break;
        case DVACT_SUSPEND:
+               rv = config_activate_children(self, act);
                azalia_suspend(sc);
                break;
-       case DVACT_POWERDOWN:
-               azalia_shutdown(sc);
-               break;
        case DVACT_RESUME:
                azalia_resume(sc);
                rv = config_activate_children(self, act);
                break;
+       case DVACT_POWERDOWN:
+               rv = config_activate_children(self, act);
+               azalia_shutdown(sc);
+               break;
        default:
                rv = config_activate_children(self, act);
                break;
index 4e7dba0..fefe948 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: cs4280.c,v 1.61 2024/05/24 06:02:53 jsg Exp $ */
+/*     $OpenBSD: cs4280.c,v 1.62 2024/08/18 14:42:56 deraadt Exp $     */
 /*     $NetBSD: cs4280.c,v 1.5 2000/06/26 04:56:23 simonb Exp $        */
 
 /*
@@ -1571,6 +1571,7 @@ cs4280_activate(struct device *self, int act)
 
        switch (act) {
        case DVACT_SUSPEND:
+               rv = config_activate_children(self, act);
                /* should I powerdown here ? */
                cs4280_write_codec(sc, AC97_REG_POWER, CS4280_POWER_DOWN_ALL);
                break;
index 7404774..7e1051e 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: cs4281.c,v 1.46 2024/05/24 06:02:53 jsg Exp $ */
+/*     $OpenBSD: cs4281.c,v 1.47 2024/08/18 14:42:56 deraadt Exp $ */
 /*     $Tera: cs4281.c,v 1.18 2000/12/27 14:24:45 tacha Exp $  */
 
 /*
@@ -960,6 +960,7 @@ cs4281_activate(struct device *self, int act)
 
        switch (act) {
        case DVACT_SUSPEND:
+               rv = config_activate_children(self, act);
                /* should I powerdown here ? */
                cs4281_write_codec(sc, AC97_REG_POWER, CS4281_POWER_DOWN_ALL);
                break;
index 3bdf82c..0c6b6ee 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: esa.c,v 1.43 2024/05/24 06:02:53 jsg Exp $    */
+/*     $OpenBSD: esa.c,v 1.44 2024/08/18 14:42:56 deraadt Exp $        */
 /* $NetBSD: esa.c,v 1.12 2002/03/24 14:17:35 jmcneill Exp $ */
 
 /*
@@ -1489,16 +1489,22 @@ int
 esa_activate(struct device *self, int act)
 {
        struct esa_softc *sc = (struct esa_softc *)self;
+       int rv;
 
        switch (act) {
        case DVACT_SUSPEND:
+               rv = config_activate_children(self, act);
                esa_suspend(sc);
                break;
        case DVACT_RESUME:
                esa_resume(sc);
+               rv = config_activate_children(self, act);
+               break;
+       default:
+               rv = config_activate_children(self, act);
                break;
        }
-       return 0;
+       return rv;
 }
 
 void
index 4bcb08c..c6b4615 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: eso.c,v 1.55 2024/05/24 06:02:53 jsg Exp $    */
+/*     $OpenBSD: eso.c,v 1.56 2024/08/18 14:42:56 deraadt Exp $        */
 /*     $NetBSD: eso.c,v 1.48 2006/12/18 23:13:39 kleink Exp $  */
 
 /*
@@ -1966,6 +1966,7 @@ eso_activate(struct device *self, int act)
                bus_space_write_1(sc->sc_iot, sc->sc_ioh, ESO_IO_IRQCTL, tmp);
                break;
        case DVACT_SUSPEND:
+               rv = config_activate_children(self, act);
                bus_space_write_1(sc->sc_iot, sc->sc_ioh, ESO_IO_A2DMAM, 0);
                bus_space_write_1(sc->sc_dmac_iot, sc->sc_dmac_ioh,
                    ESO_DMAC_CLEAR, 0);
index 3ed4a4c..b5945bb 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: maestro.c,v 1.52 2024/05/24 06:02:58 jsg Exp $        */
+/*     $OpenBSD: maestro.c,v 1.53 2024/08/18 14:42:56 deraadt Exp $    */
 /* $FreeBSD: /c/ncvs/src/sys/dev/sound/pci/maestro.c,v 1.3 2000/11/21 12:22:11 julian Exp $ */
 /*
  * FreeBSD's ESS Agogo/Maestro driver 
@@ -1352,6 +1352,7 @@ maestro_activate(struct device *self, int act)
 
        switch (act) {
        case DVACT_SUSPEND:
+               rv = config_activate_children(self, act);
                /* Power down device on shutdown. */
                DPRINTF(("maestro: power down\n"));
                if (sc->record.mode & MAESTRO_RUNNING) {
@@ -1382,9 +1383,13 @@ maestro_activate(struct device *self, int act)
                if (sc->record.mode & MAESTRO_RUNNING)
                        maestro_channel_start(&sc->record);
                maestro_update_timer(sc);
+               rv = config_activate_children(self, act);
+               break;
+       default:
+               rv = config_activate_children(self, act);
                break;
        }
-       return 0;
+       return rv;
 }
 
 void
index eae0685..42c755f 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: yds.c,v 1.65 2024/06/26 01:40:49 jsg Exp $    */
+/*     $OpenBSD: yds.c,v 1.66 2024/08/18 14:42:56 deraadt Exp $        */
 /*     $NetBSD: yds.c,v 1.5 2001/05/21 23:55:04 minoura Exp $  */
 
 /*
@@ -1571,11 +1571,11 @@ yds_activate(struct device *self, int act)
 
        switch (act) {
        case DVACT_QUIESCE:
+               rv = config_activate_children(self, act);
                if (sc->sc_play.intr || sc->sc_rec.intr)
                        sc->sc_resume_active = 1;
                else
                        sc->sc_resume_active = 0;
-               rv = config_activate_children(self, act);
                if (sc->sc_resume_active)
                        yds_close(sc);
                break;