Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: add config to enable/disable asoc compress
@ 2015-05-30 13:28 Jie Yang
  2015-06-02 10:58 ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Jie Yang @ 2015-05-30 13:28 UTC (permalink / raw)
  To: tiwai, broonie; +Cc: vivian.zhang, alsa-devel, liam.r.girdwood

From: "vivian,zhang" <vivian.zhang@intel.com>

To reduce memory footprint, we can disable asoc compress when it
is not used. Here add SND_SOC_COMPRESS to configure it.

Signed-off-by: vivian,zhang <vivian.zhang@intel.com>
Modified-by: Jie Yang <yang.jie@intel.com>
Signed-off-by: Jie Yang <yang.jie@intel.com>
---
 include/sound/soc.h |  7 +++++++
 sound/soc/Kconfig   | 10 +++++++++-
 sound/soc/Makefile  |  6 +++++-
 3 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index f6226914..6e2da70 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -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);
diff --git a/sound/soc/Kconfig b/sound/soc/Kconfig
index 3ba52da..7e7a8e1 100644
--- a/sound/soc/Kconfig
+++ b/sound/soc/Kconfig
@@ -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"
diff --git a/sound/soc/Makefile b/sound/soc/Makefile
index 974ba70..0832c3b 100644
--- a/sound/soc/Makefile
+++ b/sound/soc/Makefile
@@ -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/
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: add config to enable/disable asoc compress
  2015-05-30 13:28 [PATCH] ASoC: add config to enable/disable asoc compress Jie Yang
@ 2015-06-02 10:58 ` Mark Brown
  2015-06-02 12:01   ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2015-06-02 10:58 UTC (permalink / raw)
  To: Jie Yang; +Cc: tiwai, alsa-devel, vivian.zhang, liam.r.girdwood


[-- Attachment #1.1: Type: text/plain, Size: 249 bytes --]

On Sat, May 30, 2015 at 09:28:31PM +0800, Jie Yang wrote:

> +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?

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: add config to enable/disable asoc compress
  2015-06-02 10:58 ` Mark Brown
@ 2015-06-02 12:01   ` Takashi Iwai
  2015-06-03  5:30     ` Jie, Yang
  0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2015-06-02 12:01 UTC (permalink / raw)
  To: Mark Brown; +Cc: vivian.zhang, alsa-devel, liam.r.girdwood

At Tue, 2 Jun 2015 11:58:14 +0100,
Mark Brown wrote:
> 
> On Sat, May 30, 2015 at 09:28:31PM +0800, Jie Yang wrote:
> 
> > +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?

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: add config to enable/disable asoc compress
  2015-06-02 12:01   ` Takashi Iwai
@ 2015-06-03  5:30     ` Jie, Yang
  0 siblings, 0 replies; 4+ messages in thread
From: Jie, Yang @ 2015-06-03  5:30 UTC (permalink / raw)
  To: Takashi Iwai, Mark Brown
  Cc: alsa-devel@alsa-project.org, Zhang, Vivian, Girdwood, Liam R

> -----Original Message-----
> From: Takashi Iwai [mailto:tiwai@suse.de]
> Sent: Tuesday, June 02, 2015 8:01 PM
> To: Mark Brown
> Cc: Jie, Yang; alsa-devel@alsa-project.org; Girdwood, Liam R; Zhang, Vivian
> Subject: Re: [PATCH] ASoC: add config to enable/disable asoc compress
> 
> At Tue, 2 Jun 2015 11:58:14 +0100,
> Mark Brown wrote:
> >
> > On Sat, May 30, 2015 at 09:28:31PM +0800, Jie Yang wrote:
> >
> > > +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?
> 
> Only about Makefile, it can be simplified like
> 
> snd-soc-core-$(CONFIG_SND_SOC_COMPRESS) += soc-compress.o
 
Got it, thanks.

> 
> 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.
 
Make it a module sounds good idea, I can change it in next version.

~Keyon

> 
> 
> Takashi

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-06-03  5:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-30 13:28 [PATCH] ASoC: add config to enable/disable asoc compress Jie Yang
2015-06-02 10:58 ` Mark Brown
2015-06-02 12:01   ` Takashi Iwai
2015-06-03  5:30     ` Jie, Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox