public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [GIT PULL] regmap: Generic I2C and SPI register map library
@ 2011-07-22 13:52 Mark Brown
  2011-07-22 22:02 ` Linus Torvalds
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Brown @ 2011-07-22 13:52 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, Grant Likely, Liam Girdwood, Wolfram Sang,
	Dimitris Papastamos, Greg Kroah-Hartman

This pull request adds regmap, a library which abstracts out some widely
reimplemented code for accessing the register maps of devices on slow
buses like I2C and SPI.  As well as factoring out code this makes
it much easier to factor out higher level code for this class of
devices.  We've been using equivalent code in ASoC to great effect, the
idea here is to move that functionality so that it's usable in other
subsystems.

I'm not 100% happy with the implementation at present (to a large extent
due to keeping it simple for initial review, though there's some stuff
I'm just not happy with) so I expect a bit of internal churn but the
external interface should be solid and allow other code to start making
use of the code.

Only one driver is converted to the API in this pull request (the
tps65023), some other drivers have been converted including the generic
cache code in ASoC but various cross tree dependencies mean they can't
be applied until everything settles down in the merge window.

The code is in a separate directory because it is expected that the
addition of register cache support and diagnostic features like trace
and debugfs access to the register maps will mean that the code will
get larger.

The following changes since commit 02f8c6aee8df3cdc935e9bdd4f2d020306035dbe:

  Linux 3.0 (2011-07-21 19:17:23 -0700)

are available in the git repository at:
  git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-linus

Mark Brown (4):
      regmap: Add generic non-memory mapped register access API
      regmap: Add I2C bus support
      regmap: Add SPI bus support
      regulator: Convert tps65023 to use regmap API

 MAINTAINERS                            |    7 +
 drivers/base/Kconfig                   |    2 +
 drivers/base/Makefile                  |    1 +
 drivers/base/regmap/Kconfig            |   14 +
 drivers/base/regmap/Makefile           |    3 +
 drivers/base/regmap/regmap-i2c.c       |  115 ++++++++
 drivers/base/regmap/regmap-spi.c       |   72 +++++
 drivers/base/regmap/regmap.c           |  455 ++++++++++++++++++++++++++++++++
 drivers/regulator/Kconfig              |    1 +
 drivers/regulator/tps65023-regulator.c |   97 ++-----
 include/linux/regmap.h                 |   82 ++++++
 11 files changed, 779 insertions(+), 70 deletions(-)
 create mode 100644 drivers/base/regmap/Kconfig
 create mode 100644 drivers/base/regmap/Makefile
 create mode 100644 drivers/base/regmap/regmap-i2c.c
 create mode 100644 drivers/base/regmap/regmap-spi.c
 create mode 100644 drivers/base/regmap/regmap.c
 create mode 100644 include/linux/regmap.h

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [GIT PULL] regmap: Generic I2C and SPI register map library
  2011-07-22 13:52 [GIT PULL] regmap: Generic I2C and SPI register map library Mark Brown
@ 2011-07-22 22:02 ` Linus Torvalds
  2011-07-23  7:21   ` Mark Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Linus Torvalds @ 2011-07-22 22:02 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-kernel, Grant Likely, Liam Girdwood, Wolfram Sang,
	Dimitris Papastamos, Greg Kroah-Hartman

On Fri, Jul 22, 2011 at 6:52 AM, Mark Brown
<broonie@opensource.wolfsonmicro.com> wrote:
>
> I'm not 100% happy with the implementation at present (to a large extent
> due to keeping it simple for initial review, though there's some stuff
> I'm just not happy with) so I expect a bit of internal churn but the
> external interface should be solid and allow other code to start making
> use of the code.

What kind of sh*t is this?

First it says

   "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.:"

and then it does

   config REGMAP_I2C
        tristate
        default I2C

so now that thing turns on REGMAP_I2C and compiles in the code WITHOUT
EVEN ASKING. It's enough to enable i2c.

That is TOTALLY UNACCEPTABLE. It's pure and utter sh*t.

                       Linus

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [GIT PULL] regmap: Generic I2C and SPI register map library
  2011-07-22 22:02 ` Linus Torvalds
@ 2011-07-23  7:21   ` Mark Brown
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Brown @ 2011-07-23  7:21 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel, Grant Likely, Liam Girdwood, Wolfram Sang,
	Dimitris Papastamos, Greg Kroah-Hartman

On Fri, Jul 22, 2011 at 03:02:01PM -0700, Linus Torvalds wrote:

> so now that thing turns on REGMAP_I2C and compiles in the code WITHOUT
> EVEN ASKING. It's enough to enable i2c.

Providing some device in the system enabled regmap; the issue here was
that dependencies of selected symbols don't work terribly reliably and
originally the API was written to support the common idiom of bus
neutral core drivers which don't know which bus they're working with but
the code got refactored since then and the Kconfig didn't keep up.

Anyway, I've changed the code with the diff below and pushed out again,
pull request below the diff:

diff --git a/drivers/base/regmap/Kconfig b/drivers/base/regmap/Kconfig
index 54b5854..fabbf6c 100644
--- a/drivers/base/regmap/Kconfig
+++ b/drivers/base/regmap/Kconfig
@@ -3,12 +3,11 @@
 # subsystems should select the appropriate symbols.
 
 config REGMAP
+	default y if (REGMAP_I2C || REGMAP_SPI)
 	bool
 
 config REGMAP_I2C
 	tristate
-	default I2C
 
 config REGMAP_SPI
 	tristate
-	default SPI_MASTER
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 8128db3..c7fd2c0 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -235,7 +235,7 @@ config REGULATOR_TPS6105X
 config REGULATOR_TPS65023
 	tristate "TI TPS65023 Power regulators"
 	depends on I2C
-	select REGMAP
+	select REGMAP_I2C
 	help
 	  This driver supports TPS65023 voltage regulator chips. TPS65023 provides
 	  three step-down converters and two general-purpose LDO voltage regulators.


The following changes since commit 02f8c6aee8df3cdc935e9bdd4f2d020306035dbe:

  Linux 3.0 (2011-07-21 19:17:23 -0700)

are available in the git repository at:
  git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-linus

Mark Brown (4):
      regmap: Add generic non-memory mapped register access API
      regmap: Add I2C bus support
      regmap: Add SPI bus support
      regulator: Convert tps65023 to use regmap API

 MAINTAINERS                            |    7 +
 drivers/base/Kconfig                   |    2 +
 drivers/base/Makefile                  |    1 +
 drivers/base/regmap/Kconfig            |   13 +
 drivers/base/regmap/Makefile           |    3 +
 drivers/base/regmap/regmap-i2c.c       |  115 ++++++++
 drivers/base/regmap/regmap-spi.c       |   72 +++++
 drivers/base/regmap/regmap.c           |  455 ++++++++++++++++++++++++++++++++
 drivers/regulator/Kconfig              |    1 +
 drivers/regulator/tps65023-regulator.c |   97 ++-----
 include/linux/regmap.h                 |   82 ++++++
 11 files changed, 778 insertions(+), 70 deletions(-)
 create mode 100644 drivers/base/regmap/Kconfig
 create mode 100644 drivers/base/regmap/Makefile
 create mode 100644 drivers/base/regmap/regmap-i2c.c
 create mode 100644 drivers/base/regmap/regmap-spi.c
 create mode 100644 drivers/base/regmap/regmap.c
 create mode 100644 include/linux/regmap.h

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-07-23  7:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-22 13:52 [GIT PULL] regmap: Generic I2C and SPI register map library Mark Brown
2011-07-22 22:02 ` Linus Torvalds
2011-07-23  7:21   ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox