We don't always need soc-compress in soc, here add a config item SND_SOC_COMPRESS, please add 'select SND_SOC_COMPRESS' to driver Kconfig when it is needed.
Signed-off-by: Jie Yang yang.jie@intel.com --- include/sound/soc-dai.h | 2 +- include/sound/soc.h | 2 ++ sound/soc/Kconfig | 6 +++++- sound/soc/Makefile | 6 +++++- sound/soc/intel/Kconfig | 1 + sound/soc/intel/atom/sst-mfld-platform-pcm.c | 2 +- sound/soc/soc-compress.c | 1 + sound/soc/soc-core.c | 4 ++-- 8 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index 2df96b1..238200f 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h @@ -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;
diff --git a/include/sound/soc.h b/include/sound/soc.h index 470f208..623ce0c 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -452,7 +452,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); +#if IS_ENABLED(CONFIG_SND_SOC_COMPRESS) int 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); diff --git a/sound/soc/Kconfig b/sound/soc/Kconfig index 7de792b..20b3069 100644 --- a/sound/soc/Kconfig +++ b/sound/soc/Kconfig @@ -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,11 @@ config SND_SOC_GENERIC_DMAENGINE_PCM bool select SND_DMAENGINE_PCM
+config SND_SOC_COMPRESS + tristate + select SND_COMPRESS_OFFLOAD + default n + config SND_SOC_TOPOLOGY bool
diff --git a/sound/soc/Makefile b/sound/soc/Makefile index af0a571..a3a1505 100644 --- a/sound/soc/Makefile +++ b/sound/soc/Makefile @@ -1,5 +1,9 @@ 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 + +ifneq ($(CONFIG_SND_SOC_COMPRESS),) +snd-soc-core-objs += soc-compress.o +endif
ifneq ($(CONFIG_SND_SOC_TOPOLOGY),) snd-soc-core-objs += soc-topology.o diff --git a/sound/soc/intel/Kconfig b/sound/soc/intel/Kconfig index 05fde5e6e..221e3bd 100644 --- a/sound/soc/intel/Kconfig +++ b/sound/soc/intel/Kconfig @@ -12,6 +12,7 @@ config SND_MFLD_MACHINE
config SND_SST_MFLD_PLATFORM tristate + select SND_SOC_COMPRESS
config SND_SST_IPC tristate diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c index 5e9c316..cb1dd50 100644 --- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c +++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c @@ -512,7 +512,7 @@ static struct snd_soc_dai_driver sst_platform_dai[] = { }, { .name = "compress-cpu-dai", - .compress_dai = 1, + .compress_new = soc_new_compress, .ops = &sst_compr_dai_ops, .playback = { .stream_name = "Compress Playback", diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c index 025c38f..a672d9c 100644 --- a/sound/soc/soc-compress.c +++ b/sound/soc/soc-compress.c @@ -703,3 +703,4 @@ compr_err: kfree(compr); return ret; } +EXPORT_SYMBOL_GPL(soc_new_compress); diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 3b471f9..24b0960 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -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);