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
Reviewed-by: Shardar Mohammed <smohammed@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 bf46060d1e
commit 350a86106e
5 changed files with 26 additions and 8 deletions

View File

@@ -36,10 +36,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
# v4l2_async_subdev is renamed to v4l2_async_connection. # v4l2_async_subdev is renamed to v4l2_async_connection.
subdir-ccflags-y += -DNV_V4L2_ASYNC_SUBDEV_RENAME subdir-ccflags-y += -DNV_V4L2_ASYNC_SUBDEV_RENAME

View File

@@ -134,6 +134,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

@@ -7181,6 +7181,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

@@ -3,6 +3,8 @@
* Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. * Copyright (c) 2021-2023 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

@@ -4,6 +4,8 @@
// //
// Copyright (c) 2020-2023 NVIDIA CORPORATION. All rights reserved. // Copyright (c) 2020-2023 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>
#include <linux/module.h> #include <linux/module.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, \