summaryrefslogtreecommitdiffstats
path: root/drivers/base/regmap
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'regmap/topic/range' into regmap-nextMark Brown2013-04-162-7/+88
|\
| * regmap: debugfs: Add a registers `range' fileDimitris Papastamos2013-03-042-0/+84
| | | | | | | | | | | | | | | | | | | | | | | | This file lists the register ranges in the register map. The condition to split the range is based on whether the block is readable or not. Ensure that we lock the `debugfs_off_cache' list whenever we access and modify the list. There is a possible race otherwise between the read() operations of the `registers' file and the `range' file. Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * regmap: debugfs: Simplify calculation of `c->max_reg'Dimitris Papastamos2013-03-041-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | We don't need to use any of the file position information to calculate the base and max register of each block. Just use the counter directly. Set `i = base' at the top to avoid GCC flow analysis bugs. The value of `i' can never be undefined or 0 in the if (c) { ... }. Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | Merge remote-tracking branch 'regmap/topic/irq' into regmap-nextMark Brown2013-04-161-1/+2
|\ \
| * | regmap: irq: Clarify error message when we fail to request primary IRQMark Brown2013-03-191-1/+2
| | | | | | | | | | | | | | | | | | | | | Display the name for the chip rather than just the primary IRQ so it is clearer what exactly has failed. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | | Merge remote-tracking branch 'regmap/topic/cache' into regmap-nextMark Brown2013-04-165-110/+315
|\ \ \
| * | | regmap: don't corrupt work buffer in _regmap_raw_write()Stephen Warren2013-04-161-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | _regmap_raw_write() contains code to call regcache_write() to write values to the cache. That code calls memcpy() to copy the value data to the start of the work_buf. However, at least when _regmap_raw_write() is called from _regmap_bus_raw_write(), the value data is in the work_buf, and this memcpy() operation may over-write part of that value data, depending on the value of reg_bytes + pad_bytes. At least when using reg_bytes==1 and pad_bytes==0, corruption of the value data does occur. To solve this, remove the memcpy() operation, and modify the subsequent .parse_val() call to parse the original value buffer directly. At least in the case of 8-bit register address and 16-bit values, and writes of single registers at a time, this memcpy-then-parse combination used to cancel each-other out; for a work-buffer containing xx 89 03, the memcpy changed it to 89 03 03, and the parse_val changed it back to 89 89 03, thus leaving the value uncorrupted. This appears completely accidental though. Since commit 8a819ff "regmap: core: Split out in place value parsing", .parse_val only returns the parsed value, and does not modify the buffer, and hence does not (accidentally) undo the corruption caused by memcpy(). This caused bogus values to get written to HW, thus preventing e.g. audio playback on systems with a WM8903 CODEC. This patch fixes that. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * | | Merge tag 'v3.9-rc7' into regmap-cacheMark Brown2013-04-163-3/+6
| |\ \ \ | | | | | | | | | | | | | | | Linux 3.9-rc7
| * | | | regmap: cache: Fix format specifier in dev_dbgStratos Karafotis2013-04-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix format specifier in dev_dbg and suppress the following warning drivers/base/regmap/regcache.c: In function ‘regcache_sync_block_raw_flush’: drivers/base/regmap/regcache.c:593:2: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat] Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * | | | regmap: cache: Make regcache_sync_block_raw staticSachin Kamat2013-04-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | regcache_sync_block_raw is used only in this file. Hence make it static. Silences the following warning: drivers/base/regmap/regcache.c:608:5: warning: symbol 'regcache_sync_block_raw' was not declared. Should it be static? Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * | | | regmap: cache: Write consecutive registers in a single block writeMark Brown2013-03-301-17/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When syncing blocks of data using raw writes combine the writes into a single block write, saving us bus overhead for setup, addressing and teardown. Currently the block write is done unconditionally as it is expected that hardware which has a register format which can support raw writes will support auto incrementing writes, this decision may need to be revised in future. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Reviewed-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
| * | | | regmap: cache: Split raw and non-raw syncsMark Brown2013-03-301-11/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For code clarity after implementing block writes split out the raw and non-raw I/O sync implementations. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Reviewed-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
| * | | | regmap: cache: Factor out block syncMark Brown2013-03-303-42/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | | | regmap: cache: Factor out reg_present support from rbtree cacheMark Brown2013-03-303-58/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | | | regmap: cache: Use raw I/O to sync rbtrees if we canMark Brown2013-03-271-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | | | regmap: core: Provide regmap_can_raw_write() operationMark Brown2013-03-271-3/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mainly useful internally but exported since this is a public API that's being checked for. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * | | | regmap: cache: Provide a get address of value operationMark Brown2013-03-262-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Provide a helper to do the size based index into a block of registers and use it when reading a value. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * | | | regmap: Cut down on the average # of nodes in the rbtree cacheDimitris Papastamos2013-03-261-1/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | | | regmap: core: Make raw write available to regcacheMark Brown2013-03-262-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows the cache to sync values directly to the device when stored in native format and also allows asynchronous I/O. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * | | | regmap: core: Warn on invalid operation combinationsMark Brown2013-03-261-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't grind to a screaming halt, just generate a warning. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * | | | regmap: rbtree Expose total memory consumption in the rbtree debugfs entryDimitris Papastamos2013-03-131-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | | | regmap: cache: Store caches in native register format where possibleMark Brown2013-03-041-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows the cached data to be sent directly to the device when we sync it. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * | | | regmap: core: Split out in place value parsingMark Brown2013-03-042-17/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently the value parsing operations both return the parsed value and modify the passed buffer. This precludes their use in places like the cache code so split out the in place modification into a new parse_inplace() operation. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * | | | regmap: cache: Use regcache_get_value() to check if we updatedMark Brown2013-03-041-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Factor things out a little. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * | | | regmap: cache: Pass the map rather than the word size when updating valuesMark Brown2013-03-044-44/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | | | regmap: rbtree: Don't bother checking for noop updatesMark Brown2013-03-041-5/+0
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | | Merge remote-tracking branch 'regmap/topic/async' into regmap-nextMark Brown2013-04-161-0/+8
|\ \ \ \ | |_|/ / |/| | |
| * | | regmap: async: Add tracepoints for async I/OMark Brown2013-03-041-0/+8
| |/ / | | | | | | | | | | | | | | | | | | | | | Trace when we start and complete async writes, and when we start and finish blocking for their completion. This is useful for performance analysis of the resulting I/O patterns. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | | regmap: Back out work buffer fixMark Brown2013-04-091-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit bc8ce4 (regmap: don't corrupt work buffer in _regmap_raw_write()) since it turns out that it can cause issues when taken in isolation from the other changes in -next that lead to its discovery. On the basis that nobody noticed the problems for quite some time without that subsequent work let's drop it from v3.9. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | | Merge remote-tracking branch 'regmap/fix/async' into tmpMark Brown2013-03-311-0/+2
|\ \ \
| * | | regmap: async: Add missing returnMark Brown2013-03-271-0/+2
| | |/ | |/| | | | | | | | | | | | | Let's only write once... Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | | Merge remote-tracking branch 'regmap/fix/core' into tmpMark Brown2013-03-311-2/+2
|\ \ \
| * | | regmap: Initialize `map->debugfs' before regcacheDimitris Papastamos2013-03-121-2/+2
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the rbtree code we are exposing statistics relating to the number of nodes/registers of the rbtree cache for each of the devices. Ensure that `map->debugfs' has been initialized before we attempt to initialize the debugfs entry for the rbtree cache. Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: stable@vger.kernel.org
* | | regmap: don't corrupt work buffer in _regmap_raw_write()Stephen Warren2013-03-211-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | _regmap_raw_write() contains code to call regcache_write() to write values to the cache. That code calls memcpy() to copy the value data to the start of the work_buf. However, at least when _regmap_raw_write() is called from _regmap_bus_raw_write(), the value data is in the work_buf, and this memcpy() operation may over-write part of that value data, depending on the value of reg_bytes + pad_bytes. At least when using reg_bytes==1 and pad_bytes==0, corruption of the value data does occur. To solve this, remove the memcpy() operation, and modify the subsequent .parse_val() call to parse the original value buffer directly. At least in the case of 8-bit register address and 16-bit values, and writes of single registers at a time, this memcpy-then-parse combination used to cancel each-other out; for a work-buffer containing xx 89 03, the memcpy changed it to 89 03 03, and the parse_val changed it back to 89 89 03, thus leaving the value uncorrupted. This appears completely accidental though. Since commit 8a819ff "regmap: core: Split out in place value parsing", .parse_val only returns the parsed value, and does not modify the buffer, and hence does not (accidentally) undo the corruption caused by memcpy(). This caused bogus values to get written to HW, thus preventing e.g. audio playback on systems with a WM8903 CODEC. This patch fixes that. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | | regmap: cache Fix regcache-rbtree syncLars-Peter Clausen2013-03-131-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge tag 'regmap-v3.9-rc1' of ↵Linus Torvalds2013-03-071-0/+1
|\ \ | |/ |/| | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap Pull regmap PM fix from Mark Brown: "A simple fix to stop us leaking a runtime PM reference in the case where we fail to enable a device." * tag 'regmap-v3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap: regmap: irq: call pm_runtime_put in pm_runtime_get_sync failed case
| * regmap: irq: call pm_runtime_put in pm_runtime_get_sync failed caseLi Fei2013-03-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | Even in failed case of pm_runtime_get_sync, the usage_count is incremented. In order to keep the usage_count with correct value and runtime power management to behave correctly, call pm_runtime_put(_sync) in such case. Signed-off-by Liu Chuansheng <chuansheng.liu@intel.com> Signed-off-by: Li Fei <fei.li@intel.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | Merge tag 'modules-next-for-linus' of ↵Linus Torvalds2013-02-251-1/+1
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux Pull module update from Rusty Russell: "The sweeping change is to make add_taint() explicitly indicate whether to disable lockdep, but it's a mechanical change." * tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux: MODSIGN: Add option to not sign modules during modules_install MODSIGN: Add -s <signature> option to sign-file MODSIGN: Specify the hash algorithm on sign-file command line MODSIGN: Simplify Makefile with a Kconfig helper module: clean up load_module a little more. modpost: Ignore ARC specific non-alloc sections module: constify within_module_* taint: add explicit flag to show whether lock dep is still OK. module: printk message when module signature fail taints kernel.
| * taint: add explicit flag to show whether lock dep is still OK.Rusty Russell2013-01-211-1/+1
| | | | | | | | | | | | | | Fix up all callers as they were before, with make one change: an unsigned module taints the kernel, but doesn't turn off lockdep. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* | Merge remote-tracking branch 'regmap/topic/no-bus' into regmap-nextMark Brown2013-02-142-12/+48
|\ \
| * | regmap: Add "no-bus" option for regmap APIAndrey Smirnov2013-01-292-12/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds provision for "no-bus" usage of the regmap API. In this configuration user can provide API with two callbacks 'reg_read' and 'reg_write' which are to be called when reads and writes to one of device's registers is performed. This is useful for devices that expose registers but whose register access sequence does not fit the 'bus' abstraction. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | | Merge remote-tracking branch 'regmap/topic/mmio' into regmap-nextMark Brown2013-02-141-13/+66
|\ \ \
| * | | regmap: mmio: add register clock supportPhilipp Zabel2013-02-141-13/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some mmio devices have a dedicated interface clock that needs to be enabled to access their registers. This patch optionally enables a clock before accessing registers in the regmap_bus callbacks. I added (devm_)regmap_init_mmio_clk variants of the init functions that have an added clk_id string parameter. This is passed to clk_get to request the clock from the clk framework. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | | | Merge remote-tracking branch 'regmap/topic/irq' into regmap-nextMark Brown2013-02-141-26/+99
|\ \ \ \
| * | | | regmap: irq: Support wake IRQ mask inversionMark Brown2013-01-041-4/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Support devices which have an enable rather than mask register for wake sources. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * | | | regmap: irq: Fix sync of wake statuses to hardwareMark Brown2013-01-041-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This wasn't implemented but happened to work on test systems due to lack of wake mask inversion support. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * | | | regmap: irq: Use a bulk read for interrupt status where possibleMark Brown2013-01-041-7/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the interrupt status registers are a single block of registers and the chip supports bulk reads then do a single bulk read rather than pay the extra I/O cost. This restores the original behaviour which was lost when support for register striding was added. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * | | | regmap: irq: Factor register read out of the IRQ parsing loopMark Brown2013-01-031-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In preparation for adding back support for block reads. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * | | | regmap: irq: enable wake support by defaultLaxman Dewangan2012-12-241-12/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | regmap-irq framework is used vastly by mfd drivers and some of devices like TPS65910, TPS80036 do not support the wake base register to enable wake. Currently wake in regmap-irq only supported if client driver passes the wake base register. As the regmap-irq is mostly used by mfd devices and it is require to have wake support from these devices in most of use cases, enabling wake support by default in regmap-irq. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | | | | Merge remote-tracking branch 'regmap/topic/flat' into regmap-nextMark Brown2013-02-144-1/+75
|\ \ \ \ \
OpenPOWER on IntegriCloud