All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vinod Koul <vinod.koul@intel.com>
To: Mark Brown <broonie@kernel.org>
Cc: alsa-devel@alsa-project.org, subhransu.s.prusty@intel.com,
	lgirdwood@gmail.com
Subject: Re: [PATCH v9 1/6] ASoC: Intel: mrfld: add the gain controls
Date: Wed, 15 Oct 2014 15:53:03 +0530	[thread overview]
Message-ID: <20141015102303.GM1638@intel.com> (raw)
In-Reply-To: <20141015104947.GC27755@sirena.org.uk>


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

On Wed, Oct 15, 2014 at 12:49:47PM +0200, Mark Brown wrote:
> On Wed, Oct 15, 2014 at 12:34:56PM +0530, Vinod Koul wrote:
> 
> > +static const struct snd_kcontrol_new sst_gain_controls[] = {
> > +	SST_GAIN("media0_in", SST_PATH_INDEX_MEDIA0_IN, SST_TASK_MMX, 0, &sst_gains[0]),
> > +	SST_GAIN("media1_in", SST_PATH_INDEX_MEDIA1_IN, SST_TASK_MMX, 0, &sst_gains[1]),
> 
> > +
> > +/* the SST_GAIN macro above will create three alsa controls for each
> > + * instance invoked, gain, mute and ramp duration, which use the same gain
> > + * cell sst_gain to keep track of data
> > + *
> > + * To calculate number of gain cell instances we need to device by 3 in
> > + * below caulcation for gain cell memory.
> > + * This gets rid of static number and issues while adding new controls
> > + */
> > +static struct sst_gain_value sst_gains[ARRAY_SIZE(sst_gain_controls)/3];
> 
> The use of ARRAY_SIZE() is nice here but I'm a bit confused about the
> divide by 3 - there's an entry in sst_gains referenced for each element
> in sst_gain_controls.
Thats is the reason added the comment above.

gain cells are used to represent the three ALSA controls. So SST_GAIN macro
expands expands to three kcontrols. If we have 5 names in array, then
ARRAY_SIZE once expanded will tell me 15.

But for gain cell allocation, we use single gain cell in firmware to
represent all three controls, so that is why we divide here by three when
allocation the gain cells. Here in example we need only 5 cells. So SST_GAIN
macro has to be compensated for by dividing by 3 :)

Thanks

-- 
~Vinod

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

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



  reply	other threads:[~2014-10-15 10:58 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-15  7:04 [PATCH v9 0/6] Add mrfld DSP topology and widgets Vinod Koul
2014-10-15  7:04 ` [PATCH v9 1/6] ASoC: Intel: mrfld: add the gain controls Vinod Koul
2014-10-15 10:49   ` Mark Brown
2014-10-15 10:23     ` Vinod Koul [this message]
2014-10-15 13:08       ` Mark Brown
2014-10-15 12:39         ` Vinod Koul
2014-10-15  7:04 ` [PATCH v9 2/6] ASoC: Intel: mrfld: add DSP core controls Vinod Koul
2014-10-15 13:15   ` Mark Brown
2014-10-15 12:47     ` Vinod Koul
2014-10-15 14:05       ` Mark Brown
2014-10-15 13:45         ` Vinod Koul
2014-10-15 15:08           ` Mark Brown
2014-10-15 14:38             ` Vinod Koul
2014-10-15  7:04 ` [PATCH v9 3/6] ASoC: Intel: mrfld: add the DSP DAPM widgets Vinod Koul
2014-10-15  7:04 ` [PATCH v9 4/6] ASoC: core: Call mute for cpu dais as well Vinod Koul
2014-10-15  9:46   ` Mark Brown
2014-10-15  7:05 ` [PATCH v9 5/6] ASoC: Intel: mfld-pcm: add FE and BE ops Vinod Koul
2014-10-15  7:05 ` [PATCH v9 6/6] ASoC: Intel: mrfld: add the DSP mixers Vinod Koul
2014-10-15 12:46 ` [PATCH v9.1 1/6] ASoC: Intel: mrfld: add the gain controls Vinod Koul

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=20141015102303.GM1638@intel.com \
    --to=vinod.koul@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=subhransu.s.prusty@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.