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 <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2993795
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Jon Hunter
2023-10-07 19:39:51 +01:00
committed by mobile promotions
parent 5ec164e7c3
commit 59b14ea0b8
19 changed files with 111 additions and 47 deletions

View File

@@ -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

View File

@@ -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 <linux/dma-engine.h>
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 <sound/jack.h>
#include <sound/soc.h>
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 <sound/soc-component.h>
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.