diff --git a/sound/soc/qcom/common.c b/sound/soc/qcom/common.c index edc4611691f7..5adc6f24be96 100644 --- a/sound/soc/qcom/common.c +++ b/sound/soc/qcom/common.c @@ -6,7 +6,9 @@ #include #include #include +#include #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 */ { diff --git a/sound/soc/qcom/common.h b/sound/soc/qcom/common.h index ee6662885593..1e8edc7e1b87 100644 --- a/sound/soc/qcom/common.h +++ b/sound/soc/qcom/common.h @@ -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