AUDIO: Split WM8750 IO routines from core for SPI
Subsystems (4)
Add SPI support to the WM8750 ASoC codec by splitting the I2C out of the WM8750 codec and adding an standard SPI driver to the system.
sound/soc/codecs/Kconfig +10 -0
@@ -10,6 +10,16 @@ config SND_SOC_WM8750 tristate depends on SND_SOC +config SND_SOC_WM8750_I2C + tristate + select SND_SOC_WM8750 + depends on SND_SOC && (CONFIG_I2C || CONFIG_I2C_MODULE) + +config SND_SOC_WM8750_SPI + tristate + select SND_SOC_WM8750 + depends on SND_SOC && CONFIG_SPI + config SND_SOC_WM8753 tristate depends on SND_SOC
sound/soc/codecs/Makefile +4 -0
@@ -1,6 +1,8 @@ snd-soc-ac97-objs := ac97.o snd-soc-wm8731-objs := wm8731.o snd-soc-wm8750-objs := wm8750.o +snd-soc-wm8750-spi-objs := wm8750-spi.o +snd-soc-wm8750-i2c-objs := wm8750-i2c.o snd-soc-wm8753-objs := wm8753.o snd-soc-wm9712-objs := wm9712.o snd-soc-wm9713-objs := wm9713.o
@@ -10,6 +12,8 @@ snd-soc-tlv320aic3x-objs := tlv320aic3x. obj-$(CONFIG_SND_SOC_AC97_CODEC) += snd-soc-ac97.o obj-$(CONFIG_SND_SOC_WM8731) += snd-soc-wm8731.o obj-$(CONFIG_SND_SOC_WM8750) += snd-soc-wm8750.o +obj-$(CONFIG_SND_SOC_WM8750_I2C) += snd-soc-wm8750-i2c.o +obj-$(CONFIG_SND_SOC_WM8750_SPI) += snd-soc-wm8750-spi.o obj-$(CONFIG_SND_SOC_WM8753) += snd-soc-wm8753.o obj-$(CONFIG_SND_SOC_WM9712) += snd-soc-wm9712.o obj-$(CONFIG_SND_SOC_WM9713) += snd-soc-wm9713.o
sound/soc/codecs/wm8750-i2c.c new file +175 -0
175 lines not on this page · raw message
sound/soc/codecs/wm8750.c +29 -128
232 lines not on this page · raw message
sound/soc/codecs/wm8750.h +13 -1
@@ -62,6 +62,18 @@ struct wm8750_setup_data { };extern struct snd_soc_codec_dai wm8750_dai; -extern struct snd_soc_codec_device soc_codec_dev_wm8750; + +extern struct snd_soc_codec_device soc_codec_dev_wm8750_i2c; +extern struct snd_soc_codec_device soc_codec_dev_wm8750_spi; + +/* internal items for the interface modules, not for SoC drivers */ + +extern struct snd_soc_codec *wm8750_probe (struct platform_device *pdev); +extern int wm8750_init (struct snd_soc_device *socdev); + +extern void wm8750_free (struct platform_device *pdev); +extern int wm8750_suspend (struct platform_device *pdev,pm_message_t state); +extern int wm8750_resume (struct platform_device *pdev); +extern int wm8750_remove (struct platform_device *pdev);#endif
sound/soc/pxa/spitz.c +1 -1
@@ -351,7 +351,7 @@ static struct wm8750_setup_data spitz_wmstatic struct snd_soc_device spitz_snd_devdata = { .machine = &snd_soc_machine_spitz, .platform = &pxa2xx_soc_platform, - .codec_dev = &soc_codec_dev_wm8750, + .codec_dev = &soc_codec_dev_wm8750_i2c, .codec_data = &spitz_wm8750_setup, };
sound/soc/pxa/Kconfig +1 -0
@@ -31,6 +31,7 @@ config SND_PXA2XX_SOC_SPITZ tristate "SoC Audio support for Sharp Zaurus SL-Cxx00" depends on SND_PXA2XX_SOC && PXA_SHARP_Cxx00 select SND_PXA2XX_SOC_I2S + select SND_SOC_WM8750_I2C select SND_SOC_WM8750 help Say Y if you want to add support for SoC audio on Sharp
sound/soc/codecs/wm8750-spi.c new file +161 -0
161 lines not on this page · raw message
Signature · 3 lines
Ben ([email protected], http://www.fluff.org/) 'a smiley only costs 4 bytes'
At Mon, 23 Jun 2008 12:54:07 +0100,
Quoted 12 lines · Ben Dooks
Add SPI support to the WM8750 ASoC codec by splitting the I2C out of the WM8750 codec and adding an standard SPI driver to the system.
Signed-off-by Ben Dooks <[email protected]>Index: linux-2.6.26-rc4-quilt3/sound/soc/codecs/Kconfig
===================================================================
sound/soc/codecs/Kconfig config SND_SOC_WM8750 · line 16
Quoted 7 lines
sound/soc/codecs/Kconfig +4
-0@@ -10,6 +10,16 @@ config SND_SOC_WM8750 tristate depends on SND_SOC +config SND_SOC_WM8750_I2C + tristate + select SND_SOC_WM8750 + depends on SND_SOC && (CONFIG_I2C || CONFIG_I2C_MODULE)
This is wrong in Kconfig. Should be
depends on SND_SOC && CONFIG_I2C
sound/soc/codecs/wm8750-i2c.c
Quoted 3 lines
sound/soc/codecs/wm8750-i2c.c new file +1
-0+#include <sound/driver.h>
This header file is obsoleted.
Takashi
Quoted 3 lines · Ben Dooks
Add SPI support to the WM8750 ASoC codec by splitting the I2C out of the WM8750 codec and adding an standard SPI driver to the system.
This looks good. My only substantial concern with it is that it means that this driver isn't consistent with the other codec drivers since there are now three modules built for it - one for the core and one for each bus type. Would it be possible to integrate the SPI support into the main WM8750 driver or are there substantial drawbacks from doing that? The main thing is ending up loading SPI when it's not needed but I'm not sure how big a cost that is or if there's anything else?
Also (very minor, but it'll get picked up on):
sound/soc/codecs/wm8750.c static int wm8750_suspend(struct platfor · line 762
Quoted 11 lines
sound/soc/codecs/wm8750.c +2
-2-static int wm8750_suspend (struct platform_device *pdev,pm_message_t state) +int wm8750_suspend (struct platform_device *pdev,pm_message_t state) {struct snd_soc_device *socdev =platform_get_drvdata (pdev);struct snd_soc_codec *codec = socdev->codec;@@ -760,7 +759,9 @@ static int wm8750_suspend(struct platforreturn 0 ; } -static int wm8750_resume (struct platform_device *pdev) +EXPORT_SYMBOL_GPL (wm8750_suspend);
checkpatch will want there to be no space between the function and the EXPORT_SYMBOL_GPL() for it.