From a304847e658dee59d0da9a39d59666a10a4211bd Mon Sep 17 00:00:00 2001 From: Uday Gupta Date: Fri, 11 Nov 2016 14:18:04 +0530 Subject: [PATCH] tegra-alt: adsp: Pass ADMA CH page to ADSP ADSP NVADMA driver needs to program different ADMA channel page based on which guest ADSP is assigned to in case of virtualization Jira EMA-358 Change-Id: I601965d255ef3ced6c5d8873a21890910689ab9a Signed-off-by: Uday Gupta Reviewed-on: http://git-master/r/1251785 Reviewed-by: mobile promotions Tested-by: mobile promotions --- sound/soc/tegra-alt/tegra210_adsp_alt.c | 30 ++++++++++++++++--------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/sound/soc/tegra-alt/tegra210_adsp_alt.c b/sound/soc/tegra-alt/tegra210_adsp_alt.c index f61fe3e8..4e02be5c 100644 --- a/sound/soc/tegra-alt/tegra210_adsp_alt.c +++ b/sound/soc/tegra-alt/tegra210_adsp_alt.c @@ -54,7 +54,7 @@ #include "tegra_asoc_utils_alt.h" #include "tegra210_adsp_alt.h" -#ifdef CONFIG_SND_SOC_TEGRA_VIRT_T210REF_PCM +#ifdef CONFIG_TEGRA_HV_MANAGER #include "tegra210_virt_alt_admaif.h" #include "tegra_virt_alt_ivc.h" #endif @@ -142,11 +142,12 @@ struct tegra210_adsp { struct mutex mutex; int init_done; int adsp_started; + uint32_t adma_ch_page; struct tegra210_adsp_path { uint32_t fe_reg; uint32_t be_reg; } pcm_path[ADSP_FE_COUNT+1][2]; -#ifdef CONFIG_SND_SOC_TEGRA_VIRT_T210REF_PCM +#ifdef CONFIG_TEGRA_HV_MANAGER struct nvaudio_ivc_ctxt *hivc_client; uint32_t fe_to_admaif_map[ADSP_FE_END - ADSP_FE_START + 1][2]; #endif @@ -719,7 +720,7 @@ static int tegra210_adsp_send_data_request_msg(struct tegra210_adsp_app *app, static int tegra210_adsp_app_init(struct tegra210_adsp *adsp, struct tegra210_adsp_app *app) { -#ifdef CONFIG_SND_SOC_TEGRA_VIRT_T210REF_PCM +#ifdef CONFIG_TEGRA_HV_MANAGER struct device *dev = adsp->dev; struct device_node *node = dev->of_node; #endif @@ -791,7 +792,7 @@ static int tegra210_adsp_app_init(struct tegra210_adsp *adsp, } __set_bit(app->adma_chan, adsp->adma_usage); -#ifdef CONFIG_SND_SOC_TEGRA_VIRT_T210REF_PCM +#ifdef CONFIG_TEGRA_HV_MANAGER if (of_device_is_compatible(node, "nvidia,tegra210-adsp-audio-hv")) app->adma_chan += TEGRA210_ADSP_ADMA_CHANNEL_START_HV; @@ -1620,7 +1621,7 @@ static int tegra210_adsp_pcm_hw_free(struct snd_pcm_substream *substream) return 0; } -#ifdef CONFIG_SND_SOC_TEGRA_VIRT_T210REF_PCM +#ifdef CONFIG_TEGRA_HV_MANAGER static uint32_t tegra_adsp_get_admaif_id( struct tegra210_adsp *adsp, uint32_t apm_out_in, @@ -1783,7 +1784,7 @@ static int tegra210_adsp_pcm_trigger(struct snd_pcm_substream *substream, int cmd) { struct tegra210_adsp_pcm_rtd *prtd = substream->runtime->private_data; -#ifdef CONFIG_SND_SOC_TEGRA_VIRT_T210REF_PCM +#ifdef CONFIG_TEGRA_HV_MANAGER struct tegra210_adsp *adsp = prtd->fe_apm->adsp; struct device *dev = adsp->dev; struct device_node *node = dev->of_node; @@ -1792,7 +1793,7 @@ static int tegra210_adsp_pcm_trigger(struct snd_pcm_substream *substream, dev_vdbg(prtd->dev, "%s : state %d", __func__, cmd); -#ifdef CONFIG_SND_SOC_TEGRA_VIRT_T210REF_PCM +#ifdef CONFIG_TEGRA_HV_MANAGER if (of_device_is_compatible(node, "nvidia,tegra210-adsp-audio-hv")) { ret = tegra210_adsp_hv_pcm_trigger(adsp, prtd->fe_apm->reg, @@ -1954,7 +1955,7 @@ static void tegra210_adsp_pcm_free(struct snd_pcm *pcm) } } -#ifdef CONFIG_SND_SOC_TEGRA_VIRT_T210REF_PCM +#ifdef CONFIG_TEGRA_HV_MANAGER static void tegra_adsp_set_admaif_id( struct tegra210_adsp *adsp, uint32_t admaif_id, @@ -2112,7 +2113,7 @@ static int tegra210_adsp_admaif_hw_params(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { struct tegra210_adsp *adsp = snd_soc_dai_get_drvdata(dai); -#ifdef CONFIG_SND_SOC_TEGRA_VIRT_T210REF_PCM +#ifdef CONFIG_TEGRA_HV_MANAGER struct device *dev = adsp->dev; struct device_node *node = dev->of_node; #endif @@ -2128,7 +2129,7 @@ static int tegra210_adsp_admaif_hw_params(struct snd_pcm_substream *substream, if (!adsp->adsp_started) return -EINVAL; -#ifdef CONFIG_SND_SOC_TEGRA_VIRT_T210REF_PCM +#ifdef CONFIG_TEGRA_HV_MANAGER if (of_device_is_compatible(node, "nvidia,tegra210-adsp-audio-hv")) { /*Start of sending IVC command for admaif cif settings*/ @@ -2150,6 +2151,7 @@ static int tegra210_adsp_admaif_hw_params(struct snd_pcm_substream *substream, adma_params.mode = ADMA_MODE_CONTINUOUS; adma_params.ahub_channel = admaif_id; adma_params.periods = 2; /* We need ping-pong buffers for ADMA */ + adma_params.adma_ch_page = adsp->adma_ch_page; /* Set DMA params connected with ADSP-BE */ /* As a COCEC DAI, CAPTURE is transmit */ @@ -3750,6 +3752,7 @@ static int tegra210_adsp_audio_platform_probe(struct platform_device *pdev) struct tegra210_adsp *adsp; int i, j, wt_idx, mux_idx, ret = 0; unsigned int compr_ops = 1; + uint32_t adma_ch_page = 0; char plugin_info[20]; pr_info("tegra210_adsp_audio_platform_probe: platform probe started\n"); @@ -3932,6 +3935,13 @@ static int tegra210_adsp_audio_platform_probe(struct platform_device *pdev) if (!compr_ops) tegra210_adsp_platform.compr_ops = NULL; + if (of_property_read_u32_index(pdev->dev.of_node, "nvidia,adma_ch_page", + 0, &adma_ch_page)) { + dev_info(&pdev->dev, "adma channel page address dt entry not found\n"); + dev_info(&pdev->dev, "using adma channel page 0\n"); + } + adsp->adma_ch_page = adma_ch_page; + ret = snd_soc_register_platform(&pdev->dev, &tegra210_adsp_platform); if (ret) { dev_err(&pdev->dev, "Could not register platform: %d\n", ret);