From 685ae3b3e19f4b5c1c3f15cd1c23c103c74b4471 Mon Sep 17 00:00:00 2001 From: Sheetal Date: Mon, 15 Nov 2021 15:25:22 +0530 Subject: [PATCH] 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 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 Reviewed-by: Mohan Kumar D Reviewed-by: svcacv Reviewed-by: Sameer Pujar Reviewed-by: svc_kernel_abi Reviewed-by: Sharad Gupta GVS: Gerrit_Virtual_Submit --- sound/soc/tegra/tegra186_asrc.c | 20 +++++++++++++++----- sound/soc/tegra/tegra186_asrc.h | 7 ++++++- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/sound/soc/tegra/tegra186_asrc.c b/sound/soc/tegra/tegra186_asrc.c index 080f2c62..4fb20c0e 100644 --- a/sound/soc/tegra/tegra186_asrc.c +++ b/sound/soc/tegra/tegra186_asrc.c @@ -2,7 +2,7 @@ // // 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 #include @@ -25,7 +25,6 @@ #include "tegra210_ahub.h" #include "tegra_cif.h" -#define ASRC_ARAM_START_ADDR 0x3F800000 #define RATIO_ARAD 0 #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 */ regmap_write(asrc->regmap, TEGRA186_ASRC_GLOBAL_SCRATCH_ADDR, - ASRC_ARAM_START_ADDR); + asrc->soc_data->aram_start_addr); regmap_write(asrc->regmap, TEGRA186_ASRC_GLOBAL_INT_MASK, 0x01); @@ -1061,9 +1060,18 @@ static void tegra186_asrc_ahc_cb(void *data) } #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[] = { - { .compatible = "nvidia,tegra186-asrc" }, - { .compatible = "nvidia,tegra194-asrc" }, + { .compatible = "nvidia,tegra186-asrc", .data = &soc_data_tegra186 }, + { .compatible = "nvidia,tegra194-asrc", .data = &soc_data_tegra186 }, + { .compatible = "nvidia,tegra239-asrc", .data = &soc_data_tegra239 }, {}, }; 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); } + asrc->soc_data = of_device_get_match_data(&pdev->dev); + regcache_cache_only(asrc->regmap, true); #ifdef CONFIG_TEGRA186_AHC diff --git a/sound/soc/tegra/tegra186_asrc.h b/sound/soc/tegra/tegra186_asrc.h index 510d2747..7f85a0cb 100644 --- a/sound/soc/tegra/tegra186_asrc.h +++ b/sound/soc/tegra/tegra186_asrc.h @@ -2,7 +2,7 @@ /* * 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; }; +struct tegra_asrc_soc_data { + unsigned int aram_start_addr; +}; + struct tegra186_asrc { + const struct tegra_asrc_soc_data *soc_data; struct regmap *regmap; struct tegra186_asrc_lane lane[6]; struct tasklet_struct tasklet;