summaryrefslogtreecommitdiff
path: root/drivers/base
AgeCommit message (Collapse)Author
2012-04-15regmap: fix compile errors in regmap-irq.c due to stride changesStephen Warren
Commit f01ee60fffa4 ("regmap: implement register striding") caused the compile errors below. Fix them. drivers/base/regmap/regmap-irq.c: In function 'regmap_irq_sync_unlock': drivers/base/regmap/regmap-irq.c:62:12: error: 'map' undeclared (first use in this function) drivers/base/regmap/regmap-irq.c:62:12: note: each undeclared identifier is reported only once for each function it appears in drivers/base/regmap/regmap-irq.c: In function 'regmap_irq_enable': drivers/base/regmap/regmap-irq.c:77:37: error: 'map' undeclared (first use in this function) drivers/base/regmap/regmap-irq.c: In function 'regmap_irq_disable': drivers/base/regmap/regmap-irq.c:85:37: error: 'map' undeclared (first use in this function) Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit 56806555de5485d6786bf0f8df01b8ed9fc5d006) Change-Id: I1b0787c81695ddbfb081a1342690a44162474574 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/96511 Reviewed-by: Simone Willett <swillett@nvidia.com> Tested-by: Simone Willett <swillett@nvidia.com>
2012-04-15regmap: implement register stridingStephen Warren
regmap_config.reg_stride is introduced. All extant register addresses are a multiple of this value. Users of serial-oriented regmap busses will typically set this to 1. Users of the MMIO regmap bus will typically set this based on the value size of their registers, in bytes, so 4 for a 32-bit register. Throughout the regmap code, actual register addresses are used. Wherever the register address is used to index some array of values, the address is divided by the stride to determine the index, or vice-versa. Error- checking is added to all entry-points for register address data to ensure that register addresses actually satisfy the specified stride. The MMIO bus ensures that the specified stride is large enough for the register size. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit f01ee60fffa4dc6c77122121233a793f7f696e67) Change-Id: I634977dcb0fe9ff95c7932e9195a2c1918eb1c18 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/96510 Reviewed-by: Simone Willett <swillett@nvidia.com> Tested-by: Simone Willett <swillett@nvidia.com>
2012-04-15regmap: fix compilation when !CONFIG_DEBUG_FSStephen Warren
Commit 79c64d5 "regmap: allow regmap instances to be named" changed the prototype of regmap_debugfs_init, but didn't update the dummy inline used when !CONFIG_DEBUGFS. Fix this. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit abec95adefaeb2229cb28de65f3d32cd149b9dd9) Change-Id: Ieb049fa9ed0dd26d21a37592ecb25488b0909c0b Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/96509 Reviewed-by: Simone Willett <swillett@nvidia.com> Tested-by: Simone Willett <swillett@nvidia.com>
2012-04-15regmap: allow regmap instances to be namedStephen Warren
Some devices have multiple separate register regions. Logically, one regmap would be created per region. One issue that prevents this is that each instance will attempt to create the same debugfs files. Avoid this by allowing regmaps to be named, and use the name to construct the debugfs directory name. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> cherry-picked form mainline d3c242e Change-Id: Ia3301fb4d28645f1d3593e547f9409ce20c0acfe Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/96508 Reviewed-by: Simone Willett <swillett@nvidia.com> Tested-by: Simone Willett <swillett@nvidia.com>
2012-04-15regmap: validate regmap_raw_read/write val_lenStephen Warren
val_len should be a multiple of val_bytes. If it's not, error out early. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit 851960ba7cb38a6a108d102e4c8b0ab702972e22) Change-Id: Ic17d4bd832b5ea3e426d00ff5d0ae342b8abba45 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/96507 Reviewed-by: Simone Willett <swillett@nvidia.com> Tested-by: Simone Willett <swillett@nvidia.com>
2012-04-15regmap: mmio: remove some error checks now in the coreStephen Warren
These error checks are implemented in regmap core. Remove the duplicate code from regmap-mmio.c Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit 9878647f4349dbaa46b4026ed9bbf8acfc0de34c) Change-Id: I32979da1bbca852470c0cb8d8d997b2c77d6703f Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/96506 Reviewed-by: Simone Willett <swillett@nvidia.com> Tested-by: Simone Willett <swillett@nvidia.com>
2012-04-15regmap: mmio: convert some error returns to BUG()Stephen Warren
Some of the error conditions detected by regmap_mmio_*() are pure internal errors, rather than user-/client-triggerable conditions. Convert these to BUG(). Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit 40606dba450830e50420599c52a86cf6ce5c6a14) Change-Id: Ibf926ca6774e4b3d3dd855d42814065858318628 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/96505 Reviewed-by: Simone Willett <swillett@nvidia.com> Tested-by: Simone Willett <swillett@nvidia.com>
2012-04-15regmap: add MMIO bus supportStephen Warren
This is a basic memory-mapped-IO bus for regmap. It has the following features and limitations: * Registers themselves may be 8, 16, 32, or 64-bit. 64-bit is only supported on 64-bit platforms. * Register offsets are limited to precisely 32-bit. * IO is performed using readl/writel, with no provision for using the __raw_readl or readl_relaxed variants. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit 45f5ff8107a845854b1d1812ab1d9c5541f08b4d) Change-Id: Ia84cf3fec838ee687e5b77ce771fc2450abe8436 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/96504 Reviewed-by: Simone Willett <swillett@nvidia.com> Tested-by: Simone Willett <swillett@nvidia.com>
2012-04-15regmap: introduce fast_io busses, and use a spinlock for themStephen Warren
Some bus types have very fast IO. For these, acquiring a mutex for every IO operation is a significant overhead. Allow busses to indicate their IO is fast, and enhance regmap to use a spinlock for those busses. [Currently limited to native endian registers -- broonie] Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit bacdbe077342ecc9e7b3e374cc5a41995116706a) Change-Id: I337f27a09f2b176b46e8f6d05401957a1abc0609 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/96503 Reviewed-by: Simone Willett <swillett@nvidia.com> Tested-by: Simone Willett <swillett@nvidia.com>
2012-04-15regmap: introduce explicit bus_context for bus callbacksStephen Warren
The only context needed by I2C and SPI bus definitions is the device itself; this can be converted to an i2c_client or spi_device in order to perform IO on the device. However, other bus types may need more context in order to perform IO. Enable this by having regmap_init accept a bus_context parameter, and pass this to all bus callbacks. The existing callbacks simply pass the struct device here. Future bus types may pass something else. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit 0135bbcc7a0cc056f0203ff839466236b8e3dc19) Change-Id: I36b3fb3433af6e6f1e673fc6c73ba21f7eb4d054 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/96502 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Stephen Warren <swarren@nvidia.com>
2012-04-15regmap: prevent division by zero in rbtree_showStephen Warren
If there are no nodes in the cache, nodes will be 0, so calculating "registers / nodes" will cause division by zero. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: stable@vger.kernel.org (cherry picked from commit c04c1b9ee8f30c7a3a25e20e406247003f634ebe) Change-Id: I30047f1e0bd08417794c3d19e2fe1d480a74e083 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/96501 Reviewed-by: Simone Willett <swillett@nvidia.com> Tested-by: Simone Willett <swillett@nvidia.com>
2012-04-15regmap: Export regcache_sync_region()Mark Brown
regcache_sync_region() isn't going to be useful to most drivers if we don't export it since otherwise they can't use it when built modular. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit e466de05194b666114713b753e2f4be1d4200140) Change-Id: I38b12c791f0a462ebbbfbe4a6b25cfa3265ffacc Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/96500 Reviewed-by: Automatic_Commit_Validation_User
2012-04-15regmap: Use pad_bits and reg_bits when determining register format.Marc Reilly
This change combines any padding bits into the register address bits when determining register format handlers to use the next byte-divisible register size. A reg_shift member is introduced to the regmap struct to enable fixup of the reg format. Format handlers now take an extra parameter specifying the number of bits to shift the value by. Signed-off-by: Marc Reilly <marc@cpdesign.com.au> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit d939fb9a78b4743bc4bc3cc415894ed42050c5cc) Change-Id: I80921cfa4dd6aea5e7038927a313baeb347689e2 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/96499 Reviewed-by: Simone Willett <swillett@nvidia.com> Tested-by: Simone Willett <swillett@nvidia.com>
2012-04-15regmap: Add support for device with 24 data bits.Marc Reilly
Add support for devices with 24 data bits. Signed-off-by: Marc Reilly <marc@cpdesign.com.au> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit ea279fc5619e2541a0c28196b0fa06447d9ad026) Change-Id: I69ccd494eb8622c442d55294c24ecd6acd78cfcb Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/96498 Reviewed-by: Simone Willett <swillett@nvidia.com> Tested-by: Simone Willett <swillett@nvidia.com>
2012-04-15regmap: rbtree: Fix register default look-up in syncLars-Peter Clausen
The code currently passes the register offset in the current block to regcache_lookup_reg. This works fine as long as there is only one block and with base register of 0, but in all other cases it will look-up the default for a wrong register, which can cause unnecessary register writes. This patch fixes it by passing the actual register number to regcache_lookup_reg. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: <stable@vger.kernel.org> (cherry picked from commit 4b4e9e43fd210e0cd2a5d29357e7c000e13e08ae) Change-Id: Ibed70828471423df5432fea67316ca9ad8aeb52a Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/96497 Reviewed-by: Automatic_Commit_Validation_User
2012-04-15bitops: remove for_each_set_bit_cont()Akinobu Mita
Remove for_each_set_bit_cont() after confirming that no one uses for_each_set_bit_cont() anymore. [sfr@canb.auug.org.au: regmap: cope with bitops API change] Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Cc: Robert Richter <robert.richter@amd.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Cherry-pick from mainline 0a329d2 Change-Id: I6655096e5d58a1215b225035daa8dd8a2f6327d9 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/96496 Reviewed-by: Automatic_Commit_Validation_User
2012-04-15regmap: Fix future missing prototype of devres_alloc() and friendsStephen Warren
[Fix for breakage which will be introduced during the merge window via header reworks in another tree, the regmap tree does include device.h but Paul's tree breaks that. Reworded subject to reflect -- broonie] regmap.s uses devres_alloc() and others that are prototyped in device.h. Include that to solve the following: drivers/base/regmap/regmap.c: In function 'devm_regmap_init': drivers/base/regmap/regmap.c:331:2: error: implicit declaration of function 'devres_alloc' [-Werror=implicit-function-declaration] drivers/base/regmap/regmap.c:338:3: error: implicit declaration of function 'devres_add' [-Werror=implicit-function-declaration] drivers/base/regmap/regmap.c:340:3: error: implicit declaration of function 'devres_free' [-Werror=implicit-function-declaration] drivers/base/regmap/regmap.c: In function '_regmap_raw_write': drivers/base/regmap/regmap.c:421:5: error: implicit declaration of function 'dev_err' [-Werror=implicit-function-declaration] Signed-off-by: Stephen Warren <swarren@wwwdotorg.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit f5d6eba74b8aac7d4bf646c5445807aa6a247e6c) Change-Id: I38c390fb5085bf3e815aa5c4048d4f89d8698563 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/96495
2012-04-15regmap: Fix rbtree block base in syncMark Brown
Otherwise we'll end up running with bogus register numbers. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit f9353e70bcebd00cd182d946083afd7d8eddd259) Change-Id: I7615fd2d63ec29dd869585fb20a151067b53c72a Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/96494 Reviewed-by: Automatic_Commit_Validation_User
2012-04-15regcache: Make sure we sync register 0 in an rbtree cacheMark Brown
Most of the current users have register 0 as a volatile register or don't have a register 0 so it's not been apparent that it's not getting synced. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit 994f5db65ef4b83db0321842bd43c6bc0a51f000) Change-Id: Iaada5ae8ba705f45049eb1c85a1909a9f192f765 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/96493 Reviewed-by: Simone Willett <swillett@nvidia.com> Tested-by: Simone Willett <swillett@nvidia.com>
2012-04-15regmap: delete unused module.h from drivers/base/regmap filesPaul Gortmaker
Remove unused module.h and/or replace with export.h as required. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit 19694b5ea1d3a723dafe9544b5ee9a935414dc28) Change-Id: Icf76b35f6d0d1f4720ca6d51fa9b2ebf123604b1 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/96492 Reviewed-by: Automatic_Commit_Validation_User
2012-04-15regmap: Fix x86_64 breakageMark Brown
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit a0941e562e8008804f9fe4400315ceb164752fac) Change-Id: Ic582509f74612ddc48f854116553e2f40954e4ae Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/96491 Reviewed-by: Automatic_Commit_Validation_User
2012-04-15regmap: Allow drivers to sync only part of the register cacheMark Brown
Provide a regcache_sync_region() operation which allows drivers to write only part of the cache back to the hardware. This is intended for use in cases like power domains or DSP memories where part of the device register map may be reset without fully resetting the device. Fully supporting these devices is likely to require additional work to make specific regions of the register map cache only while they are in reset, but this is enough for most devices. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit 4d4cfd1656b5f6c88eae51c40741a695b108b006) Change-Id: Ia8cccf7986611485ae090e234bb68084671d7641 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/96490 Reviewed-by: Simone Willett <swillett@nvidia.com> Tested-by: Simone Willett <swillett@nvidia.com>
2012-04-15regmap: Supply ranges to the sync operationsMark Brown
In order to allow us to support partial sync operations add minimum and maximum register arguments to the sync operation and update the rbtree and lzo caches to use this new information. The LZO implementation is obviously not good, we could exit the iteration earlier, but there may be room for more wide reaching optimisation there. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit ac8d91c801905a061ca883dca427a5e19602a1e7) Change-Id: I92ceee1c704ea7c864bff0559d36cf34554c3ba5 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/96489 Reviewed-by: Simone Willett <swillett@nvidia.com> Tested-by: Simone Willett <swillett@nvidia.com>
2012-04-15regmap: Add tracepoints for cache only and cache bypassMark Brown
Useful for figuring out where the hardware interaction went or came from. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit 5d5b7d4f80ed6e861c1c220fd57e3dad0912526e) Change-Id: Ie7c0659458a3a4a2f100d86db552c606d9da0e6b Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/96488 Reviewed-by: Simone Willett <swillett@nvidia.com> Tested-by: Simone Willett <swillett@nvidia.com>
2012-04-15regmap: Mark the cache as clean after a successful syncMark Brown
Previously the cache would never be marked clean, meaning syncs would never be suppressed which isn't the end of the world but could be inefficient. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit 6ff7373809a9b4eb644d83e2e299da297e1cbffa) Change-Id: I52aef73bc6bc0df10dd64da92d0bf591e44ddc0e Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/96487 Reviewed-by: Automatic_Commit_Validation_User
2012-04-15regmap: Remove default cache sync implementationMark Brown
It's not used as all cache types have sync operations so it's just dead code which never gets tested. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit c3ec23288a92e20e0aff84a4cb6fbc7cc9bcf567) Change-Id: I3ba8c8afee9a7c945dc0a52e87c9f4a357e79308 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/96486 Reviewed-by: Simone Willett <swillett@nvidia.com> Tested-by: Simone Willett <swillett@nvidia.com>
2012-04-15regmap: Skip hardware defaults for LZO cachesMark Brown
Saves some I/O when resyncing; we assume that syncs start from the device reset state. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit a3c3774176838bbfa4f6e48133644903818e56dc) Change-Id: Ib4471bd06856ccd2652f21dd0d9d51319df00939 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/96485 Reviewed-by: Automatic_Commit_Validation_User
2012-04-15regmap: Expose the driver name in debugfsDimitris Papastamos
Add a file called 'name' containing the name of the driver. Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit f0c2319f9f196726ebe4d7508fd8fbd804988db3) Change-Id: Id67e73cfd573a71377fe6bbc5c3068718822ef38 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/96484 Reviewed-by: Automatic_Commit_Validation_User
2012-04-15regmap: Add support for writing to regmap registers via debugfsDimitris Papastamos
To enable writing to the regmap debugfs registers file users will need to modify the source directly and #define REGMAP_ALLOW_WRITE_DEBUGFS. The reason for this is that it is dangerous to expose this functionality in general where clients could potentially be PMICs. [A couple of minor style updates -- broonie] Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit 09c6ecd394105c4864a0e409e181c9b1578c2a63) Change-Id: Ia9408880e25d5060796ab79812a023def00b10bc Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/96483 Reviewed-by: Automatic_Commit_Validation_User
2012-04-15regmap: Support raw reads from cached registersMark Brown
Fall back to a register by register read to do so; most likely we'll be cache only so the overhead will be low. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit b8fb5ab156055b745254609f4635fcfd6b7dabc8) Change-Id: I9f3b6011f4704987c5a014de8b30a2e6e3196d21 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/96482 Reviewed-by: Simone Willett <swillett@nvidia.com> Tested-by: Simone Willett <swillett@nvidia.com>
2012-04-15regmap: Allow users to query the size of register valuesMark Brown
Generic infrastructure based on top of regmap may want to operate on blocks of data and therefore find it useful to find the size of the register values. Provide an accessor operation for this. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cherry-pick from mainline a6539c3 Change-Id: I455ace158eea38f6a92938f6330ec074bc18f0da Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/96481 Reviewed-by: Automatic_Commit_Validation_User
2012-04-15regmap: Implement support for 32 bit registers and valuesMark Brown
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit 7d5e525b9ceda0e3b85da0acdaa2de19fea51edc) Change-Id: I6f6fec44b439b4916eba7f32ece1fa011e3ac021 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/96480 Reviewed-by: Simone Willett <swillett@nvidia.com> Tested-by: Simone Willett <swillett@nvidia.com>
2012-03-05regmap: Bypassing cache when initializing cacheLaxman Dewangan
During regcache_init, if client has not passed the default data of cached register then it is directly read from the hw to initialize cache. This hw register read happens before cache ops are initialized and hence avoiding register read to check for the data available on cache or not by enabling flag of cache_bypass. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit df00c79f78d8b0ad788daf689ea461ace9d0811f) Change-Id: I4398162bd6b12689c795afe5ee02397e975e456c Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/87593
2012-03-05regmap: Fix cache defaults initialization from raw cache defaultsLars-Peter Clausen
Currently registers with a value of 0 are ignored when initializing the register defaults from raw defaults. This worked in the past, because registers without a explicit default were assumed to have a default value of 0. This was changed in commit b03622a8 ("regmap: Ensure rbtree syncs registers set to zero properly"). As a result registers, which have a raw default value of 0 are now assumed to have no default. This again can result in unnecessary writes when syncing the cache. It will also result in unnecessary reads for e.g. the first update operation. In the case where readback is not possible this will even let the update operation fail, if the register has not been written to before. So this patch removes the check. Instead it adds a check to ignore raw defaults for registers which are volatile, since those registers are not cached. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: stable@vger.kernel.org (cherry picked from commit 61cddc57dc14a5dffa0921d9a24fd68edbb374ac) Change-Id: Iccd58a95a432d222befd8b339fe0c6edd26666bb Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/87592
2012-03-05regmap: add regmap_bulk_write() for register writeLaxman Dewangan
The bulk_write() supports the data transfer to multi register which takes the data into cpu_endianness format and does formatting of data to device format before sending to device. The transfer can be completed in single transfer or multiple transfer based on data formatting. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit 8eaeb21925563075ae036c2e5ba8d041b70e18fa) Change-Id: Id97fbcfa0ed7d00d97dc3ab89fdb2b025850c9b1 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/87591
2012-03-05regmap: Support for caching in reg_raw_write()Laxman Dewangan
Adding support for caching of data into the non-volatile register from the call of reg_raw_write(). This will allow the larger block of data write into multiple register without worrying whether register is cached or not through reg_raw_write(). Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit c9157198417076c0c2664ba997e7b0217f61fcce) Change-Id: I6e6a96bc9e08ca9b7fe0f52a0a5692a4a61ef0ae Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/87590
2012-03-05regmap: Fix kcalloc parameters swappedAxel Lin
The first parameter should be "number of elements" and the second parameter should be "element size". Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit 2a14d7d9b7439fe62082a60a7f8983ccb463d134) Change-Id: Ibe00000c7c6db1b36e5530e00713cdb434052f0a Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/87589
2012-03-05regmap: Add debugfs information for the cache statusMark Brown
Show all the cache status flags in debugfs if we have a cache. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit 028a01e601487b5991b70dba506dfe87d83543f6) Change-Id: I2b5297143ea8c81477a5124c7db0e6683fd56255 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/87588
2012-03-05regmap: Don't use bitfields for booleansMark Brown
This was a cut'n'paste from some older code. Since we're about to add debugfs support don't do the obvious thing and use bool, use u32 instead (which debugfs has been using since time immemorial). cherry-picked from mainline 847fb6fdf58c0ef4c207d2853a043a4da3db9c76 Change-Id: I0eff043969a97190e7470bc695ef78323e9cb8d7 Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/87587
2012-03-05regmap: Remove incorrect unreachable comment in regcache_set_val()Axel Lin
regcache_set_val() returns false if cache[idx] != val. Thus it actually is not unreachable. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit aa795d129246cb4c973076e3242b8a2eb374f1ef) Change-Id: I83bbce848914e4648723a5c5dd0ca7f04ba0c64e Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/87586
2012-03-05regmap: Implement managed regmap_init()Mark Brown
Save error handling and unwinding code in drivers by providing managed versions of the regmap init functions, simplifying usage. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit c0eb46766d395da8d62148bda2e59bad5e6ee2f2) Change-Id: I6df96ae10ad8a882feb7da908dd46c2f56a28f9f Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/87585
2012-03-05regmap: if format_write is used, declare all registers as "unreadable"Wolfram Sang
Using .format_write means, we have a custom function to write to the chip, but not to read back. Also, mark registers as "not precious" and "not volatile" which is implicit because we cannot read them. Make those functions use 'regmap_readable' to reuse the checks done there. Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit 4191f19792bf91267835eb090d970e9cd6277a65) Change-Id: Iff0be114904ada151315750fdd92ba562dab6314 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/87584
2012-03-05regmap: Properly round reg_bytes and val_bytesWolfram Sang
For the upcoming 2/6-format, we don't see debugfs output otherwise, since the current division results in 0. I'd think 10/14 is broken currently, too. Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit c212acccc368a087a53559aac2b7d3be941b1252) Change-Id: I2d8d1683f1649697ad73aa7544a3ac994931e237 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/87583
2012-03-05regmap: Add support for 2/6 register formatingWolfram Sang
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit 9aa507505cdcd10b7390398790f013374ee74a26) Change-Id: I3af1a4c4e9aa30f9ebbd64d5c1818e3e04328e7e Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/87582
2012-03-05regmap: Reset device debugfs when reinitialising the cacheMark Brown
Most of the data exposed via debugfs is for or from the cache so reset all the debugfs configuration to make sure everything is up to date with the latest configuration, especially if we're changing cache type. cherry-picked from mainline commit a24f64a648376766497fddd8bc24b1ca5b906431 Change-Id: I9db449602d9c37b22e024bf78a54fd7d09a07638 Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/87581
2012-03-05regmap: Bypass the cache when applying patchesMark Brown
Otherwise any patch that affects a register which is writable may trash cached values. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit 8a892d6996b60c822f19ad1844eb15b96ce393c7) Change-Id: I278d4f4aa34709e2e15d0cc83238e4b419f159cb Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/87580
2012-03-05regmap: Skip patch application when the cache is not dirty on syncMark Brown
On the basis that if we don't actually need to resync the cache then the patches are probably also already applied. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit d9db762708e27c2892db9d8a54e735a8e506e16e) Change-Id: I1b41ea112ae97812be6c9e2e3ea8c490e0835732 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/87579
2012-03-05regmap: Unexport regcache_write() and regcache_read()Mark Brown
They have no current users which is fortunate as they don't take the lock and therefore aren't safe to use externally. We'll need to add new operations if direct cache access is needed. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit 7e53b195e412a813e915843adc7e4d91868e8e94) Change-Id: I6a273d8f42fafe5f2d0f2269dd9e0253e8ac8e3f Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/87578
2012-03-05regmap: Support register patch setsMark Brown
Device manufacturers frequently provide register sequences, usually not fully documented, to be run at startup in order to provide better defaults for devices (for example, improving performance in the light of silicon evaluation). Support such updates by allowing drivers to register update sets with the core. These updates will be written to the device immediately and will also be rewritten when the cache is synced. The assumption is that the reason for resyncing the cache will always be that the device has been powered off. If this turns out to not be the case then a separate operation can be provided. Currently the implementation only allows a single set of updates to be specified for a device, this could be extended in future. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit 22f0d90a34827812413bb3fbeda6a2a79bb58423) Change-Id: I02f4ead9866a90b3635c4b98f1f9c3be3109c5ea Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/87577
2012-03-05regmap: Reset cache status when reinitialsing the cacheMark Brown
When we reinitialise the cache make sure that we reset the cache access flags, ensuring that the reinitialised cache is in the default state which is what callers would and do expect given the function name. This is particularly likely to cause issues in systems where there was no cache previously as those systems have cache bypass enabled, as for the wm8994 driver where this was noticed. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> (cherry picked from commit 421e8d2de3bd8b089dc6322d8589b7eb38437a23) Change-Id: I99959185b9dd9862717a2faf2d011c9966e23c7f Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/87576