From 5fcc7c00d1ab9623a48eb298c5175c89804231b0 Mon Sep 17 00:00:00 2001 From: Derek Chen Date: Thu, 11 Feb 2016 19:44:00 -0500 Subject: [PATCH] ASoC: msm: qdsp6v2: init tdm group ref on tdm group q6 probe Initialize tdm group reference count on tdm group q6 probe instead of tdm per dai probe to avoid duplicated init calls. CRs-fixed: 975767 Change-Id: I88bc791fc2bfbb60f1cf6b2faeb6de0c865539c0 Signed-off-by: Derek Chen --- sound/soc/msm/qdsp6v2/msm-dai-q6-v2.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/sound/soc/msm/qdsp6v2/msm-dai-q6-v2.c b/sound/soc/msm/qdsp6v2/msm-dai-q6-v2.c index cf73838fbe1e..e1c789ff343f 100644 --- a/sound/soc/msm/qdsp6v2/msm-dai-q6-v2.c +++ b/sound/soc/msm/qdsp6v2/msm-dai-q6-v2.c @@ -3992,6 +3992,7 @@ static int msm_dai_tdm_q6_probe(struct platform_device *pdev) const uint32_t *port_id_array = NULL; uint32_t array_length = 0; int i = 0; + int group_idx = 0; /* extract tdm group info into static */ rc = of_property_read_u32(pdev->dev.of_node, @@ -4062,6 +4063,16 @@ static int msm_dai_tdm_q6_probe(struct platform_device *pdev) dev_dbg(&pdev->dev, "%s: Clk Rate from DT file %d\n", __func__, tdm_clk_set.clk_freq_in_hz); + /* other initializations within device group */ + group_idx = msm_dai_q6_get_group_idx(tdm_group_cfg.group_id); + if (group_idx < 0) { + dev_err(&pdev->dev, "%s: group id 0x%x not supported\n", + __func__, tdm_group_cfg.group_id); + rc = -EINVAL; + goto rtn; + } + atomic_set(&tdm_group_ref[group_idx], 0); + /* probe child node info */ rc = of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev); if (rc) { @@ -4895,7 +4906,7 @@ static int msm_dai_q6_dai_tdm_probe(struct snd_soc_dai *dai) struct snd_kcontrol *data_format_kcontrol = NULL; struct snd_kcontrol *header_type_kcontrol = NULL; struct snd_kcontrol *header_kcontrol = NULL; - int port_idx = 0, i = 0; + int port_idx = 0; const struct snd_kcontrol_new *data_format_ctrl = NULL; const struct snd_kcontrol_new *header_type_ctrl = NULL; const struct snd_kcontrol_new *header_ctrl = NULL; @@ -4967,10 +4978,6 @@ static int msm_dai_q6_dai_tdm_probe(struct snd_soc_dai *dai) rc = msm_dai_q6_dai_add_route(dai); - /* other initializations */ - for (i = 0; i < IDX_GROUP_TDM_MAX; i++) - atomic_set(&tdm_group_ref[i], 0); - rtn: return rc; }