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 5/7] ASoC: apple: mca: Support capture on multiples BEs
Date: Sun, 05 Jul 2026 13:37:54 +1000 [thread overview]
Message-ID: <20260705-apple-audio-redux-v3-5-ff7a7afe2b6b@gmail.com> (raw)
In-Reply-To: <20260705-apple-audio-redux-v3-0-ff7a7afe2b6b@gmail.com>
From: Martin Povišer <povik+lin@cutebit.org>
When multiple BEs are linked to a FE, the former behavior was to source
the data line from the DIN pin of the first BE only. Change this to
ORing the DIN inputs of all linked BEs.
As long as the unused slots on each BE's line are zeroed out and the
slots on the BEs don't overlap, this will work out well.
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, 14 insertions(+), 17 deletions(-)
diff --git a/sound/soc/apple/mca.c b/sound/soc/apple/mca.c
index 92c9f8df50d6..d8973e5611dd 100644
--- a/sound/soc/apple/mca.c
+++ b/sound/soc/apple/mca.c
@@ -261,22 +261,19 @@ static int mca_fe_trigger(struct snd_pcm_substream *substream, int cmd,
return 0;
}
-static int mca_fe_get_port(struct snd_pcm_substream *substream)
+static int mca_fe_get_portmask(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *fe = snd_soc_substream_to_rtd(substream);
- struct snd_soc_pcm_runtime *be;
struct snd_soc_dpcm *dpcm;
+ int mask = 0;
- be = NULL;
for_each_dpcm_be(fe, substream->stream, dpcm) {
- be = dpcm->be;
- break;
- }
+ int no = mca_dai_to_cluster(snd_soc_rtd_to_cpu(dpcm->be, 0))->no;
- if (!be)
- return -EINVAL;
+ mask |= 1 << no;
+ }
- return mca_dai_to_cluster(snd_soc_rtd_to_cpu(be, 0))->no;
+ return mask;
}
static int mca_fe_enable_clocks(struct mca_cluster *cl)
@@ -417,7 +414,7 @@ static int mca_fe_prepare(struct snd_pcm_substream *substream,
/* Turn on the cluster power domain if not already in use */
if (!cl->syncgen_in_use) {
- int port = mca_fe_get_port(substream);
+ int port = ffs(mca_fe_get_portmask(substream));
cl->pd_link = device_link_add(mca->dev, cl->pd_dev,
DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME |
@@ -466,7 +463,7 @@ static unsigned int mca_crop_mask(unsigned int mask, int nchans)
static int mca_configure_serdes(struct mca_cluster *cl, int serdes_unit,
unsigned int mask, int slots, int nchans,
- int slot_width, bool is_tx, int port)
+ int slot_width, bool is_tx, int portmask)
{
__iomem void *serdes_base = cl->base + serdes_unit;
u32 serdes_conf, serdes_conf_mask;
@@ -525,7 +522,7 @@ static int mca_configure_serdes(struct mca_cluster *cl, int serdes_unit,
serdes_base + REG_RX_SERDES_SLOTMASK);
writel_relaxed(~((u32)mca_crop_mask(mask, nchans)),
serdes_base + REG_RX_SERDES_SLOTMASK + 0x4);
- writel_relaxed(1 << port,
+ writel_relaxed(portmask,
serdes_base + REG_RX_SERDES_PORT);
}
@@ -662,7 +659,7 @@ static int mca_fe_hw_params(struct snd_pcm_substream *substream,
unsigned long bclk_ratio;
unsigned int tdm_slots, tdm_slot_width, tdm_mask;
u32 regval, pad;
- int ret, port, nchans_ceiled;
+ int ret, portmask, nchans_ceiled;
if (!cl->tdm_slot_width) {
/*
@@ -711,13 +708,13 @@ static int mca_fe_hw_params(struct snd_pcm_substream *substream,
tdm_mask = (1 << tdm_slots) - 1;
}
- port = mca_fe_get_port(substream);
- if (port < 0)
- return port;
+ portmask = mca_fe_get_portmask(substream);
+ if (!portmask)
+ return -EINVAL;
ret = mca_configure_serdes(cl, is_tx ? CLUSTER_TX_OFF : CLUSTER_RX_OFF,
tdm_mask, tdm_slots, params_channels(params),
- tdm_slot_width, is_tx, port);
+ tdm_slot_width, is_tx, portmask);
if (ret)
return ret;
--
2.55.0
next prev 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 ` [PATCH v3 3/7] ASoC: apple: mca: Factor out mca_be_get_fe James Calligeros
2026-07-05 3:37 ` [PATCH v3 4/7] ASoC: apple: mca: Support FEs being clock consumers James Calligeros
2026-07-05 3:37 ` James Calligeros [this message]
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-5-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