ASoC: qcom: common: Add SNDRV channel map to Q6 slot helper

Add a small helper that converts ALSA channel map positions to the Q6 PCM
channel identifiers used by Qualcomm machine drivers.

The mapping is useful beyond a single machine driver when exposing
writable channel-map controls.

Assisted-by: Codex:GPT-5.5
Link: https://patch.msgid.link/20260724-b4-sound-qcom-x1e80100-allow-ucm-channel-map-v2-1-2ca3c1250018@oss.qualcomm.com
Signed-off-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
This commit is contained in:
Abel Vesa
2026-08-05 15:37:10 +03:00
parent 7cc8e7c6d6
commit 866e8702bf
2 changed files with 31 additions and 0 deletions
+30
View File
@@ -6,7 +6,9 @@
#include <linux/module.h>
#include <sound/jack.h>
#include <linux/input-event-codes.h>
#include <sound/pcm.h>
#include "common.h"
#include "qdsp6/q6dsp-common.h"
#define NAME_SIZE 32
@@ -172,6 +174,34 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
}
EXPORT_SYMBOL_GPL(qcom_snd_parse_of);
int qcom_snd_chmap_to_q6(unsigned int pos)
{
switch (pos) {
case SNDRV_CHMAP_FL:
return PCM_CHANNEL_FL;
case SNDRV_CHMAP_FR:
return PCM_CHANNEL_FR;
case SNDRV_CHMAP_MONO:
case SNDRV_CHMAP_FC:
return PCM_CHANNEL_FC;
case SNDRV_CHMAP_LFE:
return PCM_CHANNEL_LFE;
case SNDRV_CHMAP_RL:
return PCM_CHANNEL_LB;
case SNDRV_CHMAP_RR:
return PCM_CHANNEL_RB;
case SNDRV_CHMAP_SL:
return PCM_CHANNEL_LS;
case SNDRV_CHMAP_SR:
return PCM_CHANNEL_RS;
case SNDRV_CHMAP_RC:
return PCM_CHANNEL_CS;
default:
return -EINVAL;
}
}
EXPORT_SYMBOL_GPL(qcom_snd_chmap_to_q6);
static struct snd_soc_jack_pin qcom_headset_jack_pins[] = {
/* Headset */
{
+1
View File
@@ -14,6 +14,7 @@ int qcom_snd_wcd_jack_setup(struct snd_soc_pcm_runtime *rtd,
struct snd_soc_jack *jack, bool *jack_setup);
int qcom_snd_dp_jack_setup(struct snd_soc_pcm_runtime *rtd,
struct snd_soc_jack *dp_jack, int id);
int qcom_snd_chmap_to_q6(unsigned int pos);
#endif