summaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-02-17 14:20:14 -0800
committerSimone Willett <swillett@nvidia.com>2012-04-15 13:22:39 -0700
commit4905e92c32deb4438361f3e52f3355aa877728ff (patch)
tree00988a74ff78e2050bcf8da35e53ec68444cd5cf /drivers/base
parent8d5017795c0e7d407852bae55452ae979b45071f (diff)
regmap: Allow users to query the size of register values
Generic infrastructure based on top of regmap may want to operate on blocks of data and therefore find it useful to find the size of the register values. Provide an accessor operation for this. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cherry-pick from mainline a6539c3 Change-Id: I455ace158eea38f6a92938f6330ec074bc18f0da Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/96481 Reviewed-by: Automatic_Commit_Validation_User
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/regmap/regmap.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 67311c212748..e5ae78623fb7 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -927,6 +927,21 @@ out:
}
EXPORT_SYMBOL_GPL(regmap_register_patch);
+/**
+ * regmap_get_val_bytes(): Report the size of a register value
+ *
+ * Report the size of a register value, mainly intended to for use by
+ * generic infrastructure built on top of regmap.
+ */
+int regmap_get_val_bytes(struct regmap *map)
+{
+ if (map->format.format_write)
+ return -EINVAL;
+
+ return map->format.val_bytes;
+}
+EXPORT_SYMBOL_GPL(regmap_get_val_bytes);
+
static int __init regmap_initcall(void)
{
regmap_debugfs_initcall();