summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* 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-302-0/+20
| | | | | | | | 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>
* mfd: Support software initiated shutdown of WM831x PMICsMark Brown2011-09-205-0/+33
| | | | | | | | | | | In systems where there is no hardware signal from the processor to the PMIC to initiate the final power off sequence we must initiate the shutdown with a register write to the PMIC. Support such systems in the driver. Since this may prevent a full shutdown of the system platform data is used to enable the feature. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* regmap: Allow drivers to control cache_only flagMark Brown2011-09-192-0/+20
| | | | Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regmap: Prototype regcache_sync()Mark Brown2011-09-191-0/+1
| | | | 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-192-1/+31
| | | | | 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-196-1/+368
| | | | | | | | | | | | | | | | | | 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-195-1/+403
| | | | | | | | | | | | | | | | | | | | | | | | | 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-195-1/+69
| | | | | | | | | | | | 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-194-2/+371
| | | | | | | | | | | | | | | | | | 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>
* Merge branch 'regmap-interface' into regmap-nextMark Brown2011-09-090-0/+0
|\
| * regmap: Provide device read and write map interface for mergingMark Brown2011-09-091-0/+9
| | | | | | | | | | | | | | | | | | | | | | Add the externally visible interface introduced by Lars-Peter's commit 6f3064 (regmap: Add support for device specific write and read flag masks) separately in order to allow merge into other subsystems for integration with drivers. Drivers relying on this feature will not be functional until they are merged with the implementation. Signed-off-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-053-3/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-053-5/+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: Remove bitrotted module_put()sMark Brown2011-09-051-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The conversion to per bus type registration functions means we don't need to do module_get()s to hold the bus types in memory (their users will link to them) so we removed all those calls. This left module_put() calls in the cleanup paths which aren't needed and which cause unbalanced puts if we ever try to unload anything. Reported-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | | Merge branch 'regmap-mfd' into regmap-nextMark Brown2011-08-229-513/+487
|\ \ \
| * | | mfd: Convert WM8400 to regmap APIMark Brown2011-08-222-81/+32
| | | | | | | | | | | | | | | | Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * | | mfd: Convert WM8994 to use new register map APIMark Brown2011-08-223-152/+36
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Samuel Ortiz <sameo@linux.intel.com>
| * | | mfd: Use device ID matching for WM831x SPI driverMark Brown2011-08-221-119/+19
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Samuel Ortiz <sameo@linux.intel.com>
| * | | mfd: Provide regmap register access info from wm831x driverMark Brown2011-08-221-0/+351
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Lets us see the register map in debugfs and will enable us to push access checking down into the regmap API. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Samuel Ortiz <sameo@linux.intel.com>
| * | | mfd: Convert WM831x to use regmap APIMark Brown2011-08-225-170/+58
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | Factor out the register read/write code to use the register map API. We still need some wm831x specific code and locking in place to check that the user key is handled correctly but only on the write side, reads are not affected by the key. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Samuel Ortiz <sameo@linux.intel.com>
* | | Merge branch 'regmap-interface' into regmap-nextMark Brown2011-08-211-2/+22
|\ \ \ | |/ /
| * | regmap: Allow drivers to specify register defaultsMark Brown2011-08-211-2/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is useful for the register cache code to be able to specify the default values for the device registers. The major use is when restoring the register cache after suspend, knowing the register defaults allows us to skip registers that are at their default values when we resume which can be a substantial win on larger modern devices. For some devices (mostly older ones) the hardware does not support readback so the only way we can know the values is from code and so initializing the cache with default values makes it much easier for drivers work with read/modify/write updates. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | | 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: Specify a module licenseStephen Warren2011-08-122-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CONFIG_REGMAP_I2C/SPI are set to m when selected by a tristate config option that's set to m. The regmap modules don't specify a license, so fail to link to regmap_init at load time, since that is EXPORT_SYMBOL_GPL. Fix this by specifying a license for the regmap modules. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
OpenPOWER on IntegriCloud