summaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2013-10-08 18:37:36 +0100
committerMark Brown <broonie@linaro.org>2013-10-09 14:05:21 +0100
commit651e013e3ce6c0646c39a07e22bebad75a207209 (patch)
treec6397245cf3cafa078fa11dc60b5a10a7c560feb /drivers/base
parent7e09a979404ed07b8f05d09a0e87a87c7891f472 (diff)
downloadop-kernel-dev-651e013e3ce6c0646c39a07e22bebad75a207209.zip
op-kernel-dev-651e013e3ce6c0646c39a07e22bebad75a207209.tar.gz
regmap: Don't generate gather writes for single register raw writes
Since it is quite common for single register raw or async writes to be generated by rbtree cache syncs or firmware downloads and essentially all hardware will be faster with only a single transfer optimise this case by copying single values into the internal scratch buffer before sending. Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/regmap/regmap.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 742f300..d27758c 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1116,6 +1116,16 @@ int _regmap_raw_write(struct regmap *map, unsigned int reg,
u8[0] |= map->write_flag_mask;
+ /*
+ * Essentially all I/O mechanisms will be faster with a single
+ * buffer to write. Since register syncs often generate raw
+ * writes of single registers optimise that case.
+ */
+ if (val != work_val && val_len == map->format.val_bytes) {
+ memcpy(work_val, val, map->format.val_bytes);
+ val = work_val;
+ }
+
if (async && map->bus->async_write) {
struct regmap_async *async;
OpenPOWER on IntegriCloud