From 8fbb56adb6dc6fe9ef822b4c2f4bd659654a2f07 Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Thu, 13 Jun 2024 14:45:15 +0100 Subject: [PATCH] ASoC: tegra: Fix build for Linux v6.11 For Linux v6.11, the 'tx_slot' and 'rx_slot' arguments for the ASoC set_channel_map() function were made constant. Add a test to conftest to check for this and update the Tegra210 ADX and AMX driver accordingly. Bug 4749580 Change-Id: I584d721ee46ae0af6312df4641fc4bbdbc1714f0 Signed-off-by: Jon Hunter Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3184824 Tested-by: mobile promotions Reviewed-by: mobile promotions --- scripts/conftest/Makefile | 1 + scripts/conftest/conftest.sh | 20 ++++++++++++++++++++ sound/soc/tegra/tegra210_adx.c | 5 +++++ sound/soc/tegra/tegra210_amx.c | 5 +++++ 4 files changed, 31 insertions(+) diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index ffb49204..066b6781 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -158,6 +158,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += snd_soc_card_jack_new_has_no_snd_soc_jack_ 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_dai_ops_struct_has_probe +NV_CONFTEST_FUNCTION_COMPILE_TESTS += snd_soc_dai_ops_struct_set_channel_map_has_const_slot_args NV_CONFTEST_FUNCTION_COMPILE_TESTS += snd_soc_of_get_dai_name_has_index_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += snd_soc_rtd_to_codec NV_CONFTEST_FUNCTION_COMPILE_TESTS += simple_util_dai_init diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index d7136efd..a4c5c91e 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -7659,6 +7659,26 @@ compile_test() { compile_check_conftest "$CODE" "NV_SND_SOC_DAI_OPS_STRUCT_HAS_PROBE_PRESENT" "" "types" ;; + snd_soc_dai_ops_struct_set_channel_map_has_const_slot_args) + # + # Determine if the ASoC set_channel_map() has constant 'tx_slot' and + # 'rx_slot' arguments. + # + # Commit 965cc040bf06 ("ASoC: Constify channel mapping array arguments in + # set_channel_map()") updated the 'tx_slot' and 'rx_slot' arguments to be + # constant in Linux v6.11. + # + CODE=" + #include + int conftest_snd_soc_dai_ops(struct snd_soc_dai_ops *ops) { + int (*fn)(struct snd_soc_dai *dai, unsigned int tx_num, + const unsigned int *tx_slot, unsigned int rx_num, + const unsigned int *rx_slot) = ops->set_channel_map; + }" + + compile_check_conftest "$CODE" "NV_SND_SOC_DAI_OPS_STRUCT_SET_CHANNEL_MAP_HAS_CONST_SLOT_ARGS" "" "types" + ;; + snd_soc_of_get_dai_name_has_index_arg) # # Determine if the function 'snd_soc_of_get_dai_name()' has an index argument. diff --git a/sound/soc/tegra/tegra210_adx.c b/sound/soc/tegra/tegra210_adx.c index e21d3ee2..7a0bac33 100644 --- a/sound/soc/tegra/tegra210_adx.c +++ b/sound/soc/tegra/tegra210_adx.c @@ -325,8 +325,13 @@ static int tegra210_adx_in_hw_params(struct snd_pcm_substream *substream, } static int tegra210_adx_set_channel_map(struct snd_soc_dai *dai, +#if defined (NV_SND_SOC_DAI_OPS_STRUCT_SET_CHANNEL_MAP_HAS_CONST_SLOT_ARGS) + unsigned int tx_num, const unsigned int *tx_slot, + unsigned int rx_num, const unsigned int *rx_slot) +#else unsigned int tx_num, unsigned int *tx_slot, unsigned int rx_num, unsigned int *rx_slot) +#endif { struct device *dev = dai->dev; struct tegra210_adx *adx = snd_soc_dai_get_drvdata(dai); diff --git a/sound/soc/tegra/tegra210_amx.c b/sound/soc/tegra/tegra210_amx.c index adbe9ff9..46a83ceb 100644 --- a/sound/soc/tegra/tegra210_amx.c +++ b/sound/soc/tegra/tegra210_amx.c @@ -369,8 +369,13 @@ static int tegra210_amx_out_hw_params(struct snd_pcm_substream *substream, } static int tegra210_amx_set_channel_map(struct snd_soc_dai *dai, +#if defined (NV_SND_SOC_DAI_OPS_STRUCT_SET_CHANNEL_MAP_HAS_CONST_SLOT_ARGS) + unsigned int tx_num, const unsigned int *tx_slot, + unsigned int rx_num, const unsigned int *rx_slot) +#else unsigned int tx_num, unsigned int *tx_slot, unsigned int rx_num, unsigned int *rx_slot) +#endif { struct device *dev = dai->dev; struct tegra210_amx *amx = snd_soc_dai_get_drvdata(dai);