summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2014-05-05 13:33:06 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2014-05-05 13:33:06 +0200
commit845f765b6e7f5830b14c7910203d271c43e6af6a (patch)
treee37b3c0d8d77c3218c280d8f38405d9a66e6bbd3 /include
parent9bb76883c19f360693d54b12b67a9b0d17dc83a8 (diff)
parentacb427e2d0b9250859729420e93e4b77dfd43593 (diff)
downloadbarebox-845f765b6e7f5830b14c7910203d271c43e6af6a.tar.gz
barebox-845f765b6e7f5830b14c7910203d271c43e6af6a.tar.xz
Merge branch 'for-next/regulator'
Conflicts: commands/Makefile
Diffstat (limited to 'include')
-rw-r--r--include/mci.h2
-rw-r--r--include/regulator.h47
2 files changed, 49 insertions, 0 deletions
diff --git a/include/mci.h b/include/mci.h
index cd3e2c2870..f2c6fd1cbb 100644
--- a/include/mci.h
+++ b/include/mci.h
@@ -28,6 +28,7 @@
#include <linux/list.h>
#include <block.h>
+#include <regulator.h>
/* Firmware revisions for SD cards */
#define SD_VERSION_SD 0x20000
@@ -301,6 +302,7 @@ struct mci_host {
unsigned max_req_size;
unsigned dsr_val; /**< optional dsr value */
int use_dsr; /**< optional dsr usage flag */
+ struct regulator *supply;
/** init the host interface */
int (*init)(struct mci_host*, struct device_d*);
diff --git a/include/regulator.h b/include/regulator.h
new file mode 100644
index 0000000000..26a5e56046
--- /dev/null
+++ b/include/regulator.h
@@ -0,0 +1,47 @@
+#ifndef __REGULATOR_H
+#define __REGULATOR_H
+
+/* struct regulator is an opaque object for consumers */
+struct regulator;
+
+struct regulator_dev {
+ struct regulator_ops *ops;
+};
+
+struct regulator_ops {
+ /* enable/disable regulator */
+ int (*enable) (struct regulator_dev *);
+ int (*disable) (struct regulator_dev *);
+ int (*is_enabled) (struct regulator_dev *);
+};
+
+int of_regulator_register(struct regulator_dev *rd, struct device_node *node);
+
+void regulators_print(void);
+
+#ifdef CONFIG_REGULATOR
+
+struct regulator *regulator_get(struct device_d *, const char *);
+int regulator_enable(struct regulator *);
+int regulator_disable(struct regulator *);
+
+#else
+
+static inline struct regulator *regulator_get(struct device_d *dev, const char *id)
+{
+ return NULL;
+}
+
+static inline int regulator_enable(struct regulator *r)
+{
+ return 0;
+}
+
+static inline int regulator_disable(struct regulator *r)
+{
+ return 0;
+}
+
+#endif
+
+#endif /* __REGULATOR_H */