[alsa-devel] [PATCH v9 1/6] ASoC: Intel: mrfld: add the gain controls

Mark Brown broonie at kernel.org
Wed Oct 15 12:49:47 CEST 2014


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20141015/8949702c/attachment.sig>


More information about the Alsa-devel mailing list