aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/base/regmap/regcache.c18
-rw-r--r--include/linux/regmap.h2
2 files changed, 20 insertions, 0 deletions
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index 179f222d76c3..e2b172b93dba 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -240,6 +240,24 @@ int regcache_sync(struct regmap *map)
240} 240}
241EXPORT_SYMBOL_GPL(regcache_sync); 241EXPORT_SYMBOL_GPL(regcache_sync);
242 242
243/**
244 * regcache_cache_only: Put a register map into cache only mode
245 *
246 * @map: map to configure
247 * @cache_only: flag if changes should be written to the hardware
248 *
249 * When a register map is marked as cache only writes to the register
250 * map API will only update the register cache, they will not cause
251 * any hardware changes. This is useful for allowing portions of
252 * drivers to act as though the device were functioning as normal when
253 * it is disabled for power saving reasons.
254 */
255void regcache_cache_only(struct regmap *map, bool enable)
256{
257 map->cache_only = enable;
258}
259EXPORT_SYMBOL_GPL(regcache_cache_only);
260
243bool regcache_set_val(void *base, unsigned int idx, 261bool regcache_set_val(void *base, unsigned int idx,
244 unsigned int val, unsigned int word_size) 262 unsigned int val, unsigned int word_size)
245{ 263{
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 63b30752adfd..76ac255a17a5 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -141,4 +141,6 @@ int regmap_update_bits(struct regmap *map, unsigned int reg,
141 unsigned int mask, unsigned int val); 141 unsigned int mask, unsigned int val);
142 142
143int regcache_sync(struct regmap *map); 143int regcache_sync(struct regmap *map);
144void regcache_cache_only(struct regmap *map, bool enable);
145
144#endif 146#endif