diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-12-05 13:18:50 +0000 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-12-05 13:18:50 +0000 |
commit | 8569d023a0db699c462337d471f7e92163142e37 (patch) | |
tree | 7852eeafa7986edf03b2fab354b4ba2718ee44bd /drivers/base/regmap | |
parent | bc7ee55633867909bb05e71f957a4d3c1aa1b488 (diff) | |
parent | bf315173359b2f3b8b8ccca4264815e91f30be12 (diff) | |
download | op-kernel-dev-8569d023a0db699c462337d471f7e92163142e37.zip op-kernel-dev-8569d023a0db699c462337d471f7e92163142e37.tar.gz |
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.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index add5da6..be10a4f 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -259,6 +259,39 @@ err: 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 */ void regmap_exit(struct regmap *map) |