ASoC: tegra: Fix hardcoded ARAM address

- ARAM start address is not same for all the chips and
  ARAM start address was hardcoded in asrc driver.
  To handle it for all the chips, moved ARAM start address
  info into compatible data of device.

Bug 3434231
Bug 3506754

Signed-off-by: Sheetal <sheetal@nvidia.com>
Change-Id: I860d2d299d11890c01187b19fac16f0d7b31e88c
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.10/+/2704344
(cherry picked from commit 2b93c82cbdafd80859488cb51f41ae8d5341bb79)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.10/+/2626008
Tested-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Sheetal
2021-11-15 15:25:22 +05:30
committed by Sameer Pujar
parent 125740cada
commit 685ae3b3e1
2 changed files with 21 additions and 6 deletions

View File

@@ -2,7 +2,7 @@
// //
// tegra186_asrc.c - Tegra186 ASRC driver // tegra186_asrc.c - Tegra186 ASRC driver
// //
// Copyright (c) 2015-2021, NVIDIA CORPORATION. All rights reserved. // Copyright (c) 2015-2022, NVIDIA CORPORATION. All rights reserved.
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/delay.h> #include <linux/delay.h>
@@ -25,7 +25,6 @@
#include "tegra210_ahub.h" #include "tegra210_ahub.h"
#include "tegra_cif.h" #include "tegra_cif.h"
#define ASRC_ARAM_START_ADDR 0x3F800000
#define RATIO_ARAD 0 #define RATIO_ARAD 0
#define RATIO_SW 1 #define RATIO_SW 1
@@ -171,7 +170,7 @@ static int tegra186_asrc_runtime_resume(struct device *dev)
/* Set global starting address of the buffer in ARAM */ /* Set global starting address of the buffer in ARAM */
regmap_write(asrc->regmap, regmap_write(asrc->regmap,
TEGRA186_ASRC_GLOBAL_SCRATCH_ADDR, TEGRA186_ASRC_GLOBAL_SCRATCH_ADDR,
ASRC_ARAM_START_ADDR); asrc->soc_data->aram_start_addr);
regmap_write(asrc->regmap, TEGRA186_ASRC_GLOBAL_INT_MASK, regmap_write(asrc->regmap, TEGRA186_ASRC_GLOBAL_INT_MASK,
0x01); 0x01);
@@ -1061,9 +1060,18 @@ static void tegra186_asrc_ahc_cb(void *data)
} }
#endif #endif
static const struct tegra_asrc_soc_data soc_data_tegra186 = {
.aram_start_addr = 0x3F800000,
};
static const struct tegra_asrc_soc_data soc_data_tegra239 = {
.aram_start_addr = 0x70000000,
};
static const struct of_device_id tegra186_asrc_of_match[] = { static const struct of_device_id tegra186_asrc_of_match[] = {
{ .compatible = "nvidia,tegra186-asrc" }, { .compatible = "nvidia,tegra186-asrc", .data = &soc_data_tegra186 },
{ .compatible = "nvidia,tegra194-asrc" }, { .compatible = "nvidia,tegra194-asrc", .data = &soc_data_tegra186 },
{ .compatible = "nvidia,tegra239-asrc", .data = &soc_data_tegra239 },
{}, {},
}; };
MODULE_DEVICE_TABLE(of, tegra186_asrc_of_match); MODULE_DEVICE_TABLE(of, tegra186_asrc_of_match);
@@ -1095,6 +1103,8 @@ static int tegra186_asrc_platform_probe(struct platform_device *pdev)
return PTR_ERR(asrc->regmap); return PTR_ERR(asrc->regmap);
} }
asrc->soc_data = of_device_get_match_data(&pdev->dev);
regcache_cache_only(asrc->regmap, true); regcache_cache_only(asrc->regmap, true);
#ifdef CONFIG_TEGRA186_AHC #ifdef CONFIG_TEGRA186_AHC

View File

@@ -2,7 +2,7 @@
/* /*
* tegra186_asrc.h - Definitions for Tegra186 ASRC driver * tegra186_asrc.h - Definitions for Tegra186 ASRC driver
* *
* Copyright (c) 2015-2021, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2015-2022, NVIDIA CORPORATION. All rights reserved.
* *
*/ */
@@ -157,7 +157,12 @@ struct tegra186_asrc_lane {
unsigned int output_thresh; unsigned int output_thresh;
}; };
struct tegra_asrc_soc_data {
unsigned int aram_start_addr;
};
struct tegra186_asrc { struct tegra186_asrc {
const struct tegra_asrc_soc_data *soc_data;
struct regmap *regmap; struct regmap *regmap;
struct tegra186_asrc_lane lane[6]; struct tegra186_asrc_lane lane[6];
struct tasklet_struct tasklet; struct tasklet_struct tasklet;