summaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2013-03-26 21:26:19 +0000
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-03-27 13:03:41 +0000
commit137b833457864091610ca01d7443a67028a2b3ce (patch)
tree4e9994a1de5278ad1fa63277c9106f078d66919d /drivers/base
parent221ad7f2df7c54b3f05471a3599ea7368366aaeb (diff)
downloadop-kernel-dev-137b833457864091610ca01d7443a67028a2b3ce.zip
op-kernel-dev-137b833457864091610ca01d7443a67028a2b3ce.tar.gz
regmap: cache: Use raw I/O to sync rbtrees if we can
This will bring no meaningful benefit by itself, it is done as a separate commit to aid bisection if there are problems with the following commits adding support for coalescing adjacent writes. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/regmap/regcache-rbtree.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c
index 792a760..382a6de 100644
--- a/drivers/base/regmap/regcache-rbtree.c
+++ b/drivers/base/regmap/regcache-rbtree.c
@@ -55,6 +55,12 @@ static unsigned int regcache_rbtree_get_register(struct regmap *map,
return regcache_get_val(map, rbnode->block, idx);
}
+static const void *regcache_rbtree_get_reg_addr(struct regmap *map,
+ struct regcache_rbtree_node *rbnode, unsigned int idx)
+{
+ return regcache_get_val_addr(map, rbnode->block, idx);
+}
+
static void regcache_rbtree_set_register(struct regmap *map,
struct regcache_rbtree_node *rbnode,
unsigned int idx, unsigned int val)
@@ -442,6 +448,7 @@ static int regcache_rbtree_sync(struct regmap *map, unsigned int min,
struct regcache_rbtree_node *rbnode;
unsigned int regtmp;
unsigned int val;
+ const void *addr;
int ret;
int i, base, end;
@@ -480,7 +487,17 @@ static int regcache_rbtree_sync(struct regmap *map, unsigned int min,
continue;
map->cache_bypass = 1;
- ret = _regmap_write(map, regtmp, val);
+
+ if (regmap_can_raw_write(map)) {
+ addr = regcache_rbtree_get_reg_addr(map,
+ rbnode, i);
+ ret = _regmap_raw_write(map, regtmp, addr,
+ map->format.val_bytes,
+ false);
+ } else {
+ ret = _regmap_write(map, regtmp, val);
+ }
+
map->cache_bypass = 0;
if (ret)
return ret;
OpenPOWER on IntegriCloud