diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-03-26 17:26:19 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-03-27 09:03:41 -0400 |
commit | 137b833457864091610ca01d7443a67028a2b3ce (patch) | |
tree | 4e9994a1de5278ad1fa63277c9106f078d66919d /drivers/base | |
parent | 221ad7f2df7c54b3f05471a3599ea7368366aaeb (diff) |
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.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c index 792a760c8ab1..382a6deb3ca8 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, | |||
55 | return regcache_get_val(map, rbnode->block, idx); | 55 | return regcache_get_val(map, rbnode->block, idx); |
56 | } | 56 | } |
57 | 57 | ||
58 | static const void *regcache_rbtree_get_reg_addr(struct regmap *map, | ||
59 | struct regcache_rbtree_node *rbnode, unsigned int idx) | ||
60 | { | ||
61 | return regcache_get_val_addr(map, rbnode->block, idx); | ||
62 | } | ||
63 | |||
58 | static void regcache_rbtree_set_register(struct regmap *map, | 64 | static void regcache_rbtree_set_register(struct regmap *map, |
59 | struct regcache_rbtree_node *rbnode, | 65 | struct regcache_rbtree_node *rbnode, |
60 | unsigned int idx, unsigned int val) | 66 | unsigned int idx, unsigned int val) |
@@ -442,6 +448,7 @@ static int regcache_rbtree_sync(struct regmap *map, unsigned int min, | |||
442 | struct regcache_rbtree_node *rbnode; | 448 | struct regcache_rbtree_node *rbnode; |
443 | unsigned int regtmp; | 449 | unsigned int regtmp; |
444 | unsigned int val; | 450 | unsigned int val; |
451 | const void *addr; | ||
445 | int ret; | 452 | int ret; |
446 | int i, base, end; | 453 | int i, base, end; |
447 | 454 | ||
@@ -480,7 +487,17 @@ static int regcache_rbtree_sync(struct regmap *map, unsigned int min, | |||
480 | continue; | 487 | continue; |
481 | 488 | ||
482 | map->cache_bypass = 1; | 489 | map->cache_bypass = 1; |
483 | ret = _regmap_write(map, regtmp, val); | 490 | |
491 | if (regmap_can_raw_write(map)) { | ||
492 | addr = regcache_rbtree_get_reg_addr(map, | ||
493 | rbnode, i); | ||
494 | ret = _regmap_raw_write(map, regtmp, addr, | ||
495 | map->format.val_bytes, | ||
496 | false); | ||
497 | } else { | ||
498 | ret = _regmap_write(map, regtmp, val); | ||
499 | } | ||
500 | |||
484 | map->cache_bypass = 0; | 501 | map->cache_bypass = 0; |
485 | if (ret) | 502 | if (ret) |
486 | return ret; | 503 | return ret; |