From 7658313e7a7126fbe94d68f738795211ce061dc3 Mon Sep 17 00:00:00 2001 From: Alex Frid Date: Mon, 10 Feb 2014 17:35:48 -0800 Subject: regmap: cache: Add interface to change volatile attribute Defined regmap driver callback to set access attribute for the single register as either volatile or cached. Provided the respective public interface for changing access attribute on top of the callback. Cleared cache present bit to invalidate register cache whenever access is actually changed. Bug 1454969 Change-Id: If4e29ccc4c67892974ab6095f9d82e001198d19d Signed-off-by: Alex Frid Reviewed-on: http://git-master/r/365704 Reviewed-by: Laxman Dewangan --- include/linux/regmap.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include') diff --git a/include/linux/regmap.h b/include/linux/regmap.h index 61c350d24de0..882d360b9d75 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -126,6 +126,8 @@ typedef void (*regmap_unlock)(void *); * field is NULL but precious_table (see below) is not, the * check is performed on such table (a register is precious if * it belongs to one of the ranges specified by precious_table). + * @reg_volatile_set: Optional callback to change access mode for the register + * between volatile and cached. * @lock: Optional lock callback (overrides regmap's default lock * function, based on spinlock or mutex). * @unlock: As above for unlocking. @@ -189,6 +191,8 @@ struct regmap_config { bool (*readable_reg)(struct device *dev, unsigned int reg); bool (*volatile_reg)(struct device *dev, unsigned int reg); bool (*precious_reg)(struct device *dev, unsigned int reg); + int (*reg_volatile_set)(struct device *dev, unsigned int reg, + bool is_volatile); regmap_lock lock; regmap_unlock unlock; void *lock_arg; @@ -401,6 +405,8 @@ int regcache_sync_region(struct regmap *map, unsigned int min, 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); +int regcache_volatile_set(struct regmap *map, unsigned int reg, + bool is_volatile); int regmap_register_patch(struct regmap *map, const struct reg_default *regs, int num_regs); @@ -597,6 +603,13 @@ static inline void regcache_mark_dirty(struct regmap *map) WARN_ONCE(1, "regmap API is disabled"); } +static int regcache_volatile_set(struct regmap *map, unsigned int reg, + bool is_volatile) +{ + WARN_ONCE(1, "regmap API is disabled"); + return -EINVAL; +} + static inline void regmap_async_complete(struct regmap *map) { WARN_ONCE(1, "regmap API is disabled"); -- cgit v1.2.3