Commit Graph

522 Commits

Author SHA1 Message Date
Linus Torvalds e880e87488 driver core update for 4.4-rc1
Here's the "big" driver core updates for 4.4-rc1.  Primarily a bunch of
 debugfs updates, with a smattering of minor driver core fixes and
 updates as well.
 
 All have been in linux-next for a long time.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iEYEABECAAYFAlY6ePQACgkQMUfUDdst+ymNTgCgpP0CZw57GpwF/Hp2L/lMkVeo
 Kx8AoKhEi4iqD5fdCQS9qTfomB+2/M6g
 =g7ZO
 -----END PGP SIGNATURE-----

Merge tag 'driver-core-4.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core updates from Greg KH:
 "Here's the "big" driver core updates for 4.4-rc1.  Primarily a bunch
  of debugfs updates, with a smattering of minor driver core fixes and
  updates as well.

  All have been in linux-next for a long time"

* tag 'driver-core-4.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
  debugfs: Add debugfs_create_ulong()
  of: to support binding numa node to specified device in devicetree
  debugfs: Add read-only/write-only bool file ops
  debugfs: Add read-only/write-only size_t file ops
  debugfs: Add read-only/write-only x64 file ops
  debugfs: Consolidate file mode checks in debugfs_create_*()
  Revert "mm: Check if section present during memory block (un)registering"
  driver-core: platform: Provide helpers for multi-driver modules
  mm: Check if section present during memory block (un)registering
  devres: fix a for loop bounds check
  CMA: fix CONFIG_CMA_SIZE_MBYTES overflow in 64bit
  base/platform: assert that dev_pm_domain callbacks are called unconditionally
  sysfs: correctly handle short reads on PREALLOC attrs.
  base: soc: siplify ida usage
  kobject: move EXPORT_SYMBOL() macros next to corresponding definitions
  kobject: explain what kobject's sd field is
  debugfs: document that debugfs_remove*() accepts NULL and error values
  debugfs: Pass bool pointer to debugfs_create_bool()
  ACPI / EC: Fix broken 64bit big-endian users of 'global_lock'
2015-11-04 21:50:37 -08:00
Mark Brown d4a1a317e7 Merge remote-tracking branches 'regmap/topic/atomic', 'regmap/topic/debugfs' and 'regmap/topic/irq-hdr' into regmap-next 2015-10-12 19:25:07 +01:00
Mark Brown b3961e8703 regmap: Allow buses to provide a custom update_bits() operation
Some buses provide a native _update_bits() operation which for uncached
 registers is faster than doing a read/modify/write cycle as it is a
 single bus transaction.  Add support for implementing this to regmap.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJWE+cLAAoJECTWi3JdVIfQaCcH/3m85peX2dlE7KhI6gL9N76h
 v4w7phygbkQqdD3v9bbbiRavkOMrrBCVNZ28uXIO/52LulrK9pzxRVTuhqdyVasO
 CIWfAYinlxWJA0BnJ1E2toqXkym9PEILCixfPyYEI5iZTX3w3rosSdup9MzYTxZZ
 N3Vux2bjgCiXp9hYbajITFQ9QRNXzn3hlI/Jl0/x9SkodkzCLJurMq5JAaFE+mhO
 1W2S+ERvb0M5bHuyr1Bhf3Bzb8uMFTl1QK3vxRkSI9UVe3MSpQP9SZeN+ye7p7U0
 hDlike9FxyLTMMnIe9XnsNEtBZmxNuAb7meF50Bi7xzItRGOIlDxB/Ak55uD4I8=
 =hCDC
 -----END PGP SIGNATURE-----

Merge tag 'regmap-offload-update-bits' into regmap-next

regmap: Allow buses to provide a custom update_bits() operation

Some buses provide a native _update_bits() operation which for uncached
registers is faster than doing a read/modify/write cycle as it is a
single bus transaction.  Add support for implementing this to regmap.

# gpg: Signature made Tue 06 Oct 2015 16:21:47 BST using RSA key ID 5D5487D0
# gpg: Oops: keyid_from_fingerprint: no pubkey
# gpg: Oops: keyid_from_fingerprint: no pubkey
# gpg: key 00000000 occurs more than once in the trustdb
# gpg: key 16005C11: no public key for trusted key - skipped
# gpg: key 16005C11 marked as ultimately trusted
# gpg: Good signature from "Mark Brown <broonie@sirena.org.uk>"
# gpg:                 aka "Mark Brown <broonie@debian.org>"
# gpg:                 aka "Mark Brown <broonie@kernel.org>"
# gpg:                 aka "Mark Brown <broonie@tardis.ed.ac.uk>"
# gpg:                 aka "Mark Brown <broonie@linaro.org>"
# gpg:                 aka "Mark Brown <Mark.Brown@linaro.org>"
2015-10-12 19:24:30 +01:00
Mark Brown ba5890a0c7 regmap: Support for split mask and unmask interrupt registers
This branch adds an interface for supporting devices which have separate
 mask and unmask registers.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJV+ptkAAoJECTWi3JdVIfQeIoH/3e1rQhIJFwO+iOV8A/vWSyk
 P+NlBqPRCH77NofBfmilRHSTzI7bhuW5IDaD9mMvTcXID8j9p0HvJxJPVsrWtr8X
 p7MaBYjNUitIUyO1coBDQ9YIh+gtVn5GaSzmfa5o+B0g8wpAKoqqE2BG08jR8yvH
 oKp+Z/RZsIpjIgTLPLvoNX6WsjkOKMH5GB7uBAv5epmDarCJsi8gb+vs8OFoITdN
 lBm0PSRD77nMn1a37n0FHa79yf/pszma0ep/mU662Ym+52BtSQM/UloNheoYQZ4Z
 D7cgQjeXCJo57p1sXW6L26o1LhHRy1ovtr47nV+EXa7z0u1oY5EEwxOdUzXKiCA=
 =+gx/
 -----END PGP SIGNATURE-----

Merge tag 'regmap-irq-unmask' into regmap-next

regmap: Support for split mask and unmask interrupt registers

This branch adds an interface for supporting devices which have separate
mask and unmask registers.

# gpg: Signature made Thu 17 Sep 2015 11:52:20 BST using RSA key ID 5D5487D0
# gpg: Oops: keyid_from_fingerprint: no pubkey
# gpg: Oops: keyid_from_fingerprint: no pubkey
# gpg: key 00000000 occurs more than once in the trustdb
# gpg: key 16005C11: no public key for trusted key - skipped
# gpg: key 16005C11 marked as ultimately trusted
# gpg: Good signature from "Mark Brown <broonie@sirena.org.uk>"
# gpg:                 aka "Mark Brown <broonie@debian.org>"
# gpg:                 aka "Mark Brown <broonie@kernel.org>"
# gpg:                 aka "Mark Brown <broonie@tardis.ed.ac.uk>"
# gpg:                 aka "Mark Brown <broonie@linaro.org>"
# gpg:                 aka "Mark Brown <Mark.Brown@linaro.org>"
2015-10-12 19:24:30 +01:00
Jon Ringle 77792b1140 regmap: Allow installing custom reg_update_bits function
This commit allows installing a custom reg_update_bits function for cases where
the hardware provides a mechanism to set or clear register bits without a
read/modify/write cycle. Such is the case with the Microchip ENCX24J600.

If a custom reg_update_bits function is provided, it will only be used against
volatile registers.

Signed-off-by: Jon Ringle <jringle@gridpoint.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-06 16:12:34 +01:00
Viresh Kumar 621a5f7ad9 debugfs: Pass bool pointer to debugfs_create_bool()
Its a bit odd that debugfs_create_bool() takes 'u32 *' as an argument,
when all it needs is a boolean pointer.

It would be better to update this API to make it accept 'bool *'
instead, as that will make it more consistent and often more convenient.
Over that bool takes just a byte.

That required updates to all user sites as well, in the same commit
updating the API. regmap core was also using
debugfs_{read|write}_file_bool(), directly and variable types were
updated for that to be bool as well.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Mark Brown <broonie@kernel.org>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04 11:36:07 +01:00
Rasmus Villemoes ca07e9f3cb regmap: debugfs: simplify regmap_reg_ranges_read_file() slightly
By printing the newline character to entry, we can avoid accounting
for it manually in several places.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-09-30 20:31:16 +01:00
Rasmus Villemoes 20991cdb26 regmap: debugfs: use memcpy instead of snprintf
Since we know the length of entry and that there's room enough in the
output buffer, using memcpy instead of snprintf is simpler and
cheaper.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-09-30 20:31:16 +01:00
Rasmus Villemoes e34dc49071 regmap: debugfs: use snprintf return value in regmap_reg_ranges_read_file()
Calling strlen() no less than three times on entry is silly. Since
we're formatting into a buffer with plenty of room, there's no chance
of truncation, so snprintf() has actually returned the value we want,
meaning we don't even have to call strlen once.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-09-30 20:31:15 +01:00
Mark Brown 9ae3109d1d regmap: debugfs: Remove scratch buffer for register length calculation
Now we no longer use the scratch buffer for register length calculation
there is no need for callers to supply one.

Signed-off-by: Mark Brown <broonie@kernel.org>
2015-09-19 07:38:27 -07:00
Mark Brown 176fc2d577 regmap: debugfs: Don't bother actually printing when calculating max length
The in kernel snprintf() will conveniently return the actual length of
the printed string even if not given an output beffer at all so just do
that rather than relying on the user to pass in a suitable buffer,
ensuring that we don't need to worry if the buffer was truncated due to
the size of the buffer passed in.

Reported-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
2015-09-19 07:38:12 -07:00
Mark Brown b763ec17ac regmap: debugfs: Ensure we don't underflow when printing access masks
If a read is attempted which is smaller than the line length then we may
underflow the subtraction we're doing with the unsigned size_t type so
move some of the calculation to be additions on the right hand side
instead in order to avoid this.

Reported-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
2015-09-19 07:38:11 -07:00
Guo Zeng a650fdd942 regmap: irq: add ack_invert flag for chips using cleared bits as ack
An user will be CSR SiRFSoC ARM chips.

Signed-off-by: Guo Zeng <Guo.Zeng@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-09-17 11:46:10 +01:00
Guo Zeng 7b7d1968e4 regmap: irq: add support for chips who have separate unmask registers
Some chips have separate unmask registers from mask registers for
some consideration of concurrency SMP write performance. And this
patch adds a flag for it.

An user will be CSR SiRFSoC ARM chips.

Signed-off-by: Guo Zeng <Guo.Zeng@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-09-17 11:46:09 +01:00
Stephen Boyd b4a21fc275 regmap: Allocate buffers with GFP_ATOMIC when fast_io == true
If a regmap is using fast_io, allocate the scratch buffer in
regmap_bulk_write() with GFP_ATOMIC instead of GFP_KERNEL.
Otherwise we may schedule while atomic.

Reported-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-09-14 19:49:26 +01:00
Mark Brown 072502a67c Merge remote-tracking branches 'regmap/topic/lockdep' and 'regmap/topic/seq-delay' into regmap-next 2015-09-04 17:22:10 +01:00
Mark Brown 84fb9015d2 Merge remote-tracking branches 'regmap/topic/debugfs' and 'regmap/topic/force-update' into regmap-next 2015-09-04 17:22:09 +01:00
Mark Brown a458a6d411 Merge remote-tracking branch 'regmap/topic/core' into regmap-next 2015-09-04 17:22:08 +01:00
Mark Brown f747416153 Merge remote-tracking branch 'regmap/fix/raw' into regmap-linus 2015-09-04 17:22:07 +01:00
Mark Brown b3959b5cd3 Merge remote-tracking branch 'regmap/fix/core' into regmap-linus 2015-09-04 17:22:07 +01:00
Mark Brown 04782ca20a Merge branch 'topic/smbus-block' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap into regmap-core 2015-09-04 17:16:39 +01:00
Sergey SENOZHATSKY 17649c90ff regmap: fix a NULL pointer dereference in __regmap_init
__regmap_init() may receive a NULL `struct regmap_bus *bus' pointer,
for example, from snd_hdac_regmap_init(), and it make sure that it
does not NULL deference `bus`, except around ->max_raw_read and
->max_raw_write initialisation. Add missing check.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-31 11:38:36 +01:00
Mark Brown d5b98eb124 regmap: Support bulk reads for devices without raw formatting
When doing a bulk read from a device which lacks raw I/O support we fall
back to doing register at a time reads but we still use the raw
formatters in order to render the data into the word size used by the
device (since bulk reads still operate on the device word size rather
than unsigned ints).  This means that devices without raw formatting
such as those that provide reg_read() are not supported.  Provide
handling for them by copying the values read into native endian values
of the appropriate size.

Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-31 11:15:07 +01:00
Markus Pargmann 29332534e2 regmap-i2c: Add smbus i2c block support
This allows to read/write up to 32 bytes of data and is to be prefered
if supported before the register read/write smbus support.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-30 10:19:23 +01:00
Markus Pargmann c335931ed9 regmap: Add raw_write/read checks for max_raw_write/read sizes
Check in regmap_raw_read() and regmap_raw_write() for correct maximum
sizes of the operations. Return -E2BIG if this size is not supported
because it is too big.

Also this patch causes an uninitialized variable warning so it
initializes ret (although not necessary).

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-30 10:19:22 +01:00
Markus Pargmann f50c9eb4e9 regmap: regmap max_raw_read/write getter functions
Add functions to access the maximum size we can read/write using
regmap_raw_read/write().

This helps drivers that need to know how much they can write with the
raw functions without problems. There are some devices (e.g. bmc150)
that have fifos as registers which need to be read in specific chunks
otherwise samples are dropped.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-30 10:19:22 +01:00
Markus Pargmann adaac45975 regmap: Introduce max_raw_read/write for regmap_bulk_read/write
There are some buses which have a limit on the maximum number of bytes
that can be send/received. An example for this is
I2C_FUNC_SMBUS_I2C_BLOCK which does not support any reads/writes of more
than 32 bytes. The regmap_bulk operations should still be able to
utilize the full 32 bytes in this case.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-30 10:19:22 +01:00
Mark Brown 10524612e8 Merge branches 'fix/raw', 'topic/core', 'topic/i2c', 'topic/raw' and 'topic/doc' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap into regmap-smbus-block 2015-08-30 10:19:11 +01:00
Markus Pargmann 9c9f7f6759 regmap: No multi_write support if bus->write does not exist
There is no multi_write support available if we cannot use raw_write.
This is the case if bus->write is not implemented.

This patch adds a condition that we need bus and bus->write so that
can_multi_write is true.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-21 09:33:43 -07:00
Markus Pargmann 67921a1a66 regmap: Split use_single_rw internally into use_single_read/write
use_single_rw currently reflects the capabilities of the connected
device. The capabilities of the bus are currently missing for this
variable.

As there are read only and write only buses we need seperate values for
use_single_rw to also reflect tha capabilities of the bus.

This patch splits use_single_rw into use_single_read and
use_single_write. The initialization is changed to check the
configuration for use_single_rw and to check the capabilities of the
used bus.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-21 09:33:10 -07:00
Markus Pargmann c594b7f21d regmap: Fix regmap_bulk_write for bus writes
The regmap config does not prohibit val_bytes that are not powers of
two. But the current code of regmap_bulk_write for use_single_rw does
limit the possible val_bytes to 1, 2 and 4.

This patch fixes the behaviour to allow bus writes with non-standard
val_bytes sizes.

Cc: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-21 09:32:54 -07:00
Markus Pargmann 9a16ea900f regmap: regmap_raw_read return error on !bus->read
Return -ENOTSUPP if map->bus->read is not implemented and we do not use
the cache. This code path would directly use bus->read would run into an
NULL pointer for the read function.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-20 11:29:38 -07:00
Markus Pargmann 07ea400e1b regmap: Fix regmap_can_raw_write check
This function is missing a check if map->bus->write is implemented. If
it is not implemented arbitrary raw writes are not possible.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-14 19:07:39 +01:00
Xiubo Li b486afbd1b regmap: fix typos in regmap.c
There are two typos in drivers/base/regmap/regmap.c, and they may
introduce some noise when checking new patches.

Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-12 13:36:32 +01:00
Markus Pargmann 2f9b660b21 regmap: Fix integertypes for register address and value
These values are defined as unsigned int in the struct and are assigned
to int values.

This patch fixes the type to be unsigned int instead.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-12 13:07:23 +01:00
Nicolas Boichat 1ed8111443 regmap: Move documentation to regmap.h
Init functions defined in regmap*.c files are now prefixed with
__, take lockdep key and class parameters, and should not be
called directly: move the documentation to regmap.h, where the
macros are defined.

Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-11 17:21:44 +01:00
Nicolas Boichat 3cfe7a74d4 regmap: Use different lockdep class for each regmap init call
Lockdep validator complains about recursive locking and deadlock
when two different regmap instances are called in a nested order.
That happens anytime a regmap read/write call needs to access
another regmap.

This is because, for performance reason, lockdep groups all locks
initialized by the same mutex_init() in the same lock class.
Therefore all regmap mutexes are in the same lock class, leading
to lockdep "nested locking" warnings if a regmap accesses another
regmap.

In general, it is impossible to establish in advance the hierarchy
of regmaps, so we make sure that each regmap init call initializes
its own static lock_class_key. This is done by wrapping all
regmap_init calls into macros.

This also allows us to give meaningful names to the lock_class_key.
For example, in rt5677 case, we have in /proc/lockdep_chains:
irq_context: 0
[ffffffc0018d2198] &dev->mutex
[ffffffc0018d2198] &dev->mutex
[ffffffc001bd7f60] rt5677:5104:(&rt5677_regmap)->_lock
[ffffffc001bd7f58] rt5677:5096:(&rt5677_regmap_physical)->_lock
[ffffffc001b95448] &(&base->lock)->rlock

The above would have resulted in a lockdep recursive warning
previously. This is not the case anymore as the lockdep validator
now clearly identifies the 2 regmaps as separate.

Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-07 14:50:59 +01:00
Axel Lin 1635e88885 regmap: debugfs: Fix misuse of IS_ENABLED
IS_ENABLED should only be used for CONFIG_* symbols.

I have done a small test:
  #define REGMAP_ALLOW_WRITE_DEBUGFS
  IS_ENABLED(REGMAP_ALLOW_WRITE_DEBUGFS) returns 0.

  #define REGMAP_ALLOW_WRITE_DEBUGFS 0
  IS_ENABLED(REGMAP_ALLOW_WRITE_DEBUGFS) returns 0.

  #define REGMAP_ALLOW_WRITE_DEBUGFS 1
  IS_ENABLED(REGMAP_ALLOW_WRITE_DEBUGFS) returns 1.

  #define REGMAP_ALLOW_WRITE_DEBUGFS 2
  IS_ENABLED(REGMAP_ALLOW_WRITE_DEBUGFS) returns 0.

So fix the misuse of IS_ENABLED(REGMAP_ALLOW_WRITE_DEBUGFS) and switch to
use #if defined(REGMAP_ALLOW_WRITE_DEBUGFS) instead.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-07 13:31:58 +01:00
Guenter Roeck 8ef9724bf9 regmap: regcache-rbtree: Clean new present bits on present bitmap resize
When inserting a new register into a block, the present bit map size is
increased using krealloc. krealloc does not clear the additionally
allocated memory, leaving it filled with random values. Result is that
some registers are considered cached even though this is not the case.

Fix the problem by clearing the additionally allocated memory. Also, if
the bitmap size does not increase, do not reallocate the bitmap at all
to reduce overhead.

Fixes: 3f4ff561bc ("regmap: rbtree: Make cache_present bitmap per node")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
2015-07-29 15:10:13 +01:00
Richard Fitzgerald d3dc5430d6 regmap: debugfs: Allow writes to cache state settings
Allow the user to write the cache_only and cache_bypass settings.
This can be useful for debugging.

Since this can lead to the hardware getting out-of-sync with the
cache, at least for the period that the cache state is forced, the
kernel is tainted and the action is recorded in the kernel log.

When disabling cache_only through debugfs a cache sync will be performed.

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-20 18:45:00 +01:00
Nariman Poushin 2de9d6006c regmap: Apply optional delay in multi_reg_write/register_patch
Add an optional delay_us field in reg_sequence to allow the client to
specify a delay (in microseconds) to be applied after any given write
in a sequence of writes.

We treat a delay in a sequence the same way we treat a page change as
they are logically similar in that you can coalesce all write before
a delay (in the same way you can coalesce all writes before a page
change is needed)

Signed-off-by: Nariman Poushin <nariman@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-16 22:02:55 +01:00
Nariman Poushin 8019ff6cfc regmap: Use reg_sequence for multi_reg_write / register_patch
Separate the functionality using sequences of register writes from the
functions that take register defaults. This change renames the arguments
in order to support the extension of reg_sequence to take an optional
delay to be applied after any given register in a sequence is written.
This avoids adding an int to all register defaults, which could
substantially increase memory usage for regmaps with large default tables.

This also updates all the clients of multi_reg_write/register_patch.

Signed-off-by: Nariman Poushin <nariman@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-16 22:02:55 +01:00
Mark Brown fa3eec7791 regmap: Silence warning on invalid zero length read
Zero length reads make no sense in a regmap context and are likely to
trigger bugs further down the stack so insert an error check, also
silencing compiler warnings about use of ret in cases where we iterate
per register.

Reported-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-14 11:23:08 +01:00
Lars-Peter Clausen 04dc91ce2c regmap: Add better support for devices without readback support
Currently regmap requires that a reg_read callback is supplied, otherwise a
warning is emitted each time regmap_read() is called. This means a device
or bus without readback support needs to supply dummy reg_read callback.
Apart from that regmap_read() will still work fine if a cache is used.

Remove the warning and let regmap_readable() return false if not reg_read
callback is supplied. This means a device no longer has to supply a dummy
callback if it does not support readback and it also doesn't have to have a
readable_reg callback that always returns false since this is now implicit.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-13 11:49:18 +01:00
Kuninori Morimoto e874e6c7ed regmap: add regmap_fields_force_write()
regmap_fields_force_write() is similar to regmap_fields_write(),
but regmap_fields_force_write() write data to register even though
it is same value.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-10 11:38:00 +01:00
Kuninori Morimoto fd4b7286cc regmap: add regmap_write_bits()
regmap_write_bits() is similar to regmap_update_bits(),
but regmap_write_bits() write data to register even though
it is same value.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-10 11:38:00 +01:00
Kuninori Morimoto 7ff0589c7b regmap: add force_write option on _regmap_update_bits()
Sometimes we want to write data even though it doesn't change value.
Then, force_write option on _regmap_update_bits() helps this purpose.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-10 11:38:00 +01:00
Mark Brown 8ca006adef Merge remote-tracking branches 'regmap/topic/defaults', 'regmap/topic/irq' and 'regmap/topic/reg-params' into regmap-next 2015-06-17 17:40:08 +01:00
Mark Brown 4705a81b2c Merge remote-tracking branch 'regmap/topic/core' into regmap-next 2015-06-17 17:40:07 +01:00
Mark Brown d2b923ef7b Merge remote-tracking branch 'regmap/fix/field' into regmap-linus 2015-06-17 17:40:07 +01:00