Skip to contentSkip to conversation

mfd: Factor out WM831x I2C I/O from the core driver

PATCH New Mark Brown 1 participant 2 messages Oct 8, 2010

Subsystems (5)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/2 mfd: Factor out WM831x I2C I/O from the core driver

In preparation for the addition of SPI support for the WM831x move the I2C specific code into a separate file with a separate Kconfig option so the I2C support can be excluded from the build.

Also update the 1133-EV1 PMIC module support for SMDK6410 to use the new symbol.

---
 arch/arm/mach-s3c64xx/Kconfig   |    1 +
 drivers/mfd/Kconfig             |   14 +++--
 drivers/mfd/Makefile            |    1 +
 drivers/mfd/wm831x-core.c       |  138 +------------------------------------
 drivers/mfd/wm831x-i2c.c        |  143 +++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/wm831x/core.h |   12 +++
 6 files changed, 170 insertions(+), 139 deletions(-)
 create mode 100644 drivers/mfd/wm831x-i2c.c
arch/arm/mach-s3c64xx/Kconfig +1 -0
index 1e4d78a..546db5c 100644
@@ -185,6 +185,7 @@ config SMDK6410_WM1192_EV1
 	select REGULATOR_WM831X
 	select S3C24XX_GPIO_EXTRA64
 	select MFD_WM831X
+	select MFD_WM831X_I2C
 	help
 	  The Wolfson Microelectronics 1192-EV1 is a WM831x based PMIC
 	  daughtercard for the Samsung SMDK6410 reference platform.
drivers/mfd/Kconfig +9 -5
index 6c6b9f0..608a277 100644
@@ -315,14 +315,18 @@ config MFD_WM8400
 	  the functionality of the device.
 
 config MFD_WM831X
-	bool "Support Wolfson Microelectronics WM831x/2x PMICs"
+	bool
+	depends on GENERIC_HARDIRQS
+
+config MFD_WM831X_I2C
+	bool "Support Wolfson Microelectronics WM831x/2x PMICs with I2C"
 	select MFD_CORE
 	depends on I2C=y && GENERIC_HARDIRQS
 	help
-	  Support for the Wolfson Microelecronics WM831x and WM832x PMICs.
-	  This driver provides common support for accessing the device,
-	  additional drivers must be enabled in order to use the
-	  functionality of the device.
+	  Support for the Wolfson Microelecronics WM831x and WM832x PMICs
+	  when controlled using I2C.  This driver provides common support
+	  for accessing the device, additional drivers must be enabled in
+	  order to use the functionality of the device.
 
 config MFD_WM8350
 	bool
drivers/mfd/Makefile +1 -0
index 70b2699..c9ef41b 100644
@@ -24,6 +24,7 @@ obj-$(CONFIG_MFD_TC6393XB)	+= tc6393xb.o tmio_core.o
 obj-$(CONFIG_MFD_WM8400)	+= wm8400-core.o
 wm831x-objs			:= wm831x-core.o wm831x-irq.o wm831x-otp.o
 obj-$(CONFIG_MFD_WM831X)	+= wm831x.o
+obj-$(CONFIG_MFD_WM831X_I2C)	+= wm831x-i2c.o
 wm8350-objs			:= wm8350-core.o wm8350-regmap.o wm8350-gpio.o
 wm8350-objs			+= wm8350-irq.o
 obj-$(CONFIG_MFD_WM8350)	+= wm8350.o
drivers/mfd/wm831x-core.c +4 -134

173 lines not on this page · raw message

drivers/mfd/wm831x-i2c.c new file +143 -0

143 lines not on this page · raw message

include/linux/mfd/wm831x/core.h +12 -0
index eb5bd4e..a1239c4 100644
@@ -238,6 +238,15 @@ struct regulator_dev;
 
 #define WM831X_NUM_IRQ_REGS 5
 
+enum wm831x_parent {
+	WM8310 = 0x8310,
+	WM8311 = 0x8311,
+	WM8312 = 0x8312,
+	WM8320 = 0x8320,
+	WM8321 = 0x8321,
+	WM8325 = 0x8325,
+};
+
 struct wm831x {
 	struct mutex io_lock;
 
@@ -285,6 +294,9 @@ int wm831x_set_bits(struct wm831x *wm831x, unsigned short reg,
 int wm831x_bulk_read(struct wm831x *wm831x, unsigned short reg,
 		     int count, u16 *buf);
 
+int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq);
+void wm831x_device_exit(struct wm831x *wm831x);
+int wm831x_device_suspend(struct wm831x *wm831x);
 int wm831x_irq_init(struct wm831x *wm831x, int irq);
 void wm831x_irq_exit(struct wm831x *wm831x);
 
Signature · 1 line
1.7.1
author
#1 lore raw

PATCH 2/2 mfd: Add WM831x SPI support

Implement support for controlling WM831x and WM832x devices using SPI.

---
 drivers/mfd/Kconfig      |   10 ++
 drivers/mfd/Makefile     |    1 +
 drivers/mfd/wm831x-spi.c |  232 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 243 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mfd/wm831x-spi.c
drivers/mfd/Kconfig +10 -0
index 608a277..40aa2e8 100644
@@ -328,6 +328,16 @@ config MFD_WM831X_I2C
 	  for accessing the device, additional drivers must be enabled in
 	  order to use the functionality of the device.
 
+config MFD_WM831X_SPI
+	bool "Support Wolfson Microelectronics WM831x/2x PMICs with SPI"
+	select MFD_CORE
+	depends on SPI_MASTER && GENERIC_HARDIRQS
+	help
+	  Support for the Wolfson Microelecronics WM831x and WM832x PMICs
+	  when controlled using SPI.  This driver provides common support
+	  for accessing the device, additional drivers must be enabled in
+	  order to use the functionality of the device.
+
 config MFD_WM8350
 	bool
 	depends on GENERIC_HARDIRQS
drivers/mfd/Makefile +1 -0
index c9ef41b..f54b365 100644
@@ -25,6 +25,7 @@ obj-$(CONFIG_MFD_WM8400)	+= wm8400-core.o
 wm831x-objs			:= wm831x-core.o wm831x-irq.o wm831x-otp.o
 obj-$(CONFIG_MFD_WM831X)	+= wm831x.o
 obj-$(CONFIG_MFD_WM831X_I2C)	+= wm831x-i2c.o
+obj-$(CONFIG_MFD_WM831X_SPI)	+= wm831x-spi.o
 wm8350-objs			:= wm8350-core.o wm8350-regmap.o wm8350-gpio.o
 wm8350-objs			+= wm8350-irq.o
 obj-$(CONFIG_MFD_WM8350)	+= wm8350.o
drivers/mfd/wm831x-spi.c new file +232 -0

232 lines not on this page · raw message

Signature · 1 line
1.7.1