Commit 6f0c4226 authored by Jie Yang's avatar Jie Yang Committed by Mark Brown

ASoC: compress: add config item for soc-compress to make it compiled only when needed

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: default avatarJie Yang <yang.jie@intel.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 26d9ca34
...@@ -214,7 +214,7 @@ struct snd_soc_dai_driver { ...@@ -214,7 +214,7 @@ struct snd_soc_dai_driver {
int (*suspend)(struct snd_soc_dai *dai); int (*suspend)(struct snd_soc_dai *dai);
int (*resume)(struct snd_soc_dai *dai); int (*resume)(struct snd_soc_dai *dai);
/* compress 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 */ /* DAI is also used for the control bus */
bool bus_control; bool bus_control;
......
...@@ -440,7 +440,9 @@ int snd_soc_platform_read(struct snd_soc_platform *platform, ...@@ -440,7 +440,9 @@ int snd_soc_platform_read(struct snd_soc_platform *platform,
int snd_soc_platform_write(struct snd_soc_platform *platform, int snd_soc_platform_write(struct snd_soc_platform *platform,
unsigned int reg, unsigned int val); unsigned int reg, unsigned int val);
int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num); 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, struct snd_pcm_substream *snd_soc_get_dai_substream(struct snd_soc_card *card,
const char *dai_link, int stream); const char *dai_link, int stream);
......
...@@ -9,7 +9,6 @@ menuconfig SND_SOC ...@@ -9,7 +9,6 @@ menuconfig SND_SOC
select SND_JACK if INPUT=y || INPUT=SND select SND_JACK if INPUT=y || INPUT=SND
select REGMAP_I2C if I2C select REGMAP_I2C if I2C
select REGMAP_SPI if SPI_MASTER select REGMAP_SPI if SPI_MASTER
select SND_COMPRESS_OFFLOAD
---help--- ---help---
If you want ASoC support, you should say Y here and also to the If you want ASoC support, you should say Y here and also to the
...@@ -30,6 +29,10 @@ config SND_SOC_GENERIC_DMAENGINE_PCM ...@@ -30,6 +29,10 @@ config SND_SOC_GENERIC_DMAENGINE_PCM
bool bool
select SND_DMAENGINE_PCM select SND_DMAENGINE_PCM
config SND_SOC_COMPRESS
bool
select SND_COMPRESS_OFFLOAD
config SND_SOC_TOPOLOGY config SND_SOC_TOPOLOGY
bool bool
......
snd-soc-core-objs := soc-core.o soc-dapm.o soc-jack.o soc-cache.o soc-utils.o 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),) ifneq ($(CONFIG_SND_SOC_TOPOLOGY),)
snd-soc-core-objs += soc-topology.o snd-soc-core-objs += soc-topology.o
......
...@@ -12,6 +12,7 @@ config SND_MFLD_MACHINE ...@@ -12,6 +12,7 @@ config SND_MFLD_MACHINE
config SND_SST_MFLD_PLATFORM config SND_SST_MFLD_PLATFORM
tristate tristate
select SND_SOC_COMPRESS
config SND_SST_IPC config SND_SST_IPC
tristate tristate
......
...@@ -529,7 +529,7 @@ static struct snd_soc_dai_driver sst_platform_dai[] = { ...@@ -529,7 +529,7 @@ static struct snd_soc_dai_driver sst_platform_dai[] = {
}, },
{ {
.name = "compress-cpu-dai", .name = "compress-cpu-dai",
.compress_dai = 1, .compress_new = snd_soc_new_compress,
.ops = &sst_compr_dai_ops, .ops = &sst_compr_dai_ops,
.playback = { .playback = {
.stream_name = "Compress Playback", .stream_name = "Compress Playback",
......
...@@ -612,8 +612,15 @@ static struct snd_compr_ops soc_compr_dyn_ops = { ...@@ -612,8 +612,15 @@ static struct snd_compr_ops soc_compr_dyn_ops = {
.get_codec_caps = soc_compr_get_codec_caps .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_codec *codec = rtd->codec;
struct snd_soc_platform *platform = rtd->platform; struct snd_soc_platform *platform = rtd->platform;
...@@ -703,3 +710,4 @@ int soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) ...@@ -703,3 +710,4 @@ int soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
kfree(compr); kfree(compr);
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(snd_soc_new_compress);
...@@ -1370,9 +1370,9 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order) ...@@ -1370,9 +1370,9 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
soc_dpcm_debugfs_add(rtd); soc_dpcm_debugfs_add(rtd);
#endif #endif
if (cpu_dai->driver->compress_dai) { if (cpu_dai->driver->compress_new) {
/*create compress_device"*/ /*create compress_device"*/
ret = soc_new_compress(rtd, num); ret = cpu_dai->driver->compress_new(rtd, num);
if (ret < 0) { if (ret < 0) {
dev_err(card->dev, "ASoC: can't create compress %s\n", dev_err(card->dev, "ASoC: can't create compress %s\n",
dai_link->stream_name); dai_link->stream_name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment