]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/base/regmap/regmap.c
regmap: Don't generate gather writes for single register raw writes
[karo-tx-linux.git] / drivers / base / regmap / regmap.c
index 742f300ca48a173f4f9e4785e6e41a6eb4909ed2..d27758c337af702ddadf05ca9d87d2694973986b 100644 (file)
@@ -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;