aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/regmap/regcache.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-01-21 07:01:14 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-01-23 09:01:18 -0500
commit22f0d90a34827812413bb3fbeda6a2a79bb58423 (patch)
treec54935a6e2637408da23aa261c81f89dffa0724e /drivers/base/regmap/regcache.c
parentdcd6c92267155e70a94b3927bce681ce74b80d1f (diff)
regmap: Support register patch sets
Device manufacturers frequently provide register sequences, usually not fully documented, to be run at startup in order to provide better defaults for devices (for example, improving performance in the light of silicon evaluation). Support such updates by allowing drivers to register update sets with the core. These updates will be written to the device immediately and will also be rewritten when the cache is synced. The assumption is that the reason for resyncing the cache will always be that the device has been powered off. If this turns out to not be the case then a separate operation can be provided. Currently the implementation only allows a single set of updates to be specified for a device, this could be extended in future. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/base/regmap/regcache.c')
-rw-r--r--drivers/base/regmap/regcache.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index 1ead66186b7..ce2034c10ff 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -268,6 +268,17 @@ int regcache_sync(struct regmap *map)
268 map->cache_ops->name); 268 map->cache_ops->name);
269 name = map->cache_ops->name; 269 name = map->cache_ops->name;
270 trace_regcache_sync(map->dev, name, "start"); 270 trace_regcache_sync(map->dev, name, "start");
271
272 /* Apply any patch first */
273 for (i = 0; i < map->patch_regs; i++) {
274 ret = _regmap_write(map, map->patch[i].reg, map->patch[i].def);
275 if (ret != 0) {
276 dev_err(map->dev, "Failed to write %x = %x: %d\n",
277 map->patch[i].reg, map->patch[i].def, ret);
278 goto out;
279 }
280 }
281
271 if (!map->cache_dirty) 282 if (!map->cache_dirty)
272 goto out; 283 goto out;
273 if (map->cache_ops->sync) { 284 if (map->cache_ops->sync) {