-/* $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>
*
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 = {
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)
{
-/* $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>
*
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 = {
}
}
+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)
{