diff options
author | Dimitris Papastamos <dp@opensource.wolfsonmicro.com> | 2011-09-19 17:34:00 +0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-09-19 22:06:31 +0400 |
commit | 9fabe24e9b1af84509b842731d2beaf85e66681e (patch) | |
tree | 6ff64e0b6f42775925fdb3d396adce620a64e6f6 /include | |
parent | b9fb3f3e77cbd536b245db023091e3b7423adeba (diff) | |
download | linux-9fabe24e9b1af84509b842731d2beaf85e66681e.tar.xz |
regmap: Introduce caching support
This patch introduces caching support for regmap. The regcache API
has evolved essentially out of ASoC soc-cache so most of the actual
caching types (except LZO) have been tested in the past.
The purpose of regcache is to optimize in time and space the handling
of register caches. Time optimization is achieved by not having to go
over a slow bus like I2C to read the value of a register, instead it is
cached locally in memory and can be retrieved faster. Regarding space
optimization, some of the cache types are better at packing the caches,
for e.g. the rbtree and the LZO caches. By doing this the sacrifice in
time still wins over doing I2C transactions.
Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Tested-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/regmap.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/include/linux/regmap.h b/include/linux/regmap.h index 18d4afaac166..9d8029449292 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -20,6 +20,11 @@ struct i2c_client; struct spi_device; +/* An enum of all the supported cache types */ +enum regcache_type { + REGCACHE_NONE, +}; + /** * Default value for a register. We use an array of structs rather * than a simple array as many modern devices have very sparse @@ -59,6 +64,11 @@ struct reg_default { * @write_flag_mask: Mask to be set in the top byte of the register when doing * a write. If both read_flag_mask and write_flag_mask are * empty the regmap_bus default masks are used. + * + * @cache_type: The actual cache type. + * @reg_defaults_raw: Power on reset values for registers (for use with + * register cache support). + * @num_reg_defaults_raw: Number of elements in reg_defaults_raw. */ struct regmap_config { int reg_bits; @@ -71,7 +81,10 @@ struct regmap_config { unsigned int max_register; struct reg_default *reg_defaults; - int num_reg_defaults; + unsigned int num_reg_defaults; + enum regcache_type cache_type; + const void *reg_defaults_raw; + unsigned int num_reg_defaults_raw; u8 read_flag_mask; u8 write_flag_mask; |