5e0cbe78762b5f02986bf9e59a188dad2f6e0be1 |
|
24-Aug-2014 |
Lars-Peter Clausen <lars@metafoo.de> |
regmap: Fix regcache debugfs initialization Commit 6cfec04bcc05 ("regmap: Separate regmap dev initialization") moved the regmap debugfs initialization after regcache initialization. This means that the regmap debugfs directory is not created yet when the cache initialization runs and so any debugfs files registered by the regcache are created in the debugfs root directory rather than the debugfs directory of the regmap instance. Fix this by adding a separate callback for the regcache debugfs initialization which will be called after the parent debugfs entry has been created. Fixes: 6cfec04bcc05 (regmap: Separate regmap dev initialization) Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org> Cc: stable@vger.kernel.org
|
70d383b7fefc40179da3eadbeb79c222d21987df |
|
01-Apr-2014 |
Jean-Christophe PINCE <jean-christophe.pince@intel.com> |
regmap: rbtree: improve 64bits memory alignment Change regcache_rbtree_node strcuture fields order to align the pointers on 64bits architectures. Signed-off-by: Jean-Christophe PINCE <jean-christophe.pince@intel.com> Signed-off-by: David Cohen <david.a.cohen@linux.intel.com> Signed-off-by: Mark Brown <broonie@linaro.org>
|
3f4ff561bc88b074d5e868dde4012d89cbb06c87 |
|
29-Aug-2013 |
Lars-Peter Clausen <lars@metafoo.de> |
regmap: rbtree: Make cache_present bitmap per node With devices which have a dense and small register map but placed at a large offset the global cache_present bitmap imposes a huge memory overhead. Making the cache_present per rbtree node avoids the issue and easily reduces the memory footprint by a factor of ten. For devices with a more sparse map or without a large base register offset the memory usage might increase slightly by a few bytes, but not significantly. E.g. for a device which has ~50 registers at offset 0x4000 the memory footprint of the register cache goes down form 2496 bytes to 175 bytes. Moving the bitmap to a per node basis means that the handling of the bitmap is now cache implementation specific and can no longer be managed by the core. The regcache_sync_block() function is extended by a additional parameter so that the cache implementation can tell the core which registers in the block are set and which are not. The parameter is optional and if NULL the core assumes that all registers are set. The rbtree cache also needs to implement its own drop callback instead of relying on the core to handle this. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
|
472fdec7380cec483e241fa696d9b90bc37ddd4c |
|
29-Aug-2013 |
Lars-Peter Clausen <lars@metafoo.de> |
regmap: rbtree: Reduce number of nodes, take 2 Support for reducing the number of nodes and memory consumption of the rbtree cache by allowing for small unused holes in the node's register cache block was initially added in commit 0c7ed856 ("regmap: Cut down on the average # of nodes in the rbtree cache"). But the commit had problems and so its effect was reverted again in commit 4e67fb5 ("regmap: rbtree: Fix overlapping rbnodes."). This patch brings the feature back of reducing the average number of nodes, which will speedup node look-up, while at the same time also reducing the memory usage of the rbtree cache. This patch takes a slightly different approach than the original patch though. It modifies the adjacent node look-up to not only consider nodes that are just one to the left or the right of the register but any node that falls in a certain range around the register. The range is calculated based on how much memory it would take to allocate a new node compared to how much memory it takes adding a set of unused registers to an existing node. E.g. if a node takes up 24 bytes and each register in a block uses 1 byte the range will be from the register address - 24 to the register address + 24. If we find a node that falls within this range it is cheaper or as expensive to add the register to the existing node and have a couple of unused registers in the node's cache compared to allocating a new node. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
|
194c753a214ba7f1497552dd530021884d164146 |
|
29-Aug-2013 |
Lars-Peter Clausen <lars@metafoo.de> |
regmap: rbtree: Simplify adjacent node look-up A register which is adjacent to a node will either be left to the first register or right to the last register. It will not be within the node's range, so there is no point in checking for each register cached by the node whether the new register is next to it. It is sufficient to check whether the register comes before the first register or after the last register of the node. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
|
b6752123ccef4eec3c70c20dbdfc05d1674319c5 |
|
27-Aug-2013 |
Lars-Peter Clausen <lars@metafoo.de> |
regcache-rbtree: Fix reg_stride != 1 There are a couple of calculations, which convert between register addresses and block indices, in regcache_rbtree_sync() and regcache_rbtree_node_alloc() which assume that reg_stride is 1. This will break the rb cache for configurations which do not use a reg_stride of 1. Also rename 'base' in regcache_rbtree_sync() to 'start' to avoid confusion with 'base_reg'. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
|
4e67fb5f5e336250db944921e3c68057d6203034 |
|
21-Aug-2013 |
David Jander <david@protonic.nl> |
regmap: rbtree: Fix overlapping rbnodes. Avoid overlapping register regions by making the initial blklen of a new node 1. If a register write occurs to a yet uncached register, that is lower than but near an existing node's base_reg, a new node is created and it's blklen is set to an arbitrary value (sizeof(*rbnode)). That may cause this node to overlap with another node. Those nodes should be merged, but this merge doesn't happen yet, so this patch at least makes the initial blklen small enough to avoid hitting the wrong node, which may otherwise lead to severe breakage. Signed-off-by: David Jander <david@protonic.nl> Signed-off-by: Mark Brown <broonie@linaro.org> Cc: stable@vger.kernel.org
|
f3284f91535cc2e1406b7efe27a1de96c96c19b4 |
|
31-May-2013 |
Maarten ter Huurne <maarten@treewalker.org> |
regmap: rbtree: Fixed node range check on sync A node starting before the minimum register is no reason to reject it, since its end could be in range. The check for the end already exists two lines lower, so we can just remove the incorrect check. Signed-off-by: Maarten ter Huurne <maarten@treewalker.org> Signed-off-by: Mark Brown <broonie@linaro.org>
|
f20c783c3ae33c30fd7cf0616db18d30cb6e802b |
|
23-May-2013 |
Lars-Peter Clausen <lars@metafoo.de> |
regmap: regcache: Fixup locking for custom lock callbacks The parameter passed to the regmap lock/unlock callbacks needs to be map->lock_arg, regcache passes just map. This works fine in the case that no custom locking callbacks are used since in this case map->lock_arg equals map, but will break when custom locking callbacks are used. The issue was introduced in commit 0d4529c5("regmap: make lock/unlock functions customizable") and is fixed by this patch. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
81485f5220770c381ac076573642ac44f13723af |
|
23-May-2013 |
Lars-Peter Clausen <lars@metafoo.de> |
regmap: regcache: Fixup locking for custom lock callbacks The parameter passed to the regmap lock/unlock callbacks needs to be map->lock_arg, regcache passes just map. This works fine in the case that no custom locking callbacks are used, since in this case map->lock_arg equals map, but will break when custom locking callbacks are used. The issue was introduced in commit 0d4529c5 ("regmap: make lock/unlock functions customizable") and is fixed by this patch. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
7278af5fb3eb7247449fd4489dacb75b9ba86f73 |
|
08-May-2013 |
Mark Brown <broonie@opensource.wolfsonmicro.com> |
regmap: rbtree: Use range information to allocate nodes If range information has been provided then when we allocate a rbnode within a range allocate the entire range. The goal is to minimise the number of reallocations done when combining or extending blocks. At present only readability and yes_ranges are taken into account, this is expected to cover most cases efficiently. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
0186645d2549f94c3a8067c97cad261c678d6718 |
|
08-May-2013 |
Mark Brown <broonie@opensource.wolfsonmicro.com> |
regmap: rbtree: Factor out node allocation In preparation for being slightly smarter about how we allocate memory factor out the node allocation. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
f8bd822cbf953299b2957b45f6a43c08e7931ddc |
|
29-Mar-2013 |
Mark Brown <broonie@opensource.wolfsonmicro.com> |
regmap: cache: Factor out block sync The idea of holding blocks of registers in device format is shared between at least rbtree and lzo cache formats so split out the loop that does the sync from the rbtree code so optimisations on it can be reused. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Reviewed-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
|
78493f2d7b51d6f6d03982cee559c62dfab4c292 |
|
29-Mar-2013 |
Mark Brown <broonie@opensource.wolfsonmicro.com> |
regmap: cache: Factor out reg_present support from rbtree cache The idea of maintaining a bitmap of present registers is something that can usefully be used by other cache types that maintain blocks of cached registers so move the code out of the rbtree cache and into the generic regcache code. Refactor the interface slightly as we go to wrap the set bit and enlarge bitmap operations (since we never do one without the other) and make it more robust for reads of uncached registers by bounds checking before we look at the bitmap. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Reviewed-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
|
137b833457864091610ca01d7443a67028a2b3ce |
|
26-Mar-2013 |
Mark Brown <broonie@opensource.wolfsonmicro.com> |
regmap: cache: Use raw I/O to sync rbtrees if we can This will bring no meaningful benefit by itself, it is done as a separate commit to aid bisection if there are problems with the following commits adding support for coalescing adjacent writes. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
0c7ed8563a0282c032936ae1c667498d59691593 |
|
15-Mar-2013 |
Dimitris Papastamos <dp@opensource.wolfsonmicro.com> |
regmap: Cut down on the average # of nodes in the rbtree cache This patch aims to bring down the average number of nodes in the rbtree cache and increase the average number of registers per node. This should improve general lookup and traversal times. This is achieved by setting the minimum size of a block within the rbnode to the size of the rbnode itself. This will essentially cache possibly non-existent registers so to combat this scenario, we keep a separate bitmap in memory which keeps track of which register exists. The memory overhead of this change is likely in the order of ~5-10%, possibly less depending on the register file layout. On my test system with a bitmap of ~4300 bits and a relatively sparse register layout, the memory requirements for the entire cache did not increase (the cutting down of nodes which was about 50% of the original number compensated the situation). A second patch that can be built on top of this can look at the ratio `sizeof(*rbnode) / map->cache_word_size' in order to suitably adjust the block length of each block. Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
8abac3ba51b5525354e9b2ec0eed1c9e95c905d9 |
|
13-Mar-2013 |
Lars-Peter Clausen <lars@metafoo.de> |
regmap: cache Fix regcache-rbtree sync The last register block, which falls into the specified range, is not handled correctly. The formula which calculates the number of register which should be synced is inverse (and off by one). E.g. if all registers in that block should be synced only one is synced, and if only one should be synced all (but one) are synced. To calculate the number of registers that need to be synced we need to subtract the number of the first register in the block from the max register number and add one. This patch updates the code accordingly. The issue was introduced in commit ac8d91c ("regmap: Supply ranges to the sync operations"). Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: stable@vger.kernel.org
|
a42277c739c29b06cb27502347f557e11fed8b0e |
|
12-Mar-2013 |
Dimitris Papastamos <dp@opensource.wolfsonmicro.com> |
regmap: rbtree Expose total memory consumption in the rbtree debugfs entry Provide a feel of how much overhead the rbtree cache adds to the game. [Slightly reworded output in debugfs -- broonie] Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
879082c9fe6e8fbddf787170eee605e4be138d0f |
|
21-Feb-2013 |
Mark Brown <broonie@opensource.wolfsonmicro.com> |
regmap: cache: Pass the map rather than the word size when updating values It's more idiomatic to pass the map structure around and this means we can use other bits of information from the map. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
66baf407571662f7e2a22dd0764cbe279559446c |
|
21-Feb-2013 |
Mark Brown <broonie@opensource.wolfsonmicro.com> |
regmap: rbtree: Don't bother checking for noop updates If we're updating a value in place it's more work to read the value and compare the value with what we're about to set than it is to just write the value into the cache; there are no further operations after writing in the code even though there's an early return here. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
edc9ae420f98dd094e47f8b2d33652858bdc830b |
|
09-Apr-2012 |
Stephen Warren <swarren@nvidia.com> |
regmap: implement register striding regmap_config.reg_stride is introduced. All extant register addresses are a multiple of this value. Users of serial-oriented regmap busses will typically set this to 1. Users of the MMIO regmap bus will typically set this based on the value size of their registers, in bytes, so 4 for a 32-bit register. Throughout the regmap code, actual register addresses are used. Wherever the register address is used to index some array of values, the address is divided by the stride to determine the index, or vice-versa. Error- checking is added to all entry-points for register address data to ensure that register addresses actually satisfy the specified stride. The MMIO bus ensures that the specified stride is large enough for the register size. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
a42678c4c8b5f6d489829ffc3071fa1f08ee99d1 |
|
04-Apr-2012 |
Stephen Warren <swarren@nvidia.com> |
regmap: introduce fast_io busses, and use a spinlock for them Some bus types have very fast IO. For these, acquiring a mutex for every IO operation is a significant overhead. Allow busses to indicate their IO is fast, and enhance regmap to use a spinlock for those busses. [Currently limited to native endian registers -- broonie] Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
f01ee60fffa4dc6c77122121233a793f7f696e67 |
|
09-Apr-2012 |
Stephen Warren <swarren@nvidia.com> |
regmap: implement register striding regmap_config.reg_stride is introduced. All extant register addresses are a multiple of this value. Users of serial-oriented regmap busses will typically set this to 1. Users of the MMIO regmap bus will typically set this based on the value size of their registers, in bytes, so 4 for a 32-bit register. Throughout the regmap code, actual register addresses are used. Wherever the register address is used to index some array of values, the address is divided by the stride to determine the index, or vice-versa. Error- checking is added to all entry-points for register address data to ensure that register addresses actually satisfy the specified stride. The MMIO bus ensures that the specified stride is large enough for the register size. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
bacdbe077342ecc9e7b3e374cc5a41995116706a |
|
04-Apr-2012 |
Stephen Warren <swarren@nvidia.com> |
regmap: introduce fast_io busses, and use a spinlock for them Some bus types have very fast IO. For these, acquiring a mutex for every IO operation is a significant overhead. Allow busses to indicate their IO is fast, and enhance regmap to use a spinlock for those busses. [Currently limited to native endian registers -- broonie] Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
c04c1b9ee8f30c7a3a25e20e406247003f634ebe |
|
04-Apr-2012 |
Stephen Warren <swarren@nvidia.com> |
regmap: prevent division by zero in rbtree_show If there are no nodes in the cache, nodes will be 0, so calculating "registers / nodes" will cause division by zero. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: stable@vger.kernel.org
|
4b4e9e43fd210e0cd2a5d29357e7c000e13e08ae |
|
23-Mar-2012 |
Lars-Peter Clausen <lars@metafoo.de> |
regmap: rbtree: Fix register default look-up in sync The code currently passes the register offset in the current block to regcache_lookup_reg. This works fine as long as there is only one block and with base register of 0, but in all other cases it will look-up the default for a wrong register, which can cause unnecessary register writes. This patch fixes it by passing the actual register number to regcache_lookup_reg. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: <stable@vger.kernel.org>
|
51990e825431089747f8896244b5c17d3a6423f1 |
|
22-Jan-2012 |
Paul Gortmaker <paul.gortmaker@windriver.com> |
device.h: cleanup users outside of linux/include (C files) For files that are actively using linux/device.h, make sure that they call it out. This will allow us to clean up some of the implicit uses of linux/device.h within include/* without introducing build regressions. Yes, this was created by "cheating" -- i.e. the headers were cleaned up, and then the fallout was found and fixed, and then the two commits were reordered. This ensures we don't introduce build regressions into the git history. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
|
f9353e70bcebd00cd182d946083afd7d8eddd259 |
|
06-Mar-2012 |
Mark Brown <broonie@opensource.wolfsonmicro.com> |
regmap: Fix rbtree block base in sync Otherwise we'll end up running with bogus register numbers. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
994f5db65ef4b83db0321842bd43c6bc0a51f000 |
|
06-Mar-2012 |
Mark Brown <broonie@opensource.wolfsonmicro.com> |
regcache: Make sure we sync register 0 in an rbtree cache Most of the current users have register 0 as a volatile register or don't have a register 0 so it's not been apparent that it's not getting synced. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
ac8d91c801905a061ca883dca427a5e19602a1e7 |
|
23-Feb-2012 |
Mark Brown <broonie@opensource.wolfsonmicro.com> |
regmap: Supply ranges to the sync operations In order to allow us to support partial sync operations add minimum and maximum register arguments to the sync operation and update the rbtree and lzo caches to use this new information. The LZO implementation is obviously not good, we could exit the iteration earlier, but there may be room for more wide reaching optimisation there. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
cce585ce1ebd5307c9709e24758d5eb8a1e087a7 |
|
22-Nov-2011 |
Mark Brown <broonie@opensource.wolfsonmicro.com> |
regmap: Fix rbtreee build when not using debugfs The debugfs functions don't stub themselves out quite so well as might be desirable so provide functions which do do this stubbing. Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
bad2ab4b6d938482c2b0bdcf80a8d14dbef4e8f5 |
|
21-Nov-2011 |
Mark Brown <broonie@opensource.wolfsonmicro.com> |
regmap: Provide debugfs dump of the rbtree cache data Show the register ranges we have in each rbtree node in debugfs, plus some statistics on how big each node is and the total number of nodes. It may also be worth collecting data on the ranges of dirty registers to see if there's much mileage in trying to coalesce writes on sync. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
462a185c5cea7063348003c1644b70a6f6780f01 |
|
15-Nov-2011 |
Lars-Peter Clausen <lars@metafoo.de> |
regmap: Do not call regcache_exit from regcache_rbtree_init error path Calling regcache_exit from regcache_rbtree_init is first of all a layering violation and secondly will cause double frees. regcache_exit will free buffers allocated by the core, but the core will also free the same buffers when the cacheops init callback returns an error. Thus we end up with a double free. Fix this by not calling regcache_exit but only free those buffers which, have been allocated in this function. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
b03622a80d2206c4179d6a41a0dc5cfbdfc853ee |
|
09-Oct-2011 |
Mark Brown <broonie@opensource.wolfsonmicro.com> |
regmap: Ensure rbtree syncs registers set to zero properly Simplify the check for registers set at their default value by avoiding picking a default value in the case where we don't have one. Instead we only compare the current value to the current value when we looked one up. This fixes the case where we don't have a default stored but the value was set to zero when that isn't the chip default. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
|
e42c5a9a4230c38ceba0a890b30a2d0dd9314bff |
|
09-Oct-2011 |
Mark Brown <broonie@opensource.wolfsonmicro.com> |
regmap: Allow rbtree to cache zero default values Ensure that when we start up in cache only mode we can store defaults of zero, otherwise if the hardware is unavailable we won't be able to read. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
|
6e6ace00a045251bd172b9b9c2379857bbff3dc7 |
|
09-Oct-2011 |
Mark Brown <broonie@opensource.wolfsonmicro.com> |
regmap: Return a sensible error code if we fail to read the cache If a register isn't cached then let callers know that so they can fall back or error handle appropriately. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
|
13753a9088af23c61e2f5c10a8f3ea136d8ebab5 |
|
29-Sep-2011 |
Dimitris Papastamos <dp@opensource.wolfsonmicro.com> |
regmap: Lock the sync path, ensure we use the lockless _regmap_write() Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
3405addd220a0cf2e3a8ffb9051afe766e5f52e8 |
|
27-Sep-2011 |
Lars-Peter Clausen <lars@metafoo.de> |
regmap: rbtree-cache: Move cached rbnode handling into lookup function Move the handling of the cached rbnode into regcache_rbtree_lookup. This allows us to remove of some duplicated code sections in regcache_rbtree_read and regcache_rbtree_write. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
c5713004b304e89c8c5117d8f226d5a1603571dc |
|
27-Sep-2011 |
Lars-Peter Clausen <lars@metafoo.de> |
regmap: regcache_rbtree_{set,get}_register: Use regcache_{set,get}_val Use regcache_{set,get}_val in regcache_rbtree_{set,get}_register instead of re-implementing its functionality. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
25ed1156ddf99f6d8feb87d0992b2ecb1fef667a |
|
27-Sep-2011 |
Dimitris Papastamos <dp@opensource.wolfsonmicro.com> |
regmap: Remove redundant member `word_size' from regcache_rbtree_node Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
28644c809f44498b8cd91d00b4cdb09e63b99843 |
|
19-Sep-2011 |
Dimitris Papastamos <dp@opensource.wolfsonmicro.com> |
regmap: Add the rbtree cache support This patch adds support for the rbtree cache compression type. Each rbnode manages a variable length block of registers. There can be no two nodes with overlapping blocks. Each block has a base register and a currently top register, all the other registers, if any, lie in between these two and in ascending order. The reasoning behind the construction of this rbtree is simple. In the snd_soc_rbtree_cache_init() function, we iterate over the register defaults provided by the regcache core. For each register value that is non-zero we insert it in the rbtree. In order to determine in which rbnode we need to add the register, we first look if there is another register already added that is adjacent to the one we are about to add. If that is the case we append it in that rbnode block, otherwise we create a new rbnode with a single register in its block and add it to the tree. There are various optimizations across the implementation to speed up lookups by caching the most recently used rbnode. 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>
|