summaryrefslogtreecommitdiff
path: root/include/acpi/acpigen.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-07-07 13:12:00 -0600
committerBin Meng <bmeng.cn@gmail.com>2020-07-17 14:32:24 +0800
commitf9189d5ada8d48932463dc1d56ea4d44c050ebbd (patch)
treeac8c5c634ce28b5f31a35ab4586163df375d1ab9 /include/acpi/acpigen.h
parent9c70e7e556339ce9fa864782445f7927fafc5c03 (diff)
acpi: Add support for writing a Power Resource
These are used in ACPI to disable power to various pats of the system when in sleep. Add a way to create a power resource, with the caller finishing off the details. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'include/acpi/acpigen.h')
-rw-r--r--include/acpi/acpigen.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/acpi/acpigen.h b/include/acpi/acpigen.h
index 2dd806aa27..2c07a56208 100644
--- a/include/acpi/acpigen.h
+++ b/include/acpi/acpigen.h
@@ -51,6 +51,7 @@ enum {
AND_OP = 0x7b,
OR_OP = 0x7d,
NOT_OP = 0x80,
+ POWER_RES_OP = 0x84,
RETURN_OP = 0xa4,
};
@@ -321,4 +322,25 @@ void acpigen_write_and(struct acpi_ctx *ctx, u8 arg1, u8 arg2, u8 res);
*/
void acpigen_write_not(struct acpi_ctx *ctx, u8 arg, u8 res);
+/**
+ * acpigen_write_power_res() - Write a power resource
+ *
+ * Name (_PRx, Package(One) { name })
+ * ...
+ * PowerResource (name, level, order)
+ *
+ * The caller should fill in the rest of the power resource and then call
+ * acpigen_pop_len() to close it off
+ *
+ * @ctx: ACPI context pointer
+ * @name: Name of power resource (e.g. "PRIC")
+ * @level: Deepest sleep level that this resource must be kept on (0=S0, 3=S3)
+ * @order: Order that this must be enabled/disabled (e.g. 0)
+ * @dev_stats: List of states to define, e.g. {"_PR0", "_PR3"}
+ * @dev_states_count: Number of dev states
+ */
+void acpigen_write_power_res(struct acpi_ctx *ctx, const char *name, uint level,
+ uint order, const char *const dev_states[],
+ size_t dev_states_count);
+
#endif