aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/regmap.h (follow)
AgeCommit message (Collapse)AuthorFilesLines
2014-07-25regmap: Fix return code for stub regmap_get_device()Mark Brown1-1/+1
We return a pointer, not an int. Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-25regmap: Add regmap_get_deviceTuomas Tynkkynen1-0/+7
Add a new function regmap_get_device to obtain the underlying struct device from a regmap. Signed-off-by: Tuomas Tynkkynen <ttynkkynen@nvidia.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-18regmap: add reg_read/reg_write callbacks to regmap_bus structBoris BREZILLON1-0/+6
Some busses do not support sending/receiving multiple registers in one go. Such kind of busses just unpack the registers that have been previously packed by the regmap core or pack registers that will be later unpacked by the core code. Add reg_write and reg_read callbacks in order to optimize access through this kind of busses. Signed-off-by: Boris BREZILLON <boris.brezillon@free-electrons.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-01Merge tag 'char-misc-3.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-miscLinus Torvalds1-4/+8
Pull char/misc driver patches from Greg KH: "Here's the big char/misc driver updates for 3.15-rc1. Lots of various things here, including the new mcb driver subsystem. All of these have been in linux-next for a while" * tag 'char-misc-3.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (118 commits) extcon: Move OF helper function to extcon core and change function name extcon: of: Remove unnecessary function call by using the name of device_node extcon: gpio: Use SIMPLE_DEV_PM_OPS macro extcon: palmas: Use SIMPLE_DEV_PM_OPS macro mei: don't use deprecated DEFINE_PCI_DEVICE_TABLE macro mei: amthif: fix checkpatch error mei: client.h fix checkpatch errors mei: use cl_dbg where appropriate mei: fix Unnecessary space after function pointer name mei: report consistently copy_from/to_user failures mei: drop pr_fmt macros mei: make me hw headers private to me hw. mei: fix memory leak of pending write cb objects mei: me: do not reset when less than expected data is received drivers: mcb: Fix build error discovered by 0-day bot cs5535-mfgpt: Simplify dependencies spmi: pm: drop bus-level PM suspend/resume routines spmi: pmic_arb: make selectable on ARCH_QCOM Drivers: hv: vmbus: Increase the limit on the number of pfns we can handle pch_phub: Report error writing MAC back to user ...
2014-03-28Merge remote-tracking branches 'regmap/topic/cache', 'regmap/topic/irq', 'regmap/topic/lock', 'regmap/topic/mmio', 'regmap/topic/nodev', 'regmap/topic/parse-val' and 'regmap/topic/patch' into regmap-nextMark Brown1-1/+19
2014-03-10regmap: Implementation for regmap_multi_reg_writeOpensource [Anthony Olech]1-0/+4
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/+9
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: Add bypassed version of regmap_multi_reg_writeCharles Keepax1-0/+3
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-1/+1
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-16regmap: Separate regmap dev initializationMichal Simek1-0/+2
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-4/+8
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-01-09Merge remote-tracking branch 'regmap/topic/ack' into regmap-nextMark Brown1-1/+4
2014-01-09regmap: fix a couple of typosLaszlo Papp1-5/+5
These sentences are not proper English due to the typos. I had initially caught one of them while trying to understand the regmap feature, and then I just ran the vim spell checker, and went through all the items that would need to be fixed for this header file. Signed-off-by: Laszlo Papp <lpapp@kde.org> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-16regmap: irq: Allow using zero value for ack_baseAlexander Shiyan1-1/+4
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-10-28Merge remote-tracking branch 'regmap/topic/spmi' into regmap-nextMark Brown1-0/+5
2013-10-28Merge remote-tracking branch 'regmap/topic/range' into regmap-nextMark Brown1-0/+2
2013-10-28Merge remote-tracking branch 'regmap/topic/multi' into regmap-nextMark Brown1-0/+2
2013-10-28Merge remote-tracking branch 'regmap/topic/field' into regmap-nextMark Brown1-0/+13
2013-10-28regmap: add SPMI supportJosh Cartwright1-0/+5
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-14regmap: new API regmap_multi_reg_write() definitionAnthony Olech1-0/+2
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-09regmap: Provide asynchronous write and update bits operationsMark Brown1-0/+31
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-09-20regmap: add helper macro to set min/max range of registerLaxman Dewangan1-0/+2
Add helper macro to set the min and max value of the register range. This is useful when initialising the register ranges of the device like static const struct regmap_range readable_ranges[] = { regmap_reg_range(DEVICE_REG0, DEVICE_REG10), }; Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17regmap: Add regmap_fields APIsKuninori Morimoto1-0/+11
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/+2
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 'regmap-v3.12' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmapLinus Torvalds1-3/+7
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/irq' into regmap-nextMark Brown1-3/+7
2013-08-15regmap: Add another missing header for !CONFIG_REGMAP stubsKevin Hilman1-0/+1
The use of WARN_ON() needs the definitions from bug.h, without it you can get: include/linux/regmap.h: In function 'regmap_write': include/linux/regmap.h:525:2: error: implicit declaration of function 'WARN_ONCE' [-Werror=implicit-function-declaration] Signed-off-by: Kevin Hilman <khilman@linaro.org> Signed-off-by: Mark Brown <broonie@linaro.org> Cc: stable@vger.kernel.org
2013-08-06regmap: Add missing header for !CONFIG_REGMAP stubsMateusz Krawczuk1-0/+1
regmap.h requires linux/err.h if CONFIG_REGMAP is not defined. Without it I get error. CC drivers/media/platform/exynos4-is/fimc-reg.o In file included from drivers/media/platform/exynos4-is/fimc-reg.c:14:0: include/linux/regmap.h: In function ‘regmap_write’: include/linux/regmap.h:525:10: error: ‘EINVAL’ undeclared (first use in this function) include/linux/regmap.h:525:10: note: each undeclared identifier is reported only once for each function it appears in Signed-off-by: Mateusz Krawczuk <m.krawczuk@partner.samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org> Cc: stable@kernel.org
2013-07-24regmap: irq: document mask/wake_invert flagsPhilipp Zabel1-0/+2
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-24regmap: irq: make flags bool and put them in a bitfieldPhilipp Zabel1-4/+4
This patch makes mask/wake_invert bool and puts all flags into a bitfield for consistency and to save some space. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-23regmap: irq: Allow to acknowledge masked interrupts during initializationPhilipp Zabel1-0/+2
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>
2013-06-30Merge remote-tracking branch 'regmap/topic/field' into regmap-nextMark Brown1-0/+31
2013-06-12regmap: Add regmap_field APIsSrinivas Kandagatla1-0/+31
It is common to access regmap registers at bit level, using regmap_update_bits or regmap_read functions, however the end user has to take care of a mask or shifting. This becomes overhead when such use cases are high. Having a common function to do this is much convenient and less error prone. The idea of regmap_field is simple, regmap_field gives a logical structure to bits of the regmap register, and the driver can use this logical entity without the knowledge of the bit positions and masks all over the code. This way code looks much neat and it need not handle the masks, shifts every time it access the those entities. With this new regmap_field_read/write apis the end user can setup a regmap field using regmap_field_init and use the return regmap_field to read write the register field without worrying about the masks or shifts. Also this apis will be useful for drivers which are based on regmaps, like some clocks or pinctrls which can work on the regmap_fields directly without having to worry about bit positions. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-05-12regmap: Make regmap_check_range_table() a public APIMark Brown1-0/+3
Allow drivers to use an access table as part of their implementation. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-05-12regmap: Add support for discarding parts of the register cacheMark Brown1-0/+9
Allow drivers to discard parts of the register cache, for example if part of the hardware has been reset. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-27regmap: core: Provide regmap_can_raw_write() operationMark Brown1-0/+1
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>
2013-02-14Merge remote-tracking branch 'regmap/topic/no-bus' into regmap-nextMark Brown1-1/+17
2013-02-14Merge remote-tracking branch 'regmap/topic/mmio' into regmap-nextMark Brown1-6/+41
2013-02-14Merge remote-tracking branch 'regmap/topic/irq' into regmap-nextMark Brown1-0/+1
2013-02-14Merge remote-tracking branch 'regmap/topic/flat' into regmap-nextMark Brown1-1/+2
2013-02-14regmap: mmio: add register clock supportPhilipp Zabel1-6/+41
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>
2013-01-29regmap: Add asynchronous I/O supportMark Brown1-0/+28
Some use cases like firmware download can transfer a lot of data in quick succession. With high speed buses these use cases can benefit from having multiple transfers scheduled at once since this allows the bus to minimise the delay between transfers. Support this by adding regmap_raw_write_async(), allowing raw transfers to be scheduled, and regmap_async_complete() to wait for them to finish. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-29regmap: Add "no-bus" option for regmap APIAndrey Smirnov1-1/+17
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>
2013-01-04regmap: irq: Support wake IRQ mask inversionMark Brown1-0/+1
Support devices which have an enable rather than mask register for wake sources. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-02regmap: flat: Add flat cache typeMark Brown1-1/+2
While for I2C and SPI devices the overhead of using rbtree for devices with only one block of registers is negligible the same isn't always going to be true for MMIO devices where the I/O costs are very much lower. Cater for these devices by adding a simple flat array type for them where the lookups are simple array accesses, taking us right back to the original ASoC cache implementation. Thanks to Magnus Damm for the discussion which prompted this. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-11Merge remote-tracking branch 'regmap/topic/table' into regmap-nextMark Brown1-11/+72
2012-12-11Merge remote-tracking branch 'regmap/topic/lock' into regmap-nextMark Brown1-1/+15
2012-12-11Merge remote-tracking branch 'regmap/topic/domain' into regmap-nextMark Brown1-0/+2
2012-11-21regmap: introduce tables for readable/writeable/volatile/precious checksDavide Ciminaghi1-11/+72
Many of the regmap enabled drivers implementing one or more of the readable, writeable, volatile and precious methods use the same code pattern: return ((reg >= X && reg <= Y) || (reg >= W && reg <= Z) || ...) Switch to a data driven approach, using tables to describe readable/writeable/volatile and precious registers ranges instead. The table based check can still be overridden by passing the usual function pointers via struct regmap_config. Signed-off-by: Davide Ciminaghi <ciminaghi@gnudd.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-21Merge branch 'topic/lock' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap into regmap-tableMark Brown1-1/+15