summaryrefslogtreecommitdiffstats
path: root/drivers/base/regmap/regmap-debugfs.c
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'regmap/topic/debugfs' into regmap-nextMark Brown2013-06-301-2/+2
|\
| * regmap: debugfs: Fix return from regmap_debugfs_get_dump_startSrinivas Kandagatla2013-05-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | regmap_debugfs_get_dump_start should return the offset of the register it should start reading from, However in the current code at one point the code does not return correct register offset. With this patch all the returns from this function takes reg_stride in to consideration to return correct offset. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| * regmap: debugfs: Don't mark lockdep as broken due to debugfs writeMark Brown2013-05-121-1/+1
| | | | | | | | | | | | | | | | A register write to hardware is reasonably unlikely to cause locking dependency issues, the reason we're tainting is that unexpected changes in the hardware configuration may confuse drivers. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | Merge remote-tracking branch 'regmap/topic/cache' into regmap-nextMark Brown2013-06-301-0/+4
|\ \ | |/ |/|
| * regmap: debugfs: Suppress cache for partial register filesMark Brown2013-06-191-0/+4
| | | | | | | | | | | | | | | | The cache is based on the full register map so confuses things if used for a partial map. Reported-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | regmap: debugfs: Check return value of regmap_write()Dimitris Papastamos2013-05-121-1/+4
|/ | | | | Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regmap: debugfs: Add a registers `range' fileDimitris Papastamos2013-03-041-0/+83
| | | | | | | | | | | | This file lists the register ranges in the register map. The condition to split the range is based on whether the block is readable or not. Ensure that we lock the `debugfs_off_cache' list whenever we access and modify the list. There is a possible race otherwise between the read() operations of the `registers' file and the `range' file. Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regmap: debugfs: Simplify calculation of `c->max_reg'Dimitris Papastamos2013-03-041-7/+4
| | | | | | | | | | | | We don't need to use any of the file position information to calculate the base and max register of each block. Just use the counter directly. Set `i = base' at the top to avoid GCC flow analysis bugs. The value of `i' can never be undefined or 0 in the if (c) { ... }. Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* Merge tag 'modules-next-for-linus' of ↵Linus Torvalds2013-02-251-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux Pull module update from Rusty Russell: "The sweeping change is to make add_taint() explicitly indicate whether to disable lockdep, but it's a mechanical change." * tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux: MODSIGN: Add option to not sign modules during modules_install MODSIGN: Add -s <signature> option to sign-file MODSIGN: Specify the hash algorithm on sign-file command line MODSIGN: Simplify Makefile with a Kconfig helper module: clean up load_module a little more. modpost: Ignore ARC specific non-alloc sections module: constify within_module_* taint: add explicit flag to show whether lock dep is still OK. module: printk message when module signature fail taints kernel.
| * taint: add explicit flag to show whether lock dep is still OK.Rusty Russell2013-01-211-1/+1
| | | | | | | | | | | | | | Fix up all callers as they were before, with make one change: an unsigned module taints the kernel, but doesn't turn off lockdep. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* | regmap: debugfs: Factor out debugfs_tot_len calc into a functionDimitris Papastamos2013-02-111-8/+14
| | | | | | | | | | | | | | | | | | | | In preparation to support the regmap debugfs ranges functionality factor this code out to a separate function. We'll need to ensure that the value has been correctly calculated from two separate places in the code. Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | regmap: debugfs: Optimize seeking within blocks of registersDimitris Papastamos2013-02-111-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | Optimize this so that we can better guess where to start scanning from. We know the length of the register field format, therefore given the file pointer position align to the nearest register field and scan from there onwards. We round down in this calculation and we let the rest of the code figure out where to start scanning from. Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | regmap: debugfs: Add a `max_reg' member in struct regmap_debugfs_off_cacheDimitris Papastamos2013-02-111-0/+8
| | | | | | | | | | | | | | | | | | | | | | We are keeping track of the maximum register as well, this will make things easier for us in sharing this code with the code implementing the register ranges functionality. It also simplifies a bit the calculations when looking for the relevant block:offset from within the cache. Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | regmap: debugfs: Fix reading in register field unitsDimitris Papastamos2013-02-081-1/+1
| | | | | | | | | | | | | | | | | | | | At the moment, if the length of the register field format is N bytes, we can only get anything meaningful back to userspace by providing a buffer that is N + 2 bytes large. Fix this so we that we only need to provide a buffer of N bytes. Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | regmap: regmap: avoid spurious warning in regmap_read_debugfsRussell King2013-01-271-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Gcc warns about the case where regmap_read_debugfs tries to walk an empty map->debugfs_off_cache list, which would results in uninitialized variable getting returned, if we hadn't checked the same condition just before that. After an originally suggested inferior patch from Arnd Bergmann, this is the solution that Russell King came up with, sidestepping the problem by merging the error case for an empty list with the normal path. Without this patch, building mxs_defconfig results in: drivers/base/regmap/regmap-debugfs.c: In function 'regmap_read_debugfs': drivers/base/regmap/regmap-debugfs.c:147:9: : warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized] Reported-by: Vincent Stehle <v-stehle@ti.com> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | regmap: debugfs: Fix seeking from the cacheMark Brown2013-01-171-2/+0
|/ | | | | | | | | We don't want to bomb out early if we failed to get the cache any more, just soldier on instead and we won't get confused and always return the first block. Reported-by: Philipp Zabel <p.zabel@pengutronix.de Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regmap: debugfs: Make sure we store the last entry in the offset cacheMark Brown2013-01-081-0/+9
| | | | Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regmap: debugfs: Ensure a correct return value for empty cachesMark Brown2013-01-081-0/+10
| | | | | | This should never happen in the real world. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regmap: debugfs: Discard the cache if we fail to allocate an entryMark Brown2013-01-081-11/+18
| | | | | | | | Rather than trying to soldier on with a partially allocated cache just throw the cache away and pretend we don't have one in case we can get a full cache next time around. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regmap: debugfs: Fix check for block start in cached seeksMark Brown2013-01-081-1/+1
| | | | | | | Check for the block we were asked to start from, not the position we're in. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regmap: debugfs: Fix attempts to read nonexistant register blocksMark Brown2013-01-081-1/+2
| | | | | | | | Return the start of the last block we tried to read rather than a position, and also make sure we update the byte position while we're at it. Without this reads that go into nonexistant areas get confused. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regmap: debugfs: Cache offsets of valid regions for dumpMark Brown2012-12-111-14/+53
| | | | | | | | | | | | | | Avoid doing a linear scan of the entire register map for each read() of the debugfs register dump by recording the offsets where valid registers exist when we first read the registers file. This assumes the set of valid registers never changes, if this is not the case invalidation of the cache will be required. This could be further improved for large blocks of contiguous registers by calculating the register we will read from within the block - currently we do a linear scan of the block. An rbtree may also be worthwhile. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regmap: debugfs: Factor out initial seekMark Brown2012-12-111-3/+36
| | | | | | | In preparation for doing things a bit more quickly than a linear scan factor out the initial seek from the debugfs register dump. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regmap: debugfs: Avoid overflows for very small readsMark Brown2012-12-111-1/+1
| | | | | | | | | | | If count is less than the size of a register then we may hit integer wraparound when trying to move backwards to check if we're still in the buffer. Instead move the position forwards to check if it's still in the buffer, we are unlikely to be able to allocate a buffer sufficiently big to overflow here. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: stable@vger.kernel.org
* regmap: Cache register and value sizes for debugfsMark Brown2012-12-061-10/+14
| | | | | | No point in calculating them every time. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regmap: Provide debugfs read of register rangesMark Brown2012-10-151-0/+31
| | | | | | | If a register range is named then provide a debugfs file showing the contents of the range separately. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regmap: Factor out debugfs register readMark Brown2012-10-151-5/+14
| | | | | | This will allow the use of the same code for reading register ranges. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regmap: implement register stridingStephen Warren2012-04-101-2/+2
| | | | | | | | | | | | | | | | | | | 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>
*-. Merge branches 'regmap-core', 'regmap-mmio' and 'regmap-naming' into ↵Mark Brown2012-04-101-3/+11
|\ \ | | | | | | | | | regmap-stride
| | * regmap: allow regmap instances to be namedStephen Warren2012-04-101-3/+11
| |/ | | | | | | | | | | | | | | | | | | | | 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>
* | simple_open: automatically convert to simple_open()Stephen Boyd2012-04-051-9/+3
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many users of debugfs copy the implementation of default_open() when they want to support a custom read/write function op. This leads to a proliferation of the default_open() implementation across the entire tree. Now that the common implementation has been consolidated into libfs we can replace all the users of this function with simple_open(). This replacement was done with the following semantic patch: <smpl> @ open @ identifier open_f != simple_open; identifier i, f; @@ -int open_f(struct inode *i, struct file *f) -{ ( -if (i->i_private) -f->private_data = i->i_private; | -f->private_data = i->i_private; ) -return 0; -} @ has_open depends on open @ identifier fops; identifier open.open_f; @@ struct file_operations fops = { ... -.open = open_f, +.open = simple_open, ... }; </smpl> [akpm@linux-foundation.org: checkpatch fixes] Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Julia Lawall <Julia.Lawall@lip6.fr> Acked-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Merge tag 'device-for-3.4' of ↵Linus Torvalds2012-03-241-0/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux Pull <linux/device.h> avoidance patches from Paul Gortmaker: "Nearly every subsystem has some kind of header with a proto like: void foo(struct device *dev); and yet there is no reason for most of these guys to care about the sub fields within the device struct. This allows us to significantly reduce the scope of headers including headers. For this instance, a reduction of about 40% is achieved by replacing the include with the simple fact that the device is some kind of a struct. Unlike the much larger module.h cleanup, this one is simply two commits. One to fix the implicit <linux/device.h> users, and then one to delete the device.h includes from the linux/include/ dir wherever possible." * tag 'device-for-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux: device.h: audit and cleanup users in main include dir device.h: cleanup users outside of linux/include (C files)
| * device.h: cleanup users outside of linux/include (C files)Paul Gortmaker2012-03-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | For files that are actively using linux/device.h, make sure that they call it out. This will allow us to clean up some of the implicit uses of linux/device.h within include/* without introducing build regressions. Yes, this was created by "cheating" -- i.e. the headers were cleaned up, and then the fallout was found and fixed, and then the two commits were reordered. This ensures we don't introduce build regressions into the git history. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
* | regmap: delete unused module.h from drivers/base/regmap filesPaul Gortmaker2012-03-011-1/+0
| | | | | | | | | | | | | | | | 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>
* | regmap: Expose the driver name in debugfsDimitris Papastamos2012-02-221-0/+32
| | | | | | | | | | | | | | 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>
* | regmap: Add support for writing to regmap registers via debugfsDimitris Papastamos2012-02-221-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | regmap: Add debugfs information for the cache statusMark Brown2012-02-061-0/+9
|/ | | | | | Show all the cache status flags in debugfs if we have a cache. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regmap: Include the last register in debugfs outputMark Brown2011-09-051-2/+2
| | | | | | | Off by one in the array iteration. Reported-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regmap: Provide access information via debugfsMark Brown2011-08-141-1/+71
| | | | | | | | | | | | | Let userspace know what the access map for the device is. This is helpful for verifying that the access map is correctly configured and could also be useful for programs that try to work with the data. File format is: register: R W V P where R, W, V and P are 'y' or 'n' showing readable, writable, volatile and precious respectively. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regmap: Share some of the debugfs infrastructure ready for more filesMark Brown2011-08-141-4/+10
| | | | Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regmap: Add functions to check for access on registersMark Brown2011-08-141-4/+2
| | | | | | | We're going to be using these in quite a few places so factor out the readable/writable/volatile/precious checks. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regmap: Fix type of field width specifiers for x86_64Mark Brown2011-08-101-1/+1
| | | | | | | | x86_64 size_t is not an int but the printf format specifier for size_t should be an int. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
* regmap: Skip precious registers when dumping registers via debugfsMark Brown2011-08-081-0/+4
| | | | Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* regmap: Provide register map dump via debugfsMark Brown2011-08-081-0/+131
Copy over the read parts of the ASoC debugfs implementation into regmap, allowing users to see what the register values the device has are at runtime. The implementation, especially the support for seeking, is mostly due to Dimitris Papastamos' work in ASoC. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
OpenPOWER on IntegriCloud