ASoC: compress: add config item for soc-compress to make it compiled only when needed
authorJie Yang <yang.jie@intel.com>
Tue, 13 Oct 2015 15:41:00 +0000 (23:41 +0800)
committerMark Brown <broonie@kernel.org>
Thu, 22 Oct 2015 12:52:16 +0000 (13:52 +0100)
We don't always need soc-compress in soc, here add a config item
SND_SOC_COMPRESS, when nobody select it, the soc-compress will
not be compiled.

Here also change Kconfig to 'select SND_SOC_COMPRESS' for drivers
that needed soc-compress.

Signed-off-by: Jie Yang <yang.jie@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc-dai.h
include/sound/soc.h
sound/soc/Kconfig
sound/soc/Makefile
sound/soc/intel/Kconfig
sound/soc/intel/atom/sst-mfld-platform-pcm.c
sound/soc/soc-compress.c
sound/soc/soc-core.c

index 2df96b1384c718fdecc2a26d423a484dc5a9d727..238200ffba5b08c6fc0783bab0d0bdde9253a6b6 100644 (file)
@@ -214,7 +214,7 @@ struct snd_soc_dai_driver {
        int (*suspend)(struct snd_soc_dai *dai);
        int (*resume)(struct snd_soc_dai *dai);
        /* compress dai */
-       bool compress_dai;
+       int (*compress_new)(struct snd_soc_pcm_runtime *rtd, int num);
        /* DAI is also used for the control bus */
        bool bus_control;
 
index 71e0c0566b6edab220d913e19a0a3004d247798a..a7bc82b08cd44480aa0dcfb49c0715c01d96ac3a 100644 (file)
@@ -440,7 +440,9 @@ int snd_soc_platform_read(struct snd_soc_platform *platform,
 int snd_soc_platform_write(struct snd_soc_platform *platform,
                                        unsigned int reg, unsigned int val);
 int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num);
-int soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num);
+#ifdef CONFIG_SND_SOC_COMPRESS
+int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num);
+#endif
 
 struct snd_pcm_substream *snd_soc_get_dai_substream(struct snd_soc_card *card,
                const char *dai_link, int stream);
index 225bfda414e98d91da49140451d8bb09e16c9f12..3e4f444346000cee2f97cf676017f75c5335f831 100644 (file)
@@ -9,7 +9,6 @@ menuconfig SND_SOC
        select SND_JACK if INPUT=y || INPUT=SND
        select REGMAP_I2C if I2C
        select REGMAP_SPI if SPI_MASTER
-       select SND_COMPRESS_OFFLOAD
        ---help---
 
          If you want ASoC support, you should say Y here and also to the
@@ -30,6 +29,10 @@ config SND_SOC_GENERIC_DMAENGINE_PCM
        bool
        select SND_DMAENGINE_PCM
 
+config SND_SOC_COMPRESS
+       bool
+       select SND_COMPRESS_OFFLOAD
+
 config SND_SOC_TOPOLOGY
        bool
 
index 134aca150a50bb62ef6d9d13ddc5636b7adde463..280ac8257d3effb92b672f56cf3d6ed275fc86ed 100644 (file)
@@ -1,5 +1,6 @@
 snd-soc-core-objs := soc-core.o soc-dapm.o soc-jack.o soc-cache.o soc-utils.o
-snd-soc-core-objs += soc-pcm.o soc-compress.o soc-io.o soc-devres.o soc-ops.o
+snd-soc-core-objs += soc-pcm.o soc-io.o soc-devres.o soc-ops.o
+snd-soc-core-$(CONFIG_SND_SOC_COMPRESS) += soc-compress.o
 
 ifneq ($(CONFIG_SND_SOC_TOPOLOGY),)
 snd-soc-core-objs += soc-topology.o
index 05fde5e6e2578396aa4e4be20d84d3b35d3bc6ff..221e3bd73adb34e1cfaee60ba3979ca7d643c52d 100644 (file)
@@ -12,6 +12,7 @@ config SND_MFLD_MACHINE
 
 config SND_SST_MFLD_PLATFORM
        tristate
+       select SND_SOC_COMPRESS
 
 config SND_SST_IPC
        tristate
index 683e5011615241b026d91c4056ce3cb28e97c537..4c734f5aeb8b21d5789e9df982866ceda1d226d3 100644 (file)
@@ -529,7 +529,7 @@ static struct snd_soc_dai_driver sst_platform_dai[] = {
 },
 {
        .name = "compress-cpu-dai",
-       .compress_dai = 1,
+       .compress_new = snd_soc_new_compress,
        .ops = &sst_compr_dai_ops,
        .playback = {
                .stream_name = "Compress Playback",
index 025c38fbe3c03fea08db0b365e472902c5f110fc..12a9820feac1548d5c3d3cbc50e0a8cc2bfefc25 100644 (file)
@@ -612,8 +612,15 @@ static struct snd_compr_ops soc_compr_dyn_ops = {
        .get_codec_caps = soc_compr_get_codec_caps
 };
 
-/* create a new compress */
-int soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
+/**
+ * snd_soc_new_compress - create a new compress.
+ *
+ * @rtd: The runtime for which we will create compress
+ * @num: the device index number (zero based - shared with normal PCMs)
+ *
+ * Return: 0 for success, else error.
+ */
+int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
 {
        struct snd_soc_codec *codec = rtd->codec;
        struct snd_soc_platform *platform = rtd->platform;
@@ -703,3 +710,4 @@ compr_err:
        kfree(compr);
        return ret;
 }
+EXPORT_SYMBOL_GPL(snd_soc_new_compress);
index 6173d15236c3c0c2ce53c3c31b721310f9576e9e..6e543e18b4fa7ffc1a3a73e0052536428cab3ef3 100644 (file)
@@ -1370,9 +1370,9 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
                soc_dpcm_debugfs_add(rtd);
 #endif
 
-       if (cpu_dai->driver->compress_dai) {
+       if (cpu_dai->driver->compress_new) {
                /*create compress_device"*/
-               ret = soc_new_compress(rtd, num);
+               ret = cpu_dai->driver->compress_new(rtd, num);
                if (ret < 0) {
                        dev_err(card->dev, "ASoC: can't create compress %s\n",
                                         dai_link->stream_name);