Re: [PATCH v3 3/3] ASoC: qcom: x1e80100: Allow userspace WSA RX chmap override

From: Mark Brown

Date: Fri Nov 20 2026 - 07:55:41 EST


> The WSA RX slot mapping is currently computed entirely from the channel
> count in .prepare() and pushed unconditionally via
> snd_soc_dai_set_channel_map(). Userspace has no way to express a
> different channel map, so any map defined in UCM is ignored.

> +
> +static int x1e80100_wsa_chmap_ctl_get(struct snd_kcontrol *kcontrol,
> + struct snd_ctl_elem_value *ucontrol)
> +{
> + unsigned int *map = x1e80100_wsa_chmap_from_kcontrol(kcontrol);
> + int i;
> +
> + if (!map)
> + return -EINVAL;
> +
> + for (i = 0; i < X1E80100_WSA_MAX_CHANNELS; i++)
> + ucontrol->value.integer.value[i] = map[i];

Nothing intialises the default maps AFAICT so this will just return 0s
until the control has been written.

> +static int x1e80100_wsa_chmap_ctl_put(struct snd_kcontrol *kcontrol,
> + struct snd_ctl_elem_value *ucontrol)
> +{

> + for (i = 0; i < X1E80100_WSA_MAX_CHANNELS; i++)
> + map[i] = ucontrol->value.integer.value[i];
> +
> + return 1;

This just stores the value but doesn't tell the hardware about it, we
only write at prepare() time. Either the writes should take effect or
we should refuse them while the stream is prepared.

> +static int x1e80100_add_wsa_chmap_ctls(struct snd_soc_pcm_runtime *rtd,
> + const char *name)
> +{

> + /*
> + * The core registers a query-only control. Make it writable so that
> + * userspace (UCM) can select the WSA channel map. The card is not yet
> + * registered at this point, so the control is not visible to
> + * userspace while being modified.
> + */
> + for (i = 0; i < info->kctl->count; i++)
> + info->kctl->vd[i].access |= SNDRV_CTL_ELEM_ACCESS_WRITE;
> + info->kctl->get = x1e80100_wsa_chmap_ctl_get;
> + info->kctl->put = x1e80100_wsa_chmap_ctl_put;

The TLV should also advertise SNDRV_CTL_TLVT_CHMAP_VAR.

--
Mark Brown <broonie@xxxxxxxxxx>