v6.0: ASoC: simple-card-utils: Move snd_soc_component_is_codec to be local
commit 28086d05ada6d03daa886aad0e469854b811311c Author: Charles Keepax <ckeepax@opensource.cirrus.com> Date: Thu May 19 16:43:18 2022 +0100 ASoC: simple-card-utils: Move snd_soc_component_is_codec to be local The helper function snd_soc_component_is_codec is based off the presence of the non_legacy_dai_naming flag. This isn't super robust as CPU side components may also specify this flag, and indeed the kernel already contains a couple that do. After componentisation there isn't really a totally robust solution to identifying what is a CODEC driver, without introducing a flag specifically for that purpose, and really the desirable direction to move in is that the distinction doesn't matter. This patch does two things to try to mitigate these problems. Firstly, now that all the other users of the helper function have been removed, it makes the helper function local to the driver rather, than being part of the core. This should help to discourage any new code from being created that depends on the CODEC driver distinction. Secondly, it updates the helper function itself to use the endianness flag rather than the non_legacy_dai_naming flag. The endianness flag is definitely invalid on a CPU side component, so it a more reliable indicator that the device is definitely a CODEC. The vast majority of buses require the CODEC to set the endianness flag, so the number of corner cases should be fairly minimal. It is worth noting that CODECs sending audio over SPI, or built into the CPU CODECs are potential corner cases, however the hope is that in most cases those types of devices do not consitute a simple audio card. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220519154318.2153729-57-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
8dbe3726b7
commit
99bbf880e9
1 changed files with 6 additions and 1 deletions
|
@ -354,6 +354,11 @@ static int asoc_simple_init_dai(struct snd_soc_dai *dai,
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0)
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0)
|
||||||
|
static inline int asoc_simple_component_is_codec(struct snd_soc_component *component)
|
||||||
|
{
|
||||||
|
return component->driver->endianness;
|
||||||
|
}
|
||||||
|
|
||||||
static int asoc_simple_init_dai_link_params(struct snd_soc_pcm_runtime *rtd)
|
static int asoc_simple_init_dai_link_params(struct snd_soc_pcm_runtime *rtd)
|
||||||
{
|
{
|
||||||
struct snd_soc_dai_link *dai_link = rtd->dai_link;
|
struct snd_soc_dai_link *dai_link = rtd->dai_link;
|
||||||
|
@ -364,7 +369,7 @@ static int asoc_simple_init_dai_link_params(struct snd_soc_pcm_runtime *rtd)
|
||||||
|
|
||||||
/* Only Codecs */
|
/* Only Codecs */
|
||||||
for_each_rtd_components(rtd, i, component) {
|
for_each_rtd_components(rtd, i, component) {
|
||||||
if (!snd_soc_component_is_codec(component))
|
if (!asoc_simple_component_is_codec(component))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue