mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
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:
committed by
mobile promotions
parent
07a8392942
commit
b0b6f09a6d
@@ -1,9 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2017-2023 NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Tegra ASoC Machine driver
|
||||
*/
|
||||
// SPDX-FileCopyrightText: Copyright (c) 2017-2024 NVIDIA CORPORATION. All rights reserved.
|
||||
//
|
||||
// tegra_machine_driver.c - Tegra ASoC Machine driver
|
||||
|
||||
#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,
|
||||
unsigned int rate, unsigned int channels,
|
||||
u64 formats)
|
||||
u64 formats,
|
||||
struct snd_pcm_hw_params *pcm_params)
|
||||
{
|
||||
unsigned int mask = (1 << channels) - 1;
|
||||
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);
|
||||
|
||||
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 (!rtd->dai_link->c2c_params)
|
||||
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),
|
||||
params_channels(params),
|
||||
params_format(params));
|
||||
params_format(params),
|
||||
params);
|
||||
if (err < 0) {
|
||||
dev_err(card->dev, "Failed dai init\n");
|
||||
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,
|
||||
codec_params.ch_out,
|
||||
SNDRV_PCM_FORMAT_S16_LE);
|
||||
SNDRV_PCM_FORMAT_S16_LE,
|
||||
NULL);
|
||||
if (err < 0) {
|
||||
dev_err(card->dev, "Failed dai init\n");
|
||||
return err;
|
||||
@@ -327,6 +344,46 @@ static struct snd_soc_card snd_soc_tegra_card = {
|
||||
.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 */
|
||||
static const struct of_device_id tegra_machine_of_match[] = {
|
||||
{ .compatible = "nvidia,tegra186-ape" },
|
||||
@@ -360,6 +417,13 @@ static int tegra_machine_driver_probe(struct platform_device *pdev)
|
||||
if (ret < 0)
|
||||
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);
|
||||
if (ret < 0)
|
||||
goto cleanup_asoc;
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
* later by storing all DAI settings in the driver.
|
||||
*/
|
||||
|
||||
#include <nvidia/conftest.h>
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/module.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 */
|
||||
for_each_card_rtds(card, rtd) {
|
||||
/* Skip FE links */
|
||||
if (!rtd->dai_link->no_pcm)
|
||||
/* Skip FE links for sound card with DPCM routes for AHUB */
|
||||
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;
|
||||
|
||||
rtd->dai_link->be_hw_params_fixup = tegra_hw_params_fixup;
|
||||
|
||||
Reference in New Issue
Block a user