summaryrefslogtreecommitdiffstats
path: root/drivers/base/regmap/regcache.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-02-20 22:21:33 +0100
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-02-20 22:21:33 +0100
commitaca1e172a1096ed3785e0da01d82943b7562527c (patch)
tree0826c140b4e31acd7f8546727498dd849f099ba6 /drivers/base/regmap/regcache.c
parentMerge branch 'topic/devm' of git://git.kernel.org/pub/scm/linux/kernel/git/br... (diff)
parentregmap: Fix kcalloc parameters swapped (diff)
downloadlinux-aca1e172a1096ed3785e0da01d82943b7562527c.tar.xz
linux-aca1e172a1096ed3785e0da01d82943b7562527c.zip
Merge branch 'topic/patch' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap into regmap-drivers
Diffstat (limited to 'drivers/base/regmap/regcache.c')
-rw-r--r--drivers/base/regmap/regcache.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index d1daa5e9fadf..e9032c329067 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -268,8 +268,22 @@ int regcache_sync(struct regmap *map)
map->cache_ops->name);
name = map->cache_ops->name;
trace_regcache_sync(map->dev, name, "start");
+
if (!map->cache_dirty)
goto out;
+
+ /* Apply any patch first */
+ map->cache_bypass = 1;
+ for (i = 0; i < map->patch_regs; i++) {
+ ret = _regmap_write(map, map->patch[i].reg, map->patch[i].def);
+ if (ret != 0) {
+ dev_err(map->dev, "Failed to write %x = %x: %d\n",
+ map->patch[i].reg, map->patch[i].def, ret);
+ goto out;
+ }
+ }
+ map->cache_bypass = 0;
+
if (map->cache_ops->sync) {
ret = map->cache_ops->sync(map);
} else {