diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2026-02-11 09:23:13 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2026-02-11 09:23:13 -0800 |
| commit | d5cbd9f332c70be9589201474b9477baf9b5a24d (patch) | |
| tree | e9b9045860f9b8ce8a2ba5ef27d5de2f2b0e9224 /include/linux | |
| parent | be653d2d1f435218cf4b7abad96b42a20ce28451 (diff) | |
| parent | 4651c87b0083925540f6c3d26a6c5b4868d7b884 (diff) | |
Merge tag 'regmap-v6.20' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap
Pull regmap updates from Mark Brown:
"The main change here is the implementation of a mechanism for
generating register defaults via a callback rather than with a table
in the driver.
This is useful for devices where there are large ranges of registers
with the same or generated values, it allows us to have a small amount
of code instead of a larger amount of default data"
* tag 'regmap-v6.20' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap:
regcache: Demote defaults readback from HW to debug print
regmap: add KUnit coverage for reg_default_cb callback
regmap: Add reg_default_cb callback for flat cache defaults
regmap: Enable REGMAP when REGMAP_SLIMBUS is enabled
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/regmap.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/regmap.h b/include/linux/regmap.h index b0b9be750d93..caff2240bdab 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -359,6 +359,10 @@ typedef void (*regmap_unlock)(void *); * @reg_defaults: Power on reset values for registers (for use with * register cache support). * @num_reg_defaults: Number of elements in reg_defaults. + * @reg_default_cb: Optional callback to return default values for registers + * not listed in reg_defaults. This is only used for + * REGCACHE_FLAT population; drivers must ensure the readable_reg/ + * writeable_reg callbacks are defined to handle holes. * * @read_flag_mask: Mask to be set in the top bytes of the register when doing * a read. @@ -449,6 +453,8 @@ struct regmap_config { const struct regmap_access_table *rd_noinc_table; const struct reg_default *reg_defaults; unsigned int num_reg_defaults; + int (*reg_default_cb)(struct device *dev, unsigned int reg, + unsigned int *def); enum regcache_type cache_type; const void *reg_defaults_raw; unsigned int num_reg_defaults_raw; @@ -1349,6 +1355,14 @@ static inline int regmap_write_bits(struct regmap *map, unsigned int reg, return regmap_update_bits_base(map, reg, mask, val, NULL, false, true); } +static inline int regmap_default_zero_cb(struct device *dev, + unsigned int reg, + unsigned int *def) +{ + *def = 0; + return 0; +} + int regmap_get_val_bytes(struct regmap *map); int regmap_get_max_register(struct regmap *map); int regmap_get_reg_stride(struct regmap *map); |
