Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87h7dft7dn.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Kuninori Morimoto and committed by
Mark Brown
01e90ee1 86e4aef6

+9 -5
+5
include/sound/soc-component.h
··· 333 333 return regcache_sync(component->regmap); 334 334 } 335 335 336 + static inline int snd_soc_component_is_codec(struct snd_soc_component *component) 337 + { 338 + return component->driver->non_legacy_dai_naming; 339 + } 340 + 336 341 void snd_soc_component_set_aux(struct snd_soc_component *component, 337 342 struct snd_soc_aux_dev *aux); 338 343 int snd_soc_component_init(struct snd_soc_component *component);
+2 -2
sound/soc/generic/simple-card-utils.c
··· 355 355 struct snd_pcm_hardware hw; 356 356 int i, ret, stream; 357 357 358 - /* Only codecs should have non_legacy_dai_naming set. */ 358 + /* Only Codecs */ 359 359 for_each_rtd_components(rtd, i, component) { 360 - if (!component->driver->non_legacy_dai_naming) 360 + if (!snd_soc_component_is_codec(component)) 361 361 return 0; 362 362 } 363 363
+2 -3
sound/soc/soc-core.c
··· 1247 1247 1248 1248 /* 1249 1249 * Flip the polarity for the "CPU" end of a CODEC<->CODEC link 1250 - * the component which has non_legacy_dai_naming is Codec 1251 1250 */ 1252 1251 inv_dai_fmt = snd_soc_daifmt_clock_provider_fliped(dai_fmt); 1253 1252 1254 1253 for_each_rtd_cpu_dais(rtd, i, cpu_dai) { 1255 1254 unsigned int fmt = dai_fmt; 1256 1255 1257 - if (cpu_dai->component->driver->non_legacy_dai_naming) 1256 + if (snd_soc_component_is_codec(cpu_dai->component)) 1258 1257 fmt = inv_dai_fmt; 1259 1258 1260 1259 ret = snd_soc_dai_set_fmt(cpu_dai, fmt); ··· 2520 2521 2521 2522 for (i = 0; i < count; i++) { 2522 2523 dai = snd_soc_register_dai(component, dai_drv + i, count == 1 && 2523 - !component->driver->non_legacy_dai_naming); 2524 + !snd_soc_component_is_codec(component)); 2524 2525 if (dai == NULL) { 2525 2526 ret = -ENOMEM; 2526 2527 goto err;