Commit 1ea975cf authored by Cristian Birsan's avatar Cristian Birsan Committed by Mark Brown

regmap: Add a function to check if a regmap register is cached

Add a function to check if a regmap register is cached. This will be used
in debugfs to dump the cached values of write only registers.
Signed-off-by: default avatarCristian Birsan <cristian.birsan@microchip.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 29b4817d
......@@ -173,6 +173,7 @@ struct regcache_ops {
int (*drop)(struct regmap *map, unsigned int min, unsigned int max);
};
bool regmap_cached(struct regmap *map, unsigned int reg);
bool regmap_writeable(struct regmap *map, unsigned int reg);
bool regmap_readable(struct regmap *map, unsigned int reg);
bool regmap_volatile(struct regmap *map, unsigned int reg);
......
......@@ -93,6 +93,29 @@ bool regmap_writeable(struct regmap *map, unsigned int reg)
return true;
}
bool regmap_cached(struct regmap *map, unsigned int reg)
{
int ret;
unsigned int val;
if (map->cache == REGCACHE_NONE)
return false;
if (!map->cache_ops)
return false;
if (map->max_register && reg > map->max_register)
return false;
map->lock(map->lock_arg);
ret = regcache_read(map, reg, &val);
map->unlock(map->lock_arg);
if (ret)
return false;
return true;
}
bool regmap_readable(struct regmap *map, unsigned int reg)
{
if (!map->reg_read)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment