Skip to content

Commit f5468be

Browse files
committed
Merge tag 'regmap-v6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap
Pull regmap updates from Mark Brown: "This is a much bigger change for regmap than is normal, the main things being the addition of some KUnit coverage and a maple tree based register cache which longer term is likely to replace the rbtree cache except possibly for very small register maps. While it's complete overkill for most applications the code for maple trees is there and there are some larger, sparser devices where the data structure is a better fit. The maple tree support is still a work in progress but already useful, there's some conversions of drivers ready to go after the merge window. Summary: - Support for shifting register addresses up as well as down, there's a use cases with memory mapped MDIO. - Refactoring of the type configuration in regmap-irq to allow access to driver data in the handler, needed by some GPIO devices. - Some initial KUnit coverage, the bulk of the driver facing API is covered but there's holes and things like the data marshalling for bytestream buses are just not covered in the slightest. - Removal of the compressed cache type, it had zero users and was getting in the way of KUnit. - Addition of a maple tree based register cache, there's more work to do but it's already useful for some devices with a flatter data structure than rbtree and getting to use all the optimisation work Liam is doing" * tag 'regmap-v6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap: regmap: allow upshifting register addresses before performing operations regmap: Pass irq_drv_data as a parameter for set_type_config() regmap: Use mas_walk() instead of mas_find() regmap: Fix double unlock in the maple cache regmap: Add maple tree based register cache regmap: Factor out single value register syncing regmap: Add some basic kunit tests regmap: Add RAM backed register map regmap: Removed compressed cache support regmap: Support paging for buses with reg_read()/reg_write() regmap: Clarify error for unknown cache types regmap: Handle sparse caches in the default sync regmap: add a helper to translate the register address regmap: cache: Silence checkpatch warning regmap: cache: Return error in cache sync operations for REGCACHE_NONE regmap-irq: Place kernel doc of struct regmap_irq_chip in order regmap-irq: Add no_status support regmap: sdw: Remove 8-bit value size restriction regmap: sdw: Update misleading comment
2 parents 088e0c1 + 4a670ac commit f5468be

13 files changed

Lines changed: 1284 additions & 447 deletions

File tree

drivers/base/regmap/Kconfig

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ config REGMAP
99
select MDIO_BUS if REGMAP_MDIO
1010
bool
1111

12-
config REGCACHE_COMPRESSED
13-
select LZO_COMPRESS
14-
select LZO_DECOMPRESS
15-
bool
12+
config REGMAP_KUNIT
13+
tristate "KUnit tests for regmap"
14+
depends on KUNIT
15+
default KUNIT_ALL_TESTS
16+
select REGMAP
17+
select REGMAP_RAM
1618

1719
config REGMAP_AC97
1820
tristate
@@ -46,6 +48,9 @@ config REGMAP_MMIO
4648
config REGMAP_IRQ
4749
bool
4850

51+
config REGMAP_RAM
52+
tristate
53+
4954
config REGMAP_SOUNDWIRE
5055
tristate
5156
depends on SOUNDWIRE

drivers/base/regmap/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
CFLAGS_regmap.o := -I$(src)
44

55
obj-$(CONFIG_REGMAP) += regmap.o regcache.o
6-
obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-flat.o
7-
obj-$(CONFIG_REGCACHE_COMPRESSED) += regcache-lzo.o
6+
obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-flat.o regcache-maple.o
87
obj-$(CONFIG_DEBUG_FS) += regmap-debugfs.o
8+
obj-$(CONFIG_REGMAP_KUNIT) += regmap-kunit.o
99
obj-$(CONFIG_REGMAP_AC97) += regmap-ac97.o
1010
obj-$(CONFIG_REGMAP_I2C) += regmap-i2c.o
11+
obj-$(CONFIG_REGMAP_RAM) += regmap-ram.o
1112
obj-$(CONFIG_REGMAP_SLIMBUS) += regmap-slimbus.o
1213
obj-$(CONFIG_REGMAP_SPI) += regmap-spi.o
1314
obj-$(CONFIG_REGMAP_SPMI) += regmap-spmi.o

drivers/base/regmap/internal.h

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ struct regmap_format {
3131
size_t buf_size;
3232
size_t reg_bytes;
3333
size_t pad_bytes;
34-
size_t reg_downshift;
3534
size_t val_bytes;
35+
s8 reg_shift;
3636
void (*format_write)(struct regmap *map,
3737
unsigned int reg, unsigned int val);
3838
void (*format_reg)(void *buf, unsigned int reg, unsigned int shift);
@@ -270,6 +270,7 @@ unsigned int regcache_get_val(struct regmap *map, const void *base,
270270
bool regcache_set_val(struct regmap *map, void *base, unsigned int idx,
271271
unsigned int val);
272272
int regcache_lookup_reg(struct regmap *map, unsigned int reg);
273+
int regcache_sync_val(struct regmap *map, unsigned int reg, unsigned int val);
273274

274275
int _regmap_raw_write(struct regmap *map, unsigned int reg,
275276
const void *val, size_t val_len, bool noinc);
@@ -281,7 +282,7 @@ enum regmap_endian regmap_get_val_endian(struct device *dev,
281282
const struct regmap_config *config);
282283

283284
extern struct regcache_ops regcache_rbtree_ops;
284-
extern struct regcache_ops regcache_lzo_ops;
285+
extern struct regcache_ops regcache_maple_ops;
285286
extern struct regcache_ops regcache_flat_ops;
286287

287288
static inline const char *regmap_name(const struct regmap *map)
@@ -307,4 +308,23 @@ static inline unsigned int regcache_get_index_by_order(const struct regmap *map,
307308
return reg >> map->reg_stride_order;
308309
}
309310

311+
struct regmap_ram_data {
312+
unsigned int *vals; /* Allocatd by caller */
313+
bool *read;
314+
bool *written;
315+
};
316+
317+
/*
318+
* Create a test register map with data stored in RAM, not intended
319+
* for practical use.
320+
*/
321+
struct regmap *__regmap_init_ram(const struct regmap_config *config,
322+
struct regmap_ram_data *data,
323+
struct lock_class_key *lock_key,
324+
const char *lock_name);
325+
326+
#define regmap_init_ram(config, data) \
327+
__regmap_lockdep_wrapper(__regmap_init_ram, #config, config, data)
328+
329+
310330
#endif

0 commit comments

Comments
 (0)