ASoC: tegra: Fix build for Linux v6.13

In Linux v6.13, commit 1bd775da9ba9 ("ASoC: add symmetric_ prefix for
dai->rate/channels/sample_bits") added a 'symmetric_' prefix to some
member of the 'snd_soc_dai' structure. Use conftest to determine if
these structure members have the 'symmetric_' prefix and update the
Tegra Mixer Control driver accordingly.

Bug 4991705

Change-Id: I366595f31932caaa447033c0d0e3b1d2b8dba6e3
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3261697
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Jon Hunter
2024-12-03 22:52:47 +00:00
parent c9d5d23a33
commit 52a4903b87
3 changed files with 60 additions and 10 deletions

View File

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

View File

@@ -8034,6 +8034,24 @@ compile_test() {
compile_check_conftest "$CODE" "NV_SND_SOC_DAI_OPS_STRUCT_HAS_PROBE_PRESENT" "" "types"
;;
snd_soc_dai_struct_has_symmetric_prefix)
#
# Determine if the rate/channels/sample_bits members of the
# snd_soc_dai structure have a 'symmetric_' prefix.
#
# Commit 1bd775da9ba9 ("ASoC: add symmetric_ prefix for
# dai->rate/channels/sample_bits") added a 'symmetric_' prefix to
# members of the snd_soc_dai structure in Linux v6.13.
#
CODE="
#include <sound/soc.h>
unsigned int conftest_snd_soc_dai_struct_has_symmetric_prefix(struct snd_soc_dai *dai) {
return dai->symmetric_rate;
}"
compile_check_conftest "$CODE" "NV_SND_SOC_DAI_STRUCT_HAS_SYMMETRIC_PREFIX" "" "types"
;;
snd_soc_of_get_dai_name_has_index_arg)
#
# Determine if the function 'snd_soc_of_get_dai_name()' has an index argument.

View File

@@ -55,7 +55,11 @@ static int dai_get_rate(struct snd_kcontrol *kcontrol,
if (i++ != reg)
continue;
#if defined(NV_SND_SOC_DAI_STRUCT_HAS_SYMMETRIC_PREFIX) /* Linux v6.13 */
ucontrol->value.integer.value[0] = dai->symmetric_rate;
#else
ucontrol->value.integer.value[0] = dai->rate;
#endif
break;
}
@@ -78,7 +82,11 @@ static int dai_put_rate(struct snd_kcontrol *kcontrol,
if (i++ != reg)
continue;
#if defined(NV_SND_SOC_DAI_STRUCT_HAS_SYMMETRIC_PREFIX) /* Linux v6.13 */
dai->symmetric_rate = value;
#else
dai->rate = value;
#endif
change = true;
break;
@@ -100,7 +108,11 @@ static int dai_get_channel(struct snd_kcontrol *kcontrol,
if (i++ != reg)
continue;
#if defined(NV_SND_SOC_DAI_STRUCT_HAS_SYMMETRIC_PREFIX) /* Linux v6.13 */
ucontrol->value.integer.value[0] = dai->symmetric_channels;
#else
ucontrol->value.integer.value[0] = dai->channels;
#endif
break;
}
@@ -122,7 +134,11 @@ static int dai_put_channel(struct snd_kcontrol *kcontrol,
if (i++ != reg)
continue;
#if defined(NV_SND_SOC_DAI_STRUCT_HAS_SYMMETRIC_PREFIX) /* Linux v6.13 */
dai->symmetric_channels = value;
#else
dai->channels = value;
#endif
change = true;
break;
@@ -144,7 +160,11 @@ static int dai_get_bits(struct snd_kcontrol *kcontrol,
if (i++ != reg)
continue;
#if defined(NV_SND_SOC_DAI_STRUCT_HAS_SYMMETRIC_PREFIX) /* Linux v6.13 */
ucontrol->value.integer.value[0] = dai->symmetric_sample_bits;
#else
ucontrol->value.integer.value[0] = dai->sample_bits;
#endif
break;
}
@@ -166,7 +186,11 @@ static int dai_put_bits(struct snd_kcontrol *kcontrol,
if (i++ != reg)
continue;
#if defined(NV_SND_SOC_DAI_STRUCT_HAS_SYMMETRIC_PREFIX) /* Linux v6.13 */
dai->symmetric_sample_bits = value;
#else
dai->sample_bits = value;
#endif
change = true;
break;
@@ -305,21 +329,28 @@ static void tegra_dai_fixup(struct snd_soc_dai *dai,
SNDRV_PCM_HW_PARAM_CHANNELS);
struct snd_mask *mask = hw_param_mask(params,
SNDRV_PCM_HW_PARAM_FORMAT);
unsigned int d_rate, d_channels, d_sample_bits;
if (dai->rate) {
rate->min =
rate->max = dai->rate;
}
#if defined(NV_SND_SOC_DAI_STRUCT_HAS_SYMMETRIC_PREFIX) /* Linux v6.13 */
d_rate = dai->symmetric_rate;
d_channels = dai->symmetric_channels;
d_sample_bits = dai->symmetric_sample_bits;
#else
d_rate = dai->rate;
d_channels = dai->channels;
d_sample_bits = dai->sample_bits;
#endif
if (dai->channels) {
channels->min =
channels->max = dai->channels;
}
if (d_rate)
rate->min = rate->max = d_rate;
if (dai->sample_bits) {
if (d_channels)
channels->min = channels->max = d_channels;
if (d_sample_bits) {
snd_mask_none(mask);
switch (dai->sample_bits) {
switch (d_sample_bits) {
case 8:
snd_mask_set(mask, SNDRV_PCM_FORMAT_S8);
break;