diff --git a/sound/soc/tegra/tegra210_admaif.c b/sound/soc/tegra/tegra210_admaif.c index 3e91aa5d..994d5e8f 100644 --- a/sound/soc/tegra/tegra210_admaif.c +++ b/sound/soc/tegra/tegra210_admaif.c @@ -1174,6 +1174,7 @@ static const struct snd_soc_component_driver tegra210_admaif_cmpnt = { .close = tegra_pcm_close, .hw_params = tegra_pcm_hw_params, .pointer = tegra_pcm_pointer, + .use_dai_pcm_id = 1, }; static const struct snd_soc_component_driver tegra186_admaif_cmpnt = { @@ -1188,6 +1189,7 @@ static const struct snd_soc_component_driver tegra186_admaif_cmpnt = { .close = tegra_pcm_close, .hw_params = tegra_pcm_hw_params, .pointer = tegra_pcm_pointer, + .use_dai_pcm_id = 1, }; static const struct tegra_admaif_soc_data soc_data_tegra210 = { diff --git a/sound/soc/tegra/tegra210_adsp.c b/sound/soc/tegra/tegra210_adsp.c index 3ff29499..dbac867f 100644 --- a/sound/soc/tegra/tegra210_adsp.c +++ b/sound/soc/tegra/tegra210_adsp.c @@ -3,7 +3,7 @@ * tegra210_adsp.c - Tegra ADSP audio driver * * Author: Sumit Bhattacharya - * Copyright (c) 2014-2021 NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2014-2022 NVIDIA CORPORATION. All rights reserved. * */ @@ -4438,6 +4438,8 @@ static struct snd_soc_component_driver tegra210_adsp_cmpnt = { .compress_ops = &tegra210_adsp_compress_ops, .read = tegra210_adsp_read, .write = tegra210_adsp_write, + + .use_dai_pcm_id = 1, }; static u64 tegra_dma_mask = DMA_BIT_MASK(32); diff --git a/sound/soc/tegra/tegra_asoc_machine.c b/sound/soc/tegra/tegra_asoc_machine.c index 792fe52f..586dbb23 100644 --- a/sound/soc/tegra/tegra_asoc_machine.c +++ b/sound/soc/tegra/tegra_asoc_machine.c @@ -2,7 +2,7 @@ /* * tegra_asoc_machine.c - Tegra DAI links parser * - * Copyright (c) 2014-2021 NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2014-2022 NVIDIA CORPORATION. All rights reserved. * */ @@ -424,6 +424,7 @@ static int parse_dt_dai_links(struct snd_soc_card *card, struct device_node *codec = NULL, *cpu = NULL; struct snd_soc_dai_link *dai_link; int link_type = 0, codec_count = 0; + char *link_addr; if (!of_dai_link_is_available(link_node)) { link_node = of_get_next_child(top, link_node); @@ -505,6 +506,28 @@ static int parse_dt_dai_links(struct snd_soc_card *card, goto cleanup; } + /* + * Assign DAI link ID based on DT link address. + * This is done to use consistent PCM/Compress device + * IDs irrespective of parsing order of DT DAI links. + */ + link_addr = strrchr(link_node->full_name, '@'); + if (!link_addr) { + dev_err(&pdev->dev, + "Invalid link node (%pOF)\n", + link_node); + ret = -EINVAL; + goto cleanup; + } + + ret = kstrtos32(++link_addr, 10, &dai_link->id); + if (ret < 0) { + dev_err(&pdev->dev, + "Failed to get link node (%pOF) ID\n", + link_node); + goto cleanup; + } + link_count++; codec_count++; } @@ -544,7 +567,7 @@ int parse_card_info(struct snd_soc_card *card, struct snd_soc_ops *pcm_ops, return ret; } - /* + /*str * Below property of routing map is required only when there * are DAPM input/output widgets available for external codec, * which require them to be connected to machine source/sink