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

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: soc-dai: add snd_soc_dai_prepare() and use it internally

Add a new snd_soc_dai_prepare() which can be used (in an upcoming patch)
by soc-dapm.c. Use this new function internally in
snd_soc_pcm_dai_prepare() to avoid duplicating code.

Suggested-by: Jerome Brunet <jbrunet@baylibre.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Reviewed-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://patch.msgid.link/20250114215617.336105-2-martin.blumenstingl@googlemail.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Martin Blumenstingl and committed by
Mark Brown
d4e91adf 6b077230

+22 -8
+3
include/sound/soc-dai.h
··· 193 193 194 194 int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate); 195 195 196 + int snd_soc_dai_prepare(struct snd_soc_dai *dai, 197 + struct snd_pcm_substream *substream); 198 + 196 199 /* Digital Audio Interface mute */ 197 200 int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute, 198 201 int direction);
+19 -8
sound/soc/soc-dai.c
··· 360 360 } 361 361 EXPORT_SYMBOL_GPL(snd_soc_dai_set_tristate); 362 362 363 + int snd_soc_dai_prepare(struct snd_soc_dai *dai, 364 + struct snd_pcm_substream *substream) 365 + { 366 + int ret = 0; 367 + 368 + if (!snd_soc_dai_stream_valid(dai, substream->stream)) 369 + return 0; 370 + 371 + if (dai->driver->ops && 372 + dai->driver->ops->prepare) 373 + ret = dai->driver->ops->prepare(substream, dai); 374 + 375 + return soc_dai_ret(dai, ret); 376 + } 377 + EXPORT_SYMBOL_GPL(snd_soc_dai_prepare); 378 + 363 379 /** 364 380 * snd_soc_dai_digital_mute - configure DAI system or master clock. 365 381 * @dai: DAI ··· 593 577 int i, ret; 594 578 595 579 for_each_rtd_dais(rtd, i, dai) { 596 - if (!snd_soc_dai_stream_valid(dai, substream->stream)) 597 - continue; 598 - if (dai->driver->ops && 599 - dai->driver->ops->prepare) { 600 - ret = dai->driver->ops->prepare(substream, dai); 601 - if (ret < 0) 602 - return soc_dai_ret(dai, ret); 603 - } 580 + ret = snd_soc_dai_prepare(dai, substream); 581 + if (ret < 0) 582 + return ret; 604 583 } 605 584 606 585 return 0;