diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2023-07-26 11:09:25 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2023-07-26 11:09:25 +0000 |
commit | 35959d01967b154717b0ab7f263f1ba1324084e7 (patch) | |
tree | de840086c12df35fee8d2843157da280f1975c02 /sys/arch/arm64/dev | |
parent | ee092654a1a1d812ffb6e6560a87b3fb63da3eba (diff) |
Shutd down the power domains suring suspend.
ok patrick@, tobhe@
Diffstat (limited to 'sys/arch/arm64/dev')
-rw-r--r-- | sys/arch/arm64/dev/apldma.c | 23 | ||||
-rw-r--r-- | sys/arch/arm64/dev/aplmca.c | 32 |
2 files changed, 51 insertions, 4 deletions
diff --git a/sys/arch/arm64/dev/apldma.c b/sys/arch/arm64/dev/apldma.c index f842f9f5148..01fd2693d41 100644 --- a/sys/arch/arm64/dev/apldma.c +++ b/sys/arch/arm64/dev/apldma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apldma.c,v 1.5 2022/11/26 21:35:22 kettenis Exp $ */ +/* $OpenBSD: apldma.c,v 1.6 2023/07/26 11:09:24 kettenis Exp $ */ /* * Copyright (c) 2022 Mark Kettenis <kettenis@openbsd.org> * @@ -110,9 +110,11 @@ struct apldma_softc *apldma_sc; int apldma_match(struct device *, void *, void *); void apldma_attach(struct device *, struct device *, void *); +int apldma_activate(struct device *, int); const struct cfattach apldma_ca = { - sizeof (struct apldma_softc), apldma_match, apldma_attach + sizeof (struct apldma_softc), apldma_match, apldma_attach, NULL, + apldma_activate }; struct cfdriver apldma_cd = { @@ -197,6 +199,23 @@ unmap: bus_space_unmap(sc->sc_iot, sc->sc_ioh, faa->fa_reg[0].size); } +int +apldma_activate(struct device *self, int act) +{ + struct apldma_softc *sc = (struct apldma_softc *)self; + + switch (act) { + case DVACT_SUSPEND: + power_domain_disable(sc->sc_node); + break; + case DVACT_RESUME: + power_domain_enable(sc->sc_node); + break; + } + + return 0; +} + void apldma_fill_descriptors(struct apldma_channel *ac) { diff --git a/sys/arch/arm64/dev/aplmca.c b/sys/arch/arm64/dev/aplmca.c index 88cb4358b61..95da05e4726 100644 --- a/sys/arch/arm64/dev/aplmca.c +++ b/sys/arch/arm64/dev/aplmca.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aplmca.c,v 1.6 2023/02/03 13:20:21 kettenis Exp $ */ +/* $OpenBSD: aplmca.c,v 1.7 2023/07/26 11:09:24 kettenis Exp $ */ /* * Copyright (c) 2022 Mark Kettenis <kettenis@openbsd.org> * @@ -152,9 +152,11 @@ const struct audio_hw_if aplmca_hw_if = { int aplmca_match(struct device *, void *, void *); void aplmca_attach(struct device *, struct device *, void *); +int aplmca_activate(struct device *, int); const struct cfattach aplmca_ca = { - sizeof (struct aplmca_softc), aplmca_match, aplmca_attach + sizeof (struct aplmca_softc), aplmca_match, aplmca_attach, NULL, + aplmca_activate }; struct cfdriver aplmca_cd = { @@ -224,6 +226,32 @@ aplmca_attach(struct device *parent, struct device *self, void *aux) } int +aplmca_activate(struct device *self, int act) +{ + struct aplmca_softc *sc = (struct aplmca_softc *)self; + int i; + + switch (act) { + case DVACT_SUSPEND: + for (i = 0; i < sc->sc_nclusters; i++) { + if (sc->sc_ad[i].ad_ac) + power_domain_disable_idx(sc->sc_node, i + 1); + } + power_domain_disable_idx(sc->sc_node, 0); + break; + case DVACT_RESUME: + power_domain_enable_idx(sc->sc_node, 0); + for (i = 0; i < sc->sc_nclusters; i++) { + if (sc->sc_ad[i].ad_ac) + power_domain_enable_idx(sc->sc_node, i + 1); + } + break; + } + + return 0; +} + +int aplmca_dai_init(struct aplmca_softc *sc, int port) { struct aplmca_dai *ad = &sc->sc_ad[port]; |