summaryrefslogtreecommitdiff
path: root/include/linux/mfd/dbx500-prcmu.h
diff options
context:
space:
mode:
authorJonas Aaberg <jonas.aberg@stericsson.com>2010-10-26 11:33:23 +0200
committerJonas ABERG <jonas.aberg@stericsson.com>2011-09-29 09:01:34 +0200
commit06315bbb56c19ea09c506cc578af05f62e76185e (patch)
tree32c1a9f62ad0f71fc9a0e99b124f4b4b211e7e35 /include/linux/mfd/dbx500-prcmu.h
parent17e88d5a547285bb15a66631c2c03cc704962940 (diff)
regulator: dbx500-prcmu: add support for special regulators
The DMA driver needs to be able to enable/disable its regulator in atomic context, which is not supported by the regulator framework. This patch adds an interface for such special cases. Change-Id: I3e6efab1cb2be47cdcea18bf1038ee8be54a4bea Signed-off-by: Jonas Aaberg <jonas.aberg@stericsson.com> Signed-off-by: Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/32109
Diffstat (limited to 'include/linux/mfd/dbx500-prcmu.h')
-rw-r--r--include/linux/mfd/dbx500-prcmu.h75
1 files changed, 75 insertions, 0 deletions
diff --git a/include/linux/mfd/dbx500-prcmu.h b/include/linux/mfd/dbx500-prcmu.h
index 7da5694f8ca..072a4c70059 100644
--- a/include/linux/mfd/dbx500-prcmu.h
+++ b/include/linux/mfd/dbx500-prcmu.h
@@ -10,6 +10,7 @@
#include <linux/interrupt.h>
#include <linux/notifier.h>
+#include <linux/err.h>
#include <asm/mach-types.h>
/* PRCMU Wakeup defines */
@@ -549,4 +550,78 @@ static inline int prcmu_qos_remove_notifier(int prcmu_qos_class,
#endif
+struct ux500_regulator;
+
+#ifdef CONFIG_REGULATOR
+/*
+ * NOTE! The device will be connected to the correct regulator by this
+ * new framework. A list with connections will match up dev_name(dev)
+ * to the specific regulator. This follows the same principle as the
+ * normal regulator framework.
+ *
+ * This framework shall only be used in special cases when a regulator
+ * has to be enabled/disabled in atomic context.
+ */
+
+/**
+ * ux500_regulator_get()
+ *
+ * @dev: Drivers device struct
+ *
+ * Returns a ux500_regulator struct. Shall be used as argument for
+ * ux500_regulator_atomic_enable/disable calls.
+ * Return ERR_PTR(-EINVAL) upon no matching regulator found.
+ */
+struct ux500_regulator *__must_check ux500_regulator_get(struct device *dev);
+
+/**
+ * ux500_regulator_atomic_enable()
+ *
+ * @regulator: Regulator handle, provided from ux500_regulator_get.
+ *
+ * The enable/disable functions keep an internal counter, so every
+ * enable must be paired with an disable in order to turn off regulator.
+ */
+int ux500_regulator_atomic_enable(struct ux500_regulator *regulator);
+
+/**
+ * ux500_regulator_atomic_disable()
+ *
+ * @regulator: Regulator handle, provided from ux500_regulator_get.
+ *
+ */
+int ux500_regulator_atomic_disable(struct ux500_regulator *regulator);
+
+/**
+ * ux500_regulator_put()
+ *
+ * @regulator: Regulator handle, provided from ux500_regulator_get.
+ */
+void ux500_regulator_put(struct ux500_regulator *regulator);
+
+#else
+
+static inline struct ux500_regulator *__must_check
+ux500_regulator_get(struct device *dev)
+{
+ return ERR_PTR(-EINVAL);
+}
+
+static inline int
+ux500_regulator_atomic_enable(struct ux500_regulator *regulator)
+{
+ return -EINVAL;
+}
+
+static inline int
+ux500_regulator_atomic_disable(struct ux500_regulator *regulator)
+{
+ return -EINVAL;
+}
+
+static inline void ux500_regulator_put(struct ux500_regulator *regulator)
+{
+}
+#endif /* CONFIG_REGULATOR */
+
#endif /* __MACH_PRCMU_H */