diff options
Diffstat (limited to 'drivers/base/regmap/internal.h')
-rw-r--r-- | drivers/base/regmap/internal.h | 39 |
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 | ||
44 | struct regmap_async { | 45 | struct 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, | |||
187 | int regcache_write(struct regmap *map, | 191 | int regcache_write(struct regmap *map, |
188 | unsigned int reg, unsigned int value); | 192 | unsigned int reg, unsigned int value); |
189 | int regcache_sync(struct regmap *map); | 193 | int regcache_sync(struct regmap *map); |
190 | 194 | int regcache_sync_block(struct regmap *map, void *block, | |
191 | unsigned 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); |
193 | bool regcache_set_val(void *base, unsigned int idx, | 197 | |
194 | unsigned int val, unsigned int word_size); | 198 | static 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 | |||
205 | unsigned int regcache_get_val(struct regmap *map, const void *base, | ||
206 | unsigned int idx); | ||
207 | bool regcache_set_val(struct regmap *map, void *base, unsigned int idx, | ||
208 | unsigned int val); | ||
195 | int regcache_lookup_reg(struct regmap *map, unsigned int reg); | 209 | int regcache_lookup_reg(struct regmap *map, unsigned int reg); |
210 | int regcache_set_reg_present(struct regmap *map, unsigned int reg); | ||
211 | |||
212 | static 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 | |||
221 | int _regmap_raw_write(struct regmap *map, unsigned int reg, | ||
222 | const void *val, size_t val_len, bool async); | ||
196 | 223 | ||
197 | void regmap_async_complete_cb(struct regmap_async *async, int ret); | 224 | void regmap_async_complete_cb(struct regmap_async *async, int ret); |
198 | 225 | ||