aboutsummaryrefslogtreecommitdiff
path: root/drivers/base/regmap/regcache-rbtree.c
AgeCommit message (Collapse)AuthorFilesLines
2012-03-11device.h: cleanup users outside of linux/include (C files)Paul Gortmaker1-0/+1
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 <[email protected]>
2012-03-05regmap: Fix rbtree block base in syncMark Brown1-1/+1
Otherwise we'll end up running with bogus register numbers. Signed-off-by: Mark Brown <[email protected]>
2012-03-05regcache: Make sure we sync register 0 in an rbtree cacheMark Brown1-1/+1
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 <[email protected]>
2012-02-24regmap: Supply ranges to the sync operationsMark Brown1-3/+22
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 <[email protected]>
2011-11-22regmap: Fix rbtreee build when not using debugfsMark Brown1-1/+10
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 <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2011-11-21regmap: Provide debugfs dump of the rbtree cache dataMark Brown1-0/+49
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 <[email protected]>
2011-11-15regmap: Do not call regcache_exit from regcache_rbtree_init error pathLars-Peter Clausen1-1/+2
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 <[email protected]> Acked-by: Dimitris Papastamos <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2011-10-10regmap: Ensure rbtree syncs registers set to zero properlyMark Brown1-6/+5
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 <[email protected]> Acked-by: Dimitris Papastamos <[email protected]>
2011-10-10regmap: Allow rbtree to cache zero default valuesMark Brown1-3/+0
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 <[email protected]> Acked-by: Dimitris Papastamos <[email protected]>
2011-10-10regmap: Return a sensible error code if we fail to read the cacheMark Brown1-2/+1
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 <[email protected]> Acked-by: Dimitris Papastamos <[email protected]>
2011-09-30regmap: Lock the sync path, ensure we use the lockless _regmap_write()Dimitris Papastamos1-1/+1
Signed-off-by: Dimitris Papastamos <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2011-09-28regmap: rbtree-cache: Move cached rbnode handling into lookup functionLars-Peter Clausen1-43/+18
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 <[email protected]> Acked-by: Dimitris Papastamos <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2011-09-28regmap: regcache_rbtree_{set,get}_register: Use regcache_{set,get}_valLars-Peter Clausen1-33/+2
Use regcache_{set,get}_val in regcache_rbtree_{set,get}_register instead of re-implementing its functionality. Signed-off-by: Lars-Peter Clausen <[email protected]> Acked-by: Dimitris Papastamos <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2011-09-27regmap: Remove redundant member `word_size' from regcache_rbtree_nodeDimitris Papastamos1-23/+30
Signed-off-by: Dimitris Papastamos <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2011-09-19regmap: Add the rbtree cache supportDimitris Papastamos1-0/+399
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 <[email protected]> Tested-by: Lars-Peter Clausen <[email protected]> Signed-off-by: Mark Brown <[email protected]>