aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/regmap
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-12-05 08:18:50 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-12-05 08:18:50 -0500
commit8569d023a0db699c462337d471f7e92163142e37 (patch)
tree7852eeafa7986edf03b2fab354b4ba2718ee44bd /drivers/base/regmap
parentbc7ee55633867909bb05e71f957a4d3c1aa1b488 (diff)
parentbf315173359b2f3b8b8ccca4264815e91f30be12 (diff)
Merge branch 'topic/cache' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap into regmap-next
Diffstat (limited to 'drivers/base/regmap')
-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 add5da6d9c0a..be10a4ff6609 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -259,6 +259,39 @@ err:
259EXPORT_SYMBOL_GPL(regmap_init); 259EXPORT_SYMBOL_GPL(regmap_init);
260 260
261/** 261/**
262 * regmap_reinit_cache(): Reinitialise the current register cache
263 *
264 * @map: Register map to operate on.
265 * @config: New configuration. Only the cache data will be used.
266 *
267 * Discard any existing register cache for the map and initialize a
268 * new cache. This can be used to restore the cache to defaults or to
269 * update the cache configuration to reflect runtime discovery of the
270 * hardware.
271 */
272int regmap_reinit_cache(struct regmap *map, const struct regmap_config *config)
273{
274 int ret;
275
276 mutex_lock(&map->lock);
277
278 regcache_exit(map);
279
280 map->max_register = config->max_register;
281 map->writeable_reg = config->writeable_reg;
282 map->readable_reg = config->readable_reg;
283 map->volatile_reg = config->volatile_reg;
284 map->precious_reg = config->precious_reg;
285 map->cache_type = config->cache_type;
286
287 ret = regcache_init(map, config);
288
289 mutex_unlock(&map->lock);
290
291 return ret;
292}
293
294/**
262 * regmap_exit(): Free a previously allocated register map 295 * regmap_exit(): Free a previously allocated register map
263 */ 296 */
264void regmap_exit(struct regmap *map) 297void regmap_exit(struct regmap *map)