aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/regmap/regmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/regmap/regmap.c')
-rw-r--r--drivers/base/regmap/regmap.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 3aca18dbf367..579e85b8a684 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -231,6 +231,39 @@ err:
231EXPORT_SYMBOL_GPL(regmap_init); 231EXPORT_SYMBOL_GPL(regmap_init);
232 232
233/** 233/**
234 * regmap_reinit_cache(): Reinitialise the current register cache
235 *
236 * @map: Register map to operate on.
237 * @config: New configuration. Only the cache data will be used.
238 *
239 * Discard any existing register cache for the map and initialize a
240 * new cache. This can be used to restore the cache to defaults or to
241 * update the cache configuration to reflect runtime discovery of the
242 * hardware.
243 */
244int regmap_reinit_cache(struct regmap *map, const struct regmap_config *config)
245{
246 int ret;
247
248 mutex_lock(&map->lock);
249
250 regcache_exit(map);
251
252 map->max_register = config->max_register;
253 map->writeable_reg = config->writeable_reg;
254 map->readable_reg = config->readable_reg;
255 map->volatile_reg = config->volatile_reg;
256 map->precious_reg = config->precious_reg;
257 map->cache_type = config->cache_type;
258
259 ret = regcache_init(map, config);
260
261 mutex_unlock(&map->lock);
262
263 return ret;
264}
265
266/**
234 * regmap_exit(): Free a previously allocated register map 267 * regmap_exit(): Free a previously allocated register map
235 */ 268 */
236void regmap_exit(struct regmap *map) 269void regmap_exit(struct regmap *map)