Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: "Jie, Yang" <yang.jie@intel.com>
Cc: "ramesh.babu@linux.intel.com" <ramesh.babu@linux.intel.com>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"Zhang, Vivian" <vivian.zhang@intel.com>,
	"vinod.koul@linux.intel.com" <vinod.koul@linux.intel.com>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"Girdwood, Liam R" <liam.r.girdwood@intel.com>
Subject: Re: [PATCH v2 1/2] ASoC: soc-compress: add a config item for soc-compress
Date: Mon, 15 Jun 2015 16:26:54 +0200	[thread overview]
Message-ID: <s5h4mm9gi8h.wl-tiwai@suse.de> (raw)
In-Reply-To: <E7B1D079BA13FB44A978CC8F69C7D6A90554AA25@SHSMSX101.ccr.corp.intel.com>

At Mon, 15 Jun 2015 14:15:40 +0000,
Jie, Yang wrote:
> 
> > -----Original Message-----
> > From: Takashi Iwai [mailto:tiwai@suse.de]
> > Sent: Monday, June 15, 2015 7:34 PM
> > To: Jie, Yang
> > Cc: broonie@kernel.org; alsa-devel@alsa-project.org; Girdwood, Liam R;
> > vinod.koul@linux.intel.com; ramesh.babu@linux.intel.com; Zhang, Vivian
> > Subject: Re: [PATCH v2 1/2] ASoC: soc-compress: add a config item for soc-
> > compress
> > 
> > At Mon, 15 Jun 2015 11:20:44 +0800,
> > Jie Yang wrote:
> > >
> > > 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.
> > >
> > > Signed-off-by: Jie Yang <yang.jie@intel.com>
> > > ---
> > >  include/sound/soc.h     | 7 +++++++
> > >  sound/soc/Kconfig       | 5 ++++-
> > >  sound/soc/Makefile      | 3 ++-
> > >  sound/soc/intel/Kconfig | 1 +
> > >  4 files changed, 14 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/include/sound/soc.h b/include/sound/soc.h index
> > > 93df8bf..cc1cd4f 100644
> > > --- a/include/sound/soc.h
> > > +++ b/include/sound/soc.h
> > > @@ -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);
> > > +#if IS_ENABLED(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
> > 
> > A dummy function in such a case has both merit and demerit.  The demerit is
> > that you won't get errors if the driver really wants the compress support but
> > just forgot to select the dependency.
>  
> Here I used -EPERM to return and tell caller that compress operation is not
> permitted, does it make sense, Takashi?

The question is whether a runtime error is the best option.  A runtime
error won't be caught by build tests but only when actually running by
a user.

> Or can you suggest a better solution, according to this specific case?

Well, there are several ways, obviously (e.g. give the preprocessor
error if CONFIG_SND_SOC_COMPRESS is enabled).  But I'm not sure what
is the best to fit, too.  It's rather a matter of taste.


Takashi

> Thanks,
> ~Keyon
> > 
> > 
> > Takashi
> > 
> > >  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
> > > e2828e1..a124759 100644
> > > --- a/sound/soc/Kconfig
> > > +++ b/sound/soc/Kconfig
> > > @@ -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
> > > +	tristate
> > > +	select SND_COMPRESS_OFFLOAD
> > > +
> > >  # 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
> > > a0e1ee6..184c1e6 100644
> > > --- a/sound/soc/Makefile
> > > +++ b/sound/soc/Makefile
> > > @@ -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 diff --git
> > > a/sound/soc/intel/Kconfig b/sound/soc/intel/Kconfig index
> > > 791953f..e559174 100644
> > > --- a/sound/soc/intel/Kconfig
> > > +++ b/sound/soc/intel/Kconfig
> > > @@ -12,6 +12,7 @@ config SND_MFLD_MACHINE
> > >
> > >  config SND_SST_MFLD_PLATFORM
> > >  	tristate
> > > +	select SND_SOC_COMPRESS
> > >
> > >  config SND_SST_IPC
> > >  	tristate
> > > --
> > > 1.9.1
> > >
> 

  reply	other threads:[~2015-06-15 14:26 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-15  3:20 [PATCH v2 1/2] ASoC: soc-compress: add a config item for soc-compress Jie Yang
2015-06-15  3:20 ` [PATCH v2 2/2] ASoC: soc-compress: split soc-compress to a module Jie Yang
2015-06-15 15:07   ` Mark Brown
2015-06-15 11:33 ` [PATCH v2 1/2] ASoC: soc-compress: add a config item for soc-compress Takashi Iwai
2015-06-15 14:15   ` Jie, Yang
2015-06-15 14:26     ` Takashi Iwai [this message]
2015-06-15 14:46       ` Jie, Yang
2015-06-15 15:05         ` Mark Brown
2015-06-16  0:49           ` Jie, Yang
2015-06-16 10:54             ` Mark Brown
2015-06-16 12:36               ` Jie, Yang
2015-06-16 16:06                 ` Mark Brown
2015-06-16 16:14                   ` Takashi Iwai
2015-06-16 16:17                     ` Takashi Iwai
2015-06-16 16:25                       ` Vinod Koul
2015-06-16 16:36                         ` Takashi Iwai
2015-06-17  2:54                           ` Vinod Koul
2015-06-17 12:23                             ` Mark Brown
2015-06-17 16:22                               ` Vinod Koul
2015-06-17 16:38                                 ` Mark Brown
2015-06-18  2:59                               ` Jie, Yang
2015-06-17 11:10                           ` Jie, Yang
2015-09-15  6:53                           ` Jie, Yang
2015-06-16 16:29                       ` Qais Yousef

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5h4mm9gi8h.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=liam.r.girdwood@intel.com \
    --cc=ramesh.babu@linux.intel.com \
    --cc=vinod.koul@linux.intel.com \
    --cc=vivian.zhang@intel.com \
    --cc=yang.jie@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox