summaryrefslogtreecommitdiff
path: root/drivers/base/regmap
diff options
context:
space:
mode:
authorXiubo Li <lixiubo@cmss.chinamobile.com>2016-01-04 13:00:34 +0300
committerMark Brown <broonie@kernel.org>2016-02-19 19:12:11 +0300
commit8b31ec5572f812acac36f3d02944ade76a8f51b9 (patch)
tree70467c764e55d4eaea56776491b6f3403fcba481 /drivers/base/regmap
parentca747be22fa57bbee50e34c220401160e8f2a07f (diff)
downloadlinux-8b31ec5572f812acac36f3d02944ade76a8f51b9.tar.xz
regcache: Introduce the index parsing API by stride order
Here introduces regcache_get_index_by_order() for regmap cache, which uses the register stride order and bit rotation, to improve the performance. Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/base/regmap')
-rw-r--r--drivers/base/regmap/internal.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/base/regmap/internal.h b/drivers/base/regmap/internal.h
index c22b04b2ca17..5c79526245c2 100644
--- a/drivers/base/regmap/internal.h
+++ b/drivers/base/regmap/internal.h
@@ -273,4 +273,10 @@ static inline unsigned int regmap_get_offset(const struct regmap *map,
return index * map->reg_stride;
}
+static inline unsigned int regcache_get_index_by_order(const struct regmap *map,
+ unsigned int reg)
+{
+ return reg >> map->reg_stride_order;
+}
+
#endif