aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2013-10-08 13:37:36 -0400
committerMark Brown <broonie@linaro.org>2013-10-09 09:05:21 -0400
commit651e013e3ce6c0646c39a07e22bebad75a207209 (patch)
treec6397245cf3cafa078fa11dc60b5a10a7c560feb
parent7e09a979404ed07b8f05d09a0e87a87c7891f472 (diff)
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>
-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 742f300ca48a..d27758c337af 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,
1116 1116
1117 u8[0] |= map->write_flag_mask; 1117 u8[0] |= map->write_flag_mask;
1118 1118
1119 /*
1120 * Essentially all I/O mechanisms will be faster with a single
1121 * buffer to write. Since register syncs often generate raw
1122 * writes of single registers optimise that case.
1123 */
1124 if (val != work_val && val_len == map->format.val_bytes) {
1125 memcpy(work_val, val, map->format.val_bytes);
1126 val = work_val;
1127 }
1128
1119 if (async && map->bus->async_write) { 1129 if (async && map->bus->async_write) {
1120 struct regmap_async *async; 1130 struct regmap_async *async;
1121 1131