From 59b14ea0b88989a98b7fe4012af498dad697459c Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Sat, 7 Oct 2023 19:39:51 +0100 Subject: [PATCH] ASoC: tegra: Avoid kernel version checks Rather than using kernel version checks to determine which kernel APIs to use, add the necessary tests to the conftest script to determine which kernel APIs are present in the kernel. Note that the function snd_soc_dai_init_dma_data() has been present in the Linux kernel since v3.13 and so use this for all kernel versions. In Linux v6.3, the 'playback_dma_data' and 'capture_dma_data' members of the snd_soc_dai_driver structure were replaced and so these could no longer be set directly. However, the arguments to snd_soc_dai_init_dma_data() have not changed and so can be used for older kernels and well has the current. This is beneficial for working with 3rd party Linux kernels that may have back-ported upstream changes into their kernel and so the kernel version checks do not work. Bug 4221847 Change-Id: Ibac0c6bab78e93f03981dfe3d1b2025ea19d4c92 Signed-off-by: Jon Hunter Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2993795 Tested-by: mobile promotions Reviewed-by: mobile promotions --- scripts/conftest/Makefile | 3 + scripts/conftest/conftest.sh | 58 +++++++++++++++++++ .../tegra-virt-alt/tegra210_virt_alt_admaif.c | 6 -- sound/soc/tegra/tegra186_arad.c | 5 +- sound/soc/tegra/tegra186_asrc.c | 5 +- sound/soc/tegra/tegra186_dspk.c | 5 +- sound/soc/tegra/tegra210_admaif.c | 7 +-- sound/soc/tegra/tegra210_adx.c | 5 +- sound/soc/tegra/tegra210_afc.c | 7 ++- sound/soc/tegra/tegra210_ahub.c | 9 +-- sound/soc/tegra/tegra210_amx.c | 4 +- sound/soc/tegra/tegra210_dmic.c | 5 +- sound/soc/tegra/tegra210_i2s.c | 5 +- sound/soc/tegra/tegra210_mixer.c | 5 +- sound/soc/tegra/tegra210_mvc.c | 5 +- sound/soc/tegra/tegra210_ope.c | 5 +- sound/soc/tegra/tegra210_sfc.c | 5 +- sound/soc/tegra/tegra_codecs.c | 9 ++- sound/tegra-safety-audio/sound-card.c | 5 +- 19 files changed, 111 insertions(+), 47 deletions(-) diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index e6663cb6..ea751ca1 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -101,6 +101,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += define_semaphore_has_number_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += device_add_disk_has_int_return_type NV_CONFTEST_FUNCTION_COMPILE_TESTS += devm_thermal_of_zone_register NV_CONFTEST_FUNCTION_COMPILE_TESTS += disk_check_media_change +NV_CONFTEST_FUNCTION_COMPILE_TESTS += dma_slave_config_struct_has_slave_id NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_aperture_remove_framebuffers NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_driver_struct_has_irq_enabled_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_fb_helper_alloc_info @@ -119,6 +120,8 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += netif_set_tso_max_size NV_CONFTEST_FUNCTION_COMPILE_TESTS += netif_napi_add_weight NV_CONFTEST_FUNCTION_COMPILE_TESTS += pde_data NV_CONFTEST_FUNCTION_COMPILE_TESTS += register_shrinker_has_fmt_arg +NV_CONFTEST_FUNCTION_COMPILE_TESTS += snd_soc_card_jack_new_has_no_snd_soc_jack_pins +NV_CONFTEST_FUNCTION_COMPILE_TESTS += snd_soc_component_driver_struct_has_non_legacy_dai_naming NV_CONFTEST_FUNCTION_COMPILE_TESTS += snd_soc_dai_link_struct_has_c2c_params_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += snd_soc_of_get_dai_name_has_index_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += tc_taprio_qopt_offload_struct_has_cmd diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index d8867862..e686765c 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -6566,6 +6566,23 @@ compile_test() { compile_check_conftest "$CODE" "NV_DISK_CHECK_MEDIA_CHANGE_PRESENT" "" "functions" ;; + dma_slave_config_struct_has_slave_id) + # + # Determine if 'struct dma_slave_config' has the 'slave_id' member. + # + # In Linux v5.17, commit 3c2196440757 ("dmaengine: remove slave_id config field") + # removed the 'slave_id' member from the 'struct dma_slave_config'. + # + CODE=" + #include + int conftest_dma_slave_config_struct_has_slave_id(void) { + return offsetof(struct dma_slave_config, slave_id); + }" + + compile_check_conftest "$CODE" \ + "NV_DMA_SLAVE_CONFIG_STRUCT_HAS_SLAVE_ID" "" "types" + ;; + drm_aperture_remove_framebuffers) # # Determine if the function 'drm_aperture_remove_framebuffers' @@ -6916,6 +6933,47 @@ compile_test() { compile_check_conftest "$CODE" "NV_REQUEST_STRUCT_HAS_COMPLETION_DATA_ARG" "" "types" ;; + snd_soc_card_jack_new_has_no_snd_soc_jack_pins) + # + # Determine if the function snd_soc_card_jack_new() has 'pins' and + # 'num_pins' arguments. + # + # In Linux v5,19, commit 19aed2d6cdb7 ("ASoC: soc-card: Create jack + # kcontrol without pins") removed the 'pins' and 'num_pins' + # arguments from the snd_soc_card_jack_new() function. + # + CODE=" + #include + #include + int conftest_snd_soc_card_jack_new_has_no_snd_soc_jack_pins(struct snd_soc_card *card, + struct snd_soc_jack *jack) { + return snd_soc_card_jack_new(card, \"Jack\", SND_JACK_HEADSET, jack); + }" + + compile_check_conftest "$CODE" \ + "NV_SND_SOC_CARD_JACK_NEW_HAS_NO_SND_SOC_JACK_PINS" "" "types" + ;; + + snd_soc_component_driver_struct_has_non_legacy_dai_naming) + # + # Determine if 'struct snd_soc_component_driver' has the + # 'non_legacy_dai_naming' member. + # + # In Linux v6.0, commit 01936221278c ("ASoC: soc-component: Remove + # non_legacy_dai_naming flag") removed the 'non_legacy_dai_naming' + # flag from the 'struct snd_soc_component_driver'. + # + CODE=" + #include + unsigned int conftest_snd_soc_component_driver_struct_has_non_legacy_dai_naming( + struct snd_soc_component_driver *driver) { + return driver->non_legacy_dai_naming; + }" + + compile_check_conftest "$CODE" \ + "NV_SND_SOC_COMPONENT_DRIVER_STRUCT_HAS_NON_LEGACY_DAI_NAMING" "" "types" + ;; + snd_soc_dai_link_struct_has_c2c_params_arg) # # Determine if 'struct snd_soc_dai_link' has the 'c2c_params' member. diff --git a/sound/soc/tegra-virt-alt/tegra210_virt_alt_admaif.c b/sound/soc/tegra-virt-alt/tegra210_virt_alt_admaif.c index 8975114f..489654ca 100644 --- a/sound/soc/tegra-virt-alt/tegra210_virt_alt_admaif.c +++ b/sound/soc/tegra-virt-alt/tegra210_virt_alt_admaif.c @@ -3,7 +3,6 @@ * Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. */ -#include #include #include #include @@ -237,13 +236,8 @@ static struct snd_soc_dai_ops tegra210_admaif_dai_ops = { static int tegra210_admaif_dai_probe(struct snd_soc_dai *dai) { -#if (KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE) snd_soc_dai_init_dma_data(dai, &admaif->playback_dma_data[dai->id], &admaif->capture_dma_data[dai->id]); -#else - dai->capture_dma_data = &admaif->capture_dma_data[dai->id]; - dai->playback_dma_data = &admaif->playback_dma_data[dai->id]; -#endif return 0; } diff --git a/sound/soc/tegra/tegra186_arad.c b/sound/soc/tegra/tegra186_arad.c index 29680d18..c9c6b655 100644 --- a/sound/soc/tegra/tegra186_arad.c +++ b/sound/soc/tegra/tegra186_arad.c @@ -4,6 +4,8 @@ // // Copyright (c) 2015-2023, NVIDIA CORPORATION. All rights reserved. +#include + #include #include #include @@ -17,7 +19,6 @@ #ifdef CONFIG_TEGRA186_AHC #include #endif -#include #include #include #include @@ -536,7 +537,7 @@ static struct snd_soc_component_driver tegra186_arad_cmpnt = { .num_dapm_routes = ARRAY_SIZE(tegra186_arad_routes), .controls = tegra186_arad_controls, .num_controls = ARRAY_SIZE(tegra186_arad_controls), -#if (KERNEL_VERSION(6, 0, 0) > LINUX_VERSION_CODE) +#if defined(NV_SND_SOC_COMPONENT_DRIVER_STRUCT_HAS_NON_LEGACY_DAI_NAMING) /* Linux v6.0 */ .non_legacy_dai_naming = 1, #endif }; diff --git a/sound/soc/tegra/tegra186_asrc.c b/sound/soc/tegra/tegra186_asrc.c index 8b0e2d57..6e7f96f2 100644 --- a/sound/soc/tegra/tegra186_asrc.c +++ b/sound/soc/tegra/tegra186_asrc.c @@ -4,6 +4,8 @@ // // Copyright (c) 2015-2023, NVIDIA CORPORATION. All rights reserved. +#include + #include #include #include @@ -17,7 +19,6 @@ #ifdef CONFIG_TEGRA186_AHC #include #endif -#include #include #include #include @@ -875,7 +876,7 @@ static struct snd_soc_component_driver tegra186_asrc_cmpnt = { .num_dapm_routes = ARRAY_SIZE(tegra186_asrc_routes), .controls = tegra186_asrc_controls, .num_controls = ARRAY_SIZE(tegra186_asrc_controls), -#if (KERNEL_VERSION(6, 0, 0) > LINUX_VERSION_CODE) +#if defined(NV_SND_SOC_COMPONENT_DRIVER_STRUCT_HAS_NON_LEGACY_DAI_NAMING) /* Linux v6.0 */ .non_legacy_dai_naming = 1, #endif }; diff --git a/sound/soc/tegra/tegra186_dspk.c b/sound/soc/tegra/tegra186_dspk.c index 05288d53..01916c4d 100644 --- a/sound/soc/tegra/tegra186_dspk.c +++ b/sound/soc/tegra/tegra186_dspk.c @@ -4,6 +4,8 @@ // // Copyright (c) 2020-2023 NVIDIA CORPORATION. All rights reserved. +#include + #include #include #include @@ -12,7 +14,6 @@ #include #include #include -#include #include #include #include @@ -564,7 +565,7 @@ static const struct snd_soc_component_driver tegra186_dspk_cmpnt = { .num_dapm_routes = ARRAY_SIZE(tegra186_dspk_routes), .controls = tegrat186_dspk_controls, .num_controls = ARRAY_SIZE(tegrat186_dspk_controls), -#if (KERNEL_VERSION(6, 0, 0) > LINUX_VERSION_CODE) +#if defined(NV_SND_SOC_COMPONENT_DRIVER_STRUCT_HAS_NON_LEGACY_DAI_NAMING) /* Linux v6.0 */ .non_legacy_dai_naming = 1, #endif }; diff --git a/sound/soc/tegra/tegra210_admaif.c b/sound/soc/tegra/tegra210_admaif.c index 44bdaf01..9d6421f8 100644 --- a/sound/soc/tegra/tegra210_admaif.c +++ b/sound/soc/tegra/tegra210_admaif.c @@ -4,7 +4,6 @@ // // Copyright (c) 2020-2023 NVIDIA CORPORATION. All rights reserved. -#include #include #include #include @@ -792,13 +791,9 @@ static int tegra_admaif_dai_probe(struct snd_soc_dai *dai) { struct tegra_admaif *admaif = snd_soc_dai_get_drvdata(dai); -#if (KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE) snd_soc_dai_init_dma_data(dai, &admaif->playback_dma_data[dai->id], &admaif->capture_dma_data[dai->id]); -#else - dai->capture_dma_data = &admaif->capture_dma_data[dai->id]; - dai->playback_dma_data = &admaif->playback_dma_data[dai->id]; -#endif + return 0; } diff --git a/sound/soc/tegra/tegra210_adx.c b/sound/soc/tegra/tegra210_adx.c index 98353d91..e21d3ee2 100644 --- a/sound/soc/tegra/tegra210_adx.c +++ b/sound/soc/tegra/tegra210_adx.c @@ -4,6 +4,8 @@ // // Copyright (c) 2014-2023 NVIDIA CORPORATION. All rights reserved. +#include + #include #include #include @@ -13,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -633,7 +634,7 @@ static struct snd_soc_component_driver tegra210_adx_cmpnt = { .num_dapm_routes = ARRAY_SIZE(tegra210_adx_routes), .controls = tegra210_adx_controls, .num_controls = ARRAY_SIZE(tegra210_adx_controls), -#if (KERNEL_VERSION(6, 0, 0) > LINUX_VERSION_CODE) +#if defined(NV_SND_SOC_COMPONENT_DRIVER_STRUCT_HAS_NON_LEGACY_DAI_NAMING) /* Linux v6.0 */ .non_legacy_dai_naming = 1, #endif }; diff --git a/sound/soc/tegra/tegra210_afc.c b/sound/soc/tegra/tegra210_afc.c index 3beb557e..42adc3f9 100644 --- a/sound/soc/tegra/tegra210_afc.c +++ b/sound/soc/tegra/tegra210_afc.c @@ -4,6 +4,8 @@ // // Copyright (c) 2014-2023 NVIDIA CORPORATION. All rights reserved. +#include + #include #include #include @@ -13,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -396,7 +397,7 @@ static const struct snd_soc_component_driver tegra210_afc_cmpnt = { .num_dapm_widgets = ARRAY_SIZE(tegra210_afc_widgets), .dapm_routes = tegra210_afc_routes, .num_dapm_routes = ARRAY_SIZE(tegra210_afc_routes), -#if (KERNEL_VERSION(6, 0, 0) > LINUX_VERSION_CODE) +#if defined(NV_SND_SOC_COMPONENT_DRIVER_STRUCT_HAS_NON_LEGACY_DAI_NAMING) /* Linux v6.0 */ .non_legacy_dai_naming = 1, #endif }; @@ -408,7 +409,7 @@ static const struct snd_soc_component_driver tegra186_afc_cmpnt = { .num_dapm_routes = ARRAY_SIZE(tegra210_afc_routes), .controls = tegra186_afc_controls, .num_controls = ARRAY_SIZE(tegra186_afc_controls), -#if (KERNEL_VERSION(6, 0, 0) > LINUX_VERSION_CODE) +#if defined(NV_SND_SOC_COMPONENT_DRIVER_STRUCT_HAS_NON_LEGACY_DAI_NAMING) /* Linux v6.0 */ .non_legacy_dai_naming = 1, #endif }; diff --git a/sound/soc/tegra/tegra210_ahub.c b/sound/soc/tegra/tegra210_ahub.c index fa2fa946..f0c6f38a 100644 --- a/sound/soc/tegra/tegra210_ahub.c +++ b/sound/soc/tegra/tegra210_ahub.c @@ -4,6 +4,8 @@ // // Copyright (c) 2020-2023 NVIDIA CORPORATION. All rights reserved. +#include + #include #include #include @@ -11,7 +13,6 @@ #include #include #include -#include #include #include "tegra210_ahub.h" @@ -1496,7 +1497,7 @@ static const struct snd_soc_component_driver tegra210_ahub_component = { .num_dapm_widgets = ARRAY_SIZE(tegra210_ahub_widgets), .dapm_routes = tegra210_ahub_routes, .num_dapm_routes = ARRAY_SIZE(tegra210_ahub_routes), -#if (KERNEL_VERSION(6, 0, 0) > LINUX_VERSION_CODE) +#if defined(NV_SND_SOC_COMPONENT_DRIVER_STRUCT_HAS_NON_LEGACY_DAI_NAMING) /* Linux v6.0 */ .non_legacy_dai_naming = 1, #endif }; @@ -1506,7 +1507,7 @@ static const struct snd_soc_component_driver tegra186_ahub_component = { .num_dapm_widgets = ARRAY_SIZE(tegra186_ahub_widgets), .dapm_routes = tegra186_ahub_routes, .num_dapm_routes = ARRAY_SIZE(tegra186_ahub_routes), -#if (KERNEL_VERSION(6, 0, 0) > LINUX_VERSION_CODE) +#if defined(NV_SND_SOC_COMPONENT_DRIVER_STRUCT_HAS_NON_LEGACY_DAI_NAMING) /* Linux v6.0 */ .non_legacy_dai_naming = 1, #endif }; @@ -1516,7 +1517,7 @@ static const struct snd_soc_component_driver tegra234_ahub_component = { .num_dapm_widgets = ARRAY_SIZE(tegra234_ahub_widgets), .dapm_routes = tegra186_ahub_routes, .num_dapm_routes = ARRAY_SIZE(tegra186_ahub_routes), -#if (KERNEL_VERSION(6, 0, 0) > LINUX_VERSION_CODE) +#if defined(NV_SND_SOC_COMPONENT_DRIVER_STRUCT_HAS_NON_LEGACY_DAI_NAMING) /* Linux v6.0 */ .non_legacy_dai_naming = 1, #endif }; diff --git a/sound/soc/tegra/tegra210_amx.c b/sound/soc/tegra/tegra210_amx.c index d4025c7a..adbe9ff9 100644 --- a/sound/soc/tegra/tegra210_amx.c +++ b/sound/soc/tegra/tegra210_amx.c @@ -4,6 +4,8 @@ // // Copyright (c) 2014-2023 NVIDIA CORPORATION. All rights reserved. +#include + #include #include #include @@ -672,7 +674,7 @@ static struct snd_soc_component_driver tegra210_amx_cmpnt = { .num_dapm_routes = ARRAY_SIZE(tegra210_amx_routes), .controls = tegra210_amx_controls, .num_controls = ARRAY_SIZE(tegra210_amx_controls), -#if (KERNEL_VERSION(6, 0, 0) > LINUX_VERSION_CODE) +#if defined(NV_SND_SOC_COMPONENT_DRIVER_STRUCT_HAS_NON_LEGACY_DAI_NAMING) /* Linux v6.0 */ .non_legacy_dai_naming = 1, #endif }; diff --git a/sound/soc/tegra/tegra210_dmic.c b/sound/soc/tegra/tegra210_dmic.c index d8c40a8d..3ee630a1 100644 --- a/sound/soc/tegra/tegra210_dmic.c +++ b/sound/soc/tegra/tegra210_dmic.c @@ -4,6 +4,8 @@ // // Copyright (c) 2020-2023 NVIDIA CORPORATION. All rights reserved. +#include + #include #include #include @@ -12,7 +14,6 @@ #include #include #include -#include #include #include #include @@ -566,7 +567,7 @@ static const struct snd_soc_component_driver tegra210_dmic_compnt = { .num_dapm_routes = ARRAY_SIZE(tegra210_dmic_routes), .controls = tegra210_dmic_controls, .num_controls = ARRAY_SIZE(tegra210_dmic_controls), -#if (KERNEL_VERSION(6, 0, 0) > LINUX_VERSION_CODE) +#if defined(NV_SND_SOC_COMPONENT_DRIVER_STRUCT_HAS_NON_LEGACY_DAI_NAMING) /* Linux v6.0 */ .non_legacy_dai_naming = 1, #endif }; diff --git a/sound/soc/tegra/tegra210_i2s.c b/sound/soc/tegra/tegra210_i2s.c index 092ae5ca..57e629f5 100644 --- a/sound/soc/tegra/tegra210_i2s.c +++ b/sound/soc/tegra/tegra210_i2s.c @@ -4,6 +4,8 @@ // // Copyright (c) 2020-2023 NVIDIA CORPORATION. All rights reserved. +#include + #include #include #include @@ -11,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -1127,7 +1128,7 @@ static const struct snd_soc_component_driver tegra210_i2s_cmpnt = { .num_dapm_routes = ARRAY_SIZE(tegra210_i2s_routes), .controls = tegra210_i2s_controls, .num_controls = ARRAY_SIZE(tegra210_i2s_controls), -#if (KERNEL_VERSION(6, 0, 0) > LINUX_VERSION_CODE) +#if defined(NV_SND_SOC_COMPONENT_DRIVER_STRUCT_HAS_NON_LEGACY_DAI_NAMING) /* Linux v6.0 */ .non_legacy_dai_naming = 1, #endif }; diff --git a/sound/soc/tegra/tegra210_mixer.c b/sound/soc/tegra/tegra210_mixer.c index 6fd3ce4f..021c28a5 100644 --- a/sound/soc/tegra/tegra210_mixer.c +++ b/sound/soc/tegra/tegra210_mixer.c @@ -4,6 +4,8 @@ // // Copyright (c) 2014-2023 NVIDIA CORPORATION. All rights reserved. +#include + #include #include #include @@ -13,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -516,7 +517,7 @@ static struct snd_soc_component_driver tegra210_mixer_cmpnt = { .num_dapm_routes = ARRAY_SIZE(tegra210_mixer_routes), .controls = tegra210_mixer_gain_ctls, .num_controls = ARRAY_SIZE(tegra210_mixer_gain_ctls), -#if (KERNEL_VERSION(6, 0, 0) > LINUX_VERSION_CODE) +#if defined(NV_SND_SOC_COMPONENT_DRIVER_STRUCT_HAS_NON_LEGACY_DAI_NAMING) /* Linux v6.0 */ .non_legacy_dai_naming = 1, #endif }; diff --git a/sound/soc/tegra/tegra210_mvc.c b/sound/soc/tegra/tegra210_mvc.c index 3c8db4ff..53e130d9 100644 --- a/sound/soc/tegra/tegra210_mvc.c +++ b/sound/soc/tegra/tegra210_mvc.c @@ -4,6 +4,8 @@ // // Copyright (c) 2014-2023 NVIDIA CORPORATION. All rights reserved. +#include + #include #include #include @@ -13,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -620,7 +621,7 @@ static struct snd_soc_component_driver tegra210_mvc_cmpnt = { .num_dapm_routes = ARRAY_SIZE(tegra210_mvc_routes), .controls = tegra210_mvc_vol_ctrl, .num_controls = ARRAY_SIZE(tegra210_mvc_vol_ctrl), -#if (KERNEL_VERSION(6, 0, 0) > LINUX_VERSION_CODE) +#if defined(NV_SND_SOC_COMPONENT_DRIVER_STRUCT_HAS_NON_LEGACY_DAI_NAMING) /* Linux v6.0 */ .non_legacy_dai_naming = 1, #endif }; diff --git a/sound/soc/tegra/tegra210_ope.c b/sound/soc/tegra/tegra210_ope.c index e674bb31..b09cea59 100644 --- a/sound/soc/tegra/tegra210_ope.c +++ b/sound/soc/tegra/tegra210_ope.c @@ -4,6 +4,8 @@ // // Copyright (c) 2014-2023, NVIDIA CORPORATION. All rights reserved. +#include + #include #include #include @@ -13,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -209,7 +210,7 @@ static struct snd_soc_component_driver tegra210_ope_cmpnt = { .num_dapm_routes = ARRAY_SIZE(tegra210_ope_routes), .controls = tegra210_ope_controls, .num_controls = ARRAY_SIZE(tegra210_ope_controls), -#if (KERNEL_VERSION(6, 0, 0) > LINUX_VERSION_CODE) +#if defined(NV_SND_SOC_COMPONENT_DRIVER_STRUCT_HAS_NON_LEGACY_DAI_NAMING) /* Linux v6.0 */ .non_legacy_dai_naming = 1, #endif }; diff --git a/sound/soc/tegra/tegra210_sfc.c b/sound/soc/tegra/tegra210_sfc.c index c9b73028..b14c1590 100644 --- a/sound/soc/tegra/tegra210_sfc.c +++ b/sound/soc/tegra/tegra210_sfc.c @@ -4,6 +4,8 @@ // // Copyright (c) 2014-2023 NVIDIA CORPORATION. All rights reserved. +#include + #include #include #include @@ -13,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -3367,7 +3368,7 @@ static struct snd_soc_component_driver tegra210_sfc_cmpnt = { .num_dapm_routes = ARRAY_SIZE(tegra210_sfc_routes), .controls = tegra210_sfc_controls, .num_controls = ARRAY_SIZE(tegra210_sfc_controls), -#if (KERNEL_VERSION(6, 0, 0) > LINUX_VERSION_CODE) +#if defined(NV_SND_SOC_COMPONENT_DRIVER_STRUCT_HAS_NON_LEGACY_DAI_NAMING) /* Linux v6.0 */ .non_legacy_dai_naming = 1, #endif }; diff --git a/sound/soc/tegra/tegra_codecs.c b/sound/soc/tegra/tegra_codecs.c index 20014b3c..2dd67aac 100644 --- a/sound/soc/tegra/tegra_codecs.c +++ b/sound/soc/tegra/tegra_codecs.c @@ -8,7 +8,6 @@ #include #include -#include #include #include #include @@ -44,12 +43,12 @@ static int tegra_machine_rt56xx_init(struct snd_soc_pcm_runtime *rtd) if (!jack) return -ENOMEM; -#if (KERNEL_VERSION(5, 19, 0) > LINUX_VERSION_CODE) - err = snd_soc_card_jack_new(card, "Headset Jack", SND_JACK_HEADSET, - jack, NULL, 0); -#else +#if defined(NV_SND_SOC_CARD_JACK_NEW_HAS_NO_SND_SOC_JACK_PINS) /* Linux v5.19 */ err = snd_soc_card_jack_new(card, "Headset Jack", SND_JACK_HEADSET, jack); +#else + err = snd_soc_card_jack_new(card, "Headset Jack", SND_JACK_HEADSET, + jack, NULL, 0); #endif if (err) { dev_err(card->dev, "Headset Jack creation failed %d\n", err); diff --git a/sound/tegra-safety-audio/sound-card.c b/sound/tegra-safety-audio/sound-card.c index bd19afc7..f03298c3 100644 --- a/sound/tegra-safety-audio/sound-card.c +++ b/sound/tegra-safety-audio/sound-card.c @@ -5,6 +5,8 @@ #define pr_fmt(msg) "Safety I2S: " msg +#include + #include #include #include @@ -13,7 +15,6 @@ #include #include #include -#include #include "tegra_i2s.h" @@ -456,7 +457,7 @@ static int gpcdma_hw_params(struct snd_pcm_substream *substream, slave_config.src_maxburst = 2; } -#if (KERNEL_VERSION(5, 17, 0) > LINUX_VERSION_CODE) +#if defined(NV_DMA_SLAVE_CONFIG_STRUCT_HAS_SLAVE_ID) /* Linux v5.17 */ //TODO: Read from DT later on slave_config.slave_id = dma_data->req_sel; #endif