summaryrefslogtreecommitdiffstats
path: root/drivers/base/regmap/internal.h
diff options
context:
space:
mode:
authorXiubo Li <lixiubo@cmss.chinamobile.com>2016-01-04 11:00:34 +0100
committerMark Brown <broonie@kernel.org>2016-02-19 17:12:11 +0100
commit8b31ec5572f812acac36f3d02944ade76a8f51b9 (patch)
tree70467c764e55d4eaea56776491b6f3403fcba481 /drivers/base/regmap/internal.h
parentregmap: core: Introduce register stride order (diff)
downloadlinux-8b31ec5572f812acac36f3d02944ade76a8f51b9.tar.xz
linux-8b31ec5572f812acac36f3d02944ade76a8f51b9.zip
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/internal.h')
-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