未验证 提交 01e90ee1 编写于 作者: K Kuninori Morimoto 提交者: Mark Brown

ASoC: soc-component: add snd_soc_component_is_codec()

Checking .non_legacy_dai_naming is not readable.
Let's add new snd_soc_component_is_codec().
Signed-off-by: NKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87h7dft7dn.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: NMark Brown <broonie@kernel.org>
上级 86e4aef6
...@@ -333,6 +333,11 @@ static inline int snd_soc_component_cache_sync( ...@@ -333,6 +333,11 @@ static inline int snd_soc_component_cache_sync(
return regcache_sync(component->regmap); return regcache_sync(component->regmap);
} }
static inline int snd_soc_component_is_codec(struct snd_soc_component *component)
{
return component->driver->non_legacy_dai_naming;
}
void snd_soc_component_set_aux(struct snd_soc_component *component, void snd_soc_component_set_aux(struct snd_soc_component *component,
struct snd_soc_aux_dev *aux); struct snd_soc_aux_dev *aux);
int snd_soc_component_init(struct snd_soc_component *component); int snd_soc_component_init(struct snd_soc_component *component);
......
...@@ -355,9 +355,9 @@ static int asoc_simple_init_dai_link_params(struct snd_soc_pcm_runtime *rtd, ...@@ -355,9 +355,9 @@ static int asoc_simple_init_dai_link_params(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_hardware hw; struct snd_pcm_hardware hw;
int i, ret, stream; int i, ret, stream;
/* Only codecs should have non_legacy_dai_naming set. */ /* Only Codecs */
for_each_rtd_components(rtd, i, component) { for_each_rtd_components(rtd, i, component) {
if (!component->driver->non_legacy_dai_naming) if (!snd_soc_component_is_codec(component))
return 0; return 0;
} }
......
...@@ -1247,14 +1247,13 @@ int snd_soc_runtime_set_dai_fmt(struct snd_soc_pcm_runtime *rtd, ...@@ -1247,14 +1247,13 @@ int snd_soc_runtime_set_dai_fmt(struct snd_soc_pcm_runtime *rtd,
/* /*
* Flip the polarity for the "CPU" end of a CODEC<->CODEC link * Flip the polarity for the "CPU" end of a CODEC<->CODEC link
* the component which has non_legacy_dai_naming is Codec
*/ */
inv_dai_fmt = snd_soc_daifmt_clock_provider_fliped(dai_fmt); inv_dai_fmt = snd_soc_daifmt_clock_provider_fliped(dai_fmt);
for_each_rtd_cpu_dais(rtd, i, cpu_dai) { for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
unsigned int fmt = dai_fmt; unsigned int fmt = dai_fmt;
if (cpu_dai->component->driver->non_legacy_dai_naming) if (snd_soc_component_is_codec(cpu_dai->component))
fmt = inv_dai_fmt; fmt = inv_dai_fmt;
ret = snd_soc_dai_set_fmt(cpu_dai, fmt); ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
...@@ -2521,7 +2520,7 @@ static int snd_soc_register_dais(struct snd_soc_component *component, ...@@ -2521,7 +2520,7 @@ static int snd_soc_register_dais(struct snd_soc_component *component,
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
dai = snd_soc_register_dai(component, dai_drv + i, count == 1 && dai = snd_soc_register_dai(component, dai_drv + i, count == 1 &&
!component->driver->non_legacy_dai_naming); !snd_soc_component_is_codec(component));
if (dai == NULL) { if (dai == NULL) {
ret = -ENOMEM; ret = -ENOMEM;
goto err; goto err;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册