|
@@ -230,6 +230,39 @@ err:
|
|
}
|
|
}
|
|
EXPORT_SYMBOL_GPL(regmap_init);
|
|
EXPORT_SYMBOL_GPL(regmap_init);
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * regmap_reinit_cache(): Reinitialise the current register cache
|
|
|
|
+ *
|
|
|
|
+ * @map: Register map to operate on.
|
|
|
|
+ * @config: New configuration. Only the cache data will be used.
|
|
|
|
+ *
|
|
|
|
+ * Discard any existing register cache for the map and initialize a
|
|
|
|
+ * new cache. This can be used to restore the cache to defaults or to
|
|
|
|
+ * update the cache configuration to reflect runtime discovery of the
|
|
|
|
+ * hardware.
|
|
|
|
+ */
|
|
|
|
+int regmap_reinit_cache(struct regmap *map, const struct regmap_config *config)
|
|
|
|
+{
|
|
|
|
+ int ret;
|
|
|
|
+
|
|
|
|
+ mutex_lock(&map->lock);
|
|
|
|
+
|
|
|
|
+ regcache_exit(map);
|
|
|
|
+
|
|
|
|
+ map->max_register = config->max_register;
|
|
|
|
+ map->writeable_reg = config->writeable_reg;
|
|
|
|
+ map->readable_reg = config->readable_reg;
|
|
|
|
+ map->volatile_reg = config->volatile_reg;
|
|
|
|
+ map->precious_reg = config->precious_reg;
|
|
|
|
+ map->cache_type = config->cache_type;
|
|
|
|
+
|
|
|
|
+ ret = regcache_init(map, config);
|
|
|
|
+
|
|
|
|
+ mutex_unlock(&map->lock);
|
|
|
|
+
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* regmap_exit(): Free a previously allocated register map
|
|
* regmap_exit(): Free a previously allocated register map
|
|
*/
|
|
*/
|