Re: [PATCH 12/28] ASoC: ops: Introduce 'soc_set_enum_kctl'
From: Mark Brown
Date: Tue Sep 22 2026 - 06:03:39 EST
On Sun, Sep 20, 2026 at 02:53:51PM +1000, James Calligeros wrote:
> From: Martin Povišer <povik+lin@xxxxxxxxxxx>
>
> 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.
Attachment:
signature.asc
Description: PGP signature