Merge "ASoC: update channel map for rx multi codec usecase"
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

commit
03011b6324
@@ -2154,7 +2154,7 @@ static int lpass_cdc_wsa2_macro_soft_clip_enable_put(struct snd_kcontrol *kcontr
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct snd_kcontrol_new lpass_cdc_wsa2_macro_snd_controls[] = {
|
static const struct snd_kcontrol_new lpass_cdc_wsa2_macro_snd_controls[] = {
|
||||||
SOC_ENUM_EXT("GSM mode Enable", lpass_cdc_wsa2_macro_vbat_bcl_gsm_mode_enum,
|
SOC_ENUM_EXT("WSA2_GSM mode Enable", lpass_cdc_wsa2_macro_vbat_bcl_gsm_mode_enum,
|
||||||
lpass_cdc_wsa2_macro_vbat_bcl_gsm_mode_func_get,
|
lpass_cdc_wsa2_macro_vbat_bcl_gsm_mode_func_get,
|
||||||
lpass_cdc_wsa2_macro_vbat_bcl_gsm_mode_func_put),
|
lpass_cdc_wsa2_macro_vbat_bcl_gsm_mode_func_put),
|
||||||
SOC_ENUM_EXT("WSA2_RX0 comp_mode", lpass_cdc_wsa2_macro_comp_mode_enum,
|
SOC_ENUM_EXT("WSA2_RX0 comp_mode", lpass_cdc_wsa2_macro_comp_mode_enum,
|
||||||
|
@@ -1741,6 +1741,9 @@ static int wsa883x_swr_probe(struct swr_device *pdev)
|
|||||||
/* Get last digit from HEX format */
|
/* Get last digit from HEX format */
|
||||||
dev_index = (int)((char)(pdev->addr & 0xF));
|
dev_index = (int)((char)(pdev->addr & 0xF));
|
||||||
|
|
||||||
|
if (of_device_is_compatible(pdev->dev.of_node, "qcom,wsa883x_2"))
|
||||||
|
dev_index += 2;
|
||||||
|
|
||||||
snprintf(buffer, sizeof(buffer), "wsa-codec.%d", dev_index);
|
snprintf(buffer, sizeof(buffer), "wsa-codec.%d", dev_index);
|
||||||
wsa883x->driver->name = kstrndup(buffer, strlen(buffer), GFP_KERNEL);
|
wsa883x->driver->name = kstrndup(buffer, strlen(buffer), GFP_KERNEL);
|
||||||
|
|
||||||
|
@@ -40,6 +40,8 @@ struct snd_card_pdata {
|
|||||||
#define BUF_SZ 32
|
#define BUF_SZ 32
|
||||||
#define DIR_SZ 10
|
#define DIR_SZ 10
|
||||||
|
|
||||||
|
#define MAX_CODEC_DAI 8
|
||||||
|
|
||||||
static struct attribute device_state_attr = {
|
static struct attribute device_state_attr = {
|
||||||
.name = "state",
|
.name = "state",
|
||||||
.mode = 0660,
|
.mode = 0660,
|
||||||
@@ -60,7 +62,8 @@ enum backend_id {
|
|||||||
|
|
||||||
struct chmap_pdata {
|
struct chmap_pdata {
|
||||||
int id;
|
int id;
|
||||||
struct snd_soc_dai *dai;
|
uint32_t num_codec_dai;
|
||||||
|
struct snd_soc_dai *dai[MAX_CODEC_DAI];
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MAX_USR_INPUT 10
|
#define MAX_USR_INPUT 10
|
||||||
@@ -378,27 +381,28 @@ int msm_channel_map_get(struct snd_kcontrol *kcontrol,
|
|||||||
uint32_t rx_ch[MAX_PORT], tx_ch[MAX_PORT];
|
uint32_t rx_ch[MAX_PORT], tx_ch[MAX_PORT];
|
||||||
uint32_t rx_ch_cnt = 0, tx_ch_cnt = 0;
|
uint32_t rx_ch_cnt = 0, tx_ch_cnt = 0;
|
||||||
uint32_t *chmap_data = NULL;
|
uint32_t *chmap_data = NULL;
|
||||||
int ret = 0, len = 0;
|
int ret = 0, len = 0, i = 0;
|
||||||
|
|
||||||
if (kctl_pdata == NULL) {
|
if (kctl_pdata == NULL) {
|
||||||
pr_debug("%s: chmap_pdata is not initialized\n", __func__);
|
pr_debug("%s: chmap_pdata is not initialized\n", __func__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
codec_dai = kctl_pdata->dai;
|
codec_dai = kctl_pdata->dai[0];
|
||||||
backend_id = kctl_pdata->id;
|
backend_id = kctl_pdata->id;
|
||||||
|
|
||||||
ret = snd_soc_dai_get_channel_map(codec_dai,
|
|
||||||
&tx_ch_cnt, tx_ch, &rx_ch_cnt, rx_ch);
|
|
||||||
if (ret || (tx_ch_cnt == 0 && rx_ch_cnt == 0)) {
|
|
||||||
pr_err("%s: get channel map failed for %d\n",
|
|
||||||
__func__, backend_id);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
switch (backend_id) {
|
switch (backend_id) {
|
||||||
case SLIM: {
|
case SLIM: {
|
||||||
uint32_t *chmap;
|
uint32_t *chmap;
|
||||||
uint32_t ch_cnt, i;
|
uint32_t ch_cnt;
|
||||||
|
|
||||||
|
ret = snd_soc_dai_get_channel_map(codec_dai,
|
||||||
|
&tx_ch_cnt, tx_ch, &rx_ch_cnt, rx_ch);
|
||||||
|
if (ret || (tx_ch_cnt == 0 && rx_ch_cnt == 0)) {
|
||||||
|
pr_debug("%s: got incorrect channel map for backend_id:%d\n",
|
||||||
|
__func__, backend_id);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
if (rx_ch_cnt) {
|
if (rx_ch_cnt) {
|
||||||
chmap = rx_ch;
|
chmap = rx_ch;
|
||||||
@@ -420,6 +424,46 @@ int msm_channel_map_get(struct snd_kcontrol *kcontrol,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CODEC_DMA: {
|
case CODEC_DMA: {
|
||||||
|
uint32_t cur_rx_ch = 0, cur_tx_ch = 0;
|
||||||
|
uint32_t cur_rx_ch_cnt = 0, cur_tx_ch_cnt = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < kctl_pdata->num_codec_dai; ++i) {
|
||||||
|
codec_dai = kctl_pdata->dai[i];
|
||||||
|
if(!codec_dai) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
cur_rx_ch_cnt = 0;
|
||||||
|
cur_tx_ch_cnt = 0;
|
||||||
|
cur_tx_ch = 0;
|
||||||
|
cur_rx_ch = 0;
|
||||||
|
ret = snd_soc_dai_get_channel_map(codec_dai,
|
||||||
|
&cur_tx_ch_cnt, &cur_tx_ch,
|
||||||
|
&cur_rx_ch_cnt, &cur_rx_ch);
|
||||||
|
|
||||||
|
/* DAIs that not supports get_channel_map should pass */
|
||||||
|
if (ret && (ret != -ENOTSUPP)) {
|
||||||
|
pr_err("%s: get channel map failed for backend_id:%d,"
|
||||||
|
" ret:%d\n",
|
||||||
|
__func__, backend_id, ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
rx_ch_cnt += cur_rx_ch_cnt;
|
||||||
|
tx_ch_cnt += cur_tx_ch_cnt;
|
||||||
|
rx_ch[0] |= cur_rx_ch;
|
||||||
|
tx_ch[0] |= cur_tx_ch;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* reset return value from the loop above */
|
||||||
|
ret = 0;
|
||||||
|
if (rx_ch_cnt == 0 && tx_ch_cnt == 0) {
|
||||||
|
pr_debug("%s: got incorrect channel map for backend_id:%d, ",
|
||||||
|
"RX Channel Count:%d,"
|
||||||
|
"TX Channel Count:%d\n",
|
||||||
|
__func__, backend_id, rx_ch_cnt, tx_ch_cnt);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
chmap_data = kzalloc(sizeof(uint32_t) * 2, GFP_KERNEL);
|
chmap_data = kzalloc(sizeof(uint32_t) * 2, GFP_KERNEL);
|
||||||
if (!chmap_data)
|
if (!chmap_data)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@@ -466,6 +510,7 @@ int msm_common_dai_link_init(struct snd_soc_pcm_runtime *rtd)
|
|||||||
struct device *dev = rtd->card->dev;
|
struct device *dev = rtd->card->dev;
|
||||||
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
int index = 0;
|
||||||
const char *mixer_ctl_name = CODEC_CHMAP;
|
const char *mixer_ctl_name = CODEC_CHMAP;
|
||||||
char *mixer_str = NULL;
|
char *mixer_str = NULL;
|
||||||
char *backend_name = NULL;
|
char *backend_name = NULL;
|
||||||
@@ -521,12 +566,20 @@ int msm_common_dai_link_init(struct snd_soc_pcm_runtime *rtd)
|
|||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto free_mixer_str;
|
goto free_mixer_str;
|
||||||
}
|
}
|
||||||
if (!strncmp(backend_name, "SLIM", strlen("SLIM")))
|
|
||||||
pdata->id = SLIM;
|
|
||||||
else
|
|
||||||
pdata->id = CODEC_DMA;
|
|
||||||
|
|
||||||
pdata->dai = codec_dai;
|
pdata->dai[0] = codec_dai;
|
||||||
|
pdata->num_codec_dai = 1;
|
||||||
|
if (!strncmp(backend_name, "SLIM", strlen("SLIM"))) {
|
||||||
|
pdata->id = SLIM;
|
||||||
|
} else {
|
||||||
|
pdata->id = CODEC_DMA;
|
||||||
|
if (rtd->num_codecs <= MAX_CODEC_DAI) {
|
||||||
|
pdata->num_codec_dai = rtd->num_codecs;
|
||||||
|
for_each_rtd_codec_dais(rtd, index, codec_dai) {
|
||||||
|
pdata->dai[index] = codec_dai;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
kctl->private_data = pdata;
|
kctl->private_data = pdata;
|
||||||
free_mixer_str:
|
free_mixer_str:
|
||||||
kfree(backend_name);
|
kfree(backend_name);
|
||||||
|
@@ -54,31 +54,22 @@ SND_SOC_DAILINK_DEFS(auxpcm_tx,
|
|||||||
SND_SOC_DAILINK_DEFS(wsa_dma_rx0,
|
SND_SOC_DAILINK_DEFS(wsa_dma_rx0,
|
||||||
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
|
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
|
||||||
DAILINK_COMP_ARRAY(COMP_CODEC("lpass-cdc", "wsa_macro_rx1"),
|
DAILINK_COMP_ARRAY(COMP_CODEC("lpass-cdc", "wsa_macro_rx1"),
|
||||||
// COMP_CODEC("lpass-cdc", "wsa2_macro_rx1"),
|
|
||||||
COMP_CODEC("wsa-codec1", "wsa_rx1"),
|
COMP_CODEC("wsa-codec1", "wsa_rx1"),
|
||||||
COMP_CODEC("wsa-codec2", "wsa_rx2"),
|
COMP_CODEC("wsa-codec2", "wsa_rx2")),
|
||||||
COMP_CODEC("wsa-codec3", "wsa_rx3"),
|
|
||||||
COMP_CODEC("wsa-codec4", "wsa_rx4")),
|
|
||||||
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
|
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
|
||||||
|
|
||||||
SND_SOC_DAILINK_DEFS(wsa_dma_rx1,
|
SND_SOC_DAILINK_DEFS(wsa_dma_rx1,
|
||||||
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
|
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
|
||||||
DAILINK_COMP_ARRAY(COMP_CODEC("lpass-cdc", "wsa_macro_rx_mix"),
|
DAILINK_COMP_ARRAY(COMP_CODEC("lpass-cdc", "wsa_macro_rx_mix"),
|
||||||
// COMP_CODEC("lpass-cdc", "wsa2_macro_rx_mix"),
|
|
||||||
COMP_CODEC("wsa-codec1", "wsa_rx1"),
|
COMP_CODEC("wsa-codec1", "wsa_rx1"),
|
||||||
COMP_CODEC("wsa-codec2", "wsa_rx2"),
|
COMP_CODEC("wsa-codec2", "wsa_rx2")),
|
||||||
COMP_CODEC("wsa-codec3", "wsa_rx3"),
|
|
||||||
COMP_CODEC("wsa-codec4", "wsa_rx4")),
|
|
||||||
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
|
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
|
||||||
|
|
||||||
SND_SOC_DAILINK_DEFS(wsa_dma_tx1,
|
SND_SOC_DAILINK_DEFS(wsa_dma_tx1,
|
||||||
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
|
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
|
||||||
DAILINK_COMP_ARRAY(COMP_CODEC("lpass-cdc", "wsa_macro_echo"),
|
DAILINK_COMP_ARRAY(COMP_CODEC("lpass-cdc", "wsa_macro_echo"),
|
||||||
// COMP_CODEC("lpass-cdc", "wsa2_macro_echo"),
|
|
||||||
COMP_CODEC("wsa-codec1", "wsa_rx1"),
|
COMP_CODEC("wsa-codec1", "wsa_rx1"),
|
||||||
COMP_CODEC("wsa-codec2", "wsa_rx2"),
|
COMP_CODEC("wsa-codec2", "wsa_rx2")),
|
||||||
COMP_CODEC("wsa-codec3", "wsa_rx3"),
|
|
||||||
COMP_CODEC("wsa-codec4", "wsa_rx4")),
|
|
||||||
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
|
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
|
||||||
|
|
||||||
SND_SOC_DAILINK_DEFS(wsa2_dma_rx0,
|
SND_SOC_DAILINK_DEFS(wsa2_dma_rx0,
|
||||||
@@ -102,6 +93,36 @@ SND_SOC_DAILINK_DEFS(wsa2_dma_tx1,
|
|||||||
COMP_CODEC("wsa-codec4", "wsa_rx4")),
|
COMP_CODEC("wsa-codec4", "wsa_rx4")),
|
||||||
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
|
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
|
||||||
|
|
||||||
|
SND_SOC_DAILINK_DEFS(wsa_wsa2_dma_rx0,
|
||||||
|
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
|
||||||
|
DAILINK_COMP_ARRAY(COMP_CODEC("lpass-cdc", "wsa_macro_rx1"),
|
||||||
|
COMP_CODEC("lpass-cdc", "wsa2_macro_rx1"),
|
||||||
|
COMP_CODEC("wsa-codec1", "wsa_rx1"),
|
||||||
|
COMP_CODEC("wsa-codec2", "wsa_rx2"),
|
||||||
|
COMP_CODEC("wsa-codec3", "wsa_rx3"),
|
||||||
|
COMP_CODEC("wsa-codec4", "wsa_rx4")),
|
||||||
|
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
|
||||||
|
|
||||||
|
SND_SOC_DAILINK_DEFS(wsa_wsa2_dma_rx1,
|
||||||
|
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
|
||||||
|
DAILINK_COMP_ARRAY(COMP_CODEC("lpass-cdc", "wsa_macro_rx_mix"),
|
||||||
|
COMP_CODEC("lpass-cdc", "wsa2_macro_rx_mix"),
|
||||||
|
COMP_CODEC("wsa-codec1", "wsa_rx1"),
|
||||||
|
COMP_CODEC("wsa-codec2", "wsa_rx2"),
|
||||||
|
COMP_CODEC("wsa-codec3", "wsa_rx3"),
|
||||||
|
COMP_CODEC("wsa-codec4", "wsa_rx4")),
|
||||||
|
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
|
||||||
|
|
||||||
|
SND_SOC_DAILINK_DEFS(wsa_wsa2_dma_tx1,
|
||||||
|
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
|
||||||
|
DAILINK_COMP_ARRAY(COMP_CODEC("lpass-cdc", "wsa_macro_echo"),
|
||||||
|
COMP_CODEC("lpass-cdc", "wsa2_macro_echo"),
|
||||||
|
COMP_CODEC("wsa-codec1", "wsa_rx1"),
|
||||||
|
COMP_CODEC("wsa-codec2", "wsa_rx2"),
|
||||||
|
COMP_CODEC("wsa-codec3", "wsa_rx3"),
|
||||||
|
COMP_CODEC("wsa-codec4", "wsa_rx4")),
|
||||||
|
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
|
||||||
|
|
||||||
SND_SOC_DAILINK_DEFS(rx_dma_rx0,
|
SND_SOC_DAILINK_DEFS(rx_dma_rx0,
|
||||||
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
|
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
|
||||||
DAILINK_COMP_ARRAY(COMP_CODEC("lpass-cdc", "rx_macro_rx1"),
|
DAILINK_COMP_ARRAY(COMP_CODEC("lpass-cdc", "rx_macro_rx1"),
|
||||||
@@ -309,6 +330,12 @@ SND_SOC_DAILINK_DEFS(wsa2_vi_feedback,
|
|||||||
DAILINK_COMP_ARRAY(COMP_CODEC("lpass-cdc", "wsa2_macro_vifeedback")),
|
DAILINK_COMP_ARRAY(COMP_CODEC("lpass-cdc", "wsa2_macro_vifeedback")),
|
||||||
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
|
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
|
||||||
|
|
||||||
|
SND_SOC_DAILINK_DEFS(wsa_wsa2_vi_feedback,
|
||||||
|
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
|
||||||
|
DAILINK_COMP_ARRAY(COMP_CODEC("lpass-cdc", "wsa_macro_vifeedback"),
|
||||||
|
COMP_CODEC("lpass-cdc", "wsa2_macro_vifeedback")),
|
||||||
|
DAILINK_COMP_ARRAY(COMP_PLATFORM("snd-soc-dummy")));
|
||||||
|
|
||||||
SND_SOC_DAILINK_DEFS(tavil_i2s_rx1,
|
SND_SOC_DAILINK_DEFS(tavil_i2s_rx1,
|
||||||
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
|
DAILINK_COMP_ARRAY(COMP_CPU("snd-soc-dummy-dai")),
|
||||||
DAILINK_COMP_ARRAY(COMP_CODEC("tavil_codec", "tavil_i2s_rx1")),
|
DAILINK_COMP_ARRAY(COMP_CODEC("tavil_codec", "tavil_i2s_rx1")),
|
||||||
|
193
asoc/waipio.c
193
asoc/waipio.c
@@ -57,6 +57,11 @@
|
|||||||
#define WCN_CDC_SLIM_TX_CH_MAX 2
|
#define WCN_CDC_SLIM_TX_CH_MAX 2
|
||||||
#define WCN_CDC_SLIM_TX_CH_MAX_LITO 3
|
#define WCN_CDC_SLIM_TX_CH_MAX_LITO 3
|
||||||
|
|
||||||
|
/* Number of WSAs */
|
||||||
|
#define MONO_SPEAKER 1
|
||||||
|
#define STEREO_SPEAKER 2
|
||||||
|
#define QUAD_SPEAKER 4
|
||||||
|
|
||||||
struct msm_asoc_mach_data {
|
struct msm_asoc_mach_data {
|
||||||
struct snd_info_entry *codec_root;
|
struct snd_info_entry *codec_root;
|
||||||
struct msm_common_pdata *common_pdata;
|
struct msm_common_pdata *common_pdata;
|
||||||
@@ -386,26 +391,6 @@ static struct snd_soc_dai_link msm_common_be_dai_links[] = {
|
|||||||
.ops = &msm_common_be_ops,
|
.ops = &msm_common_be_ops,
|
||||||
SND_SOC_DAILINK_REG(usb_audio_tx),
|
SND_SOC_DAILINK_REG(usb_audio_tx),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
.name = LPASS_BE_WSA_CDC_DMA_TX_0,
|
|
||||||
.stream_name = LPASS_BE_WSA_CDC_DMA_TX_0,
|
|
||||||
.capture_only = 1,
|
|
||||||
.ignore_suspend = 1,
|
|
||||||
.ops = &msm_common_be_ops,
|
|
||||||
/* .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, */
|
|
||||||
SND_SOC_DAILINK_REG(vi_feedback),
|
|
||||||
},
|
|
||||||
#if 0
|
|
||||||
{
|
|
||||||
.name = LPASS_BE_WSA2_CDC_DMA_TX_0,
|
|
||||||
.stream_name = LPASS_BE_WSA2_CDC_DMA_TX_0,
|
|
||||||
.capture_only = 1,
|
|
||||||
.ignore_suspend = 1,
|
|
||||||
.ops = &msm_common_be_ops,
|
|
||||||
/* .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, */
|
|
||||||
SND_SOC_DAILINK_REG(wsa2_vi_feedback),
|
|
||||||
},
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct snd_soc_dai_link msm_wcn_be_dai_links[] = {
|
static struct snd_soc_dai_link msm_wcn_be_dai_links[] = {
|
||||||
@@ -483,9 +468,17 @@ static struct snd_soc_dai_link msm_wsa_cdc_dma_be_dai_links[] = {
|
|||||||
.ops = &msm_common_be_ops,
|
.ops = &msm_common_be_ops,
|
||||||
SND_SOC_DAILINK_REG(wsa_dma_tx1),
|
SND_SOC_DAILINK_REG(wsa_dma_tx1),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.name = LPASS_BE_WSA_CDC_DMA_TX_0,
|
||||||
|
.stream_name = LPASS_BE_WSA_CDC_DMA_TX_0,
|
||||||
|
.capture_only = 1,
|
||||||
|
.ignore_suspend = 1,
|
||||||
|
.ops = &msm_common_be_ops,
|
||||||
|
/* .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, */
|
||||||
|
SND_SOC_DAILINK_REG(vi_feedback),
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
#if 0
|
|
||||||
static struct snd_soc_dai_link msm_wsa2_cdc_dma_be_dai_links[] = {
|
static struct snd_soc_dai_link msm_wsa2_cdc_dma_be_dai_links[] = {
|
||||||
/* WSA2 CDC DMA Backend DAI Links */
|
/* WSA2 CDC DMA Backend DAI Links */
|
||||||
{
|
{
|
||||||
@@ -520,8 +513,62 @@ static struct snd_soc_dai_link msm_wsa2_cdc_dma_be_dai_links[] = {
|
|||||||
.ops = &msm_common_be_ops,
|
.ops = &msm_common_be_ops,
|
||||||
SND_SOC_DAILINK_REG(wsa2_dma_tx1),
|
SND_SOC_DAILINK_REG(wsa2_dma_tx1),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.name = LPASS_BE_WSA2_CDC_DMA_TX_0,
|
||||||
|
.stream_name = LPASS_BE_WSA2_CDC_DMA_TX_0,
|
||||||
|
.capture_only = 1,
|
||||||
|
.ignore_suspend = 1,
|
||||||
|
.ops = &msm_common_be_ops,
|
||||||
|
/* .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, */
|
||||||
|
SND_SOC_DAILINK_REG(wsa2_vi_feedback),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct snd_soc_dai_link msm_wsa_wsa2_cdc_dma_be_dai_links[] = {
|
||||||
|
/* WSA CDC DMA Backend DAI Links */
|
||||||
|
{
|
||||||
|
.name = LPASS_BE_WSA_CDC_DMA_RX_0,
|
||||||
|
.stream_name = LPASS_BE_WSA_CDC_DMA_RX_0,
|
||||||
|
.playback_only = 1,
|
||||||
|
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
|
||||||
|
SND_SOC_DPCM_TRIGGER_POST},
|
||||||
|
.ignore_pmdown_time = 1,
|
||||||
|
.ignore_suspend = 1,
|
||||||
|
.ops = &msm_common_be_ops,
|
||||||
|
SND_SOC_DAILINK_REG(wsa_wsa2_dma_rx0),
|
||||||
|
.init = &msm_int_wsa_init,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = LPASS_BE_WSA_CDC_DMA_RX_1,
|
||||||
|
.stream_name = LPASS_BE_WSA_CDC_DMA_RX_1,
|
||||||
|
.playback_only = 1,
|
||||||
|
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
|
||||||
|
SND_SOC_DPCM_TRIGGER_POST},
|
||||||
|
.ignore_pmdown_time = 1,
|
||||||
|
.ignore_suspend = 1,
|
||||||
|
.ops = &msm_common_be_ops,
|
||||||
|
SND_SOC_DAILINK_REG(wsa_wsa2_dma_rx1),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = LPASS_BE_WSA_CDC_DMA_TX_1,
|
||||||
|
.stream_name = LPASS_BE_WSA_CDC_DMA_TX_1,
|
||||||
|
.capture_only = 1,
|
||||||
|
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
|
||||||
|
SND_SOC_DPCM_TRIGGER_POST},
|
||||||
|
.ignore_suspend = 1,
|
||||||
|
.ops = &msm_common_be_ops,
|
||||||
|
SND_SOC_DAILINK_REG(wsa_wsa2_dma_tx1),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = LPASS_BE_WSA_CDC_DMA_TX_0,
|
||||||
|
.stream_name = LPASS_BE_WSA_CDC_DMA_TX_0,
|
||||||
|
.capture_only = 1,
|
||||||
|
.ignore_suspend = 1,
|
||||||
|
.ops = &msm_common_be_ops,
|
||||||
|
/* .no_host_mode = SND_SOC_DAI_LINK_NO_HOST, */
|
||||||
|
SND_SOC_DAILINK_REG(wsa_wsa2_vi_feedback),
|
||||||
|
},
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
static struct snd_soc_dai_link msm_rx_tx_cdc_dma_be_dai_links[] = {
|
static struct snd_soc_dai_link msm_rx_tx_cdc_dma_be_dai_links[] = {
|
||||||
/* RX CDC DMA Backend DAI Links */
|
/* RX CDC DMA Backend DAI Links */
|
||||||
@@ -919,9 +966,8 @@ static struct snd_soc_dai_link msm_tdm_dai_links[] = {
|
|||||||
|
|
||||||
static struct snd_soc_dai_link msm_waipio_dai_links[
|
static struct snd_soc_dai_link msm_waipio_dai_links[
|
||||||
ARRAY_SIZE(msm_wsa_cdc_dma_be_dai_links) +
|
ARRAY_SIZE(msm_wsa_cdc_dma_be_dai_links) +
|
||||||
#if 0
|
|
||||||
ARRAY_SIZE(msm_wsa2_cdc_dma_be_dai_links) +
|
ARRAY_SIZE(msm_wsa2_cdc_dma_be_dai_links) +
|
||||||
#endif
|
ARRAY_SIZE(msm_wsa_wsa2_cdc_dma_be_dai_links) +
|
||||||
ARRAY_SIZE(msm_rx_tx_cdc_dma_be_dai_links) +
|
ARRAY_SIZE(msm_rx_tx_cdc_dma_be_dai_links) +
|
||||||
ARRAY_SIZE(msm_va_cdc_dma_be_dai_links) +
|
ARRAY_SIZE(msm_va_cdc_dma_be_dai_links) +
|
||||||
ARRAY_SIZE(ext_disp_be_dai_link) +
|
ARRAY_SIZE(ext_disp_be_dai_link) +
|
||||||
@@ -1119,7 +1165,7 @@ err_hs_detect:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct snd_soc_card *populate_snd_card_dailinks(struct device *dev)
|
static struct snd_soc_card *populate_snd_card_dailinks(struct device *dev, int wsa_max_devs)
|
||||||
{
|
{
|
||||||
struct snd_soc_card *card = NULL;
|
struct snd_soc_card *card = NULL;
|
||||||
struct snd_soc_dai_link *dailink = NULL;
|
struct snd_soc_dai_link *dailink = NULL;
|
||||||
@@ -1145,17 +1191,31 @@ static struct snd_soc_card *populate_snd_card_dailinks(struct device *dev)
|
|||||||
total_links +=
|
total_links +=
|
||||||
ARRAY_SIZE(msm_rx_tx_cdc_dma_be_dai_links);
|
ARRAY_SIZE(msm_rx_tx_cdc_dma_be_dai_links);
|
||||||
|
|
||||||
memcpy(msm_waipio_dai_links + total_links,
|
switch (wsa_max_devs) {
|
||||||
msm_wsa_cdc_dma_be_dai_links,
|
case MONO_SPEAKER:
|
||||||
sizeof(msm_wsa_cdc_dma_be_dai_links));
|
case STEREO_SPEAKER:
|
||||||
total_links += ARRAY_SIZE(msm_wsa_cdc_dma_be_dai_links);
|
memcpy(msm_waipio_dai_links + total_links,
|
||||||
|
msm_wsa_cdc_dma_be_dai_links,
|
||||||
|
sizeof(msm_wsa_cdc_dma_be_dai_links));
|
||||||
|
total_links += ARRAY_SIZE(msm_wsa_cdc_dma_be_dai_links);
|
||||||
|
break;
|
||||||
|
case QUAD_SPEAKER:
|
||||||
|
memcpy(msm_waipio_dai_links + total_links,
|
||||||
|
msm_wsa2_cdc_dma_be_dai_links,
|
||||||
|
sizeof(msm_wsa2_cdc_dma_be_dai_links));
|
||||||
|
total_links += ARRAY_SIZE(msm_wsa2_cdc_dma_be_dai_links);
|
||||||
|
|
||||||
#if 0
|
memcpy(msm_waipio_dai_links + total_links,
|
||||||
memcpy(msm_waipio_dai_links + total_links,
|
msm_wsa_wsa2_cdc_dma_be_dai_links,
|
||||||
msm_wsa2_cdc_dma_be_dai_links,
|
sizeof(msm_wsa_wsa2_cdc_dma_be_dai_links));
|
||||||
sizeof(msm_wsa2_cdc_dma_be_dai_links));
|
total_links += ARRAY_SIZE(msm_wsa_wsa2_cdc_dma_be_dai_links);
|
||||||
total_links += ARRAY_SIZE(msm_wsa2_cdc_dma_be_dai_links);
|
break;
|
||||||
#endif
|
default:
|
||||||
|
dev_dbg(dev,
|
||||||
|
"%s: Unexpected number of WSAs, wsa_max_devs: %d\n",
|
||||||
|
__func__, wsa_max_devs);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
memcpy(msm_waipio_dai_links + total_links,
|
memcpy(msm_waipio_dai_links + total_links,
|
||||||
msm_va_cdc_dma_be_dai_links,
|
msm_va_cdc_dma_be_dai_links,
|
||||||
@@ -1239,7 +1299,6 @@ static int msm_int_wsa_init(struct snd_soc_pcm_runtime *rtd)
|
|||||||
SWR_CLK_RATE_0P3MHZ, SWR_CLK_RATE_1P2MHZ};
|
SWR_CLK_RATE_0P3MHZ, SWR_CLK_RATE_1P2MHZ};
|
||||||
unsigned int ch_mask[WSA883X_MAX_SWR_PORTS] = {0x1, 0xF, 0x3, 0x3};
|
unsigned int ch_mask[WSA883X_MAX_SWR_PORTS] = {0x1, 0xF, 0x3, 0x3};
|
||||||
struct snd_soc_component *component = NULL;
|
struct snd_soc_component *component = NULL;
|
||||||
struct snd_soc_dapm_context *dapm = NULL;
|
|
||||||
struct msm_asoc_mach_data *pdata =
|
struct msm_asoc_mach_data *pdata =
|
||||||
snd_soc_card_get_drvdata(rtd->card);
|
snd_soc_card_get_drvdata(rtd->card);
|
||||||
|
|
||||||
@@ -1250,17 +1309,10 @@ static int msm_int_wsa_init(struct snd_soc_pcm_runtime *rtd)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
dapm = snd_soc_component_get_dapm(component);
|
|
||||||
|
|
||||||
wsa883x_set_channel_map(component, &spkleft_ports[0],
|
wsa883x_set_channel_map(component, &spkleft_ports[0],
|
||||||
WSA883X_MAX_SWR_PORTS, &ch_mask[0],
|
WSA883X_MAX_SWR_PORTS, &ch_mask[0],
|
||||||
&ch_rate[0], &spkleft_port_types[0]);
|
&ch_rate[0], &spkleft_port_types[0]);
|
||||||
|
|
||||||
if (dapm->component) {
|
|
||||||
snd_soc_dapm_ignore_suspend(dapm, "spkrLeft IN");
|
|
||||||
snd_soc_dapm_ignore_suspend(dapm, "spkrLeft SPKR");
|
|
||||||
}
|
|
||||||
|
|
||||||
wsa883x_codec_info_create_codec_entry(pdata->codec_root,
|
wsa883x_codec_info_create_codec_entry(pdata->codec_root,
|
||||||
component);
|
component);
|
||||||
}
|
}
|
||||||
@@ -1273,22 +1325,14 @@ static int msm_int_wsa_init(struct snd_soc_pcm_runtime *rtd)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
dapm = snd_soc_component_get_dapm(component);
|
|
||||||
|
|
||||||
wsa883x_set_channel_map(component, &spkright_ports[0],
|
wsa883x_set_channel_map(component, &spkright_ports[0],
|
||||||
WSA883X_MAX_SWR_PORTS, &ch_mask[0],
|
WSA883X_MAX_SWR_PORTS, &ch_mask[0],
|
||||||
&ch_rate[0], &spkright_port_types[0]);
|
&ch_rate[0], &spkright_port_types[0]);
|
||||||
|
|
||||||
if (dapm->component) {
|
|
||||||
snd_soc_dapm_ignore_suspend(dapm, "spkrRight IN");
|
|
||||||
snd_soc_dapm_ignore_suspend(dapm, "spkrRight SPKR");
|
|
||||||
}
|
|
||||||
|
|
||||||
wsa883x_codec_info_create_codec_entry(pdata->codec_root,
|
wsa883x_codec_info_create_codec_entry(pdata->codec_root,
|
||||||
component);
|
component);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (pdata->wsa_max_devs > 2) {
|
if (pdata->wsa_max_devs > 2) {
|
||||||
component = snd_soc_rtdcom_lookup(rtd, "wsa-codec.3");
|
component = snd_soc_rtdcom_lookup(rtd, "wsa-codec.3");
|
||||||
if (!component) {
|
if (!component) {
|
||||||
@@ -1296,17 +1340,10 @@ static int msm_int_wsa_init(struct snd_soc_pcm_runtime *rtd)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
dapm = snd_soc_component_get_dapm(component);
|
|
||||||
|
|
||||||
wsa883x_set_channel_map(component, &spkleft_ports[0],
|
wsa883x_set_channel_map(component, &spkleft_ports[0],
|
||||||
WSA883X_MAX_SWR_PORTS, &ch_mask[0],
|
WSA883X_MAX_SWR_PORTS, &ch_mask[0],
|
||||||
&ch_rate[0], &spkleft_port_types[0]);
|
&ch_rate[0], &spkleft_port_types[0]);
|
||||||
|
|
||||||
if (dapm->component) {
|
|
||||||
snd_soc_dapm_ignore_suspend(dapm, "spkr2Left IN");
|
|
||||||
snd_soc_dapm_ignore_suspend(dapm, "spkr2Left SPKR");
|
|
||||||
}
|
|
||||||
|
|
||||||
wsa883x_codec_info_create_codec_entry(pdata->codec_root,
|
wsa883x_codec_info_create_codec_entry(pdata->codec_root,
|
||||||
component);
|
component);
|
||||||
}
|
}
|
||||||
@@ -1318,31 +1355,13 @@ static int msm_int_wsa_init(struct snd_soc_pcm_runtime *rtd)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
dapm = snd_soc_component_get_dapm(component);
|
|
||||||
|
|
||||||
wsa883x_set_channel_map(component, &spkright_ports[0],
|
wsa883x_set_channel_map(component, &spkright_ports[0],
|
||||||
WSA883X_MAX_SWR_PORTS, &ch_mask[0],
|
WSA883X_MAX_SWR_PORTS, &ch_mask[0],
|
||||||
&ch_rate[0], &spkright_port_types[0]);
|
&ch_rate[0], &spkright_port_types[0]);
|
||||||
|
|
||||||
if (dapm->component) {
|
|
||||||
snd_soc_dapm_ignore_suspend(dapm, "spkr2Right IN");
|
|
||||||
snd_soc_dapm_ignore_suspend(dapm, "spkr2Right SPKR");
|
|
||||||
}
|
|
||||||
|
|
||||||
wsa883x_codec_info_create_codec_entry(pdata->codec_root,
|
wsa883x_codec_info_create_codec_entry(pdata->codec_root,
|
||||||
component);
|
component);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
snd_soc_dapm_ignore_suspend(dapm, "WSA_SPK1 OUT");
|
|
||||||
snd_soc_dapm_ignore_suspend(dapm, "WSA_SPK2 OUT");
|
|
||||||
#if 0
|
|
||||||
snd_soc_dapm_ignore_suspend(dapm, "WSA2_SPK1 OUT");
|
|
||||||
snd_soc_dapm_ignore_suspend(dapm, "WSA2_SPK2 OUT");
|
|
||||||
#endif
|
|
||||||
snd_soc_dapm_ignore_suspend(dapm, "WSA AIF VI");
|
|
||||||
snd_soc_dapm_ignore_suspend(dapm, "VIINPUT_WSA");
|
|
||||||
snd_soc_dapm_sync(dapm);
|
|
||||||
|
|
||||||
msm_common_dai_link_init(rtd);
|
msm_common_dai_link_init(rtd);
|
||||||
|
|
||||||
@@ -1582,7 +1601,17 @@ static int msm_asoc_machine_probe(struct platform_device *pdev)
|
|||||||
"qcom,wcd-disabled",
|
"qcom,wcd-disabled",
|
||||||
&pdata->wcd_disabled);
|
&pdata->wcd_disabled);
|
||||||
|
|
||||||
card = populate_snd_card_dailinks(&pdev->dev);
|
/* Get maximum WSA device count for this platform */
|
||||||
|
ret = of_property_read_u32(pdev->dev.of_node,
|
||||||
|
"qcom,wsa-max-devs", &pdata->wsa_max_devs);
|
||||||
|
if (ret) {
|
||||||
|
dev_info(&pdev->dev,
|
||||||
|
"%s: wsa-max-devs property missing in DT %s, ret = %d\n",
|
||||||
|
__func__, pdev->dev.of_node->full_name, ret);
|
||||||
|
pdata->wsa_max_devs = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
card = populate_snd_card_dailinks(&pdev->dev, pdata->wsa_max_devs);
|
||||||
if (!card) {
|
if (!card) {
|
||||||
dev_err(&pdev->dev, "%s: Card uninitialized\n", __func__);
|
dev_err(&pdev->dev, "%s: Card uninitialized\n", __func__);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
@@ -1613,16 +1642,6 @@ static int msm_asoc_machine_probe(struct platform_device *pdev)
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get maximum WSA device count for this platform */
|
|
||||||
ret = of_property_read_u32(pdev->dev.of_node,
|
|
||||||
"qcom,wsa-max-devs", &pdata->wsa_max_devs);
|
|
||||||
if (ret) {
|
|
||||||
dev_info(&pdev->dev,
|
|
||||||
"%s: wsa-max-devs property missing in DT %s, ret = %d\n",
|
|
||||||
__func__, pdev->dev.of_node->full_name, ret);
|
|
||||||
pdata->wsa_max_devs = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = devm_snd_soc_register_card(&pdev->dev, card);
|
ret = devm_snd_soc_register_card(&pdev->dev, card);
|
||||||
if (ret == -EPROBE_DEFER) {
|
if (ret == -EPROBE_DEFER) {
|
||||||
if (codec_reg_done)
|
if (codec_reg_done)
|
||||||
|
Reference in New Issue
Block a user