summaryrefslogtreecommitdiffstats
path: root/drivers/base/regmap
Commit message (Collapse)AuthorAgeFilesLines
* drivers/base: Add export.h for EXPORT_SYMBOL/THIS_MODULE as required.Paul Gortmaker2011-10-311-0/+1
| | | | | | | | | | Most of these files were implicitly getting EXPORT_SYMBOL via device.h which was including module.h, but that path will be broken soon. [ with input from Stephen Rothwell <sfr@canb.auug.org.au> ] Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
* Merge branch 'for-linus' of git://opensource.wolfsonmicro.com/regmapLinus Torvalds2011-10-2511-47/+1691
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'for-linus' of git://opensource.wolfsonmicro.com/regmap: (62 commits) mfd: Enable rbtree cache for wm831x devices regmap: Support some block operations on cached devices regmap: Allow caches for devices with no defaults regmap: Ensure rbtree syncs registers set to zero properly regmap: Allow rbtree to cache zero default values regmap: Warn on raw I/O as well as bulk reads that bypass cache regmap: Return a sensible error code if we fail to read the cache regmap: Use bsearch() to search the register defaults regmap: Fix doc comment regmap: Optimize the lookup path to use binary search regmap: Ensure we scream if we enable cache bypass/only at the same time regmap: Implement regcache_cache_bypass helper function regmap: Save/restore the bypass state upon syncing regmap: Lock the sync path, ensure we use the lockless _regmap_write() regmap: Fix apostrophe usage regmap: Make _regmap_write() global regmap: Fix lock used for regcache_cache_only() regmap: Grab the lock in regcache_cache_only() regmap: Modify map->cache_bypass directly regmap: Fix regcache_sync generic implementation ...
| * regmap: Support some block operations on cached devicesMark Brown2011-10-131-8/+26
| | | | | | | | | | | | | | | | | | | | Support raw reads if all the registers being read are volatile, the cache will have no impact for tem. Support bulk reads either directly (if all the registers are volatile) or by falling back to iterating over single register reads otherwise. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * regmap: Allow caches for devices with no defaultsMark Brown2011-10-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We only really need the defaults in order to cut down the number of registers we sync and to satisfy reads while the device is powered off but not all devices are going to need to do that (always on devices like PMICs being the prime example) so don't require those devices to supply a default. Instead only try to fall back to hardware defaults if the driver told us to. Devices using LZO won't be able to instantiate with this, that will require some updates in the LZO code to handle this case. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
| * regmap: Ensure rbtree syncs registers set to zero properlyMark Brown2011-10-101-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 <broonie@opensource.wolfsonmicro.com> Acked-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
| * regmap: Allow rbtree to cache zero default valuesMark Brown2011-10-101-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 <broonie@opensource.wolfsonmicro.com> Acked-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
| * regmap: Warn on raw I/O as well as bulk reads that bypass cacheMark Brown2011-10-101-0/+4
| | | | | | | | | | | | | | | | As with the bulk reads we really should be able to make these play nicely with the cache but warn for now. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
| * regmap: Return a sensible error code if we fail to read the cacheMark Brown2011-10-104-9/+7
| | | | | | | | | | | | | | | | 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>
| * regmap: Use bsearch() to search the register defaultsMark Brown2011-10-091-20/+20
| | | | | | | | | | | | | | | | | | | | Rather than open coding a binary search use the standard bsearch() using the comparison function we're already using for sort() on insert. This fixes a lockup I was observing due to iterating on min <= max rather than min < max when we fail to look up. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
| * regmap: Fix doc commentDimitris Papastamos2011-10-031-1/+1
| | | | | | | | | | Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * regmap: Optimize the lookup path to use binary searchDimitris Papastamos2011-10-031-5/+24
| | | | | | | | | | | | | | | | | | | | Since there are more lookups than insertions in a typical scenario, optimize the linear search into a binary search. For this to work, we need to keep reg_defaults sorted upon insertions, for now be lazy and use sort(). Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * regmap: Ensure we scream if we enable cache bypass/only at the same timeDimitris Papastamos2011-09-301-0/+2
| | | | | | | | | | Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * regmap: Implement regcache_cache_bypass helper functionDimitris Papastamos2011-09-301-0/+19
| | | | | | | | | | | | | | | | Ensure we've got a function so users can enable/disable the cache bypass option. Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * regmap: Save/restore the bypass state upon syncingDimitris Papastamos2011-09-301-0/+5
| | | | | | | | | | Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * regmap: Lock the sync path, ensure we use the lockless _regmap_write()Dimitris Papastamos2011-09-304-5/+7
| | | | | | | | | | Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * regmap: Fix apostrophe usageMark Brown2011-09-301-1/+1
| | | | | | | | | | | | An apostrophe does not mean "look out, here comes an s!". Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * regmap: Make _regmap_write() globalDimitris Papastamos2011-09-292-2/+5
| | | | | | | | | | Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * regmap: Fix lock used for regcache_cache_only()Mark Brown2011-09-291-2/+2
| | | | | | | | | | Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * regmap: Grab the lock in regcache_cache_only()Dimitris Papastamos2011-09-281-0/+2
| | | | | | | | | | Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * regmap: Modify map->cache_bypass directlyDimitris Papastamos2011-09-281-2/+2
| | | | | | | | | | | | | | | | | | In preperation for the upcoming patches, modify map->cache_bypass directly. The helper functions will grab an exclusive lock. Because we'll have acquired the same lock we need to avoid a deadlock. Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * regmap: Fix regcache_sync generic implementationDimitris Papastamos2011-09-281-1/+1
| | | | | | | | | | | | | | | | We want to use regmap_write() to actually write anything to the HW. Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * regmap: rbtree-cache: Move cached rbnode handling into lookup functionLars-Peter Clausen2011-09-281-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 <lars@metafoo.de> Acked-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * regmap: regcache_rbtree_{set,get}_register: Use regcache_{set,get}_valLars-Peter Clausen2011-09-281-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 <lars@metafoo.de> Acked-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * regmap: Implement generic syncing functionalityDimitris Papastamos2011-09-271-7/+26
| | | | | | | | | | | | | | | | | | In the absence of a sync callback, do it manually. This of course can't take advantange of the specific optimizations of each cache type but it will do well enough in most cases. Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * regmap: Fix signed/unsigned comparisonDimitris Papastamos2011-09-271-1/+1
| | | | | | | | | | Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * regmap: Remove redundant member `word_size' from regcache_rbtree_nodeDimitris Papastamos2011-09-271-23/+30
| | | | | | | | | | Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * regmap: Allow drivers to control cache_only flagMark Brown2011-09-191-0/+18
| | | | | | | | Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * regmap: A cache type of _NONE behaves like a bypassed cacheMark Brown2011-09-191-1/+3
| | | | | | | | | | | | | | Avoid extra special casing by setting the cache_bypass flag when we're not caching. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * regmap: Incorporate the regcache core into regmapDimitris Papastamos2011-09-191-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | This patch incorporates the regcache core code into regmap. All previous patches have been no-ops essentially up to this point. The bulk read operation is not supported by regcache at the moment. This will be implemented incrementally. 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>
| * regmap: Add the regcache_sync trace eventDimitris Papastamos2011-09-191-1/+7
| | | | | | | | | | Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * regmap: Add the LZO cache supportDimitris Papastamos2011-09-195-1/+367
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for LZO compression when storing the register cache. For a typical device whose register map would normally occupy 25kB or 50kB by using the LZO compression technique, one can get down to ~5-7kB. There might be a performance penalty associated with each individual read/write due to decompressing/compressing the underlying cache, however that should not be noticeable. These memory benefits depend on whether the target architecture can get rid of the memory occupied by the original register defaults cache which is marked as __devinitconst. Nevertheless there will be some memory gain even if the target architecture can't get rid of the original register map, this should be around ~30-32kB instead of 50kB. Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * regmap: Add the rbtree cache supportDimitris Papastamos2011-09-194-1/+402
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * regmap: Add the indexed cache supportDimitris Papastamos2011-09-194-1/+68
| | | | | | | | | | | | | | | | | | | | | | | | This is the simplest form of a cache available in regcache. Any registers whose default value is 0 are ignored. If any of those registers are modified in the future, they will be placed in the cache on demand. The cache layout is essentially using the provided register defaults by the regcache core directly and does not re-map it to another representation. Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * regmap: Introduce caching supportDimitris Papastamos2011-09-193-1/+357
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * regmap: Make debugfs stubs static inlineLars-Peter Clausen2011-09-051-3/+3
| | | | | | | | | | | | | | | | | | Make the debugfs stubs static inline to avoid future compilation issues due to duplicated symbols when CONFIG_DEBUG_FS=n once internal.h is included by multiple source files. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * regmap: Add support for device specific write and read flag masks.Lars-Peter Clausen2011-09-052-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some buses like SPI have no standard notation of read or write operations. The general scheme here is to set or clear specific bits in the register address to indicate whether the operation is a read or write. We already support having a read flag mask per bus, but as there is no standard the bits which need to be set or cleared differ between devices and vendors, thus we need a mechanism to specify them per device. This patch adds two new entries to the regmap_config struct, read_flag_mask and write_flag_mask. These will be or'ed onto the top byte when doing a read or write operation. If both masks are empty the device will fallback to the regmap_bus masks. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * regmap: Include the last register in debugfs outputMark Brown2011-09-051-2/+2
| | | | | | | | | | | | | | Off by one in the array iteration. Reported-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * regmap: Remove redundant owner field from the bus type structMark Brown2011-09-052-2/+0
| | | | | | | | | | | | | | No longer used as users link directly with the bus types so the core module infrastructure does refcounting for us. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * Merge branch 'regmap-linus' into regmap-nextMark Brown2011-09-051-4/+1
| |\
| * | regmap: Provide access information via debugfsMark Brown2011-08-141-1/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Let userspace know what the access map for the device is. This is helpful for verifying that the access map is correctly configured and could also be useful for programs that try to work with the data. File format is: register: R W V P where R, W, V and P are 'y' or 'n' showing readable, writable, volatile and precious respectively. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * | regmap: Share some of the debugfs infrastructure ready for more filesMark Brown2011-08-141-4/+10
| | | | | | | | | | | | Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * | regmap: Add functions to check for access on registersMark Brown2011-08-143-4/+51
| | | | | | | | | | | | | | | | | | | | | We're going to be using these in quite a few places so factor out the readable/writable/volatile/precious checks. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * | Merge branch 'regmap-linus' into regmap-nextMark Brown2011-08-122-0/+3
| |\ \
| * | | regmap: Remove unused type and list fields from bus interfaceMark Brown2011-08-102-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We no longer enumerate the bus types, we rely on the driver telling us this on init. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * | | regmap: Fix type of field width specifiers for x86_64Mark Brown2011-08-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | x86_64 size_t is not an int but the printf format specifier for size_t should be an int. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
| * | | regmap: Skip precious registers when dumping registers via debugfsMark Brown2011-08-083-0/+6
| | | | | | | | | | | | | | | | Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * | | regmap: Provide register map dump via debugfsMark Brown2011-08-084-0/+158
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Copy over the read parts of the ASoC debugfs implementation into regmap, allowing users to see what the register values the device has are at runtime. The implementation, especially the support for seeking, is mostly due to Dimitris Papastamos' work in ASoC. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * | | regmap: Use a local header for API internalsMark Brown2011-08-082-28/+46
| | | | | | | | | | | | | | | | | | | | | | | | Allowing the implementation to be multi-file. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * | | regmap: Implement writable register checksMark Brown2011-08-081-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is mainly intended to be used by devices which can dynamically block register writes at runtime, for other devices there is usually limited value. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * | | regmap: Add basic tracepointsMark Brown2011-08-081-6/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Trace single register reads and writes, plus start/stop tracepoints for the actual I/O to see where we're spending time. This makes it easy to have always on logging without overwhelming the logs and also lets us take advantage of all the context and time information that the trace subsystem collects for us. We don't currently trace register values for bulk operations as this would add complexity and overhead parsing the cooked data that's being worked with. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
OpenPOWER on IntegriCloud