asoc: bengal: fix dailink init error

-Fix the problem that the API snd_soc_rtdcom_lookup that
 wcd937x component is empty during the call of VA_CDC_DMA_TX_0
 dai-link .init .
-Put the call of API snd_soc_rtdcom_lookup to find wcd937x
 component into RX_CDC_DMA_RX_0 .init .

Change-Id: Ic0565742e462a78cd4ac90fb9e1a788b2ed15ab7
Signed-off-by: Zun Qiao <quic_zqiao@quicinc.com>
Signed-off-by: Dechen Chai <quic_dchai@quicinc.com>
This commit is contained in:
Zun Qiao 2021-11-22 19:51:22 +05:30 • committed by Dechen Chai
commit 2bd9cc0f5e

View file

@ -557,6 +557,7 @@ static void *def_wcd_mbhc_cal(void);
static void *def_rouleur_mbhc_cal(void);
static int msm_int_audrx_init(struct snd_soc_pcm_runtime*);
static int msm_aux_codec_init(struct snd_soc_pcm_runtime*);
/*
* Need to report LINEIN
@ -4260,25 +4261,19 @@ static void msm_add_auxpcm_snd_controls(struct snd_soc_component *component)
static int msm_int_audrx_init(struct snd_soc_pcm_runtime *rtd)
{
int ret = -EINVAL;
struct snd_soc_component *component;
struct snd_soc_component *bolero_component = NULL;
struct snd_soc_dapm_context *dapm;
struct snd_card *card;
struct snd_info_entry *entry;
struct platform_device *pdev = NULL;
int i = 0;
char *data = NULL;
struct snd_soc_component *component = NULL;
struct snd_soc_dapm_context *dapm = NULL;
struct snd_card *card = NULL;
struct snd_info_entry *entry = NULL;
struct msm_asoc_mach_data *pdata =
snd_soc_card_get_drvdata(rtd->card);
int ret = -EINVAL;
component = snd_soc_rtdcom_lookup(rtd, "bolero_codec");
if (!component) {
pr_err("%s: could not find component for bolero_codec\n",
__func__);
return ret;
} else {
bolero_component = component;
}
dapm = snd_soc_component_get_dapm(component);
@ -4333,6 +4328,29 @@ static int msm_int_audrx_init(struct snd_soc_pcm_runtime *rtd)
bolero_info_create_codec_entry(pdata->codec_root, component);
bolero_register_wake_irq(component, false);
err:
return ret;
}
static int msm_aux_codec_init(struct snd_soc_pcm_runtime *rtd)
{
int ret = -EINVAL;
struct snd_soc_component *component = NULL;
struct snd_soc_component *bolero_component = NULL;
struct snd_soc_dapm_context *dapm = NULL;
struct snd_card *card = NULL;
struct snd_info_entry *entry;
char *data = NULL;
struct msm_asoc_mach_data *pdata =
snd_soc_card_get_drvdata(rtd->card);
bolero_component = snd_soc_rtdcom_lookup(rtd, "bolero_codec");
if (!bolero_component) {
pr_err("%s: could not find component for bolero_codec\n",
__func__);
return -EINVAL;
}
component = snd_soc_rtdcom_lookup(rtd, ROULEUR_DRV_NAME);
if (!component)
component = snd_soc_rtdcom_lookup(rtd, WCD937X_DRV_NAME);
@ -4356,6 +4374,18 @@ static int msm_int_audrx_init(struct snd_soc_pcm_runtime *rtd)
snd_soc_dapm_ignore_suspend(dapm, "AMIC4");
snd_soc_dapm_sync(dapm);
if (!pdata->codec_root) {
entry = msm_snd_info_create_subdir(card->module, "codecs",
card->proc_root);
if (!entry) {
dev_dbg(component->dev, "%s: Cannot create codecs module entry\n",
__func__);
ret = 0;
goto err;
}
pdata->codec_root = entry;
}
if (wcd_datalane_mismatch) {
bolero_set_port_map(component,
ARRAY_SIZE(sm_port_map_khaje),
@ -5392,6 +5422,7 @@ static struct snd_soc_dai_link msm_rx_tx_cdc_dma_be_dai_links[] = {
.ignore_suspend = 1,
.ops = &msm_cdc_dma_be_ops,
SND_SOC_DAILINK_REG(rx_dma_rx0),
.init = &msm_aux_codec_init,
},
{
.name = LPASS_BE_RX_CDC_DMA_RX_1,
@ -5469,12 +5500,12 @@ static struct snd_soc_dai_link msm_va_cdc_dma_be_dai_links[] = {
.stream_name = "VA CDC DMA0 Capture",
.no_pcm = 1,
.dpcm_capture = 1,
.init = &msm_int_audrx_init,
.id = MSM_BACKEND_DAI_VA_CDC_DMA_TX_0,
.be_hw_params_fixup = msm_be_hw_params_fixup,
.ignore_suspend = 1,
.ops = &msm_cdc_dma_be_ops,
SND_SOC_DAILINK_REG(va_dma_tx0),
.init = &msm_int_audrx_init,
},
{
.name = LPASS_BE_VA_CDC_DMA_TX_1,