summaryrefslogtreecommitdiff
path: root/backport-include/linux/regmap.h
diff options
context:
space:
mode:
authorDominik Sliwa <dominik.sliwa@toradex.com>2017-07-02 16:41:37 +0200
committerDominik Sliwa <dominik.sliwa@toradex.com>2017-07-02 16:41:37 +0200
commit52409fae3e4b8d16b68b61902fc09075cd97b75d (patch)
treee67110145c5843b3f199d872ae285e2546c9ebe2 /backport-include/linux/regmap.h
Backports generated from 4.11 kernel
Initial commit. Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Diffstat (limited to 'backport-include/linux/regmap.h')
-rw-r--r--backport-include/linux/regmap.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/backport-include/linux/regmap.h b/backport-include/linux/regmap.h
new file mode 100644
index 0000000..4b73c46
--- /dev/null
+++ b/backport-include/linux/regmap.h
@@ -0,0 +1,51 @@
+#ifndef __BACKPORT_LINUX_REGMAP_H
+#define __BACKPORT_LINUX_REGMAP_H
+#include_next <linux/regmap.h>
+#include <linux/version.h>
+
+#if LINUX_VERSION_IS_LESS(3,5,0) && \
+ LINUX_VERSION_IS_GEQ(3,2,0)
+#define dev_get_regmap LINUX_BACKPORT(dev_get_regmap)
+static inline
+struct regmap *dev_get_regmap(struct device *dev, const char *name)
+{
+ return NULL;
+}
+#endif
+
+#if LINUX_VERSION_IS_LESS(3,4,0) && \
+ LINUX_VERSION_IS_GEQ(3,2,0)
+#if defined(CONFIG_REGMAP)
+#define devm_regmap_init LINUX_BACKPORT(devm_regmap_init)
+struct regmap *devm_regmap_init(struct device *dev,
+ const struct regmap_bus *bus,
+ const struct regmap_config *config);
+#if defined(CONFIG_REGMAP_I2C)
+#define devm_regmap_init_i2c LINUX_BACKPORT(devm_regmap_init_i2c)
+struct regmap *devm_regmap_init_i2c(struct i2c_client *i2c,
+ const struct regmap_config *config);
+#endif /* defined(CONFIG_REGMAP_I2C) */
+
+/*
+ * We can't backport these unless we try to backport
+ * the full regmap into core so warn if used.
+ * No drivers are using this yet anyway.
+ */
+#define regmap_raw_write_async LINUX_BACKPORT(regmap_raw_write_async)
+static inline int regmap_raw_write_async(struct regmap *map, unsigned int reg,
+ const void *val, size_t val_len)
+{
+ WARN_ONCE(1, "regmap API is disabled");
+ return -EINVAL;
+}
+
+#define regmap_async_complete LINUX_BACKPORT(regmap_async_complete)
+static inline void regmap_async_complete(struct regmap *map)
+{
+ WARN_ONCE(1, "regmap API is disabled");
+}
+
+#endif /* defined(CONFIG_REGMAP) */
+#endif /* 3.2 <= version < 3.4 */
+
+#endif /* __BACKPORT_LINUX_REGMAP_H */