sound: Use conftest to find if snd_soc_dai_ops has probe callback

Use conftest to find if struct snd_soc_dai_ops have the probe()
callback or not. In Linux 6.5, commit 516ee7009ff20 ("ASoC:
tegra: merge DAI call back functions into ops") added probe()
callback into the struct snd_soc_dai_ops.

Bug 4346767

Change-Id: If292f10d6e52a2cf80c7700ff7aba5805041531f
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3028743
(cherry picked from commit 350a86106e)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3053701
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Laxman Dewangan
2023-12-05 18:31:40 +00:00
committed by mobile promotions
parent 0d940461d4
commit 3a35e1c2b1
5 changed files with 29 additions and 11 deletions

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2022-2023, NVIDIA CORPORATION. All rights reserved. # Copyright (c) 2022-2024, NVIDIA CORPORATION. All rights reserved.
LINUXINCLUDE += -I$(srctree.nvconftest) LINUXINCLUDE += -I$(srctree.nvconftest)
LINUXINCLUDE += -I$(srctree.nvidia-oot)/include LINUXINCLUDE += -I$(srctree.nvidia-oot)/include
@@ -24,10 +24,6 @@ endif
# Changes done in Linux 6.6 onwards # Changes done in Linux 6.6 onwards
ifeq ($(shell test $(LINUX_VERSION) -ge $(LINUX_VERSION_6_6); echo $$?),0) ifeq ($(shell test $(LINUX_VERSION) -ge $(LINUX_VERSION_6_6); echo $$?),0)
# Move probe to DAI Ops.
export CONFIG_SND_SOC_MOVE_DAI_PROBE_TO_OPS=y
subdir-ccflags-y += -DNV_SND_SOC_DAI_OPS_STRUCT_HAS_PROBE_ARG
# probe_new is removed from i2c driver structure # probe_new is removed from i2c driver structure
subdir-ccflags-y += -DNV_I2C_LEGACY_PROBE_NEW_REMOVED subdir-ccflags-y += -DNV_I2C_LEGACY_PROBE_NEW_REMOVED

View File

@@ -137,6 +137,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += shrinker_alloc
NV_CONFTEST_FUNCTION_COMPILE_TESTS += snd_soc_card_jack_new_has_no_snd_soc_jack_pins 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_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_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_of_get_dai_name_has_index_arg 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 += snd_soc_rtd_to_codec
NV_CONFTEST_FUNCTION_COMPILE_TESTS += simple_util_dai_init NV_CONFTEST_FUNCTION_COMPILE_TESTS += simple_util_dai_init

View File

@@ -7240,6 +7240,23 @@ compile_test() {
"NV_SND_SOC_DAI_LINK_STRUCT_HAS_C2C_PARAMS_ARG" "" "types" "NV_SND_SOC_DAI_LINK_STRUCT_HAS_C2C_PARAMS_ARG" "" "types"
;; ;;
snd_soc_dai_ops_struct_has_probe)
#
# Determine if 'struct snd_soc_dai_ops' has the 'probe' member.
#
# In Linux v6.5, commits 516ee7009ff20 ("ASoC: tegra: merge DAI
# call back functions into ops") added probe() callback into the
# struct snd_soc_dai_ops.
#
CODE="
#include <sound/soc.h>
int conftest_snd_soc_dai_ops_struct_has_probe(void) {
return offsetof(struct snd_soc_dai_ops, probe);
}"
compile_check_conftest "$CODE" "NV_SND_SOC_DAI_OPS_STRUCT_HAS_PROBE_PRESENT" "" "types"
;;
snd_soc_of_get_dai_name_has_index_arg) snd_soc_of_get_dai_name_has_index_arg)
# #
# Determine if the function 'snd_soc_of_get_dai_name()' has an index argument. # Determine if the function 'snd_soc_of_get_dai_name()' has an index argument.

View File

@@ -1,8 +1,10 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/* /*
* Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. * Copyright (c) 2021-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*/ */
#include <nvidia/conftest.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
@@ -237,7 +239,7 @@ static int tegra210_admaif_dai_probe(struct snd_soc_dai *dai)
} }
static struct snd_soc_dai_ops tegra210_admaif_dai_ops = { static struct snd_soc_dai_ops tegra210_admaif_dai_ops = {
#if defined(NV_SND_SOC_DAI_OPS_STRUCT_HAS_PROBE_ARG) #if defined(NV_SND_SOC_DAI_OPS_STRUCT_HAS_PROBE_PRESENT) /* Linux 6.5 */
.probe = tegra210_admaif_dai_probe, .probe = tegra210_admaif_dai_probe,
#endif #endif
.hw_params = tegra210_admaif_hw_params, .hw_params = tegra210_admaif_hw_params,
@@ -245,7 +247,7 @@ static struct snd_soc_dai_ops tegra210_admaif_dai_ops = {
.startup = tegra210_admaif_startup, .startup = tegra210_admaif_startup,
}; };
#if defined(NV_SND_SOC_DAI_OPS_STRUCT_HAS_PROBE_ARG) #if defined(NV_SND_SOC_DAI_OPS_STRUCT_HAS_PROBE_PRESENT) /* Linux 6.5 */
#define ADMAIF_DAI(id) \ #define ADMAIF_DAI(id) \
{ \ { \
.name = "ADMAIF" #id, \ .name = "ADMAIF" #id, \

View File

@@ -2,7 +2,9 @@
// //
// tegra210_admaif.c - Tegra ADMAIF driver // tegra210_admaif.c - Tegra ADMAIF driver
// //
// Copyright (c) 2020-2023 NVIDIA CORPORATION. All rights reserved. // Copyright (c) 2020-2024 NVIDIA CORPORATION. All rights reserved.
#include <nvidia/conftest.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/device.h> #include <linux/device.h>
@@ -791,7 +793,7 @@ static int tegra_admaif_dai_probe(struct snd_soc_dai *dai)
} }
static const struct snd_soc_dai_ops tegra_admaif_dai_ops = { static const struct snd_soc_dai_ops tegra_admaif_dai_ops = {
#if defined(NV_SND_SOC_DAI_OPS_STRUCT_HAS_PROBE_ARG) #if defined(NV_SND_SOC_DAI_OPS_STRUCT_HAS_PROBE_PRESENT) /* Linux 6.5 */
.probe = tegra_admaif_dai_probe, .probe = tegra_admaif_dai_probe,
#endif #endif
.hw_params = tegra_admaif_hw_params, .hw_params = tegra_admaif_hw_params,
@@ -800,7 +802,7 @@ static const struct snd_soc_dai_ops tegra_admaif_dai_ops = {
.prepare = tegra_admaif_prepare, .prepare = tegra_admaif_prepare,
}; };
#if defined(NV_SND_SOC_DAI_OPS_STRUCT_HAS_PROBE_ARG) #if defined(NV_SND_SOC_DAI_OPS_STRUCT_HAS_PROBE_PRESENT) /* Linux 6.5 */
#define DAI(dai_name) \ #define DAI(dai_name) \
{ \ { \
.name = dai_name, \ .name = dai_name, \