summaryrefslogtreecommitdiffstats
path: root/drivers/base/regmap
Commit message (Collapse)AuthorAgeFilesLines
*-----------. Merge remote-tracking branches 'regmap/topic/cache', 'regmap/topic/irq', ↵Mark Brown2014-03-285-68/+341
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | 'regmap/topic/lock', 'regmap/topic/mmio', 'regmap/topic/nodev', 'regmap/topic/parse-val' and 'regmap/topic/patch' into regmap-next
| | | | | | | * regmap: Implementation for regmap_multi_reg_writeOpensource [Anthony Olech]2014-03-102-16/+174
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the implementation of regmap_multi_reg_write() There is a new capability 'can_multi_write' that device drivers must set in order to use this multi reg write mode. This replaces the first definition, which just defined the API. Signed-off-by: Anthony Olech <anthony.olech.opensource@diasemi.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| | | | | | | * regmap: Base regmap_register_patch on _regmap_multi_reg_writeCharles Keepax2014-02-261-14/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since we now have an internal version of regmap_multi_reg_write use this to apply the register patch. Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| | | | | | | * regmap: Add bypassed version of regmap_multi_reg_writeCharles Keepax2014-02-261-13/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Devices with more complex boot proceedures may occasionally apply the register patch manual. regmap_multi_reg_write is a logical way to do so, however the patch must be applied with cache bypass on, such that it doesn't override any user settings. This patch adds a regmap_multi_reg_write_bypassed function that applies a set of writes with the bypass enabled. Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| | | | | | | * regmap: Mark reg_defaults in regmap_multi_reg_write as constCharles Keepax2014-02-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There should be no need for the writes supplied to this function to be edited by it so mark them as const. Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| | | | | | | * regmap: Check stride of register patch as we register itCharles Keepax2014-02-222-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, we check the registers in the patch are aligned to the register stride everytime we sync the cache and the first time the patch is written out is unchecked. This patch checks the register patch when we first register it so the first writes are no longer unchecked and then doesn't check on subsequent syncs as the patch will be unchanged. Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| | | | | | * | regmap: add regmap_parse_val apiNenghua Cao2014-03-061-0/+12
| | | | | | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In some cases, we need regmap's format parse_val function to do be/le translation according to the bus configuration. For example, snd_soc_bytes_put() uses regmap to write/read values, and use cpu_to_be() directly to covert MASK into big endian. This is a defect, and should use regmap's format function to do it according to bus configuration. Signed-off-by: Nenghua Cao <nhcao@marvell.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| | | | | * | regmap: Separate regmap dev initializationMichal Simek2014-02-161-13/+28
| | | | | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Create special function regmap_attach_dev which can be called separately out of regmap_init. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| | | | * | regmap: mmio: Add regmap_mmio_regbits_check.Xiubo Li2014-03-281-2/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix the support for 1/2/8 bytes wide register address checking. Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| | | | * | regmap: mmio: Add support for 1/2/8 bytes wide register address.Xiubo Li2014-03-271-3/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since regmap core and mmio have already support for 1/2/8 bytes wide values, so adds support for 1/2/8 bytes wide registers address. Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| | | | * | regmap: mmio: add regmap_mmio_{regsize, count}_check.Xiubo Li2014-03-271-3/+13
| | | | |/ | | | | | | | | | | | | | | | | | | | | Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| | | * | regmap: Fix possible sleep-in-atomic in regmap_bulk_write()Takashi Iwai2014-03-181-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | regmap deploys the spinlock for the protection when set up in fast_io mode. This may lead to sleep-in-atomic by memory allocation with GFP_KERNEL in regmap_bulk_write(). This patch fixes it by moving the allocation out of the lock. [Fix excessively large locked region -- broonie] Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Mark Brown <broonie@linaro.org>
| | | * | regmap: Ensure regmap_register_patch() is compatible with fast_ioMark Brown2014-03-181-11/+14
| | | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With fast_io we use mutexes to lock the I/O operations so we would need to do GFP_ATOMIC allocations if we wanted to do allocations inside the lock as we do currently. Since it is unlikely that we will want to register a patch outside of init where concurrency shouldn't be an issue move the allocation of the patch data outside the lock. Reported-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Mark Brown <broonie@linaro.org>
| | * | regmap: irq: Set data pointer only on regmap_add_irq_chip successKrzysztof Kozlowski2014-03-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After setting the 'data' pointer (wchich is returned to the caller for freeing later) the regmap_add_irq_chip() could still fail for various reasons (ENOMEM, regmap_read or regmap_write failure). In such case the memory under 'data' was freed in error path and error value was returned but the 'data' variable was not changed. This could lead to errors if the caller passed such 'data' to regmap_del_irq_chip(). The 'data' pointer should be changed atomically from the caller perspective - set it only on regmap_add_irq_chip() success. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| | * | regmap: irq: Remove domain on exitMark Brown2014-02-031-1/+1
| | |/ | | | | | | | | | | | | | | | | | | irqdomain now supports removal of domains on exit so we can properly clean up on deletion of a regmap irqchip. Signed-off-by: Mark Brown <broonie@linaro.org>
| * | regmap: cache: Don't attempt to sync non-writeable registersDylan Reid2014-03-191-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the regcache_default_sync, if a register isn't writeable, then _regmap_write will return an error and the rest of the sync will be aborted. Avoid this by checking if a register is writeable before trying to sync it. Signed-off-by: Dylan Reid <dgreid@chromium.org> Signed-off-by: Mark Brown <broonie@linaro.org>
| * | regmap: cache: Step by stride in default syncDylan Reid2014-03-191-1/+1
| |/ | | | | | | | | | | | | | | The default sync operation was still assuming a stride of one, fix it to respect the reg_stride set in the map. Signed-off-by: Dylan Reid <dgreid@chromium.org> Signed-off-by: Mark Brown <broonie@linaro.org>
* | Merge remote-tracking branch 'regmap/topic/core' into regmap-nextMark Brown2014-03-282-8/+11
|\ \
| * | regmap: fix coccinelle warningsNenghua Cao2014-02-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | /drivers/base/regmap/regmap.c:717:6-33: WARNING: Comparison to bool. More information about semantic patching is available at http://coccinelle.lip6.fr/ Signed-off-by: Nenghua Cao <nhcao@marvell.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| * | regmap: Clean up _regmap_update_bits()Xiubo Li2014-02-201-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | Since sometimes the 'config' parameter has no use, it should be NULL. And make the code simplifier. Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| * | regmap: Check readable regs in _regmap_readMichal Simek2014-02-111-0/+3
| | | | | | | | | | | | | | | | | | | | | Check if regs are readable. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Mark Brown <broonie@linaro.org>
| * | regmap: debugfs: "registers" & "access" for single register mapsPawel Moll2014-02-031-1/+1
| |/ | | | | | | | | | | | | | | | | | | When a map covers a single register, max_register is equal to 0, so the "registers" & "access" files were not created. Now they will be, as register 0 must be readable for such map to make sense. Signed-off-by: Pawel Moll <pawel.moll@arm.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* | regmap: cache: Handle stride > 1 in sync_block_raw_flushDylan Reid2014-01-271-2/+2
|/ | | | | | | | | | | | | regcache_sync_block_raw_flush takes the address of the base register and the address of one past the last register to write to. "count" is the number of registers in the range, not the number of bytes, it should be (end addr - start addr) / stride. Without accounting for strides greater than one, registers past the end might be synced or the writeable_reg callback at the beginning of _regmap_raw_write will fail and nothing will be written. Signed-off-by: Dylan Reid <dgreid@chromium.org> Signed-off-by: Mark Brown <broonie@linaro.org>
* 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/+1
| | | | | | | | | | | | | | | | | | 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>
OpenPOWER on IntegriCloud