ASoC: add config to enable/disable asoc compress
PATCH 1/1 ASoC: add config to enable/disable asoc compress
From: "vivian,zhang" <[email protected]>
To reduce memory footprint, we can disable asoc compress when it is not used. Here add SND_SOC_COMPRESS to configure it.
--- include/sound/soc.h | 7 +++++++ sound/soc/Kconfig | 10 +++++++++- sound/soc/Makefile | 6 +++++- 3 files changed, 21 insertions(+), 2 deletions(-)
include/sound/soc.h +7 -0
@@ -430,7 +430,14 @@ 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); +#ifdef CONFIG_SND_SOC_COMPRESS int soc_new_compress (struct snd_soc_pcm_runtime *rtd,int num); +#else +static inline int soc_new_compress (struct snd_soc_pcm_runtime *rtd,int num) +{ +return -EPERM ; +} +#endif struct snd_pcm_substream *snd_soc_get_dai_substream (struct snd_soc_card *card,const char *dai_link,int stream);
sound/soc/Kconfig +9 -1
@@ -9,7 +9,7 @@ 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 + select SND_COMPRESS_OFFLOAD if SND_SOC_COMPRESS ---help--- If you want ASoC support, you should say Y here and also to the
@@ -30,6 +30,14 @@ config SND_SOC_GENERIC_DMAENGINE_PCM bool select SND_DMAENGINE_PCM +config SND_SOC_COMPRESS + bool "Asoc compress offload support" if EXPERT + default y + help + Say 'N" to disable Asoc compress offload support, which may reduce code + size about 10KB on X86_64 platform. + If unsure say Y. + # All the supported SoCs source "sound/soc/adi/Kconfig" source "sound/soc/atmel/Kconfig"
sound/soc/Makefile +5 -1
@@ -1,5 +1,5 @@ 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_GENERIC_DMAENGINE_PCM),) snd-soc-core-objs += soc-generic-dmaengine-pcm.o
@@ -9,6 +9,10 @@ ifneq ($(CONFIG_SND_SOC_AC97_BUS),) snd-soc-core-objs += soc-ac97.o endif +ifneq ($(CONFIG_SND_SOC_COMPRESS),) +snd-soc-core-objs += soc-compress.o +endif + obj-$(CONFIG_SND_SOC) += snd-soc-core.o obj-$(CONFIG_SND_SOC) += codecs/ obj-$(CONFIG_SND_SOC) += generic/
Signature · 1 line
1.9.1
Mark Brown
maintainersound/soc/Makefile ifneq ($(CONFIG_SND_SOC_AC97_BUS),) · line 14
Quoted 3 lines · Jie Yang
sound/soc/Makefile +3
-0+ifneq ($(CONFIG_SND_SOC_COMPRESS),) +snd-soc-core-objs += soc-compress.o +endif
If you want to make this optional why not make it a module so that the Makefile looks more idiomatic?
At Tue, 2 Jun 2015 11:58:14 +0100,
Quoted 9 lines · Mark Brown
sound/soc/Makefile ifneq ($(CONFIG_SND_SOC_AC97_BUS),) · line 14
Quoted 3 lines · Jie Yang
sound/soc/Makefile +3
-0+ifneq ($(CONFIG_SND_SOC_COMPRESS),) +snd-soc-core-objs += soc-compress.o +endifIf you want to make this optional why not make it a module so that the
Makefilelooks more idiomatic?
Only about Makefile, it can be simplified like
snd-soc-core-$(CONFIG_SND_SOC_COMPRESS) += soc-compress.o
But I agree with Mark. It would make more sense to split a module, as soc-compress.c isn't so small. For a small object, it's often better to keep in, as a module consumes more memory (it needs a page size). For a large size object, it's worth to consider to split.
Takashi
Quoted 18 lines
-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Tuesday, June 02, 2015 8:01 PM
To: Mark Brown
Cc: Jie, Yang; [email protected]; Girdwood, Liam R; Zhang, Vivian
Subject: Re: [PATCH] ASoC: add config to enable/disable asoc compressAt Tue, 2 Jun 2015 11:58:14 +0100,
Quoted 8 lines · Mark Brown
Review
Quoted 2 lines · Jie Yang
(quoted diff) +2
-0+ifneq ($(CONFIG_SND_SOC_COMPRESS),) snd-soc-core-objs += +soc-compress.o endifIf you want to make this optional why not make it a module so that the
Makefilelooks more idiomatic?
Quoted 3 lines
Only about
Makefile, it can be simplified likesnd-soc-core-$(CONFIG_SND_SOC_COMPRESS) += soc-compress.o
Got it, thanks.
Quoted 5 lines
But I agree with Mark. It would make more sense to split a module, as soc-
compress.cisn't so small. For a small object, it's often better to keep in, as a module consumes more memory (it needs a page size).
For a large size object, it's worth to consider to split.
Make it a module sounds good idea, I can change it in next version.
~Keyon
Quoted 3 lines
Takashi