Re: [PATCH v2 4/7] ASoC: apple: mca: Support FEs being clock consumers

"Joshua Peisach" <[email protected]>
Newsgroups dev.linux.lists.asahi,org.kernel.vger.linux-kernel,org.kernel.vger.linux-sound
Message-ID <[email protected]>
On Sun Jun 28, 2026 at 7:42 AM EDT, James Calligeros wrote:
> From: Martin Povišer <[email protected]>
>
> Support FEs being I2S clock consumers. This does not mean we support
> accepting clocks from outside the SoC (although it paves the way for
> that support in the future), but it means multiple FEs can attach to one
> BE, one being clock producer and the rest clock consumers.
>
> This is useful for grabbing I/V sense data on some machines, since in
> such a scenario the format of the sense data on the I2S bus differs
> from that of the audio data (the two formats differing in slot width).
> With two FEs attached to the bus, we can split the responsibilities and
> command different slot widths to the two.
>
> Signed-off-by: Martin Povišer <[email protected]>
> Signed-off-by: James Calligeros <[email protected]>
> ---
>  sound/soc/apple/mca.c | 129 ++++++++++++++++++++-----
>  1 file changed, 106 insertions(+), 23 deletions(-)
>
> diff --git a/sound/soc/apple/mca.c b/sound/soc/apple/mca.c
> index 730ffe0805e1..0c1fc8242907 100644
> --- a/sound/soc/apple/mca.c
> +++ b/sound/soc/apple/mca.c
> @@ -380,6 +406,57 @@ static int mca_be_hw_free(struct snd_pcm_substream *substream,
>  	return 0;
>  }
>  
> +static int mca_fe_prepare(struct snd_pcm_substream *substream,
> +			  struct snd_soc_dai *dai)
> +{
> +	struct mca_cluster *cl = mca_dai_to_cluster(dai);
> +	struct mca_data *mca = cl->host;
> +
> +	if (cl->clk_provider)
> +		return 0;
> +
> +	/* Turn on the cluster power domain if not already in use */
> +	if (!cl->syncgen_in_use) {
> +		int port = mca_fe_get_port(substream);
> +
> +		cl->pd_link = device_link_add(mca->dev, cl->pd_dev,
> +					      DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME |
> +						DL_FLAG_RPM_ACTIVE);
> +		if (!cl->pd_link) {
> +			dev_err(mca->dev,
> +				"cluster %d: unable to prop-up power domain\n", cl->no);
> +			return -EINVAL;
> +		}
> +
> +		writel_relaxed(port + 6 + 1,
> +			       cl->base + REG_SYNCGEN_MCLK_SEL);

Where does the "6 + 1" come from, and should it have its own #define?

-Josh
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.