From f702326ed3b0a7b38129f69bc32e67018dfa3466 Mon Sep 17 00:00:00 2001 From: kettenis Date: Fri, 26 Nov 2021 11:44:01 +0000 Subject: [PATCH] Add interfaces to enable all power domains for a node. ok patrick@, visa@ --- sys/dev/ofw/ofw_power.c | 14 +++++++++++++- 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 @@ -93,12 +93,24 @@ power_domain_do_enable_idx(int node, int idx, int on) free(domains, M_TEMP, len); } +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) { 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 @@ -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_ */ -- 2.20.1