summaryrefslogtreecommitdiff
path: root/sys/dev/ofw
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2021-11-26 11:44:02 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2021-11-26 11:44:02 +0000
commitad6adda49bcb9530ff53844a3688ea608210e5e0 (patch)
tree16850f22b48e9c8cf05f4da49734cf6db06761d4 /sys/dev/ofw
parent40b812c05c0157a523edab8835fbb03675293e3f (diff)
Add interfaces to enable all power domains for a node.
ok patrick@, visa@
Diffstat (limited to 'sys/dev/ofw')
-rw-r--r--sys/dev/ofw/ofw_power.c14
-rw-r--r--sys/dev/ofw/ofw_power.h16
2 files changed, 28 insertions, 2 deletions
diff --git a/sys/dev/ofw/ofw_power.c b/sys/dev/ofw/ofw_power.c
index 96aa74dd929..d0678cd6093 100644
--- a/sys/dev/ofw/ofw_power.c
+++ b/sys/dev/ofw/ofw_power.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofw_power.c,v 1.1 2018/05/02 15:16:31 patrick Exp $ */
+/* $OpenBSD: ofw_power.c,v 1.2 2021/11/26 11:44:01 kettenis Exp $ */
/*
* Copyright (c) 2016 Mark Kettenis
* Copyright (c) 2018 Patrick Wildt <patrick@blueri.se>
@@ -94,12 +94,24 @@ power_domain_do_enable_idx(int node, int idx, int on)
}
void
+power_domain_enable_idx(int node, int idx)
+{
+ power_domain_do_enable_idx(node, idx, 1);
+}
+
+void
power_domain_enable(int node)
{
power_domain_do_enable_idx(node, 0, 1);
}
void
+power_domain_disable_idx(int node, int idx)
+{
+ power_domain_do_enable_idx(node, idx, 0);
+}
+
+void
power_domain_disable(int node)
{
power_domain_do_enable_idx(node, 0, 0);
diff --git a/sys/dev/ofw/ofw_power.h b/sys/dev/ofw/ofw_power.h
index f18871375a0..3fd34c30fc9 100644
--- a/sys/dev/ofw/ofw_power.h
+++ b/sys/dev/ofw/ofw_power.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofw_power.h,v 1.1 2018/05/02 15:16:31 patrick Exp $ */
+/* $OpenBSD: ofw_power.h,v 1.2 2021/11/26 11:44:01 kettenis Exp $ */
/*
* Copyright (c) 2016 Mark Kettenis
* Copyright (c) 2018 Patrick Wildt <patrick@blueri.se>
@@ -31,6 +31,20 @@ struct power_domain_device {
void power_domain_register(struct power_domain_device *);
void power_domain_enable(int);
+void power_domain_enable_idx(int, int);
void power_domain_disable(int);
+void power_domain_disable_idx(int, int);
+
+static inline void
+power_domain_enable_all(int node)
+{
+ power_domain_enable_idx(node, -1);
+}
+
+static inline void
+power_domain_disable_all(int node)
+{
+ power_domain_disable_idx(node, -1);
+}
#endif /* _DEV_OFW_POWER_H_ */