asoc: tegra-alt: keep ADMAIF Global Enable bit set

ADMAIF Global can get disabled before ADSP disables
its ADMA channels. This is not recommended as per
programming guidelines. So set ADMAIF Global Enable
bit in probe and keept is set always.

Bug 200069840

Change-Id: I73b38c4554b33c1af9d9027333ad12c55892ed7c
Signed-off-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-on: http://git-master/r/668983
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Arun Shamanna Lakshmi <aruns@nvidia.com>
Reviewed-by: Uday Gupta <udayg@nvidia.com>
Reviewed-by: Dara Ramesh <dramesh@nvidia.com>
This commit is contained in:
Viraj Karandikar
2015-01-04 20:29:02 +05:30
committed by Sameer Pujar
parent b2ec94e8e7
commit 21e6177bea

View File

@@ -1,7 +1,7 @@
/* /*
* tegra210_admaif_alt.c - Tegra ADMAIF driver * tegra210_admaif_alt.c - Tegra ADMAIF driver
* *
* Copyright (c) 2014 NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2015 NVIDIA CORPORATION. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@@ -138,22 +138,6 @@ static const struct regmap_config tegra210_admaif_regmap_config = {
.cache_type = REGCACHE_FLAT, .cache_type = REGCACHE_FLAT,
}; };
static void tegra210_admaif_global_enable(struct tegra210_admaif *admaif,
int enable)
{
if (enable) {
regmap_update_bits(admaif->regmap,
TEGRA210_ADMAIF_GLOBAL_ENABLE, 1, 1);
admaif->refcnt++;
} else {
admaif->refcnt--;
if (!admaif->refcnt)
regmap_update_bits(admaif->regmap,
TEGRA210_ADMAIF_GLOBAL_ENABLE, 1, 0);
}
}
static int tegra210_admaif_sw_reset(struct snd_soc_dai *dai, static int tegra210_admaif_sw_reset(struct snd_soc_dai *dai,
int direction, int timeout) int direction, int timeout)
{ {
@@ -342,8 +326,6 @@ static void tegra210_admaif_start_playback(struct snd_soc_dai *dai)
struct tegra210_admaif *admaif = snd_soc_dai_get_drvdata(dai); struct tegra210_admaif *admaif = snd_soc_dai_get_drvdata(dai);
unsigned int reg; unsigned int reg;
tegra210_admaif_global_enable(admaif, 1);
reg = TEGRA210_ADMAIF_XBAR_TX_ENABLE + reg = TEGRA210_ADMAIF_XBAR_TX_ENABLE +
(dai->id * TEGRA210_ADMAIF_CHANNEL_REG_STRIDE); (dai->id * TEGRA210_ADMAIF_CHANNEL_REG_STRIDE);
regmap_update_bits(admaif->regmap, reg, regmap_update_bits(admaif->regmap, reg,
@@ -358,7 +340,6 @@ static void tegra210_admaif_stop_playback(struct snd_soc_dai *dai)
unsigned int reg; unsigned int reg;
int dcnt = 10, ret; int dcnt = 10, ret;
tegra210_admaif_global_enable(admaif, 0);
reg = TEGRA210_ADMAIF_XBAR_TX_ENABLE + reg = TEGRA210_ADMAIF_XBAR_TX_ENABLE +
(dai->id * TEGRA210_ADMAIF_CHANNEL_REG_STRIDE); (dai->id * TEGRA210_ADMAIF_CHANNEL_REG_STRIDE);
regmap_update_bits(admaif->regmap, reg, regmap_update_bits(admaif->regmap, reg,
@@ -381,7 +362,6 @@ static void tegra210_admaif_start_capture(struct snd_soc_dai *dai)
struct tegra210_admaif *admaif = snd_soc_dai_get_drvdata(dai); struct tegra210_admaif *admaif = snd_soc_dai_get_drvdata(dai);
unsigned int reg; unsigned int reg;
tegra210_admaif_global_enable(admaif, 1);
reg = TEGRA210_ADMAIF_XBAR_RX_ENABLE + reg = TEGRA210_ADMAIF_XBAR_RX_ENABLE +
(dai->id * TEGRA210_ADMAIF_CHANNEL_REG_STRIDE); (dai->id * TEGRA210_ADMAIF_CHANNEL_REG_STRIDE);
regmap_update_bits(admaif->regmap, reg, regmap_update_bits(admaif->regmap, reg,
@@ -396,7 +376,6 @@ static void tegra210_admaif_stop_capture(struct snd_soc_dai *dai)
unsigned int reg; unsigned int reg;
int dcnt = 10, ret; int dcnt = 10, ret;
tegra210_admaif_global_enable(admaif, 0);
reg = TEGRA210_ADMAIF_XBAR_RX_ENABLE + reg = TEGRA210_ADMAIF_XBAR_RX_ENABLE +
(dai->id * TEGRA210_ADMAIF_CHANNEL_REG_STRIDE); (dai->id * TEGRA210_ADMAIF_CHANNEL_REG_STRIDE);
regmap_update_bits(admaif->regmap, reg, regmap_update_bits(admaif->regmap, reg,
@@ -446,19 +425,6 @@ static struct snd_soc_dai_ops tegra210_admaif_dai_ops = {
.trigger = tegra210_admaif_trigger, .trigger = tegra210_admaif_trigger,
}; };
static int tegra210_admaif_enable(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
struct snd_soc_codec *codec = w->codec;
struct device *dev = codec->dev;
struct tegra210_admaif *admaif = dev_get_drvdata(dev);
/* Note: ADMAIF channel is enabled/disabled by ADSP */
tegra210_admaif_global_enable(admaif, !!SND_SOC_DAPM_EVENT_ON(event));
return 0;
}
static int tegra210_admaif_dai_probe(struct snd_soc_dai *dai) static int tegra210_admaif_dai_probe(struct snd_soc_dai *dai)
{ {
struct tegra210_admaif *admaif = snd_soc_dai_get_drvdata(dai); struct tegra210_admaif *admaif = snd_soc_dai_get_drvdata(dai);
@@ -584,14 +550,10 @@ static struct snd_soc_dai_driver tegra210_admaif_codec_dais[] = {
}; };
#define ADMAIF_WIDGETS(id) \ #define ADMAIF_WIDGETS(id) \
SND_SOC_DAPM_AIF_IN_E("ADMAIF" #id " FIFO RX", NULL, 0, \ SND_SOC_DAPM_AIF_IN("ADMAIF" #id " FIFO RX", NULL, 0, \
SND_SOC_NOPM, 0, 0, \ SND_SOC_NOPM, 0, 0), \
tegra210_admaif_enable, \ SND_SOC_DAPM_AIF_OUT("ADMAIF" #id " FIFO TX", NULL, 0, \
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), \ SND_SOC_NOPM, 0, 0), \
SND_SOC_DAPM_AIF_OUT_E("ADMAIF" #id " FIFO TX", NULL, 0,\
SND_SOC_NOPM, 0, 0, \
tegra210_admaif_enable, \
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), \
SND_SOC_DAPM_AIF_IN("ADMAIF" #id " CIF RX", NULL, 0, \ SND_SOC_DAPM_AIF_IN("ADMAIF" #id " CIF RX", NULL, 0, \
SND_SOC_NOPM, 0, 0), \ SND_SOC_NOPM, 0, 0), \
SND_SOC_DAPM_AIF_OUT("ADMAIF" #id " CIF TX", NULL, 0, \ SND_SOC_DAPM_AIF_OUT("ADMAIF" #id " CIF TX", NULL, 0, \
@@ -811,6 +773,9 @@ static int tegra210_admaif_probe(struct platform_device *pdev)
goto err_unregister_codec; goto err_unregister_codec;
} }
regmap_update_bits(admaif->regmap,
TEGRA210_ADMAIF_GLOBAL_ENABLE, 1, 1);
return 0; return 0;
err_unregister_codec: err_unregister_codec: