13 #include <linux/slab.h>
14 #include <linux/export.h>
15 #include <linux/device.h>
27 static int regcache_hw_init(
struct regmap *
map)
40 dev_warn(map->
dev,
"No cache defaults, reading back from HW\n");
101 for (i = 0; i < config->num_reg_defaults; i++)
102 if (config->reg_defaults[i].reg % map->
reg_stride)
115 dev_err(map->
dev,
"Could not match compress type: %d\n",
138 if (config->reg_defaults) {
151 ret = regcache_hw_init(map);
204 unsigned int reg,
unsigned int *
value)
214 ret = map->
cache_ops->read(map, reg, value);
217 trace_regmap_reg_read_cache(map->
dev, reg, *value);
235 unsigned int reg,
unsigned int value)
246 return map->
cache_ops->write(map, reg, value);
277 trace_regcache_sync(map->
dev, name,
"start");
291 dev_err(map->
dev,
"Failed to write %x = %x: %d\n",
304 trace_regcache_sync(map->
dev, name,
"stop");
340 dev_dbg(map->
dev,
"Syncing %s cache from %d-%d\n", name, min, max);
342 trace_regcache_sync(map->
dev, name,
"start region");
347 ret = map->
cache_ops->sync(map, min, max);
350 trace_regcache_sync(map->
dev, name,
"stop region");
376 trace_regmap_cache_only(map->
dev, enable);
414 trace_regmap_cache_bypass(map->
dev, enable);
420 unsigned int val,
unsigned int word_size)
425 if (cache[idx] == val)
432 if (cache[idx] == val)
439 if (cache[idx] == val)
451 unsigned int word_size)
476 static int regcache_default_cmp(
const void *
a,
const void *
b)