From 47b127bd17d1ee1aac9d7a91a4ac4a54afccd5c1 Mon Sep 17 00:00:00 2001 From: Sameer Pujar Date: Mon, 17 Oct 2022 17:48:34 +0000 Subject: [PATCH] ASoC: tegra: Fix build errors with kstable Build errors seen in following contexts with kstable: - The 'non_legacy_dai_naming' flag is not available in struct 'snd_soc_component_driver' in v6.0. Instead it is replaced with flag 'legacy_dai_naming' and default value works fine. To fix build error on kstable exclude the removed flag for kernel v6.0 onward. - Signature of snd_soc_card_jack_new() has changed in v5.19 which drops struct 'snd_soc_jack_pins' related members. These were unused for Tegra and is safe to just update the funcion call. Fix this by using correct function signature based on kernel version checks. With above fixed now, remove workaround from Makefile and enable Audio OOT driver builds again with kstable. Bug 3831575 Change-Id: I7b65c89e8140f6e085528fb827d47c3909233db1 Signed-off-by: Sameer Pujar Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2793430 Reviewed-by: Jonathan Hunter Reviewed-by: Laxman Dewangan GVS: Gerrit_Virtual_Submit --- Makefile | 2 -- sound/soc/tegra/tegra186_arad.c | 3 +++ sound/soc/tegra/tegra186_asrc.c | 3 +++ sound/soc/tegra/tegra186_dspk.c | 3 +++ sound/soc/tegra/tegra210_adx.c | 3 +++ sound/soc/tegra/tegra210_afc.c | 5 +++++ sound/soc/tegra/tegra210_ahub.c | 7 +++++++ sound/soc/tegra/tegra210_amx.c | 3 +++ sound/soc/tegra/tegra210_dmic.c | 3 +++ sound/soc/tegra/tegra210_i2s.c | 3 +++ sound/soc/tegra/tegra210_mixer.c | 3 +++ sound/soc/tegra/tegra210_mvc.c | 3 +++ sound/soc/tegra/tegra210_ope.c | 3 +++ sound/soc/tegra/tegra210_sfc.c | 3 +++ sound/soc/tegra/tegra_codecs.c | 6 ++++++ 15 files changed, 51 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 04ec43b4..c8af276a 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,4 @@ # Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. obj-m += drivers/ -ifeq ($(shell test $$VERSION -lt 6; echo $$?),0) obj-m += sound/soc/tegra/ -endif diff --git a/sound/soc/tegra/tegra186_arad.c b/sound/soc/tegra/tegra186_arad.c index e36e8895..5f455a55 100644 --- a/sound/soc/tegra/tegra186_arad.c +++ b/sound/soc/tegra/tegra186_arad.c @@ -17,6 +17,7 @@ #ifdef CONFIG_TEGRA186_AHC #include #endif +#include #include #include #include @@ -535,7 +536,9 @@ 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) .non_legacy_dai_naming = 1, +#endif }; static bool tegra186_arad_wr_reg(struct device *dev, unsigned int reg) diff --git a/sound/soc/tegra/tegra186_asrc.c b/sound/soc/tegra/tegra186_asrc.c index bf9f642b..9758e52b 100644 --- a/sound/soc/tegra/tegra186_asrc.c +++ b/sound/soc/tegra/tegra186_asrc.c @@ -17,6 +17,7 @@ #ifdef CONFIG_TEGRA186_AHC #include #endif +#include #include #include #include @@ -874,7 +875,9 @@ 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) .non_legacy_dai_naming = 1, +#endif }; static bool tegra186_asrc_wr_reg(struct device *dev, unsigned int reg) diff --git a/sound/soc/tegra/tegra186_dspk.c b/sound/soc/tegra/tegra186_dspk.c index 17f66c0f..c6001171 100644 --- a/sound/soc/tegra/tegra186_dspk.c +++ b/sound/soc/tegra/tegra186_dspk.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -598,7 +599,9 @@ 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) .non_legacy_dai_naming = 1, +#endif }; static bool tegra186_dspk_wr_reg(struct device *dev, unsigned int reg) diff --git a/sound/soc/tegra/tegra210_adx.c b/sound/soc/tegra/tegra210_adx.c index 060f4316..a9b8ba55 100644 --- a/sound/soc/tegra/tegra210_adx.c +++ b/sound/soc/tegra/tegra210_adx.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -632,7 +633,9 @@ 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) .non_legacy_dai_naming = 1, +#endif }; static bool tegra210_adx_wr_reg(struct device *dev, diff --git a/sound/soc/tegra/tegra210_afc.c b/sound/soc/tegra/tegra210_afc.c index 55f64ad3..2d8df49f 100644 --- a/sound/soc/tegra/tegra210_afc.c +++ b/sound/soc/tegra/tegra210_afc.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -395,7 +396,9 @@ 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) .non_legacy_dai_naming = 1, +#endif }; static const struct snd_soc_component_driver tegra186_afc_cmpnt = { @@ -405,7 +408,9 @@ 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) .non_legacy_dai_naming = 1, +#endif }; static bool tegra210_afc_wr_rd_reg(struct device *dev, unsigned int reg) diff --git a/sound/soc/tegra/tegra210_ahub.c b/sound/soc/tegra/tegra210_ahub.c index a21a9f9e..9db4a9b5 100644 --- a/sound/soc/tegra/tegra210_ahub.c +++ b/sound/soc/tegra/tegra210_ahub.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include "tegra210_ahub.h" @@ -1411,7 +1412,9 @@ 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) .non_legacy_dai_naming = 1, +#endif }; static const struct snd_soc_component_driver tegra186_ahub_component = { @@ -1419,7 +1422,9 @@ 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) .non_legacy_dai_naming = 1, +#endif }; static const struct snd_soc_component_driver tegra234_ahub_component = { @@ -1427,7 +1432,9 @@ 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) .non_legacy_dai_naming = 1, +#endif }; static const struct regmap_config tegra210_ahub_regmap_config = { diff --git a/sound/soc/tegra/tegra210_amx.c b/sound/soc/tegra/tegra210_amx.c index 095c94de..f6dfe443 100644 --- a/sound/soc/tegra/tegra210_amx.c +++ b/sound/soc/tegra/tegra210_amx.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -671,7 +672,9 @@ 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) .non_legacy_dai_naming = 1, +#endif }; static bool tegra210_amx_wr_reg(struct device *dev, diff --git a/sound/soc/tegra/tegra210_dmic.c b/sound/soc/tegra/tegra210_dmic.c index 174591f6..cbb4d856 100644 --- a/sound/soc/tegra/tegra210_dmic.c +++ b/sound/soc/tegra/tegra210_dmic.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -565,7 +566,9 @@ 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) .non_legacy_dai_naming = 1, +#endif }; static bool tegra210_dmic_wr_reg(struct device *dev, unsigned int reg) diff --git a/sound/soc/tegra/tegra210_i2s.c b/sound/soc/tegra/tegra210_i2s.c index 12157d42..c2eae8d3 100644 --- a/sound/soc/tegra/tegra210_i2s.c +++ b/sound/soc/tegra/tegra210_i2s.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -1126,7 +1127,9 @@ 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) .non_legacy_dai_naming = 1, +#endif }; static bool tegra210_i2s_wr_reg(struct device *dev, unsigned int reg) diff --git a/sound/soc/tegra/tegra210_mixer.c b/sound/soc/tegra/tegra210_mixer.c index 1b8fa510..99bada59 100644 --- a/sound/soc/tegra/tegra210_mixer.c +++ b/sound/soc/tegra/tegra210_mixer.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -515,7 +516,9 @@ 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) .non_legacy_dai_naming = 1, +#endif }; static bool tegra210_mixer_wr_reg(struct device *dev, diff --git a/sound/soc/tegra/tegra210_mvc.c b/sound/soc/tegra/tegra210_mvc.c index d4ee5c29..a9bf21ff 100644 --- a/sound/soc/tegra/tegra210_mvc.c +++ b/sound/soc/tegra/tegra210_mvc.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -619,7 +620,9 @@ 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) .non_legacy_dai_naming = 1, +#endif }; static bool tegra210_mvc_rd_reg(struct device *dev, unsigned int reg) diff --git a/sound/soc/tegra/tegra210_ope.c b/sound/soc/tegra/tegra210_ope.c index 522464c3..68ab67ef 100644 --- a/sound/soc/tegra/tegra210_ope.c +++ b/sound/soc/tegra/tegra210_ope.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -208,7 +209,9 @@ 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) .non_legacy_dai_naming = 1, +#endif }; static bool tegra210_ope_wr_reg(struct device *dev, unsigned int reg) diff --git a/sound/soc/tegra/tegra210_sfc.c b/sound/soc/tegra/tegra210_sfc.c index 24e79f7c..e2214277 100644 --- a/sound/soc/tegra/tegra210_sfc.c +++ b/sound/soc/tegra/tegra210_sfc.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -3366,7 +3367,9 @@ 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) .non_legacy_dai_naming = 1, +#endif }; static bool tegra210_sfc_wr_reg(struct device *dev, unsigned int reg) diff --git a/sound/soc/tegra/tegra_codecs.c b/sound/soc/tegra/tegra_codecs.c index 8be5c99c..1b1f45a8 100644 --- a/sound/soc/tegra/tegra_codecs.c +++ b/sound/soc/tegra/tegra_codecs.c @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -43,8 +44,13 @@ 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 + err = snd_soc_card_jack_new(card, "Headset Jack", SND_JACK_HEADSET, + jack); +#endif if (err) { dev_err(card->dev, "Headset Jack creation failed %d\n", err); return err;