From 764b2d2e8ed67b044506cf77234c3e48e01c08cb Mon Sep 17 00:00:00 2001 From: Vignesh Kulothungan Date: Thu, 21 Mar 2019 10:54:09 -0700 Subject: [PATCH] asoc: pcm: modify component extraction Component for channel map mixer control should be extracted from pcm runtime instead of kcontrol's private data, because kcontrol's private data in this case points to channel map info. CRs-Fixed: 2420279 Change-Id: Ibaeac4739b73a89d17f16cbacb1b5095d546968b Signed-off-by: Vignesh Kulothungan --- asoc/msm-pcm-q6-v2.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/asoc/msm-pcm-q6-v2.c b/asoc/msm-pcm-q6-v2.c index 71dbd0c987c4..a087dd822c04 100644 --- a/asoc/msm-pcm-q6-v2.c +++ b/asoc/msm-pcm-q6-v2.c @@ -1604,7 +1604,7 @@ static int msm_pcm_chmap_ctl_put(struct snd_kcontrol *kcontrol, struct snd_soc_pcm_runtime *rtd = NULL; struct msm_plat_data *pdata = NULL; struct msm_pcm_channel_mixer *chmixer_pspd = NULL; - struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); + struct snd_soc_component *component = NULL; u64 fe_id = 0; pr_debug("%s", __func__); @@ -1624,18 +1624,21 @@ static int msm_pcm_chmap_ctl_put(struct snd_kcontrol *kcontrol, /* update chmixer_pspd chmap cached with routing driver as well */ rtd = substream->private_data; if (rtd) { - fe_id = rtd->dai_link->id; - pdata = (struct msm_plat_data *) - dev_get_drvdata(component->dev); - chmixer_pspd = pdata ? - pdata->chmixer_pspd[fe_id][SESSION_TYPE_RX] : NULL; + component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); + if (component) { + fe_id = rtd->dai_link->id; + pdata = (struct msm_plat_data *) + dev_get_drvdata(component->dev); + chmixer_pspd = pdata ? + pdata->chmixer_pspd[fe_id][SESSION_TYPE_RX] : NULL; - if (chmixer_pspd && chmixer_pspd->enable) { - for (i = 0; i < PCM_FORMAT_MAX_NUM_CHANNEL_V8; i++) - chmixer_pspd->in_ch_map[i] = prtd->channel_map[i]; - chmixer_pspd->override_in_ch_map = true; - msm_pcm_routing_set_channel_mixer_cfg(fe_id, - SESSION_TYPE_RX, chmixer_pspd); + if (chmixer_pspd && chmixer_pspd->enable) { + for (i = 0; i < PCM_FORMAT_MAX_NUM_CHANNEL_V8; i++) + chmixer_pspd->in_ch_map[i] = prtd->channel_map[i]; + chmixer_pspd->override_in_ch_map = true; + msm_pcm_routing_set_channel_mixer_cfg(fe_id, + SESSION_TYPE_RX, chmixer_pspd); + } } } }