regmap: Add kerneldoc for struct regmap_config

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
regmap: Allow devices to specify which registers are accessible

This is currently unused but we need to know which registers exist and
their properties in order to implement diagnostics like register map
dumps and the cache features.

We use callbacks partly because properties can vary at runtime (eg, through
access locks on registers) and partly because big switch statements are a
good compromise between readable code and small data size for providing
information on big register maps.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
regmap: Add precious registers to the driver interface

Some devices are sensitive to reads on their registers, especially for
things like clear on read interrupt status registers. Avoid creating
problems with these with things like debugfs by allowing drivers to tell
the core about them. If a register is marked as precious then the core
will not internally generate any reads of it.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
regmap: Just send the buffer directly for single register writes

When doing a single register write we use work_buf for both the register
and the value with the buffer formatted for sending directly to the device
so we can just do a write() directly. This saves allocating a temporary
buffer if we can't do gather writes and is likely to be faster than doing
a gather write.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Merge branches 'regmap-linus' and 'regmap-interface' into regmap-next
regmap: Add basic tracepoints

Trace single register reads and writes, plus start/stop tracepoints for
the actual I/O to see where we're spending time. This makes it easy to
have always on logging without overwhelming the logs and also lets us take
advantage of all the context and time information that the trace subsystem
collects for us.

We don't currently trace register values for bulk operations as this would
add complexity and overhead parsing the cooked data that's being worked
with.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
regmap: Implement writable register checks

This is mainly intended to be used by devices which can dynamically
block register writes at runtime, for other devices there is usually
limited value.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
regmap: Use a local header for API internals

Allowing the implementation to be multi-file.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
regmap: Provide register map dump via debugfs

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>
regmap: Skip precious registers when dumping registers via debugfs

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
regmap: Fix kerneldoc errors for regmap

Field names didn't match between the documentation and the code.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Merge branch 'regmap-interface' into regmap-next
regmap: Use int rather than size_t for lengths when logging blocks

x86_64 warns as size_t is not an int.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
regmap: Fix type of field width specifiers for x86_64

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: Remove unused type and list fields from bus interface

We no longer enumerate the bus types, we rely on the driver telling us
this on init.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Merge branch 'regmap-linus' into regmap-next
regmap: Add functions to check for access on registers

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: Share some of the debugfs infrastructure ready for more files

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
regmap: Provide access information via debugfs

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: Allow drivers to specify register defaults

It is useful for the register cache code to be able to specify the
default values for the device registers. The major use is when restoring
the register cache after suspend, knowing the register defaults allows
us to skip registers that are at their default values when we resume which
can be a substantial win on larger modern devices. For some devices
(mostly older ones) the hardware does not support readback so the only way we
can know the values is from code and so initializing the cache with default
values makes it much easier for drivers work with read/modify/write
updates.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>