diff options
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ofw/ofw_power.c | 14 | ||||
-rw-r--r-- | sys/dev/ofw/ofw_power.h | 16 |
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_ */ |