summaryrefslogtreecommitdiff
path: root/sound/soc/fsl/imx-pcm.h
diff options
context:
space:
mode:
authorShawn Guo <shawn.guo@linaro.org>2013-01-28 14:25:43 +0800
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-01-28 14:46:09 +0800
commit1927661b1748480692f1fa2c390fe031c86d862a (patch)
tree674f9c0a5f08285d2b6c472bc2bdbfa635ea9668 /sound/soc/fsl/imx-pcm.h
parent93d7b7622c199f1be25ca8fe64b3cbf468ea49b9 (diff)
ASoC: fsl: fix snd-soc-imx-pcm module build
When building modules with CONFIG_SND_IMX_SOC=m in imx_v6_v7_defconfig, we will see the following link error. LD [M] sound/soc/fsl/snd-soc-fsl-ssi.o LD [M] sound/soc/fsl/snd-soc-fsl-utils.o LD [M] sound/soc/fsl/snd-soc-imx-ssi.o LD [M] sound/soc/fsl/snd-soc-imx-audmux.o LD [M] sound/soc/fsl/snd-soc-imx-pcm.o sound/soc/fsl/imx-pcm-dma.o: In function `init_module': imx-pcm-dma.c:(.init.text+0x0): multiple definition of `init_module' sound/soc/fsl/imx-pcm-fiq.o:imx-pcm-fiq.c:(.init.text+0x0): first defined here sound/soc/fsl/imx-pcm-dma.o: In function `cleanup_module': imx-pcm-dma.c:(.exit.text+0x0): multiple definition of `cleanup_module' sound/soc/fsl/imx-pcm-fiq.o:imx-pcm-fiq.c:(.exit.text+0x0): first defined here make[4]: *** [sound/soc/fsl/snd-soc-imx-pcm.o] Error 1 The module snd-soc-imx-pcm is designed to link imx-pcm.o with imx-pcm-dma.o or imx-pcm-fiq.o depending on if option SND_SOC_IMX_PCM_DMA or SND_SOC_IMX_PCM_FIQ is enabled. Both imx-pcm-dma and imx-pcm-fiq register their own module_platform_driver. However, these two options are not mutually exclusive and can be enabled together. And that's why we see above multiple init_module definition error. Instead of having both imx-pcm-dma and imx-pcm-fiq register their own platform_driver, we should do only once in imx-pcm.c. Using platform_device_id to distinguish between imx-pcm-dma and imx-pcm-fiq, we can run-time call imx-pcm-dma/fiq specific initialization in .probe hook to have module snd-soc-imx-pcm work for both cases. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/fsl/imx-pcm.h')
-rw-r--r--sound/soc/fsl/imx-pcm.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/sound/soc/fsl/imx-pcm.h b/sound/soc/fsl/imx-pcm.h
index 83c0ed7d55c9..5ae13a13a353 100644
--- a/sound/soc/fsl/imx-pcm.h
+++ b/sound/soc/fsl/imx-pcm.h
@@ -30,4 +30,22 @@ int snd_imx_pcm_mmap(struct snd_pcm_substream *substream,
int imx_pcm_new(struct snd_soc_pcm_runtime *rtd);
void imx_pcm_free(struct snd_pcm *pcm);
+#ifdef CONFIG_SND_SOC_IMX_PCM_DMA
+int imx_pcm_dma_init(struct platform_device *pdev);
+#else
+static inline int imx_pcm_dma_init(struct platform_device *pdev)
+{
+ return -ENODEV;
+}
+#endif
+
+#ifdef CONFIG_SND_SOC_IMX_PCM_FIQ
+int imx_pcm_fiq_init(struct platform_device *pdev);
+#else
+static inline int imx_pcm_fiq_init(struct platform_device *pdev)
+{
+ return -ENODEV;
+}
+#endif
+
#endif /* _IMX_PCM_H */