Skip to contentSkip to conversation

ASoC: pcm512x: Split out bus drivers

PATCH New Mark Brown 1 participant 1 message Mar 7, 2014

Subsystems (3)
lore
Share & tools
lore

Mark Brown

author maintainer
#0 lore raw

PATCH 1/1 ASoC: pcm512x: Split out bus drivers

From: Mark Brown <[email protected]>

Move to the new style of defining the bus interfaces in separate modules in order to simplify dependencies.

---
 sound/soc/codecs/Kconfig       |  18 +++++-
 sound/soc/codecs/Makefile      |   4 ++
 sound/soc/codecs/pcm512x-i2c.c |  71 ++++++++++++++++++++++
 sound/soc/codecs/pcm512x-spi.c |  69 +++++++++++++++++++++
 sound/soc/codecs/pcm512x.c     | 133 +++--------------------------------------
 sound/soc/codecs/pcm512x.h     |   9 +++
 6 files changed, 175 insertions(+), 129 deletions(-)
 create mode 100644 sound/soc/codecs/pcm512x-i2c.c
 create mode 100644 sound/soc/codecs/pcm512x-spi.c
sound/soc/codecs/Kconfig +15 -3
index f2383eb..3a6046f 100644
@@ -66,7 +66,8 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_PCM1681 if I2C
 	select SND_SOC_PCM1792A if SPI_MASTER
 	select SND_SOC_PCM3008
-	select SND_SOC_PCM512x if SND_SOC_I2C_AND_SPI
+	select SND_SOC_PCM512x_I2C if I2C
+	select SND_SOC_PCM512x_SPI if SPI_MASTER
 	select SND_SOC_RT5631 if I2C
 	select SND_SOC_RT5640 if I2C
 	select SND_SOC_SGTL5000 if I2C
@@ -362,8 +363,19 @@ config SND_SOC_PCM3008
        tristate
 
 config SND_SOC_PCM512x
-       tristate "Texas Instruments PCM512x CODECs"
-       select REGMAP
+	tristate
+
+config SND_SOC_PCM512x_I2C
+	tristate "Texas Instruments PCM512x CODECs - I2C"
+	depends on I2C
+	select SND_SOC_PCM512x
+	select REGMAP_I2C
+
+config SND_SOC_PCM512x_SPI
+	tristate "Texas Instruments PCM512x CODECs - SPI"
+	depends on SPI_MASTER
+	select SND_SOC_PCM512x
+	select REGMAP_SPI
 
 config SND_SOC_RT5631
 	tristate
sound/soc/codecs/Makefile +4 -0
index 6af7a55..ac7025c 100644
@@ -54,6 +54,8 @@ snd-soc-pcm1681-objs := pcm1681.o
 snd-soc-pcm1792a-codec-objs := pcm1792a.o
 snd-soc-pcm3008-objs := pcm3008.o
 snd-soc-pcm512x-objs := pcm512x.o
+snd-soc-pcm512x-i2c-objs := pcm512x-i2c.o
+snd-soc-pcm512x-spi-objs := pcm512x-spi.o
 snd-soc-rt5631-objs := rt5631.o
 snd-soc-rt5640-objs := rt5640.o
 snd-soc-sgtl5000-objs := sgtl5000.o
@@ -197,6 +199,8 @@ obj-$(CONFIG_SND_SOC_PCM1681)	+= snd-soc-pcm1681.o
 obj-$(CONFIG_SND_SOC_PCM1792A)	+= snd-soc-pcm1792a-codec.o
 obj-$(CONFIG_SND_SOC_PCM3008)	+= snd-soc-pcm3008.o
 obj-$(CONFIG_SND_SOC_PCM512x)	+= snd-soc-pcm512x.o
+obj-$(CONFIG_SND_SOC_PCM512x_I2C)	+= snd-soc-pcm512x-i2c.o
+obj-$(CONFIG_SND_SOC_PCM512x_SPI)	+= snd-soc-pcm512x-spi.o
 obj-$(CONFIG_SND_SOC_RT5631)	+= snd-soc-rt5631.o
 obj-$(CONFIG_SND_SOC_RT5640)	+= snd-soc-rt5640.o
 obj-$(CONFIG_SND_SOC_SGTL5000)  += snd-soc-sgtl5000.o
sound/soc/codecs/pcm512x-i2c.c new file +71 -0

71 lines not on this page · raw message

sound/soc/codecs/pcm512x-spi.c new file +69 -0

69 lines not on this page · raw message

sound/soc/codecs/pcm512x.c +7 -126

175 lines not on this page · raw message

sound/soc/codecs/pcm512x.h +9 -0
index ac4a52c..6ee76aa 100644
@@ -17,6 +17,9 @@
 #ifndef _SND_SOC_PCM512X
 #define _SND_SOC_PCM512X
 
+#include <linux/pm.h>
+#include <linux/regmap.h>
+
 #define PCM512x_VIRT_BASE 0x100
 #define PCM512x_PAGE_LEN  0x100
 #define PCM512x_PAGE_BASE(n)  (PCM512x_VIRT_BASE + (PCM512x_PAGE_LEN * n))
@@ -159,4 +162,10 @@
 #define PCM512x_AGBR_SHIFT 0
 #define PCM512x_AGBL_SHIFT 4
 
+extern const struct dev_pm_ops pcm512x_pm_ops;
+extern const struct regmap_config pcm512x_regmap;
+
+int pcm512x_probe(struct device *dev, struct regmap *regmap);
+void pcm512x_remove(struct device *dev);
+
 #endif
Signature · 1 line
1.9.0