From 49e9a4081bbcefcd5c2ed2f096d8cd01130ac6d4 Mon Sep 17 00:00:00 2001 From: Meng Wang Date: Wed, 11 Apr 2018 17:33:55 +0800 Subject: [PATCH] ASoC: msm: remove pcm_i2S_sel_vt_address from machine driver lpaif_muxsel_virt_addr to select AUXPCM or I2S is not needed in machine driver. ADSP would select AUXPCM or I2S according to afe port. Remove related change in machine driver. Change-Id: I55520a56bab2134a08e86909b98eb15d588c53ba Signed-off-by: Meng Wang --- asoc/sdm845.c | 164 +------------------------------------------------- 1 file changed, 1 insertion(+), 163 deletions(-) diff --git a/asoc/sdm845.c b/asoc/sdm845.c index e2ab1f0167da..3fe402329485 100644 --- a/asoc/sdm845.c +++ b/asoc/sdm845.c @@ -116,19 +116,6 @@ enum { AUX_PCM_MAX, }; -enum { - PCM_I2S_SEL_PRIM = 0, - PCM_I2S_SEL_SEC, - PCM_I2S_SEL_TERT, - PCM_I2S_SEL_QUAT, - PCM_I2S_SEL_MAX, -}; - -struct mi2s_aux_pcm_common_conf { - struct mutex lock; - void *pcm_i2s_sel_vt_addr; -}; - struct mi2s_conf { struct mutex lock; u32 ref_cnt; @@ -142,11 +129,6 @@ static u32 mi2s_ebit_clk[MI2S_MAX] = { Q6AFE_LPASS_CLK_ID_QUAD_MI2S_EBIT }; -struct auxpcm_conf { - struct mutex lock; - u32 ref_cnt; -}; - struct dev_config { u32 sample_rate; u32 bit_format; @@ -584,9 +566,7 @@ static struct afe_clk_set mi2s_clk[MI2S_MAX] = { } }; -static struct mi2s_aux_pcm_common_conf mi2s_auxpcm_conf[PCM_I2S_SEL_MAX]; static struct mi2s_conf mi2s_intf_conf[MI2S_MAX]; -static struct auxpcm_conf auxpcm_intf_conf[AUX_PCM_MAX]; static int slim_get_sample_rate_val(int sample_rate) { @@ -4116,83 +4096,6 @@ err: return ret; } -static int msm_aux_pcm_snd_startup(struct snd_pcm_substream *substream) -{ - int ret = 0; - struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_dai *cpu_dai = rtd->cpu_dai; - int index = cpu_dai->id - 1; - - dev_dbg(rtd->card->dev, - "%s: substream = %s stream = %d, dai name %s, dai ID %d\n", - __func__, substream->name, substream->stream, - cpu_dai->name, cpu_dai->id); - - if (index < PRIM_AUX_PCM || index > QUAT_AUX_PCM) { - ret = -EINVAL; - dev_err(rtd->card->dev, - "%s: CPU DAI id (%d) out of range\n", - __func__, cpu_dai->id); - goto err; - } - - mutex_lock(&auxpcm_intf_conf[index].lock); - if (++auxpcm_intf_conf[index].ref_cnt == 1) { - if (mi2s_auxpcm_conf[index].pcm_i2s_sel_vt_addr != NULL) { - mutex_lock(&mi2s_auxpcm_conf[index].lock); - iowrite32(1, - mi2s_auxpcm_conf[index].pcm_i2s_sel_vt_addr); - mutex_unlock(&mi2s_auxpcm_conf[index].lock); - } else { - dev_err(rtd->card->dev, - "%s lpaif_tert_muxsel_virt_addr is NULL\n", - __func__); - ret = -EINVAL; - } - } - if (ret < 0) - auxpcm_intf_conf[index].ref_cnt--; - - mutex_unlock(&auxpcm_intf_conf[index].lock); - -err: - return ret; -} - -static void msm_aux_pcm_snd_shutdown(struct snd_pcm_substream *substream) -{ - struct snd_soc_pcm_runtime *rtd = substream->private_data; - int index = rtd->cpu_dai->id - 1; - - dev_dbg(rtd->card->dev, - "%s: substream = %s stream = %d, dai name %s, dai ID %d\n", - __func__, - substream->name, substream->stream, - rtd->cpu_dai->name, rtd->cpu_dai->id); - - if (index < PRIM_AUX_PCM || index > QUAT_AUX_PCM) { - dev_err(rtd->card->dev, - "%s: CPU DAI id (%d) out of range\n", - __func__, rtd->cpu_dai->id); - return; - } - - mutex_lock(&auxpcm_intf_conf[index].lock); - if (--auxpcm_intf_conf[index].ref_cnt == 0) { - if (mi2s_auxpcm_conf[index].pcm_i2s_sel_vt_addr != NULL) { - mutex_lock(&mi2s_auxpcm_conf[index].lock); - iowrite32(0, - mi2s_auxpcm_conf[index].pcm_i2s_sel_vt_addr); - mutex_unlock(&mi2s_auxpcm_conf[index].lock); - } else { - dev_err(rtd->card->dev, - "%s lpaif_tert_muxsel_virt_addr is NULL\n", - __func__); - } - } - mutex_unlock(&auxpcm_intf_conf[index].lock); -} - static int msm_get_port_id(int be_id) { int afe_port_id; @@ -4723,18 +4626,7 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream) __func__, ret); goto clean_up; } - if (mi2s_auxpcm_conf[index].pcm_i2s_sel_vt_addr != NULL) { - mutex_lock(&mi2s_auxpcm_conf[index].lock); - iowrite32(0, - mi2s_auxpcm_conf[index].pcm_i2s_sel_vt_addr); - mutex_unlock(&mi2s_auxpcm_conf[index].lock); - } else { - dev_err(rtd->card->dev, - "%s lpaif_muxsel_virt_addr is NULL for dai %d\n", - __func__, index); - ret = -EINVAL; - goto clk_off; - } + ret = snd_soc_dai_set_fmt(cpu_dai, fmt); if (ret < 0) { pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n", @@ -4792,11 +4684,6 @@ static struct snd_soc_ops msm_mi2s_be_ops = { .shutdown = msm_mi2s_snd_shutdown, }; -static struct snd_soc_ops msm_aux_pcm_be_ops = { - .startup = msm_aux_pcm_snd_startup, - .shutdown = msm_aux_pcm_snd_shutdown, -}; - static struct snd_soc_ops msm_be_ops = { .hw_params = msm_snd_hw_params, }; @@ -6085,7 +5972,6 @@ static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = { .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_pmdown_time = 1, .ignore_suspend = 1, - .ops = &msm_aux_pcm_be_ops, }, { .name = LPASS_BE_AUXPCM_TX, @@ -6100,7 +5986,6 @@ static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = { .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_pmdown_time = 1, .ignore_suspend = 1, - .ops = &msm_aux_pcm_be_ops, }, /* Secondary AUX PCM Backend DAI Links */ { @@ -6116,7 +6001,6 @@ static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = { .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_pmdown_time = 1, .ignore_suspend = 1, - .ops = &msm_aux_pcm_be_ops, }, { .name = LPASS_BE_SEC_AUXPCM_TX, @@ -6131,7 +6015,6 @@ static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = { .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_suspend = 1, .ignore_pmdown_time = 1, - .ops = &msm_aux_pcm_be_ops, }, /* Tertiary AUX PCM Backend DAI Links */ { @@ -6147,7 +6030,6 @@ static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = { .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_pmdown_time = 1, .ignore_suspend = 1, - .ops = &msm_aux_pcm_be_ops, }, { .name = LPASS_BE_TERT_AUXPCM_TX, @@ -6162,7 +6044,6 @@ static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = { .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_suspend = 1, .ignore_pmdown_time = 1, - .ops = &msm_aux_pcm_be_ops, }, /* Quaternary AUX PCM Backend DAI Links */ { @@ -6178,7 +6059,6 @@ static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = { .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_pmdown_time = 1, .ignore_suspend = 1, - .ops = &msm_aux_pcm_be_ops, }, { .name = LPASS_BE_QUAT_AUXPCM_TX, @@ -6193,7 +6073,6 @@ static struct snd_soc_dai_link msm_auxpcm_be_dai_links[] = { .be_hw_params_fixup = msm_be_hw_params_fixup, .ignore_suspend = 1, .ignore_pmdown_time = 1, - .ops = &msm_aux_pcm_be_ops, }, }; @@ -6823,41 +6702,15 @@ err: static void msm_i2s_auxpcm_init(struct platform_device *pdev) { - struct resource *muxsel; int count; u32 mi2s_master_slave[MI2S_MAX]; int ret; - char *str[PCM_I2S_SEL_MAX] = { - "lpaif_pri_mode_muxsel", - "lpaif_sec_mode_muxsel", - "lpaif_tert_mode_muxsel", - "lpaif_quat_mode_muxsel" - }; for (count = 0; count < MI2S_MAX; count++) { mutex_init(&mi2s_intf_conf[count].lock); mi2s_intf_conf[count].ref_cnt = 0; } - for (count = 0; count < AUX_PCM_MAX; count++) { - mutex_init(&auxpcm_intf_conf[count].lock); - auxpcm_intf_conf[count].ref_cnt = 0; - } - - for (count = 0; count < PCM_I2S_SEL_MAX; count++) { - mutex_init(&mi2s_auxpcm_conf[count].lock); - mi2s_auxpcm_conf[count].pcm_i2s_sel_vt_addr = NULL; - } - - for (count = 0; count < PCM_I2S_SEL_MAX; count++) { - muxsel = platform_get_resource_byname(pdev, IORESOURCE_MEM, - str[count]); - if (muxsel) { - mi2s_auxpcm_conf[count].pcm_i2s_sel_vt_addr - = ioremap(muxsel->start, resource_size(muxsel)); - } - } - ret = of_property_read_u32_array(pdev->dev.of_node, "qcom,msm-mi2s-master", mi2s_master_slave, MI2S_MAX); @@ -6876,21 +6729,6 @@ static void msm_i2s_auxpcm_deinit(void) { int count; - for (count = 0; count < PCM_I2S_SEL_MAX; count++) { - if (mi2s_auxpcm_conf[count].pcm_i2s_sel_vt_addr != - NULL) { - iounmap( - mi2s_auxpcm_conf[count].pcm_i2s_sel_vt_addr); - mi2s_auxpcm_conf[count].pcm_i2s_sel_vt_addr = NULL; - } - mutex_destroy(&mi2s_auxpcm_conf[count].lock); - } - - for (count = 0; count < AUX_PCM_MAX; count++) { - mutex_destroy(&auxpcm_intf_conf[count].lock); - auxpcm_intf_conf[count].ref_cnt = 0; - } - for (count = 0; count < MI2S_MAX; count++) { mutex_destroy(&mi2s_intf_conf[count].lock); mi2s_intf_conf[count].ref_cnt = 0;