summaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-02-23 20:11:58 +0000
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-02-23 20:12:49 +0000
commita3c3774176838bbfa4f6e48133644903818e56dc (patch)
treea6398d371a2ee8c7b8e5854d3b04370ff404bcc9 /drivers/base
parentf0c2319f9f196726ebe4d7508fd8fbd804988db3 (diff)
regmap: Skip hardware defaults for LZO caches
Saves some I/O when resyncing; we assume that syncs start from the device reset state. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/regmap/regcache-lzo.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/base/regmap/regcache-lzo.c b/drivers/base/regmap/regcache-lzo.c
index b7d16143ede..3025cf920f2 100644
--- a/drivers/base/regmap/regcache-lzo.c
+++ b/drivers/base/regmap/regcache-lzo.c
@@ -343,6 +343,12 @@ static int regcache_lzo_sync(struct regmap *map)
ret = regcache_read(map, i, &val);
if (ret)
return ret;
+
+ /* Is this the hardware default? If so skip. */
+ ret = regcache_lookup_reg(map, i);
+ if (ret > 0 && val == map->reg_defaults[ret].def)
+ continue;
+
map->cache_bypass = 1;
ret = _regmap_write(map, i, val);
map->cache_bypass = 0;