Lines Matching refs:map
19 static int regcache_lzo_exit(struct regmap *map);
33 static int regcache_lzo_block_count(struct regmap *map) in regcache_lzo_block_count() argument
72 static int regcache_lzo_compress_cache_block(struct regmap *map, in regcache_lzo_compress_cache_block() argument
90 static int regcache_lzo_decompress_cache_block(struct regmap *map, in regcache_lzo_decompress_cache_block() argument
108 static inline int regcache_lzo_get_blkindex(struct regmap *map, in regcache_lzo_get_blkindex() argument
111 return ((reg / map->reg_stride) * map->cache_word_size) / in regcache_lzo_get_blkindex()
112 DIV_ROUND_UP(map->cache_size_raw, in regcache_lzo_get_blkindex()
113 regcache_lzo_block_count(map)); in regcache_lzo_get_blkindex()
116 static inline int regcache_lzo_get_blkpos(struct regmap *map, in regcache_lzo_get_blkpos() argument
119 return (reg / map->reg_stride) % in regcache_lzo_get_blkpos()
120 (DIV_ROUND_UP(map->cache_size_raw, in regcache_lzo_get_blkpos()
121 regcache_lzo_block_count(map)) / in regcache_lzo_get_blkpos()
122 map->cache_word_size); in regcache_lzo_get_blkpos()
125 static inline int regcache_lzo_get_blksize(struct regmap *map) in regcache_lzo_get_blksize() argument
127 return DIV_ROUND_UP(map->cache_size_raw, in regcache_lzo_get_blksize()
128 regcache_lzo_block_count(map)); in regcache_lzo_get_blksize()
131 static int regcache_lzo_init(struct regmap *map) in regcache_lzo_init() argument
141 blkcount = regcache_lzo_block_count(map); in regcache_lzo_init()
142 map->cache = kzalloc(blkcount * sizeof *lzo_blocks, in regcache_lzo_init()
144 if (!map->cache) in regcache_lzo_init()
146 lzo_blocks = map->cache; in regcache_lzo_init()
154 bmp_size = map->num_reg_defaults_raw; in regcache_lzo_init()
180 blksize = regcache_lzo_get_blksize(map); in regcache_lzo_init()
181 p = map->reg_defaults_raw; in regcache_lzo_init()
182 end = map->reg_defaults_raw + map->cache_size_raw; in regcache_lzo_init()
190 ret = regcache_lzo_compress_cache_block(map, in regcache_lzo_init()
200 regcache_lzo_exit(map); in regcache_lzo_init()
204 static int regcache_lzo_exit(struct regmap *map) in regcache_lzo_exit() argument
209 lzo_blocks = map->cache; in regcache_lzo_exit()
213 blkcount = regcache_lzo_block_count(map); in regcache_lzo_exit()
230 map->cache = NULL; in regcache_lzo_exit()
234 static int regcache_lzo_read(struct regmap *map, in regcache_lzo_read() argument
243 blkindex = regcache_lzo_get_blkindex(map, reg); in regcache_lzo_read()
245 blkpos = regcache_lzo_get_blkpos(map, reg); in regcache_lzo_read()
247 blksize = regcache_lzo_get_blksize(map); in regcache_lzo_read()
248 lzo_blocks = map->cache; in regcache_lzo_read()
260 ret = regcache_lzo_decompress_cache_block(map, lzo_block); in regcache_lzo_read()
263 *value = regcache_get_val(map, lzo_block->dst, blkpos); in regcache_lzo_read()
273 static int regcache_lzo_write(struct regmap *map, in regcache_lzo_write() argument
282 blkindex = regcache_lzo_get_blkindex(map, reg); in regcache_lzo_write()
284 blkpos = regcache_lzo_get_blkpos(map, reg); in regcache_lzo_write()
286 blksize = regcache_lzo_get_blksize(map); in regcache_lzo_write()
287 lzo_blocks = map->cache; in regcache_lzo_write()
299 ret = regcache_lzo_decompress_cache_block(map, lzo_block); in regcache_lzo_write()
306 if (regcache_set_val(map, lzo_block->dst, blkpos, value)) { in regcache_lzo_write()
316 ret = regcache_lzo_compress_cache_block(map, lzo_block); in regcache_lzo_write()
324 set_bit(reg / map->reg_stride, lzo_block->sync_bmp); in regcache_lzo_write()
334 static int regcache_lzo_sync(struct regmap *map, unsigned int min, in regcache_lzo_sync() argument
342 lzo_blocks = map->cache; in regcache_lzo_sync()
349 ret = regcache_read(map, i, &val); in regcache_lzo_sync()
354 ret = regcache_lookup_reg(map, i); in regcache_lzo_sync()
355 if (ret > 0 && val == map->reg_defaults[ret].def) in regcache_lzo_sync()
358 map->cache_bypass = 1; in regcache_lzo_sync()
359 ret = _regmap_write(map, i, val); in regcache_lzo_sync()
360 map->cache_bypass = 0; in regcache_lzo_sync()
363 dev_dbg(map->dev, "Synced register %#x, value %#x\n", in regcache_lzo_sync()