[PATCH 12/28] ASoC: ops: Introduce 'soc_set_enum_kctl'

Mark Brown broonie at kernel.org
Tue Sep 22 02:50:38 PDT 2026


On Sun, Sep 20, 2026 at 02:53:51PM +1000, James Calligeros wrote:
> From: Martin Povišer <povik+lin at cutebit.org>
> 
> The new function is to be used to set enumerated controls to desired
> values -- either a single control or many controls in bulk by pattern.
> It is something a machine driver may call in fixup_controls.

> +static int soc_set_enum_kctl(struct snd_kcontrol *kctl, const char *strval)
> +{
> +	struct snd_ctl_elem_value value;
> +	struct snd_ctl_elem_info info;

Probably best to fully initialise the value, in particular while I don't
think anything currently does it we can have multiple enums in one
control like with stereo volume controls.

> +	for (i = 0; i < info.count; i++)
> +		value.value.enumerated.item[i] = sel;
> +
> +	return kctl->put(kctl, &value);

Should check that put exists.

> +/**
> + * snd_soc_set_enum_kctl - Set enumerated controls matching a pattern
> + *
> + * @card: where to look for the controls
> + * @name: name pattern
> + * @value: string value to set the controls to
> + *
> + * Return number of matching and set controls on success, else error.
> + * No controls need to match.
> + */
> +int snd_soc_set_enum_kctl(struct snd_soc_card *card,
> +	const char *name, const char *value)

We have both value and strval in different places.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20260922/94a0dd64/attachment.sig>


More information about the linux-arm-kernel mailing list