ASoC: cs4271: Split SPI and I2C code into different modules
Subsystems (3)
PATCH 1/1 ASoC: cs4271: Split SPI and I2C code into different modules
Currently the cs4271 driver depends on SND_SOC_I2C_AND_SPI. So the driver cannot be built as built-in if CONFIG_I2C=m. Split SPI and I2C code into different modules to avoid this issue.
--- sound/soc/cirrus/Kconfig | 3 +- sound/soc/codecs/Kconfig | 18 ++++- sound/soc/codecs/Makefile | 4 ++ sound/soc/codecs/cs4271-i2c.c | 62 +++++++++++++++++ sound/soc/codecs/cs4271-spi.c | 55 +++++++++++++++ sound/soc/codecs/cs4271.c | 155 +++++------------------------------------- sound/soc/codecs/cs4271.h | 11 +++ 7 files changed, 167 insertions(+), 141 deletions(-) create mode 100644 sound/soc/codecs/cs4271-i2c.c create mode 100644 sound/soc/codecs/cs4271-spi.c create mode 100644 sound/soc/codecs/cs4271.h
sound/soc/cirrus/Kconfig +2 -1
@@ -36,7 +36,8 @@ config SND_EP93XX_SOC_EDB93XX tristate "SoC Audio support for Cirrus Logic EDB93xx boards" depends on SND_EP93XX_SOC && (MACH_EDB9301 || MACH_EDB9302 || MACH_EDB9302A || MACH_EDB9307A || MACH_EDB9315A) select SND_EP93XX_SOC_I2S - select SND_SOC_CS4271 + select SND_SOC_CS4271_I2C if I2C + select SND_SOC_CS4271_SPI if SPI_MASTER help Say Y or M here if you want to add support for I2S audio on the Cirrus Logic EDB93xx boards.
sound/soc/codecs/Kconfig +15 -3
@@ -50,7 +50,8 @@ config SND_SOC_ALL_CODECS select SND_SOC_CS42L73 if I2C select SND_SOC_CS4265 if I2C select SND_SOC_CS4270 if I2C - select SND_SOC_CS4271 if SND_SOC_I2C_AND_SPI + select SND_SOC_CS4271_I2C if I2C + select SND_SOC_CS4271_SPI if SPI_MASTER select SND_SOC_CS42XX8_I2C if I2C select SND_SOC_CX20442 if TTY select SND_SOC_DA7210 if I2C
@@ -370,8 +371,19 @@ config SND_SOC_CS4270_VD33_ERRATA depends on SND_SOC_CS4270 config SND_SOC_CS4271 - tristate "Cirrus Logic CS4271 CODEC" - depends on SND_SOC_I2C_AND_SPI + tristate + +config SND_SOC_CS4271_I2C + tristate "Cirrus Logic CS4271 CODEC (I2C)" + depends on I2C + select SND_SOC_CS4271 + select REGMAP_I2C + +config SND_SOC_CS4271_SPI + tristate "Cirrus Logic CS4271 CODEC (SPI)" + depends on SPI_MASTER + select SND_SOC_CS4271 + select REGMAP_SPI config SND_SOC_CS42XX8 tristate
sound/soc/codecs/Makefile +4 -0
@@ -41,6 +41,8 @@ snd-soc-cs42l73-objs := cs42l73.o snd-soc-cs4265-objs := cs4265.o snd-soc-cs4270-objs := cs4270.o snd-soc-cs4271-objs := cs4271.o +snd-soc-cs4271-i2c-objs := cs4271-i2c.o +snd-soc-cs4271-spi-objs := cs4271-spi.o snd-soc-cs42xx8-objs := cs42xx8.o snd-soc-cs42xx8-i2c-objs := cs42xx8-i2c.o snd-soc-cx20442-objs := cx20442.o
@@ -217,6 +219,8 @@ obj-$(CONFIG_SND_SOC_CS42L73) += snd-soc-cs42l73.o obj-$(CONFIG_SND_SOC_CS4265) += snd-soc-cs4265.o obj-$(CONFIG_SND_SOC_CS4270) += snd-soc-cs4270.o obj-$(CONFIG_SND_SOC_CS4271) += snd-soc-cs4271.o +obj-$(CONFIG_SND_SOC_CS4271_I2C) += snd-soc-cs4271-i2c.o +obj-$(CONFIG_SND_SOC_CS4271_SPI) += snd-soc-cs4271-spi.o obj-$(CONFIG_SND_SOC_CS42XX8) += snd-soc-cs42xx8.o obj-$(CONFIG_SND_SOC_CS42XX8_I2C) += snd-soc-cs42xx8-i2c.o obj-$(CONFIG_SND_SOC_CX20442) += snd-soc-cx20442.o
sound/soc/codecs/cs4271-i2c.c new file +62 -0
62 lines not on this page · raw message
sound/soc/codecs/cs4271-spi.c new file +55 -0
55 lines not on this page · raw message
sound/soc/codecs/cs4271.c +18 -137
215 lines not on this page · raw message
sound/soc/codecs/cs4271.h new file +11 -0
@@ -0,0 +1,11 @@ +#ifndef _CS4271_PRIV_H +#define _CS4271_PRIV_H + +#include <linux/regmap.h> + +extern const struct of_device_id cs4271_dt_ids[]; +extern const struct regmap_config cs4271_regmap_config; + +int cs4271_probe (struct device *dev,struct regmap *regmap); + +#endif
Signature · 1 line
1.9.1
Quoted 5 lines · Axel Lin
Currently the cs4271 driver depends on
SND_SOC_I2C_AND_SPI. So the driver cannot be built as built-in ifCONFIG_I2C=m. Split SPI and I2C code into different modules to avoid this issue.Signed-off-by Axel Lin <[email protected]>
Looks good to me. Thanks Axel!
Quoted 3 lines · Axel Lin
Currently the cs4271 driver depends on
SND_SOC_I2C_AND_SPI. So the driver cannot be built as built-in ifCONFIG_I2C=m. Split SPI and I2C code into different modules to avoid this issue.
Applied, thanks.
sound/soc/codecs/cs4271.c static int cs4271_soc_resume(struct snd_soc_codec *codec) · line 535
Quoted 9 lines
#ifdef
CONFIG_OFsound/soc/codecs/cs4271.c +2
-1-static const struct of_device_id cs4271_dt_ids[] = { +const struct of_device_id cs4271_dt_ids[] = { { .compatible ="cirrus,cs4271" , }, { } };MODULE_DEVICE_TABLE (of, cs4271_dt_ids); +EXPORT_SYMBOL_GPL (cs4271_dt_ids);#endif
I do now find myself wondering if this actually does the right thing (it could if the tools are smart enough) but it's not like this is the first driver to do this so not a problem here.