From 36d1775879a9ec87a70b04a81f8773dd0fc6c05f Mon Sep 17 00:00:00 2001 From: Laxman Dewangan Date: Tue, 21 Nov 2023 08:24:49 +0000 Subject: [PATCH] sound: soc: Avoid uses of asoc_xxx() From Linux 6.7, the asoc_xxx() is replaced by the various function. Use the appropriate functions. *** commit 1d5a2b5dd0a8d2b2b535b5266699429dbd48e62f Author: Kuninori Morimoto ASoC: soc.h: convert asoc_xxx() to snd_soc_xxx() Author: Kuninori Morimoto ASoC: simple_card_utils.h: convert not to use asoc_xxx() *** Bug 4346767 Change-Id: Ie3945f3997d745df8223fd31c1386a3db44e6ceb Signed-off-by: Laxman Dewangan Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3019997 Reviewed-by: Suresh Mangipudi GVS: Gerrit_Virtual_Submit --- Makefile | 6 +++++ sound/soc/tegra-virt-alt/tegra_pcm_virt_alt.c | 22 +++++++++++++++++++ sound/soc/tegra-virt-alt/tegra_virt_ref_alt.c | 7 +++++- sound/soc/tegra/tegra_asoc_machine.c | 18 +++++++++++++++ sound/soc/tegra/tegra_codecs.c | 5 +++++ 5 files changed, 57 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 027a579b..47233d10 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,7 @@ LINUX_VERSION_6_2 := $(shell expr 6 \* 256 + 2) LINUX_VERSION_6_3 := $(shell expr 6 \* 256 + 3) LINUX_VERSION_6_4 := $(shell expr 6 \* 256 + 4) LINUX_VERSION_6_6 := $(shell expr 6 \* 256 + 6) +LINUX_VERSION_6_7 := $(shell expr 6 \* 256 + 7) # The Tegra IVC driver was updated to support iosys-map in Linux v6.2. # For Linux v6.2 kernels, don't build any drivers that requires this. @@ -82,6 +83,11 @@ subdir-ccflags-y += -DNV_PCIE_EFP_DRIVER_PROBE_HAS_ID_ARG export CONFIG_SKIP_CRYPTO=y endif +# Changes done in Linux 6.7 onwards +ifeq ($(shell test $(LINUX_VERSION) -ge $(LINUX_VERSION_6_7); echo $$?),0) +subdir-ccflags-y += -DNV_ASOC_XXX_DROP +endif + ifeq ($(CONFIG_TEGRA_VIRTUALIZATION),y) subdir-ccflags-y += -DCONFIG_TEGRA_VIRTUALIZATION endif diff --git a/sound/soc/tegra-virt-alt/tegra_pcm_virt_alt.c b/sound/soc/tegra-virt-alt/tegra_pcm_virt_alt.c index ac63701e..70ec4401 100644 --- a/sound/soc/tegra-virt-alt/tegra_pcm_virt_alt.c +++ b/sound/soc/tegra-virt-alt/tegra_pcm_virt_alt.c @@ -37,13 +37,21 @@ static int tegra_alt_pcm_open(struct snd_soc_component *component, struct snd_soc_pcm_runtime *rtd = substream->private_data; struct tegra_alt_pcm_dma_params *dmap; struct dma_chan *chan; +#if defined(NV_ASOC_XXX_DROP) + struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); +#else struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); +#endif int ret; if (rtd->dai_link->no_pcm) return 0; +#if defined(NV_ASOC_XXX_DROP) + dmap = snd_soc_dai_get_dma_data(snd_soc_rtd_to_cpu(rtd, 0), substream); +#else dmap = snd_soc_dai_get_dma_data(asoc_rtd_to_cpu(rtd, 0), substream); +#endif /* Set HW params now that initialization is complete */ snd_soc_set_runtime_hwparams(substream, &tegra_alt_pcm_hardware); @@ -106,7 +114,11 @@ static int tegra_alt_pcm_hw_params(struct snd_soc_component *component, if (rtd->dai_link->no_pcm) return 0; +#if defined(NV_ASOC_XXX_DROP) + dmap = snd_soc_dai_get_dma_data(snd_soc_rtd_to_cpu(rtd, 0), substream); +#else dmap = snd_soc_dai_get_dma_data(asoc_rtd_to_cpu(rtd, 0), substream); +#endif if (!dmap) return 0; @@ -249,8 +261,13 @@ static int tegra_alt_pcm_dma_allocate(struct snd_soc_pcm_runtime *rtd, if (ret) return ret; +#if defined(NV_ASOC_XXX_DROP) + dmap = snd_soc_dai_get_dma_data(snd_soc_rtd_to_cpu(rtd, 0), + pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream); +#else dmap = snd_soc_dai_get_dma_data(asoc_rtd_to_cpu(rtd, 0), pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream); +#endif if (dmap->buffer_size > size) buffer_size = dmap->buffer_size; if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { @@ -261,8 +278,13 @@ static int tegra_alt_pcm_dma_allocate(struct snd_soc_pcm_runtime *rtd, goto err; } +#if defined(NV_ASOC_XXX_DROP) + dmap = snd_soc_dai_get_dma_data(snd_soc_rtd_to_cpu(rtd, 0), + pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream); +#else dmap = snd_soc_dai_get_dma_data(asoc_rtd_to_cpu(rtd, 0), pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream); +#endif if (dmap->buffer_size > size) buffer_size = dmap->buffer_size; if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { diff --git a/sound/soc/tegra-virt-alt/tegra_virt_ref_alt.c b/sound/soc/tegra-virt-alt/tegra_virt_ref_alt.c index 3b4c4de3..94873866 100644 --- a/sound/soc/tegra-virt-alt/tegra_virt_ref_alt.c +++ b/sound/soc/tegra-virt-alt/tegra_virt_ref_alt.c @@ -203,9 +203,14 @@ static int tegra_virt_machine_driver_probe(struct platform_device *pdev) } list_for_each_entry(rtd, &card->rtd_list, list) { +#if defined(NV_ASOC_XXX_DROP) + struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0); + struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); +#else struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); - struct snd_soc_dai_driver *codec_drv = codec_dai->driver; struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); +#endif + struct snd_soc_dai_driver *codec_drv = codec_dai->driver; struct snd_soc_dai_driver *cpu_drv = cpu_dai->driver; cpu_drv->playback.rates = SNDRV_PCM_RATE_KNOT; diff --git a/sound/soc/tegra/tegra_asoc_machine.c b/sound/soc/tegra/tegra_asoc_machine.c index 8d785cc5..2d4a468c 100644 --- a/sound/soc/tegra/tegra_asoc_machine.c +++ b/sound/soc/tegra/tegra_asoc_machine.c @@ -498,18 +498,32 @@ static int parse_dt_dai_links(struct snd_soc_card *card, if (of_property_read_string(link_node, "link-name", &dai_link->name)) { +#if defined(NV_ASOC_XXX_DROP) + ret = simple_util_set_dailink_name( + &pdev->dev, dai_link, "%s-%d", + "tegra-dlink", link_count); +#else ret = asoc_simple_set_dailink_name( &pdev->dev, dai_link, "%s-%d", "tegra-dlink", link_count); +#endif if (ret < 0) goto cleanup; } +#if defined(NV_ASOC_XXX_DROP) + simple_util_parse_daifmt(&pdev->dev, link_node, codec, + NULL, &dai_link->dai_fmt); + + simple_util_canonicalize_platform(dai_link->platforms, + dai_link->cpus); +#else asoc_simple_parse_daifmt(&pdev->dev, link_node, codec, NULL, &dai_link->dai_fmt); asoc_simple_canonicalize_platform(dai_link->platforms, dai_link->cpus); +#endif of_property_read_u32(link_node, "link-type", &link_type); @@ -582,7 +596,11 @@ int parse_card_info(struct snd_soc_card *card, struct snd_soc_ops *pcm_ops, struct device_node *node = card->dev->of_node; int ret; +#if defined(NV_ASOC_XXX_DROP) + ret = simple_util_parse_card_name(card, PREFIX); +#else ret = asoc_simple_parse_card_name(card, PREFIX); +#endif if (ret < 0) return ret; diff --git a/sound/soc/tegra/tegra_codecs.c b/sound/soc/tegra/tegra_codecs.c index 2dd67aac..cce49984 100644 --- a/sound/soc/tegra/tegra_codecs.c +++ b/sound/soc/tegra/tegra_codecs.c @@ -22,8 +22,13 @@ static int tegra_audio_dai_init(struct snd_soc_pcm_runtime *rtd) { /* Used for audio graph based sound cards only */ +#if defined(NV_ASOC_XXX_DROP) + if (rtd->card->component_chaining) + return simple_util_dai_init(rtd); +#else if (rtd->card->component_chaining) return asoc_simple_dai_init(rtd); +#endif return 0; }