summaryrefslogtreecommitdiffstats
path: root/drivers/base/regmap
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'regmap/topic/ack' into regmap-nextMark Brown2014-01-091-3/+3
|\
| * regmap: irq: Allow using zero value for ack_baseAlexander Shiyan2013-12-161-3/+3
| | | | | | | | | | | | | | | | | | | | | | In some cases, clear interrupt register may be at address 0. This patch allows to use such configurations by adding additional configuration bit to indicate this. [With doc fix from Levente Kurusa <levex@linux.com> -- broonie] Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Mark Brown <broonie@linaro.org>
* | regmap: Allow regmap_bulk_write() to work for "no-bus" regmapsStephen Boyd2013-12-301-25/+37
| | | | | | | | | | | | | | | | | | regmap_bulk_write() should decay to performing individual writes if we're using a "no-bus" regmap. Unfortunately, it returns an error because there is no map->bus pointer. Fix it. Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Mark Brown <broonie@linaro.org>
* | Merge tag 'v3.13-rc4' into regmap-coreMark Brown2013-12-302-9/+10
|\| | | | | | | | | | | Needed as a subsequent patch is built on some of the fixes. Linux 3.13-rc4
| *-. Merge remote-tracking branches 'regmap/fix/doc' and 'regmap/fix/mmio' into ↵Mark Brown2013-11-262-8/+9
| |\ \ | | | | | | | | | | | | regmap-linus
| | | * regmap: use IS_ERR() to check clk_get() resultsStephen Warren2013-11-261-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | clk_get() returns an error pointer, or a valid token to pass back to the clock API. Hence, the result must be checked with IS_ERR(), not by comparison against NULL. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| | * | regmap: trivial comment fix (copy'n'paste error)Gerhard Sittig2013-11-121-3/+3
| | |/ | | | | | | | | | | | | | | | | | | | | | fix a trivial copy'n'paste error in the regmap kerneldoc, s/write/read/ for the regmap_read(), regmap_raw_read() and regmap_bulk_read() routines Signed-off-by: Gerhard Sittig <gsi@denx.de> Signed-off-by: Mark Brown <broonie@linaro.org>
| * / regmap: make sure we unlock on failure in regmap_bulk_writeCourtney Cavin2013-11-211-1/+1
| |/ | | | | | | | | Signed-off-by: Courtney Cavin <courtney.cavin@sonymobile.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* | regmap: Allow regmap_bulk_read() to work for "no-bus" regmapsStephen Boyd2013-12-161-5/+1Star
| | | | | | | | | | | | | | | | | | regmap_bulk_read() should decay to performing individual reads if we're using a "no-bus" regmap. Unfortunately, it returns an error because there is no map->bus pointer. Fix it. Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Mark Brown <broonie@linaro.org>
* | regmap: Fix 'ret' would return an uninitialized valueCai Zhiyong2013-11-241-0/+4
|/ | | | | | | | | | | | | | This patch give a warning when calling regmap_register_patch with parameter num_regs <= 0. When the num_regs parameter is zero and krealloc doesn't fail, then the code would return an uninitialized value. However, calling this function with num_regs == 0, would be a waste as it essentially does nothing. Signed-off-by: Cai Zhiyong <caizhiyong@huawei.com> Reviewed-by: Geyslan G. Bem <geyslan@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* Merge remote-tracking branch 'regmap/topic/spmi' into regmap-nextMark Brown2013-10-283-1/+95
|\
| * regmap: add SPMI supportJosh Cartwright2013-10-283-1/+95
| | | | | | | | | | | | | | | | | | Add basic support for the System Power Management Interface (SPMI) bus. This is a simple implementation which only implements register accesses via the Extended Register Read/Write Long commands. Signed-off-by: Josh Cartwright <joshc@codeaurora.org> Signed-off-by: Mark Brown <broonie@linaro.org>
* | Merge remote-tracking branch 'regmap/topic/multi' into regmap-nextMark Brown2013-10-281-0/+41
|\ \
| * | regmap: new API regmap_multi_reg_write() definitionAnthony Olech2013-10-141-0/+41
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | New API regmap_multi_reg_write() is defined that allows a set of reg,val pairs to be written to a I2C client device as one block transfer from the point of view of a single I2C master system. A simple demonstration implementation is included that just splits the block write request into a sequence of single register writes. The implementation will be modified later to support those I2C clients that implement the alternative non-standard MULTIWRITE block write mode so to achieve a single I2C transfer that will be atomic even in multiple I2C master systems. Signed-off-by: Anthony Olech <anthony.olech.opensource@diasemi.com> Signed-off-by: David Dajun Chen <david.chen@diasemi.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* | Merge remote-tracking branch 'regmap/topic/irq' into regmap-nextMark Brown2013-10-281-0/+16
|\ \
| * | regmap: irq: clear status when disable irqYi Zhang2013-10-221-0/+16
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | clear the status bit if the mask register doesn't prevent the chip level irq from being asserted OR in the following sequence, there will be irq storm happens: 1) interrupt is triggered; 2) another thread disables it(the mask bit is set); 3) _Then_ the interrupt thread is not ACKed(the status bit is not cleared), and it's ignored; 4) if the irq is still asserted because of the uncleared status bit, the irq storm happens; Signed-off-by: Yi Zhang <yizhang@marvell.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* | Merge remote-tracking branch 'regmap/topic/field' into regmap-nextMark Brown2013-10-282-0/+106
|\ \
| * | regmap: Add regmap_fields APIsKuninori Morimoto2013-09-172-0/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current Linux kernel is supporting regmap_field method and it is very useful feature. It needs one regmap_filed for one register access. OTOH, there is multi port device which has many same registers in the market. The difference for each register access is only its address offset. Current API needs many regmap_field for such device, but it is not good. This patch adds new regmap_fileds API which can care about multi port/offset access via regmap. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| * | regmap: add regmap_field_update_bits()Kuninori Morimoto2013-09-171-0/+20
| |/ | | | | | | | | | | | | | | Current regmap_field is supporting read/write functions. This patch adds new update_bits function for it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* | Merge remote-tracking branch 'regmap/topic/core' into regmap-nextMark Brown2013-10-281-5/+52
|\ \
| * | regmap: debugfs: Fix a boot time crash with early regmap initTero Kristo2013-10-241-5/+52
| |/ | | | | | | | | | | | | | | | | | | | | | | If called early enough, regmap_debugfs_init causes a crash, if the fs subsystem does not have its mount cache created yet. Even if this would work, the root node for the regmap debugfs is still missing, thus postpone the regmap_debugfs_init in this case until the root node is created. A special regmap_debugfs_early list is created for this purpose which is parsed later in the boot. Signed-off-by: Tero Kristo <t-kristo@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* | regmap: Only send a single buffer for async I/O if writing one registerMark Brown2013-10-141-7/+12
| | | | | | | | | | | | | | | | Extend the interface for async I/O by allowing the value buffer to be omitted and sending the value as part of the register buffer, minimising the number of separate hardware operations required. Signed-off-by: Mark Brown <broonie@linaro.org>
* | regmap: spi: Handle async writes of only one bufferMark Brown2013-10-141-1/+2
| | | | | | | | | | | | | | | | If the value is zero then assume it has been included in the register data and don't send anything, minimising the number of interactions with the hardware. Signed-off-by: Mark Brown <broonie@linaro.org>
* | Merge remote-tracking branch 'regmap/fix/core' into regmap-asyncMark Brown2013-10-101-4/+4
|\ \
| * | regmap: Fix regmap_bulk_write single-rw mutex deadlockAnthony Olech2013-10-091-4/+5
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When regmap_bulk_write() is called with the map->use_single_rw flag set an immediate mutex deadlock happens because regmap_raw_write() is called after obtaining the mutex and regmap_raw_write() itself then tries to obtain the mutex as well. It is obvious that no one other than myself tried it with a real device. I did, but only for the purposes of an experiment and demonstration. But even if this situation will never ever happen with a real device, it is a bug and therefore should be fixed. Signed-off-by: Anthony Olech <anthony.olech.opensource@diasemi.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* | regmap: Use async I/O during cache syncMark Brown2013-10-101-2/+14
| | | | | | | | | | | | | | | | Try to speed up I/O a little by not synchronising until we are finished scheduling writes. A brief survey of existing users suggests we have none that would currently benefit from an async cache sync. Signed-off-by: Mark Brown <broonie@linaro.org>
* | regmap: Use async I/O for patch applicationMark Brown2013-10-101-0/+4
| | | | | | | | | | | | Try to speed up patch application a little using async I/O. Signed-off-by: Mark Brown <broonie@linaro.org>
* | regmap: Provide asynchronous write and update bits operationsMark Brown2013-10-091-0/+103
| | | | | | | | | | | | | | | | | | | | Make it easier for drivers to include single register writes in asynchronous sequences by providing async versions of the write and update bits operations. The update bits operations are only likely to be effective when used with devices that have caches but this is common enough to be useful. Signed-off-by: Mark Brown <broonie@linaro.org>
* | regmap: Simplify the initiation of async I/OMark Brown2013-10-093-11/+14
| | | | | | | | | | | | | | | | | | Rather than passing a flag around through the entire call stack store it in the regmap struct and read it when required. This minimises the visibility of the feature through the API, minimising the code updates needed to use it more widely. Signed-off-by: Mark Brown <broonie@linaro.org>
* | regmap: Don't generate gather writes for single register raw writesMark Brown2013-10-091-0/+10
| | | | | | | | | | | | | | | | | | Since it is quite common for single register raw or async writes to be generated by rbtree cache syncs or firmware downloads and essentially all hardware will be faster with only a single transfer optimise this case by copying single values into the internal scratch buffer before sending. Signed-off-by: Mark Brown <broonie@linaro.org>
* | regmap: Cache async work structuresMark Brown2013-10-082-27/+34
|/ | | | | | | | Rather than allocating and deallocating the structures used to manage async transfers each time we do one keep the structures around as long as the regmap is around. This should provide a small performance improvement. Signed-off-by: Mark Brown <broonie@linaro.org>
* Merge tag 'driver-core-3.12-rc1' of ↵Linus Torvalds2013-09-031-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core Pull driver core patches from Greg KH: "Here's the big driver core pull request for 3.12-rc1. Lots of tiny changes here fixing up the way sysfs attributes are created, to try to make drivers simpler, and fix a whole class race conditions with creations of device attributes after the device was announced to userspace. All the various pieces are acked by the different subsystem maintainers" * tag 'driver-core-3.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (119 commits) firmware loader: fix pending_fw_head list corruption drivers/base/memory.c: introduce help macro to_memory_block dynamic debug: line queries failing due to uninitialized local variable sysfs: sysfs_create_groups returns a value. debugfs: provide debugfs_create_x64() when disabled rbd: convert bus code to use bus_groups firmware: dcdbas: use binary attribute groups sysfs: add sysfs_create/remove_groups for when SYSFS is not enabled driver core: add #include <linux/sysfs.h> to core files. HID: convert bus code to use dev_groups Input: serio: convert bus code to use drv_groups Input: gameport: convert bus code to use drv_groups driver core: firmware: use __ATTR_RW() driver core: core: use DEVICE_ATTR_RO driver core: bus: use DRIVER_ATTR_WO() driver core: create write-only attribute macros for devices and drivers sysfs: create __ATTR_WO() driver-core: platform: convert bus code to use dev_groups workqueue: convert bus code to use dev_groups MEI: convert bus code to use dev_groups ...
| * driver core: replace strict_strto*() with kstrto*()Jingoo Han2013-07-271-1/+1
| | | | | | | | | | | | | | | | | | The usage of strict_strto*() is not preferred, because strict_strto*() is obsolete. Thus, kstrto*() should be used. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | Merge tag 'regmap-v3.12' of ↵Linus Torvalds2013-09-036-131/+194
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap Pull regmap updates from Mark Brown: "A quiet release for regmap, some cleanups, fixes and: - Improved node coalescing for rbtree, reducing memory usage and improving performance during syncs. - Support for registering multiple register patches. - A quirk for handling interrupts that need to be clear when masked in regmap-irq" * tag 'regmap-v3.12' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap: regmap: rbtree: Make cache_present bitmap per node regmap: rbtree: Reduce number of nodes, take 2 regmap: rbtree: Simplify adjacent node look-up regmap: debugfs: Fix continued read from registers file regcache-rbtree: Fix reg_stride != 1 regmap: Allow multiple patches to be registered regmap: regcache: allow read-only regs to be cached regmap: fix regcache_reg_present() for empty cache regmap: core: allow a virtual range to cover its own data window regmap: irq: document mask/wake_invert flags regmap: irq: make flags bool and put them in a bitfield regmap: irq: Allow to acknowledge masked interrupts during initialization regmap: Provide __acquires/__releases annotations
| * \ Merge remote-tracking branch 'regmap/topic/sparse' into regmap-nextMark Brown2013-08-311-0/+2
| |\ \
| | * | regmap: Provide __acquires/__releases annotationsFabio Estevam2013-07-161-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix the following sparse warnings: drivers/base/regmap/regmap.c:305:13: warning: context imbalance in 'regmap_lock_spinlock' - wrong count at exit drivers/base/regmap/regmap.c:314:13: warning: context imbalance in 'regmap_unlock_spinlock' - unexpected unlock Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| * | | Merge remote-tracking branch 'regmap/topic/rbtree' into regmap-nextMark Brown2013-08-313-117/+150
| |\ \ \
| | * | | regmap: rbtree: Make cache_present bitmap per nodeLars-Peter Clausen2013-08-293-80/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * | | regmap: rbtree: Reduce number of nodes, take 2Lars-Peter Clausen2013-08-291-17/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * | | regmap: rbtree: Simplify adjacent node look-upLars-Peter Clausen2013-08-291-20/+19Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * | | Merge remote-tracking branch 'regmap/topic/cache' into regmap-rbtreeMark Brown2013-08-293-4/+4
| | |\ \ \
| | * | | | regcache-rbtree: Fix reg_stride != 1Lars-Peter Clausen2013-08-271-11/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | | | | Merge remote-tracking branch 'regmap/topic/range' into regmap-nextMark Brown2013-08-311-0/+4
| |\ \ \ \ \
| | * | | | | regmap: core: allow a virtual range to cover its own data windowPhilipp Zabel2013-08-061-0/+4
| | | |_|_|/ | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I see no reason why a virtual range shouldn't be allowed to cover its own data window if the page selection register is in the same place on every page. For chips which use paged access for all of their registers, but only when connected via I2C, and which can access the whole register space directly when connected via SPI, this allows to avoid acrobatics with the register ranges by simply mapping the I2C ranges over the data window beginning at 0x0, and then using linear access for the SPI variant. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Mark Brown <broonie@linaro.org>
| * | | | | Merge remote-tracking branch 'regmap/topic/patch' into regmap-nextMark Brown2013-08-311-9/+8Star
| |\ \ \ \ \
| | * | | | | regmap: Allow multiple patches to be registeredMark Brown2013-08-161-9/+8Star
| | | |_|_|/ | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It may be useful to register multiple patches with regmap, for example one that depends on the device revision and one that depends on the system configuration. Add support for doing this, appending any new patches to the existing patches. Signed-off-by: Mark Brown <broonie@linaro.org>
| * | | | | Merge remote-tracking branch 'regmap/topic/irq' into regmap-nextMark Brown2013-08-311-0/+25
| |\ \ \ \ \
| | * | | | | regmap: irq: Allow to acknowledge masked interrupts during initializationPhilipp Zabel2013-07-231-0/+25
| | | |/ / / | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In case the hardware interrupt mask register does not prevent the chip level irq from being asserted by the corresponding interrupt status bit, already set interrupt bits should to be cleared once after masking them during initialization. Add a flag to let drivers enable this behavior. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Mark Brown <broonie@linaro.org>
| * | | | | Merge remote-tracking branch 'regmap/topic/cache' into regmap-nextMark Brown2013-08-313-4/+4
| |\ \ \ \ \ | | | |_|_|/ | | |/| | |
| | * | | | regmap: regcache: allow read-only regs to be cachedIonut Nicu2013-08-092-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The regmap_writeable() check should not be done in regcache_write() because this prevents read-only registers to be cached. After a read on a read-only register its value will not be stored in the cache and the next time someone will try to read it the value will be read from the bus instead of the cache. Instead the regmap_writeable() check should be done in _regmap_write() to prevent callers from writing to read-only registers. Signed-off-by: Ionut Nicu <ioan.nicu.ext@nsn.com> Signed-off-by: Mark Brown <broonie@linaro.org>