mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-11-01 10:33:27 +00:00
regmap: cache: Provide a get address of value operation
Provide a helper to do the size based index into a block of registers and use it when reading a value. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
parent
0c7ed8563a
commit
8817796b75
2 changed files with 9 additions and 2 deletions
|
@ -189,6 +189,13 @@ int regcache_write(struct regmap *map,
|
|||
unsigned int reg, unsigned int value);
|
||||
int regcache_sync(struct regmap *map);
|
||||
|
||||
static inline const void *regcache_get_val_addr(struct regmap *map,
|
||||
const void *base,
|
||||
unsigned int idx)
|
||||
{
|
||||
return base + (map->cache_word_size * idx);
|
||||
}
|
||||
|
||||
unsigned int regcache_get_val(struct regmap *map, const void *base,
|
||||
unsigned int idx);
|
||||
bool regcache_set_val(struct regmap *map, void *base, unsigned int idx,
|
||||
|
|
|
@ -458,8 +458,8 @@ unsigned int regcache_get_val(struct regmap *map, const void *base,
|
|||
|
||||
/* Use device native format if possible */
|
||||
if (map->format.parse_val)
|
||||
return map->format.parse_val(base +
|
||||
(map->cache_word_size * idx));
|
||||
return map->format.parse_val(regcache_get_val_addr(map, base,
|
||||
idx));
|
||||
|
||||
switch (map->cache_word_size) {
|
||||
case 1: {
|
||||
|
|
Loading…
Reference in a new issue