ASoC: tegra-alt: add amx auto disable support

Change adds support for auto enable/disable feature
in amx for t19x onward soc family.

Jira EMA-876

Change-Id: I8b9a63e6d186984632da6114c29e5fb8a0537b61
Signed-off-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1573651
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Dipesh Gandhi
2017-10-05 16:10:36 +05:30
committed by Sameer Pujar
parent 681288f1be
commit 93e212df79
2 changed files with 28 additions and 1 deletions

View File

@@ -49,6 +49,7 @@
#define TEGRA210_AMX_DBG 0xb4 #define TEGRA210_AMX_DBG 0xb4
#define TEGRA210_AMX_AHUBRAMCTL_AMX_CTRL 0xb8 #define TEGRA210_AMX_AHUBRAMCTL_AMX_CTRL 0xb8
#define TEGRA210_AMX_AHUBRAMCTL_AMX_DATA 0xbc #define TEGRA210_AMX_AHUBRAMCTL_AMX_DATA 0xbc
#define TEGRA194_AMX_RX1_CTRL_FRAME_PERIOD 0xc0
/* Fields in TEGRA210_AMX_AXBAR_RX1_CIF_CTRL */ /* Fields in TEGRA210_AMX_AXBAR_RX1_CIF_CTRL */
/* Uses field from TEGRA210_AUDIOCIF_CTRL_* in tegra210_xbar_alt.h */ /* Uses field from TEGRA210_AUDIOCIF_CTRL_* in tegra210_xbar_alt.h */
@@ -177,6 +178,7 @@ struct tegra210_amx_soc_data {
void (*set_audio_cif)(struct regmap *map, void (*set_audio_cif)(struct regmap *map,
unsigned int reg, unsigned int reg,
struct tegra210_xbar_cif_conf *conf); struct tegra210_xbar_cif_conf *conf);
bool is_auto_disable_supported;
}; };
struct tegra210_amx { struct tegra210_amx {

View File

@@ -369,6 +369,24 @@ static int tegra210_amx_in_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
int ret; int ret;
struct tegra210_amx *amx = snd_soc_dai_get_drvdata(dai);
/* For T19x soc frame period disable counter can be programmed as:
* counter = 1 * ahub_clk_rate
* -------------------------
* sample_rate
*
* TODO: read actual sample_rate & ahub_clk_rate
* For now using:
* sample_rate = 8000
* ahub_clk_rate = 49152000
*/
if (amx->soc_data->is_auto_disable_supported)
regmap_write(amx->regmap,
TEGRA194_AMX_RX1_CTRL_FRAME_PERIOD +
(dai->id * TEGRA210_AMX_AUDIOCIF_CH_STRIDE),
0x1800);
ret = tegra210_amx_set_audio_cif(dai, params, ret = tegra210_amx_set_audio_cif(dai, params,
TEGRA210_AMX_AXBAR_RX1_CIF_CTRL + TEGRA210_AMX_AXBAR_RX1_CIF_CTRL +
@@ -846,11 +864,18 @@ static const struct regmap_config tegra210_amx_regmap_config = {
}; };
static const struct tegra210_amx_soc_data soc_data_tegra210 = { static const struct tegra210_amx_soc_data soc_data_tegra210 = {
.set_audio_cif = tegra210_xbar_set_cif .set_audio_cif = tegra210_xbar_set_cif,
.is_auto_disable_supported = false,
};
static const struct tegra210_amx_soc_data soc_data_tegra194 = {
.set_audio_cif = tegra210_xbar_set_cif,
.is_auto_disable_supported = true,
}; };
static const struct of_device_id tegra210_amx_of_match[] = { static const struct of_device_id tegra210_amx_of_match[] = {
{ .compatible = "nvidia,tegra210-amx", .data = &soc_data_tegra210 }, { .compatible = "nvidia,tegra210-amx", .data = &soc_data_tegra210 },
{ .compatible = "nvidia,tegra194-amx", .data = &soc_data_tegra194 },
{}, {},
}; };