aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/regmap (follow)
AgeCommit message (Collapse)AuthorFilesLines
2014-03-10regmap: Implementation for regmap_multi_reg_writeOpensource [Anthony Olech]2-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>
2014-03-06regmap: add regmap_parse_val apiNenghua Cao1-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>
2014-02-26regmap: Base regmap_register_patch on _regmap_multi_reg_writeCharles Keepax1-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>
2014-02-26regmap: Add bypassed version of regmap_multi_reg_writeCharles Keepax1-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>
2014-02-26regmap: Mark reg_defaults in regmap_multi_reg_write as constCharles Keepax1-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>
2014-02-22regmap: fix coccinelle warningsNenghua Cao1-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>
2014-02-22regmap: Check stride of register patch as we register itCharles Keepax2-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>
2014-02-20regmap: Clean up _regmap_update_bits()Xiubo Li1-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>
2014-02-16regmap: Separate regmap dev initializationMichal Simek1-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>
2014-02-15regmap: spmi: support base and extended register spacesJosh Cartwright1-31/+197
SPMI states that a slave may contain two register spaces, the Base register space is a 5-bit byte-addressable space accessed via the Register Read/Write and Register Zero Write command sequences, and the Extended register space: a 16-bit byte-addressable space accessed via the Extended Read/Write and Extended Read/Write Long command sequences. Provide support for accessing both of these spaces, taking advantage of the more bandwidth-efficient commands ('Register 0 Write' vs 'Register Write', and 'Extended Register Read/Write' vs 'Extended Register Read/Write Long') when possible. Signed-off-by: Josh Cartwright <joshc@codeaurora.org> Acked-by: Mark Brown <broonie@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-14drivers/base: delete non-required instances of include <linux/init.h>Paul Gortmaker3-3/+0
None of these files are actually using any __init type directives and hence don't need to include <linux/init.h>. Most are just a left over from __devinit and __cpuinit removal, or simply due to code getting copied from one driver to the next. Cc: Len Brown <len.brown@intel.com> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Acked-by: Pavel Machek <pavel@ucw.cz> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Mark Brown <broonie@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-11regmap: Check readable regs in _regmap_readMichal Simek1-0/+3
Check if regs are readable. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03regmap: irq: Remove domain on exitMark Brown1-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>
2014-02-03regmap: debugfs: "registers" & "access" for single register mapsPawel Moll1-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>
2014-01-27regmap: cache: Handle stride > 1 in sync_block_raw_flushDylan Reid1-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>
2014-01-09Merge remote-tracking branch 'regmap/topic/ack' into regmap-nextMark Brown1-3/+3
2013-12-30regmap: Allow regmap_bulk_write() to work for "no-bus" regmapsStephen Boyd1-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>
2013-12-30Merge tag 'v3.13-rc4' into regmap-coreMark Brown2-9/+10
Needed as a subsequent patch is built on some of the fixes. Linux 3.13-rc4
2013-12-16regmap: Allow regmap_bulk_read() to work for "no-bus" regmapsStephen Boyd1-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>
2013-12-16regmap: irq: Allow using zero value for ack_baseAlexander Shiyan1-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>
2013-11-26Merge remote-tracking branches 'regmap/fix/doc' and 'regmap/fix/mmio' into regmap-linusMark Brown2-8/+9
2013-11-26regmap: use IS_ERR() to check clk_get() resultsStephen Warren1-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>
2013-11-24regmap: Fix 'ret' would return an uninitialized valueCai Zhiyong1-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>
2013-11-21regmap: make sure we unlock on failure in regmap_bulk_writeCourtney Cavin1-1/+1
Signed-off-by: Courtney Cavin <courtney.cavin@sonymobile.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-11-12regmap: trivial comment fix (copy'n'paste error)Gerhard Sittig1-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>
2013-10-28Merge remote-tracking branch 'regmap/topic/spmi' into regmap-nextMark Brown3-1/+95
2013-10-28Merge remote-tracking branch 'regmap/topic/multi' into regmap-nextMark Brown1-0/+41
2013-10-28Merge remote-tracking branch 'regmap/topic/irq' into regmap-nextMark Brown1-0/+16
2013-10-28Merge remote-tracking branch 'regmap/topic/field' into regmap-nextMark Brown2-0/+106
2013-10-28Merge remote-tracking branch 'regmap/topic/core' into regmap-nextMark Brown1-5/+52
2013-10-28regmap: add SPMI supportJosh Cartwright3-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>
2013-10-24regmap: debugfs: Fix a boot time crash with early regmap initTero Kristo1-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>
2013-10-22regmap: irq: clear status when disable irqYi Zhang1-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>
2013-10-14regmap: Only send a single buffer for async I/O if writing one registerMark Brown1-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>
2013-10-14regmap: spi: Handle async writes of only one bufferMark Brown1-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>
2013-10-14regmap: new API regmap_multi_reg_write() definitionAnthony Olech1-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>
2013-10-10Merge remote-tracking branch 'regmap/fix/core' into regmap-asyncMark Brown1-4/+4
2013-10-10regmap: Use async I/O during cache syncMark Brown1-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>
2013-10-10regmap: Use async I/O for patch applicationMark Brown1-0/+4
Try to speed up patch application a little using async I/O. Signed-off-by: Mark Brown <broonie@linaro.org>
2013-10-09regmap: Fix regmap_bulk_write single-rw mutex deadlockAnthony Olech1-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>
2013-10-09regmap: Provide asynchronous write and update bits operationsMark Brown1-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>
2013-10-09regmap: Simplify the initiation of async I/OMark Brown3-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>
2013-10-09regmap: Don't generate gather writes for single register raw writesMark Brown1-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>
2013-10-07regmap: Cache async work structuresMark Brown2-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>
2013-09-17regmap: Add regmap_fields APIsKuninori Morimoto2-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>
2013-09-17regmap: add regmap_field_update_bits()Kuninori Morimoto1-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>
2013-09-03Merge tag 'driver-core-3.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-coreLinus Torvalds1-1/+1
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 ...
2013-09-03Merge tag 'regmap-v3.12' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmapLinus Torvalds6-131/+194
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
2013-08-31Merge remote-tracking branch 'regmap/topic/sparse' into regmap-nextMark Brown1-0/+2
2013-08-31Merge remote-tracking branch 'regmap/topic/rbtree' into regmap-nextMark Brown3-117/+150