aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/regmap/regcache.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/regmap/regcache.c')
-rw-r--r--drivers/base/regmap/regcache.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index d6c2d691b6e8..d4dd77134814 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -307,6 +307,8 @@ int regcache_sync(struct regmap *map)
307 if (!map->cache_dirty) 307 if (!map->cache_dirty)
308 goto out; 308 goto out;
309 309
310 map->async = true;
311
310 /* Apply any patch first */ 312 /* Apply any patch first */
311 map->cache_bypass = 1; 313 map->cache_bypass = 1;
312 for (i = 0; i < map->patch_regs; i++) { 314 for (i = 0; i < map->patch_regs; i++) {
@@ -332,11 +334,15 @@ int regcache_sync(struct regmap *map)
332 map->cache_dirty = false; 334 map->cache_dirty = false;
333 335
334out: 336out:
335 trace_regcache_sync(map->dev, name, "stop");
336 /* Restore the bypass state */ 337 /* Restore the bypass state */
338 map->async = false;
337 map->cache_bypass = bypass; 339 map->cache_bypass = bypass;
338 map->unlock(map->lock_arg); 340 map->unlock(map->lock_arg);
339 341
342 regmap_async_complete(map);
343
344 trace_regcache_sync(map->dev, name, "stop");
345
340 return ret; 346 return ret;
341} 347}
342EXPORT_SYMBOL_GPL(regcache_sync); 348EXPORT_SYMBOL_GPL(regcache_sync);
@@ -375,17 +381,23 @@ int regcache_sync_region(struct regmap *map, unsigned int min,
375 if (!map->cache_dirty) 381 if (!map->cache_dirty)
376 goto out; 382 goto out;
377 383
384 map->async = true;
385
378 if (map->cache_ops->sync) 386 if (map->cache_ops->sync)
379 ret = map->cache_ops->sync(map, min, max); 387 ret = map->cache_ops->sync(map, min, max);
380 else 388 else
381 ret = regcache_default_sync(map, min, max); 389 ret = regcache_default_sync(map, min, max);
382 390
383out: 391out:
384 trace_regcache_sync(map->dev, name, "stop region");
385 /* Restore the bypass state */ 392 /* Restore the bypass state */
386 map->cache_bypass = bypass; 393 map->cache_bypass = bypass;
394 map->async = false;
387 map->unlock(map->lock_arg); 395 map->unlock(map->lock_arg);
388 396
397 regmap_async_complete(map);
398
399 trace_regcache_sync(map->dev, name, "stop region");
400
389 return ret; 401 return ret;
390} 402}
391EXPORT_SYMBOL_GPL(regcache_sync_region); 403EXPORT_SYMBOL_GPL(regcache_sync_region);
@@ -631,8 +643,7 @@ static int regcache_sync_block_raw_flush(struct regmap *map, const void **data,
631 643
632 map->cache_bypass = 1; 644 map->cache_bypass = 1;
633 645
634 ret = _regmap_raw_write(map, base, *data, count * val_bytes, 646 ret = _regmap_raw_write(map, base, *data, count * val_bytes);
635 false);
636 647
637 map->cache_bypass = 0; 648 map->cache_bypass = 0;
638 649