ASoC: soc-compress: add config item for soc-compress to make it compiled only when needed
Subsystems (4)
PATCH v4 1/1 ASoC: soc-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.
--- include/sound/soc-dai.h | 2 +- include/sound/soc.h | 4 +++- sound/soc/Kconfig | 5 ++++- sound/soc/Makefile | 3 ++- sound/soc/intel/Kconfig | 1 + sound/soc/intel/atom/sst-mfld-platform-pcm.c | 2 +- sound/soc/soc-compress.c | 12 ++++++++++-- sound/soc/soc-core.c | 4 ++-- 8 files changed, 24 insertions(+), 9 deletions(-)
include/sound/soc-dai.h +1 -1
@@ -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;
include/sound/soc.h +3 -1
@@ -459,7 +459,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);
sound/soc/Kconfig +4 -1
@@ -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
sound/soc/Makefile +2 -1
@@ -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
sound/soc/intel/Kconfig +1 -0
@@ -12,6 +12,7 @@ config SND_MFLD_MACHINE config SND_SST_MFLD_PLATFORM tristate + select SND_SOC_COMPRESS config SND_SST_IPC tristate
sound/soc/intel/atom/sst-mfld-platform-pcm.c +1 -1
@@ -512,7 +512,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",
sound/soc/soc-compress.c +10 -2
@@ -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);
sound/soc/soc-core.c +2 -2
@@ -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);
Signature · 1 line
1.9.1
Quoted 24 lines · Jie Yang
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
Kconfigto 'selectSND_SOC_COMPRESS' for drivers that needed soc-compress.Signed-off-by Jie Yang <[email protected]>--- include/sound/soc-dai.h | 2 +- include/sound/soc.h | 4 +++- sound/soc/Kconfig | 5 ++++- sound/soc/Makefile | 3 ++- sound/soc/intel/Kconfig | 1 + sound/soc/intel/atom/sst-mfld-platform-pcm.c | 2 +- sound/soc/soc-compress.c | 12 ++++++++++-- sound/soc/soc-core.c | 4 ++-- 8 files changed, 24 insertions(+), 9 deletions(-)include/sound/soc-dai.h +0
-0
include/sound/soc-dai.h struct snd_soc_dai_driver { · line 217
Quoted 5 lines
include/sound/soc-dai.h +1
-1@@ -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);
This feels a little awkward to be using a function pointer here. It somewhat implies I might want to customise this function but am I every going to want to set this to something other than snd_soc_new_compress?
sound/soc/soc-core.c static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order) · line 1373
Quoted 10 lines
sound/soc/soc-core.c +1
-1@@ -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) {
Would it maybe be nicer to just change this to:
if (IS_ENABLED(..)) && cpu_dai...)
Anyone else have any thoughts on that?
sound/soc/soc-core.c static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order) · line 1378
Quoted 6 lines
sound/soc/soc-core.c +1
-1/*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);
Thanks,
Charles
Quoted 28 lines
-----Original Message-----
From: Charles Keepax [mailto:[email protected]]
Sent: Wednesday, October 14, 2015 5:21 PM
To: Jie, Yang
Cc: [email protected]; [email protected]; Girdwood, Liam R
Subject: Re: [alsa-devel] [PATCH v4] ASoC: soc-compress: add config item for soc-compress to make it compiled only when neededQuoted 19 lines · Jie Yang
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
Kconfigto 'selectSND_SOC_COMPRESS' for drivers that needed soc-compress.Signed-off-by Jie Yang <[email protected]>--- include/sound/soc-dai.h | 2 +- include/sound/soc.h | 4 +++- sound/soc/Kconfig | 5 ++++- sound/soc/Makefile | 3 ++- sound/soc/intel/Kconfig | 1 + sound/soc/intel/atom/sst-mfld-platform-pcm.c | 2 +- sound/soc/soc-compress.c | 12 ++++++++++-- sound/soc/soc-core.c | 4 ++-- 8 files changed, 24 insertions(+), 9 deletions(-)
Quoted 14 lines
include/sound/soc-dai.h struct snd_soc_dai_driver { · line 217
Quoted 10 lines
include/sound/soc-dai.h index renamed from include/sound/soc-dai.h +0
-02df96b1..238200f 100644
include/sound/soc-dai.h +1
-1@@ -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);This feels a little awkward to be using a function pointer here. It somewhat implies I might want to customise this function but am I every going to want to set this to something other than
snd_soc_new_compress?
Hi Charles, we used compress_dai bool before(in v2), but for that we need add empty inline soc_compress_new(), Takashi suggest we use callback func pointer here, it can be compress_new or any other creation here. This is flexible and can be extended if any new stuff has to be handled.
Quoted 7 lines
sound/soc/soc-core.c static int soc_probe_link_dais(struct
Quoted 6 lines
sound/soc/soc-core.c index renamed from sound/soc/soc-core.c +0
-03b471f9..24b0960 100644
sound/soc/soc-core.c +0
-0@@ -1370,9 +1370,9 @@ static int soc_probe_link_dais(struct
snd_soc_card*card, int num, int order)
Quoted 8 lines
sound/soc/soc-core.c static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order) · line 1373
Quoted 5 lines
sound/soc/soc-core.c +1
-1soc_dpcm_debugfs_add (rtd);#endif -if (cpu_dai->driver->compress_dai) { +if (cpu_dai->driver->compress_new) {Would it maybe be nicer to just change this to:
if (IS_ENABLED(..)) &&cpu_dai...)
This is roll back to the old compress_dai bool?
~Keyon
Quoted 13 lines
Anyone else have any thoughts on that?
sound/soc/soc-core.c static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
Quoted 5 lines
sound/soc/soc-core.c +1
-1/*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 createcompress %s\n",
sound/soc/soc-core.c static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order) · line 1378
Quoted 1 line
sound/soc/soc-core.c +0
-0dai_link->stream_name);Thanks,
Charles
Quoted 10 lines · Yang
Quoted 9 lines
include/sound/soc-dai.h struct snd_soc_dai_driver { · line 217
Quoted 5 lines
include/sound/soc-dai.h +1
-1int (*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);This feels a little awkward to be using a function pointer here. It somewhat implies I might want to customise this function but am I every going to want to set this to something other than
snd_soc_new_compress?
Quoted 4 lines
Hi Charles, we used
compress_daibool before(in v2), but for that we need add empty inlinesoc_compress_new(), Takashi suggest we use callback func pointer here, it can becompress_newor any other creation here. This is flexible and can be extended if any new stuff has to be handled.
If everyone else is happy with it, then I don't mind. It obviously works, just felt a little odd to me.
Thanks,
Charles
Quoted 20 lines
-----Original Message-----
From: Charles Keepax [mailto:[email protected]]
Sent: Wednesday, October 14, 2015 8:47 PM
To: Jie, Yang
Cc: [email protected]; [email protected]; Girdwood, Liam R
Subject: Re: [alsa-devel] [PATCH v4] ASoC: soc-compress: add config item for soc-compress to make it compiled only when neededQuoted 9 lines · Yang
Quoted 9 lines
include/sound/soc-dai.h struct snd_soc_dai_driver { · line 217
Quoted 5 lines
include/sound/soc-dai.h +1
-1int (*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);This feels a little awkward to be using a function pointer here. It somewhat implies I might want to customise this function but am I every going to want to set this to something other than
snd_soc_new_compress?Quoted 1 line
Quoted 8 lines
Quoted 3 lines
Hi Charles, we used
compress_daibool before(in v2), but for that we need add empty inlinesoc_compress_new(), Takashi suggest we use callback func pointer here, it can becompress_newor any other creationhere.
Quoted 1 line
This is flexible and can be extended if any new stuff has to be handled.
If everyone else is happy with it, then I don't mind. It obviously works, just felt a little odd to me.
Umm, maybe we can extend it in the future when new stuff emerge.
Hi Mark, sorry to bother you, do you have any more comment about this patch?
Thanks,
~Keyon
Quoted 3 lines
Thanks,
Charles
Mark Brown
maintainerQuoted 9 lines · Charles Keepax
Quoted 4 lines · Yang
Hi Charles, we used
compress_daibool before(in v2), but for that we need add empty inlinesoc_compress_new(), Takashi suggest we use callback func pointer here, it can becompress_newor any other creation here. This is flexible and can be extended if any new stuff has to be handled.If everyone else is happy with it, then I don't mind. It obviously works, just felt a little odd to me.
Yes, it's not very nice but it does help finesse things. :/
Mark Brown
maintainerApplied "ASoC: compress: add config item for soc-compress to make it compiled only when needed" to the asoc tree
In reply to Jie YangThe patch
ASoC: compress: add config item for soc-compress to make it compiled only when needed
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
6f0c42269f000b1e346c84d9a589f17aa94c96d8Mon Sep 17 00:00:00 2001
From: Jie Yang <[email protected]>
Date: Tue, 13 Oct 2015 23:41:00 +0800
Subject: [PATCH] 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.
--- include/sound/soc-dai.h | 2 +- include/sound/soc.h | 4 +++- sound/soc/Kconfig | 5 ++++- sound/soc/Makefile | 3 ++- sound/soc/intel/Kconfig | 1 + sound/soc/intel/atom/sst-mfld-platform-pcm.c | 2 +- sound/soc/soc-compress.c | 12 ++++++++++-- sound/soc/soc-core.c | 4 ++-- 8 files changed, 24 insertions(+), 9 deletions(-)
include/sound/soc-dai.h +1 -1
@@ -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;
include/sound/soc.h +3 -1
@@ -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);
sound/soc/Kconfig +4 -1
@@ -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
sound/soc/Makefile +2 -1
@@ -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
sound/soc/intel/Kconfig +1 -0
@@ -12,6 +12,7 @@ config SND_MFLD_MACHINE config SND_SST_MFLD_PLATFORM tristate + select SND_SOC_COMPRESS config SND_SST_IPC tristate
sound/soc/intel/atom/sst-mfld-platform-pcm.c +1 -1
@@ -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",
sound/soc/soc-compress.c +10 -2
@@ -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);
sound/soc/soc-core.c +2 -2
@@ -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);
Signature · 1 line
2.6.1