Skip to contentSkip to conversation

ASoC: soc-compress: add a config item for soc-compress

PATCH Superseded Jie Yang 3 participants 12 messages Jun 12, 2015 – Jun 16, 2015

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Jie Yang

author
#0 lore raw

PATCH 1/2 ASoC: soc-compress: add a config item for soc-compress

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.

---
 include/sound/soc.h | 7 +++++++
 sound/soc/Kconfig   | 6 +++++-
 sound/soc/Makefile  | 3 ++-
 3 files changed, 14 insertions(+), 2 deletions(-)
include/sound/soc.h +7 -0
index 93df8bf..03c53a9 100644
@@ -440,7 +440,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 +5 -1
index e2828e1..de743d9 100644
@@ -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
+
 # All the supported SoCs
 source "sound/soc/adi/Kconfig"
 source "sound/soc/atmel/Kconfig"
sound/soc/Makefile +2 -1
index a0e1ee6..184c1e6 100644
@@ -1,6 +1,7 @@
 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-objs += soc-topology.o
+snd-soc-core-$(CONFIG_SND_SOC_COMPRESS) += soc-compress.o
 
 ifneq ($(CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM),)
 snd-soc-core-objs += soc-generic-dmaengine-pcm.o
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 2/2 ASoC: soc-compress: split soc-compress to a module

Split soc-compress into a separate module so we only compile/load it when it's needed.

---
 sound/soc/Makefile       |  4 +++-
 sound/soc/soc-compress.c | 20 ++++++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)
sound/soc/Makefile +3 -1
index 184c1e6..2936088 100644
@@ -1,7 +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-io.o soc-devres.o soc-ops.o
 snd-soc-core-objs += soc-topology.o
-snd-soc-core-$(CONFIG_SND_SOC_COMPRESS) += soc-compress.o
+snd-soc-compress-objs := soc-compress.o
+
+obj-$(CONFIG_SND_SOC_COMPRESS) += snd-soc-compress.o
 
 ifneq ($(CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM),)
 snd-soc-core-objs += soc-generic-dmaengine-pcm.o
sound/soc/soc-compress.c +20 -0
index 025c38f..9683f53 100644
@@ -19,6 +19,7 @@
 #include <linux/delay.h>
 #include <linux/slab.h>
 #include <linux/workqueue.h>
+#include <linux/module.h>
 #include <sound/core.h>
 #include <sound/compress_params.h>
 #include <sound/compress_driver.h>
@@ -703,3 +704,22 @@ compr_err:
 	kfree(compr);
 	return ret;
 }
+
+static int __init soc_compress_init(void)
+{
+       return 0;
+}
+module_init(soc_compress_init);
+
+static void __exit soc_compress_exit(void)
+{
+}
+module_exit(soc_compress_exit);
+
+/* Module information */
+MODULE_AUTHOR("Namarta Kohli <[email protected]>");
+MODULE_AUTHOR("Ramesh Babu K V <[email protected]>");
+MODULE_AUTHOR("Vinod Koul <[email protected]>");
+MODULE_DESCRIPTION("ALSA SoC Compress");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:soc-compress");
Signature · 1 line
1.9.1
maintainer
#2 lore raw

Re: [PATCH 2/2] ASoC: soc-compress: split soc-compress to a module

sound/soc/soc-compress.c compr_err: · line 717

Quoted 10 lines · Jie Yang
sound/soc/soc-compress.c +10 -0
+static int __init soc_compress_init(void)
+{
+       return 0;
+}
+module_init(soc_compress_init);
+
+static void __exit soc_compress_exit(void)
+{
+}
+module_exit(soc_compress_exit);

These are completely empty, why are they being added?

author
#3 lore raw

Re: [PATCH 2/2] ASoC: soc-compress: split soc-compress to a module

Quoted 11 lines

-----Original Message-----
From: Mark Brown [mailto:[email protected]]
Sent: Friday, June 12, 2015 8:15 PM
To: Jie, Yang
Cc: [email protected]; [email protected]; Girdwood, Liam R; [email protected]; [email protected]; Zhang, Vivian
Subject: Re: [PATCH 2/2] ASoC: soc-compress: split soc-compress to a module

On Fri, Jun 12, 2015 at 07:59:16PM +0800, Jie Yang wrote:

Quoted 9 lines

sound/soc/soc-compress.c compr_err: · line 717

Quoted 7 lines
sound/soc/soc-compress.c +7 -0
+static int __init soc_compress_init(void) {
+       return 0;
+}
+module_init(soc_compress_init);
+
+static void __exit soc_compress_exit(void) { }
+module_exit(soc_compress_exit);

These are completely empty, why are they being added?

I imitated that from sound/core/compress_offload.c, let me remove them.

~Keyon

maintainer
#4 lore raw

Re: [PATCH 2/2] ASoC: soc-compress: split soc-compress to a module

In reply to Jie Yang
Quoted 1 line · Jie Yang

+MODULE_ALIAS("platform:soc-compress");

Oh, and this is incorrect - there is no platform device driver in this file.

author
#5 lore raw

Re: [PATCH 2/2] ASoC: soc-compress: split soc-compress to a module

Quoted 9 lines

-----Original Message-----
From: Mark Brown [mailto:[email protected]]
Sent: Friday, June 12, 2015 8:16 PM
To: Jie, Yang
Cc: [email protected]; [email protected]; Girdwood, Liam R; [email protected]; [email protected]; Zhang, Vivian
Subject: Re: [PATCH 2/2] ASoC: soc-compress: split soc-compress to a module

Quoted 5 lines
Quoted 1 line · Jie Yang

+MODULE_ALIAS("platform:soc-compress");

Oh, and this is incorrect - there is no platform device driver in this file.

OK, will remove this line.

maintainer
#6 lore raw
In reply to Jie Yang

sound/soc/Kconfig config SND_SOC_GENERIC_DMAENGINE_PCM · line 36

Quoted 5 lines · Jie Yang
sound/soc/Kconfig +5 -0
+config SND_SOC_COMPRESS
+	tristate
+	select SND_COMPRESS_OFFLOAD
+	default n
+

No need to specify default n, it is the default. I'm not seeing any change here to make the drivers that do use compressed support select this symbol and since there's no config text there's no way for users to enable this on a per system basis so this breaks all existing compressed audio support.

author
#7 lore raw
Quoted 11 lines

-----Original Message-----
From: Mark Brown [mailto:[email protected]]
Sent: Friday, June 12, 2015 8:15 PM
To: Jie, Yang
Cc: [email protected]; [email protected]; Girdwood, Liam R; [email protected]; [email protected]; Zhang, Vivian
Subject: Re: [PATCH 1/2] ASoC: soc-compress: add a config item for soc- compress

On Fri, Jun 12, 2015 at 07:59:15PM +0800, Jie Yang wrote:

Quoted 7 lines

sound/soc/Kconfig config SND_SOC_GENERIC_DMAENGINE_PCM · line 36

Quoted 5 lines
sound/soc/Kconfig +5 -0
+config SND_SOC_COMPRESS
+	tristate
+	select SND_COMPRESS_OFFLOAD
+	default n
+

No need to specify default n, it is the default. I'm not seeing any change

OK, will remove this default setting.

Quoted 1 line

here to make the drivers that do use compressed support select this symbol

As mentioned in commit message, we need add 'select SND_SOC_COMPRESS' to driver Kconfig(e.g. sound/soc/intel/Kconfig) when it is needed.

Quoted 2 lines

and since there's no config text there's no way for users to enable this on a per system basis so this breaks all existing compressed audio support.

Do you mean I should add this message to 'Help' for this config item? Per my understanding, no existing driver really uses this compressed audio support currently, is that true?

~Keyon

maintainer
#8 lore raw
Quoted 11 lines · Yang
Quoted 1 line

here to make the drivers that do use compressed support select this symbol

As mentioned in commit message, we need add 'select SND_SOC_COMPRESS' to driver Kconfig(e.g. sound/soc/intel/Kconfig) when it is needed.

Quoted 2 lines

and since there's no config text there's no way for users to enable this on a per system basis so this breaks all existing compressed audio support.

Do you mean I should add this message to 'Help' for this config item? Per my understanding, no existing driver really uses this compressed audio support currently, is that true?

Some of the existing Intel machine drivers have references to compressed audio, it certainly looks like they're trying to use it. Are you saying that this is not actually the case?

author
#9 lore raw
Quoted 22 lines

-----Original Message-----
From: Mark Brown [mailto:[email protected]]
Sent: Friday, June 12, 2015 9:00 PM
To: Jie, Yang
Cc: [email protected]; [email protected]; Girdwood, Liam R; [email protected]; [email protected]; Zhang, Vivian
Subject: Re: [PATCH 1/2] ASoC: soc-compress: add a config item for soc- compress

Quoted 4 lines · Yang
Quoted 2 lines

here to make the drivers that do use compressed support select this symbol

As mentioned in commit message, we need add 'select

SND_SOC_COMPRESS'

Quoted 4 lines

to driver Kconfig(e.g. sound/soc/intel/Kconfig) when it is needed.

Quoted 2 lines

and since there's no config text there's no way for users to enable this on a per system basis so this breaks all existing compressed audio

support.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

Do you mean I should add this message to 'Help' for this config item? Per my understanding, no existing driver really uses this compressed audio support currently, is that true?

Some of the existing Intel machine drivers have references to compressed audio, it certainly looks like they're trying to use it. Are you saying that this is not actually the case?

Let me double confirm if the atom drivers are using it. Seems mfld platform is using that.

~Keyon

#10 lore raw
Quoted 8 lines · Yang
Quoted 8 lines

-----Original Message-----
From: Mark Brown [mailto:[email protected]]
Sent: Friday, June 12, 2015 9:00 PM
To: Jie, Yang
Cc: [email protected]; [email protected]; Girdwood, Liam R; [email protected]; [email protected]; Zhang, Vivian
Subject: Re: [PATCH 1/2] ASoC: soc-compress: add a config item for soc- compress

Okay didnt realise that its posted to alsa :( I need to remove all ref to @linux id as am not using that anymore

Quoted 18 lines
Quoted 18 lines · Yang
Quoted 5 lines
Quoted 3 lines

here to make the drivers that do use compressed support select this symbol

As mentioned in commit message, we need add 'select

SND_SOC_COMPRESS'

Quoted 4 lines

to driver Kconfig(e.g. sound/soc/intel/Kconfig) when it is needed.

Quoted 2 lines

and since there's no config text there's no way for users to enable this on a per system basis so this breaks all existing compressed audio

support.

Quoted 4 lines

Do you mean I should add this message to 'Help' for this config item? Per my understanding, no existing driver really uses this compressed audio support currently, is that true?

Quoted 6 lines
Quoted 3 lines

Some of the existing Intel machine drivers have references to compressed audio, it certainly looks like they're trying to use it. Are you saying that this is not actually the case?

Let me double confirm if the atom drivers are using it. Seems mfld platform is using that.

Yes and we will get runtime errors on all mfld-atom based drivers so please add that on all atom machines

Since the dummy symbols are present so we wont get build errors. If a driver is using the compressed API maybe we should not add dummy so that we catch ones which are not including this config option, so for that point I would say removal of dummay handlers looks best to me.

Signature · 1 line
~Vinod
author
#11 lore raw
Quoted 19 lines

-----Original Message-----
From: Koul, Vinod
Sent: Tuesday, June 16, 2015 4:14 PM
To: Jie, Yang
Cc: Mark Brown; [email protected]; [email protected]; [email protected]; Zhang, Vivian; [email protected]; Girdwood, Liam R
Subject: Re: [alsa-devel] [PATCH 1/2] ASoC: soc-compress: add a config item for soc-compress

Quoted 9 lines · Yang
Quoted 9 lines

-----Original Message-----
From: Mark Brown [mailto:[email protected]]
Sent: Friday, June 12, 2015 9:00 PM
To: Jie, Yang
Cc: [email protected]; [email protected]; Girdwood, Liam R; [email protected]; [email protected]; Zhang, Vivian
Subject: Re: [PATCH 1/2] ASoC: soc-compress: add a config item for soc- compress

Quoted 2 lines

Okay didnt realise that its posted to alsa :( I need to remove all ref to @linux id as am not using that anymore

Seems that's a big patch for replacing. :)

Quoted 26 lines
Quoted 20 lines
Quoted 20 lines · Yang
Quoted 5 lines
Quoted 3 lines

here to make the drivers that do use compressed support select this symbol

As mentioned in commit message, we need add 'select

SND_SOC_COMPRESS'

Quoted 5 lines

to driver Kconfig(e.g. sound/soc/intel/Kconfig) when it is needed.

Quoted 3 lines

and since there's no config text there's no way for users to enable this on a per system basis so this breaks all existing compressed audio

support.

Quoted 4 lines

Do you mean I should add this message to 'Help' for this config item? Per my understanding, no existing driver really uses this compressed audio support currently, is that true?

Quoted 6 lines
Quoted 3 lines

Some of the existing Intel machine drivers have references to compressed audio, it certainly looks like they're trying to use it. Are you saying that this is not actually the case?

Let me double confirm if the atom drivers are using it. Seems mfld platform is using that.

Quoted 7 lines

Yes and we will get runtime errors on all mfld-atom based drivers so please add that on all atom machines

Since the dummy symbols are present so we wont get build errors. If a driver is using the compressed API maybe we should not add dummy so that we catch ones which are not including this config option, so for that point I would say removal of dummay handlers looks best to me.

Hi, Vinod, as I mentioned in replying to v2 patch in another thread, here cpu_dai->driver->compress_dai is a runtime value, which means we don't know if we need compress API(for our driver) or not at compiling stage. So, reporting error at compiling stage looks not easy to be implemented.

At the same time, we return -EPERM to return and tell caller that compress operation is not permitted.

Anyway, let's discuss further on v2 patches thread.

Thanks,
~Keyon

Quoted 3 lines

--
~Vinod