Skip to content

Commit

Permalink
regmap: Add generic non-memory mapped register access API
Browse files Browse the repository at this point in the history
There are many places in the tree where we implement register access for
devices on non-memory mapped buses, especially I2C and SPI. Since hardware
designers seem to have settled on a relatively consistent set of register
interfaces this can be effectively factored out into shared code.  There
are a standard set of formats for marshalling data for exchange with the
device, with the actual I/O mechanisms generally being simple byte
streams.

We create an abstraction for marshaling data into formats which can be
sent on the control interfaces, and create a standard method for
plugging in actual transport underneath that.

This is mostly a refactoring and renaming of the bottom level of the
existing code for sharing register I/O which we have in ASoC. A
subsequent patch in this series converts ASoC to use this.  The main
difference in interface is that reads return values by writing to a
location provided by a pointer rather than in the return value, ensuring
we can use the full range of the type for register data.  We also use
unsigned types rather than ints for the same reason.

As some of the devices can have very large register maps the existing
ASoC code also contains infrastructure for managing register caches.
This cache work will be moved over in a future stage to allow for
separate review, the current patch only deals with the physical I/O.

Signed-off-by: Mark Brown <[email protected]>
Acked-by: Liam Girdwood <[email protected]>
Acked-by: Greg Kroah-Hartman <[email protected]>
Acked-by: Wolfram Sang <[email protected]>
Acked-by: Grant Likely <[email protected]>
  • Loading branch information
broonie committed Jul 23, 2011
1 parent 620917d commit b83a313
Show file tree
Hide file tree
Showing 7 changed files with 546 additions and 0 deletions.
7 changes: 7 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -5313,6 +5313,13 @@ L: [email protected]
S: Supported
F: fs/reiserfs/

REGISTER MAP ABSTRACTION
M: Mark Brown <[email protected]>
T: git git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git
S: Supported
F: drivers/base/regmap/
F: include/linux/regmap.h

RFKILL
M: Johannes Berg <[email protected]>
L: [email protected]
Expand Down
2 changes: 2 additions & 0 deletions drivers/base/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,6 @@ config SYS_HYPERVISOR
bool
default n

source "drivers/base/regmap/Kconfig"

endmenu
1 change: 1 addition & 0 deletions drivers/base/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ ifeq ($(CONFIG_SYSFS),y)
obj-$(CONFIG_MODULES) += module.o
endif
obj-$(CONFIG_SYS_HYPERVISOR) += hypervisor.o
obj-$(CONFIG_REGMAP) += regmap/

ccflags-$(CONFIG_DEBUG_DRIVER) := -DDEBUG

6 changes: 6 additions & 0 deletions drivers/base/regmap/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Generic register map support. There are no user servicable options here,
# this is an API intended to be used by other kernel subsystems. These
# subsystems should select the appropriate symbols.

config REGMAP
bool
1 change: 1 addition & 0 deletions drivers/base/regmap/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
obj-$(CONFIG_REGMAP) += regmap.o
Loading

0 comments on commit b83a313

Please sign in to comment.