diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index 7c7fec32..b9888a60 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -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 diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index 6d9bb238..e6a5e8a7 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -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 + 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. diff --git a/sound/soc/tegra/tegra_mixer_control.c b/sound/soc/tegra/tegra_mixer_control.c index 9ea0684d..3fe46fd8 100644 --- a/sound/soc/tegra/tegra_mixer_control.c +++ b/sound/soc/tegra/tegra_mixer_control.c @@ -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;