summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2021-05-31 09:24:05 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2021-06-02 10:16:12 +0200
commitb4abbd8a6cbbd5892e2e66270df50f60f41a137e (patch)
tree1d7787a9739bcf832546f685ec8e0d8e02f1544c /include
parente94dddebbccd1d8fe4901dbc84d9bcde20f9039d (diff)
downloadbarebox-b4abbd8a6cbbd5892e2e66270df50f60f41a137e.tar.gz
barebox-b4abbd8a6cbbd5892e2e66270df50f60f41a137e.tar.xz
nvmem: add nvmem_regmap_register helper
Registering a nvmem device for a regmap involves some boilerplate that doesn't need to change from driver to driver: - Reads are made aligned, to support normal use with md - Writes are passed along as is - nvmem parameters can be extracted from regmap Instead of having to replicate this driver by driver, add one helper to make this adaptation easier. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210531072406.5630-5-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/linux/nvmem-provider.h8
-rw-r--r--include/regmap.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h
index ac9ad21711..2d73898373 100644
--- a/include/linux/nvmem-provider.h
+++ b/include/linux/nvmem-provider.h
@@ -33,9 +33,12 @@ struct nvmem_config {
void *priv;
};
+struct regmap;
+
#if IS_ENABLED(CONFIG_NVMEM)
struct nvmem_device *nvmem_register(const struct nvmem_config *cfg);
+struct nvmem_device *nvmem_regmap_register(struct regmap *regmap, const char *name);
#else
@@ -44,5 +47,10 @@ static inline struct nvmem_device *nvmem_register(const struct nvmem_config *c)
return ERR_PTR(-ENOSYS);
}
+static inline struct nvmem_device *nvmem_regmap_register(struct regmap *regmap, const char *name)
+{
+ return ERR_PTR(-ENOSYS);
+}
+
#endif /* CONFIG_NVMEM */
#endif /* ifndef _LINUX_NVMEM_PROVIDER_H */
diff --git a/include/regmap.h b/include/regmap.h
index c5cf954ad6..f04319f204 100644
--- a/include/regmap.h
+++ b/include/regmap.h
@@ -109,6 +109,7 @@ void regmap_mmio_detach_clk(struct regmap *map);
void regmap_exit(struct regmap *map);
struct regmap *dev_get_regmap(struct device_d *dev, const char *name);
+struct device_d *regmap_get_device(struct regmap *map);
int regmap_register_cdev(struct regmap *map, const char *name);