Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 294174
b: refs/heads/master
c: 4d4cfd1
h: refs/heads/master
v: v3
  • Loading branch information
Mark Brown committed Feb 24, 2012
1 parent f92d1b1 commit 867f86e
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ac8d91c801905a061ca883dca427a5e19602a1e7
refs/heads/master: 4d4cfd1656b5f6c88eae51c40741a695b108b006
45 changes: 45 additions & 0 deletions trunk/drivers/base/regmap/regcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,51 @@ int regcache_sync(struct regmap *map)
}
EXPORT_SYMBOL_GPL(regcache_sync);

/**
* regcache_sync_region: Sync part of the register cache with the hardware.
*
* @map: map to sync.
* @min: first register to sync
* @max: last register to sync
*
* Write all non-default register values in the specified region to
* the hardware.
*
* Return a negative value on failure, 0 on success.
*/
int regcache_sync_region(struct regmap *map, unsigned int min,
unsigned int max)
{
int ret = 0;
const char *name;
unsigned int bypass;

BUG_ON(!map->cache_ops || !map->cache_ops->sync);

mutex_lock(&map->lock);

/* Remember the initial bypass state */
bypass = map->cache_bypass;

name = map->cache_ops->name;
dev_dbg(map->dev, "Syncing %s cache from %d-%d\n", name, min, max);

trace_regcache_sync(map->dev, name, "start region");

if (!map->cache_dirty)
goto out;

ret = map->cache_ops->sync(map, min, max);

out:
trace_regcache_sync(map->dev, name, "stop region");
/* Restore the bypass state */
map->cache_bypass = bypass;
mutex_unlock(&map->lock);

return ret;
}

/**
* regcache_cache_only: Put a register map into cache only mode
*
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/regmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ int regmap_update_bits_check(struct regmap *map, unsigned int reg,
bool *change);

int regcache_sync(struct regmap *map);
int regcache_sync_region(struct regmap *map, unsigned int min,
unsigned int max);
void regcache_cache_only(struct regmap *map, bool enable);
void regcache_cache_bypass(struct regmap *map, bool enable);
void regcache_mark_dirty(struct regmap *map);
Expand Down

0 comments on commit 867f86e

Please sign in to comment.