aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/regmap/internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/regmap/internal.h')
-rw-r--r--drivers/base/regmap/internal.h39
1 files changed, 33 insertions, 6 deletions
diff --git a/drivers/base/regmap/internal.h b/drivers/base/regmap/internal.h
index 5a22bd33ce3d..01fbe48e8155 100644
--- a/drivers/base/regmap/internal.h
+++ b/drivers/base/regmap/internal.h
@@ -38,7 +38,8 @@ struct regmap_format {
38 unsigned int reg, unsigned int val); 38 unsigned int reg, unsigned int val);
39 void (*format_reg)(void *buf, unsigned int reg, unsigned int shift); 39 void (*format_reg)(void *buf, unsigned int reg, unsigned int shift);
40 void (*format_val)(void *buf, unsigned int val, unsigned int shift); 40 void (*format_val)(void *buf, unsigned int val, unsigned int shift);
41 unsigned int (*parse_val)(void *buf); 41 unsigned int (*parse_val)(const void *buf);
42 void (*parse_inplace)(void *buf);
42}; 43};
43 44
44struct regmap_async { 45struct regmap_async {
@@ -125,6 +126,9 @@ struct regmap {
125 void *cache; 126 void *cache;
126 u32 cache_dirty; 127 u32 cache_dirty;
127 128
129 unsigned long *cache_present;
130 unsigned int cache_present_nbits;
131
128 struct reg_default *patch; 132 struct reg_default *patch;
129 int patch_regs; 133 int patch_regs;
130 134
@@ -187,12 +191,35 @@ int regcache_read(struct regmap *map,
187int regcache_write(struct regmap *map, 191int regcache_write(struct regmap *map,
188 unsigned int reg, unsigned int value); 192 unsigned int reg, unsigned int value);
189int regcache_sync(struct regmap *map); 193int regcache_sync(struct regmap *map);
190 194int regcache_sync_block(struct regmap *map, void *block,
191unsigned int regcache_get_val(const void *base, unsigned int idx, 195 unsigned int block_base, unsigned int start,
192 unsigned int word_size); 196 unsigned int end);
193bool regcache_set_val(void *base, unsigned int idx, 197
194 unsigned int val, unsigned int word_size); 198static inline const void *regcache_get_val_addr(struct regmap *map,
199 const void *base,
200 unsigned int idx)
201{
202 return base + (map->cache_word_size * idx);
203}
204
205unsigned int regcache_get_val(struct regmap *map, const void *base,
206 unsigned int idx);
207bool regcache_set_val(struct regmap *map, void *base, unsigned int idx,
208 unsigned int val);
195int regcache_lookup_reg(struct regmap *map, unsigned int reg); 209int regcache_lookup_reg(struct regmap *map, unsigned int reg);
210int regcache_set_reg_present(struct regmap *map, unsigned int reg);
211
212static inline bool regcache_reg_present(struct regmap *map, unsigned int reg)
213{
214 if (!map->cache_present)
215 return true;
216 if (reg > map->cache_present_nbits)
217 return false;
218 return map->cache_present[BIT_WORD(reg)] & BIT_MASK(reg);
219}
220
221int _regmap_raw_write(struct regmap *map, unsigned int reg,
222 const void *val, size_t val_len, bool async);
196 223
197void regmap_async_complete_cb(struct regmap_async *async, int ret); 224void regmap_async_complete_cb(struct regmap_async *async, int ret);
198 225