Linux Sound subsystem development
 help / color / mirror / Atom feed
From: James Calligeros <jcalligeros99@gmail.com>
To: "Martin Povišer" <povik+lin@cutebit.org>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Jaroslav Kysela" <perex@perex.cz>,
	"Takashi Iwai" <tiwai@suse.com>
Cc: asahi@lists.linux.dev, linux-sound@vger.kernel.org,
	 linux-kernel@vger.kernel.org,
	James Calligeros <jcalligeros99@gmail.com>
Subject: [PATCH v3 3/7] ASoC: apple: mca: Factor out mca_be_get_fe
Date: Sun, 05 Jul 2026 13:37:52 +1000	[thread overview]
Message-ID: <20260705-apple-audio-redux-v3-3-ff7a7afe2b6b@gmail.com> (raw)
In-Reply-To: <20260705-apple-audio-redux-v3-0-ff7a7afe2b6b@gmail.com>

From: Martin Povišer <povik+lin@cutebit.org>

This is a function that we also want to use from within mca_be_shutdown,
so factor it out.

Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
---
 sound/soc/apple/mca.c | 31 ++++++++++++++-----------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/sound/soc/apple/mca.c b/sound/soc/apple/mca.c
index feaf60a4912f..730ffe0805e1 100644
--- a/sound/soc/apple/mca.c
+++ b/sound/soc/apple/mca.c
@@ -721,30 +721,35 @@ static bool mca_be_clk_started(struct mca_cluster *cl)
 	return false;
 }
 
-static int mca_be_startup(struct snd_pcm_substream *substream,
-			  struct snd_soc_dai *dai)
+static struct snd_soc_pcm_runtime *mca_be_get_fe(struct snd_soc_pcm_runtime *be,
+						 int stream)
 {
-	struct snd_soc_pcm_runtime *be = snd_soc_substream_to_rtd(substream);
-	struct snd_soc_pcm_runtime *fe;
-	struct mca_cluster *cl = mca_dai_to_cluster(dai);
-	struct mca_cluster *fe_cl;
-	struct mca_data *mca = cl->host;
+	struct snd_soc_pcm_runtime *fe = NULL;
 	struct snd_soc_dpcm *dpcm;
 
-	fe = NULL;
-
-	for_each_dpcm_fe(be, substream->stream, dpcm) {
+	for_each_dpcm_fe(be, stream, dpcm) {
 		if (fe && dpcm->fe != fe) {
-			dev_err(mca->dev, "many FE per one BE unsupported\n");
-			return -EINVAL;
+			dev_err(be->dev, "many FE per one BE unsupported\n");
+			return NULL;
 		}
 
 		fe = dpcm->fe;
 	}
 
+	return fe;
+}
+
+static int mca_be_startup(struct snd_pcm_substream *substream,
+			  struct snd_soc_dai *dai)
+{
+	struct snd_soc_pcm_runtime *be = snd_soc_substream_to_rtd(substream);
+	struct snd_soc_pcm_runtime *fe = mca_be_get_fe(be, substream->stream);
+	struct mca_cluster *cl = mca_dai_to_cluster(dai);
+	struct mca_cluster *fe_cl;
+	struct mca_data *mca = cl->host;
+
 	if (!fe)
 		return -EINVAL;
-
 	fe_cl = mca_dai_to_cluster(snd_soc_rtd_to_cpu(fe, 0));
 
 	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {

-- 
2.55.0


  parent reply	other threads:[~2026-07-05  3:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-05  3:37 [PATCH v3 0/7] ASoC: apple: mca: support simultaneous I2S capture on the frontend James Calligeros
2026-07-05  3:37 ` [PATCH v3 1/7] ASoC: apple: mca: increase SERDES reset delay James Calligeros
2026-07-05  3:37 ` [PATCH v3 2/7] ASoC: apple: mca: Separate data & clock port setup James Calligeros
2026-07-10 20:41   ` Mark Brown
2026-07-05  3:37 ` James Calligeros [this message]
2026-07-05  3:37 ` [PATCH v3 4/7] ASoC: apple: mca: Support FEs being clock consumers James Calligeros
2026-07-05  3:37 ` [PATCH v3 5/7] ASoC: apple: mca: Support capture on multiples BEs James Calligeros
2026-07-05  3:37 ` [PATCH v3 6/7] ASoC: apple: mca: Do not mark clocks in use for non-providers James Calligeros
2026-07-05  3:37 ` [PATCH v3 7/7] ASoC: apple: mca: Add delay after configuring clock James Calligeros
2026-07-10 18:04 ` [PATCH v3 0/7] ASoC: apple: mca: support simultaneous I2S capture on the frontend Mark Brown
2026-07-10 22:24   ` Mark Brown
2026-07-11  1:09     ` James Calligeros

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260705-apple-audio-redux-v3-3-ff7a7afe2b6b@gmail.com \
    --to=jcalligeros99@gmail.com \
    --cc=asahi@lists.linux.dev \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=povik+lin@cutebit.org \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox