Revert "Revert "ASoC: tegra: use upstreamed AHUB drivers""

This reverts commit 1d0f4c4ffc.
This is done to restore original commit of using upstreamed AHUB
drivers as the GVS intermittency issue is now root caused.

Bug 4508166

Change-Id: Iae064f8dae4cf79c639f060c3e24bda43a82b201
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3083109
Reviewed-by: Mohan kumar <mkumard@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Sameer Pujar
2024-02-24 11:25:52 +00:00
committed by mobile promotions
parent 07a8392942
commit b0b6f09a6d
2 changed files with 84 additions and 10 deletions

View File

@@ -1,9 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/* // SPDX-FileCopyrightText: Copyright (c) 2017-2024 NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2017-2023 NVIDIA CORPORATION. All rights reserved. //
* // tegra_machine_driver.c - Tegra ASoC Machine driver
* Tegra ASoC Machine driver
*/
#include <nvidia/conftest.h> #include <nvidia/conftest.h>
@@ -114,7 +112,8 @@ static int tegra_machine_codec_put_format(struct snd_kcontrol *kcontrol,
static int tegra_machine_dai_init(struct snd_soc_pcm_runtime *runtime, static int tegra_machine_dai_init(struct snd_soc_pcm_runtime *runtime,
unsigned int rate, unsigned int channels, unsigned int rate, unsigned int channels,
u64 formats) u64 formats,
struct snd_pcm_hw_params *pcm_params)
{ {
unsigned int mask = (1 << channels) - 1; unsigned int mask = (1 << channels) - 1;
struct snd_soc_card *card = runtime->card; struct snd_soc_card *card = runtime->card;
@@ -167,6 +166,22 @@ static int tegra_machine_dai_init(struct snd_soc_pcm_runtime *runtime,
machine->audio_clock.set_pll_out, aud_mclk, srate); machine->audio_clock.set_pll_out, aud_mclk, srate);
list_for_each_entry(rtd, &card->rtd_list, list) { list_for_each_entry(rtd, &card->rtd_list, list) {
/* fixup PCM params */
if (pcm_params && rtd->dai_link->be_hw_params_fixup) {
struct snd_pcm_hw_params new_params = *pcm_params;
err = rtd->dai_link->be_hw_params_fixup(rtd, &new_params);
if (err) {
dev_err(rtd->card->dev, "fixup failed for link %s\n",
rtd->dai_link->name);
return err;
}
srate = params_rate(&new_params);
channels = params_channels(&new_params);
format_k = 1 << params_format(&new_params);
}
#if defined(NV_SND_SOC_DAI_LINK_STRUCT_HAS_C2C_PARAMS_ARG) /* Linux v6.4 */ #if defined(NV_SND_SOC_DAI_LINK_STRUCT_HAS_C2C_PARAMS_ARG) /* Linux v6.4 */
if (!rtd->dai_link->c2c_params) if (!rtd->dai_link->c2c_params)
continue; continue;
@@ -208,7 +223,8 @@ static int tegra_machine_pcm_hw_params(struct snd_pcm_substream *substream,
err = tegra_machine_dai_init(rtd, params_rate(params), err = tegra_machine_dai_init(rtd, params_rate(params),
params_channels(params), params_channels(params),
params_format(params)); params_format(params),
params);
if (err < 0) { if (err < 0) {
dev_err(card->dev, "Failed dai init\n"); dev_err(card->dev, "Failed dai init\n");
return err; return err;
@@ -275,7 +291,8 @@ static int tegra_machine_compr_set_params(struct snd_compr_stream *cstream)
err = tegra_machine_dai_init(rtd, codec_params.sample_rate, err = tegra_machine_dai_init(rtd, codec_params.sample_rate,
codec_params.ch_out, codec_params.ch_out,
SNDRV_PCM_FORMAT_S16_LE); SNDRV_PCM_FORMAT_S16_LE,
NULL);
if (err < 0) { if (err < 0) {
dev_err(card->dev, "Failed dai init\n"); dev_err(card->dev, "Failed dai init\n");
return err; return err;
@@ -327,6 +344,46 @@ static struct snd_soc_card snd_soc_tegra_card = {
.driver_name = "tegra-ape", .driver_name = "tegra-ape",
}; };
static struct snd_soc_dai_driver tegra_dummy_dai = {
.name = "tegra-snd-dummy-dai",
.playback = {
.stream_name = "Dummy Playback",
.channels_min = 1,
.channels_max = 32,
.rates = SNDRV_PCM_RATE_8000_192000,
.formats = SNDRV_PCM_FMTBIT_S8 |
SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S32_LE,
},
.capture = {
.stream_name = "Dummy Capture",
.channels_min = 1,
.channels_max = 32,
.rates = SNDRV_PCM_RATE_8000_192000,
.formats = SNDRV_PCM_FMTBIT_S8 |
SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S32_LE,
},
};
static const struct snd_soc_dapm_widget tegra_dummy_widgets[] = {
SND_SOC_DAPM_MIC("Dummy MIC", NULL),
SND_SOC_DAPM_SPK("Dummy SPK", NULL),
};
static const struct snd_soc_dapm_route tegra_dummy_routes[] = {
{"Dummy SPK", NULL, "Dummy Playback"},
{"Dummy Capture", NULL, "Dummy MIC"},
};
static const struct snd_soc_component_driver tegra_dummy_component = {
.dapm_widgets = tegra_dummy_widgets,
.num_dapm_widgets = ARRAY_SIZE(tegra_dummy_widgets),
.dapm_routes = tegra_dummy_routes,
.num_dapm_routes = ARRAY_SIZE(tegra_dummy_routes),
.endianness = 1,
};
/* structure to match device tree node */ /* structure to match device tree node */
static const struct of_device_id tegra_machine_of_match[] = { static const struct of_device_id tegra_machine_of_match[] = {
{ .compatible = "nvidia,tegra186-ape" }, { .compatible = "nvidia,tegra186-ape" },
@@ -360,6 +417,13 @@ static int tegra_machine_driver_probe(struct platform_device *pdev)
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = devm_snd_soc_register_component(&pdev->dev, &tegra_dummy_component,
&tegra_dummy_dai, 1);
if (ret < 0) {
dev_err(&pdev->dev, "Tegra dummy component registration fails\n");
return ret;
}
ret = add_dai_links(card); ret = add_dai_links(card);
if (ret < 0) if (ret < 0)
goto cleanup_asoc; goto cleanup_asoc;

View File

@@ -21,6 +21,8 @@
* later by storing all DAI settings in the driver. * later by storing all DAI settings in the driver.
*/ */
#include <nvidia/conftest.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
@@ -417,8 +419,16 @@ static int tegra_mixer_control_probe(struct platform_device *pdev)
/* Fixup callback for BE codec2codec links */ /* Fixup callback for BE codec2codec links */
for_each_card_rtds(card, rtd) { for_each_card_rtds(card, rtd) {
/* Skip FE links */ /* Skip FE links for sound card with DPCM routes for AHUB */
if (!rtd->dai_link->no_pcm) if (rtd->card->component_chaining && !rtd->dai_link->no_pcm)
continue;
/* Skip FE links for sound card with codec2codc routes for AHUB */
#if defined(NV_SND_SOC_DAI_LINK_STRUCT_HAS_C2C_PARAMS_ARG) /* Linux v6.4 */
if (!rtd->card->component_chaining && !rtd->dai_link->c2c_params)
#else
if (!rtd->card->component_chaining && !rtd->dai_link->params)
#endif
continue; continue;
rtd->dai_link->be_hw_params_fixup = tegra_hw_params_fixup; rtd->dai_link->be_hw_params_fixup = tegra_hw_params_fixup;