@@ -1,3 +1,3 @@
# Makefile for device boot constraints
-obj-y := clk.o core.o supply.o
+obj-y := clk.o core.o pm.o supply.o
@@ -95,6 +95,10 @@ static struct constraint *constraint_allocate(struct constraint_dev *cdev,
add = constraint_clk_add;
remove = constraint_clk_remove;
break;
+ case DEV_BOOT_CONSTRAINT_PM:
+ add = constraint_pm_add;
+ remove = constraint_pm_remove;
+ break;
case DEV_BOOT_CONSTRAINT_SUPPLY:
add = constraint_supply_add;
remove = constraint_supply_remove;
@@ -32,6 +32,9 @@ struct constraint {
int constraint_clk_add(struct constraint *constraint, void *data);
void constraint_clk_remove(struct constraint *constraint);
+int constraint_pm_add(struct constraint *constraint, void *data);
+void constraint_pm_remove(struct constraint *constraint);
+
int constraint_supply_add(struct constraint *constraint, void *data);
void constraint_supply_remove(struct constraint *constraint);
new file mode 100644
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2017 Linaro.
+ * Viresh Kumar <viresh.kumar@linaro.org>
+ */
+
+#include <linux/pm_domain.h>
+
+#include "core.h"
+
+int constraint_pm_add(struct constraint *constraint, void *data)
+{
+ struct device *dev = constraint->cdev->dev;
+
+ return dev_pm_domain_attach(dev, true);
+}
+
+void constraint_pm_remove(struct constraint *constraint)
+{
+ /* Nothing to do for now */
+}
@@ -17,10 +17,12 @@ struct device;
* enum dev_boot_constraint_type - This defines different boot constraint types.
*
* @DEV_BOOT_CONSTRAINT_CLK: This represents a clock boot constraint.
+ * @DEV_BOOT_CONSTRAINT_PM: This represents a power domain boot constraint.
* @DEV_BOOT_CONSTRAINT_SUPPLY: This represents a power supply boot constraint.
*/
enum dev_boot_constraint_type {
DEV_BOOT_CONSTRAINT_CLK,
+ DEV_BOOT_CONSTRAINT_PM,
DEV_BOOT_CONSTRAINT_SUPPLY,
};