Re: [PATCH] ASoC: qcom: x1e80100: Allow userspace WSA RX channel map override

From: Mark Brown

Date: Wed Jun 10 2026 - 12:17:59 EST


On Wed, Jun 10, 2026 at 02:16:04PM +0300, Abel Vesa wrote:

> 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.

> Add a writable "Playback Channel Map" control on the WSA RX PCM via
> snd_pcm_add_chmap_ctls() and make it writable. The map selected by
> userspace (SNDRV_CHMAP_*) is stored per AFE port and, at .prepare()
> time, translated into the q6 PCM_CHANNEL_* slots and programmed into the
> DSP.

> When userspace has not provided a full map, the previous default
> mapping is used, so existing behaviour is preserved.

> +static int x1e80100_chmap_ctl_put(struct snd_kcontrol *kcontrol,
> + struct snd_ctl_elem_value *ucontrol)
> +{
> + struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol);
> + struct snd_soc_pcm_runtime *rtd = info->pcm->private_data;
> + struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
> + struct x1e80100_snd_data *data = snd_soc_card_get_drvdata(rtd->card);
> + unsigned int *map = data->user_chmap[cpu_dai->id];
> + int i;
> +
> + for (i = 0; i < info->max_channels; i++) {
> + unsigned int pos = ucontrol->value.integer.value[i];
> +
> + /* Validate every requested non-unset position up front. */
> + if (pos && x1e80100_chmap_to_q6(pos) < 0)
> + return -EINVAL;
> +
> + map[i] = pos;
> + }
> +
> + return 0;

This should return 1 if the value changed.

> @@ -34,6 +125,9 @@ static int x1e80100_snd_init(struct snd_soc_pcm_runtime *rtd)
> switch (cpu_dai->id) {
> case WSA_CODEC_DMA_RX_0:
> case WSA_CODEC_DMA_RX_1:
> + if (!rtd->pcm)
> + return 0;
> +
> /*
> * Set limit of -3 dB on Digital Volume and 0 dB on PA Volume
> * to reduce the risk of speaker damage until we have active

This hunk seems unrelated, I can't see anything about it in the commit
log either? I'm a bit confused about what this aims to achieve, I've
not checked which it is but either we should always have created the
PCMs here or we will never have created the PCMs here, it's weird that
this might vary.

Attachment: signature.asc
Description: PGP signature