From: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
To: Charles Keepax <ckeepax@opensource.cirrus.com>
Cc: Mark Brown <broonie@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Maciej Strozek <mstrozek@opensource.cirrus.com>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Srinivas Kandagatla <srini@kernel.org>,
Bard Liao <yung-chuan.liao@linux.intel.com>,
Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>,
Richard Fitzgerald <rf@opensource.cirrus.com>,
Jorijn van der Graaf <jorijnvdgraaf@catcrafts.net>,
linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org,
devicetree@vger.kernel.org, patches@opensource.cirrus.com,
linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 1/8] ASoC: SDCA: hw_params: program upstream Input Terminals for OT DAI
Date: Mon, 27 Jul 2026 13:42:44 +0100 [thread overview]
Message-ID: <53bf0259-d7f3-48b7-bf6c-ae3d58856b49@oss.qualcomm.com> (raw)
In-Reply-To: <amcX2FWcpFFTsUVe@opensource.cirrus.com>
On 7/27/26 9:33 AM, Charles Keepax wrote:
> On Fri, Jul 24, 2026 at 05:35:36PM +0100, Srinivas Kandagatla wrote:
>> On 7/24/26 2:14 PM, Charles Keepax wrote:
>>> On Thu, Jul 23, 2026 at 12:42:11AM +0100, Srinivas Kandagatla wrote:
>>>> For a capture stream the DAI is the Output Terminal so
>>>> sdca_asoc_hw_params() only programs the OT itself: cluster, clock
>>>> and Usage. The upstream Input Terminals that actually source the
>>>> audio never get their Usage, ClusterIndex or clock programmed, so
>>>> the power domain comes up but no samples are produced.
>>>>
>>>> Walk the source graph from the OT and program every Input Terminal
>>>> reachable through it.
>>>
>>> What was the thinking with respect to the units in the middle?
>>
>> As per $6.3.2.1 and 6.3.2.2
>> FUs does not modify the cluster, its transparent to cluster, Output Pin
>> uses same cluster as input pin
>
> But that section is specific to FUs, all the other units I
> listed below do appear to allow cluster changes:
>
Yes, other units will not preserve the wire format, this is what I was
planning to send as v2 which will stop traversing at any other units
that do not preserve the wire format.
+/*
+ * For a capture stream the ASoC DAI is the Output Terminal, so
+ * hw_params only programs the OT itself. The upstream Input
+ * Terminal(s) that actually source the audio (e.g. a mic input
+ * behind a power-domain entity) never get their Usage /
+ * ClusterIndex / clock programmed and stay inactive, so the
+ * power domain comes up but no samples are produced. Walk the
+ * source graph from the OT and program every Input Terminal we
+ * reach.
+ *
+ * The walk propagates the OT's channels/rate/width to the IT,
+ * so it is only safe to descend through entities that preserve
+ * the wire format on their upstream path (PDE / FU). Stop at
+ * any other entity type: source-selecting or format-transforming
+ * units (SU, MU, CRU, UDMPU, MFPU, PPU, XU) would either clobber
+ * an inactive branch or program mismatched parameters, and a
+ * codec with such topology needs a smarter walk than this one.
+ *
+ * Depth is bounded by the number of entities to defend against
+ * a malformed graph with a cycle.
+ */
+static int
+set_input_terminal_sources(struct device *dev, struct regmap *regmap,
+ struct sdca_function_data *function,
+ struct sdca_entity *entity,
+ int channels, int rate, int width,
+ unsigned int depth)
+{
+ int i, ret;
+
+ if (depth > function->num_entities) {
+ dev_err(dev,
+ "%s: source graph too deep, possible cycle\n",
+ entity->label);
+ return -ELOOP;
+ }
+
+ for (i = 0; i < entity->num_sources; i++) {
+ struct sdca_entity *src = entity->sources[i];
+
+ switch (src->type) {
+ case SDCA_ENTITY_TYPE_IT:
+ ret = set_cluster(dev, regmap, function,
+ src, channels);
+ if (ret)
+ return ret;
+
+ if (src->iot.clock) {
+ ret = set_clock(dev, regmap, function,
+ src->iot.clock, rate);
+ if (ret)
+ return ret;
+ }
+
+ ret = set_usage(dev, regmap, function, src,
+ SDCA_CTL_IT_USAGE, rate, width);
+ if (ret)
+ return ret;
+ continue;
+ case SDCA_ENTITY_TYPE_PDE:
+ case SDCA_ENTITY_TYPE_FU:
+ ret = set_input_terminal_sources(dev, regmap,
+ function, src,
+ channels, rate,
+ width, depth + 1);
+ if (ret)
+ return ret;
+ break;
+ default:
+ dev_dbg(dev,
+ "%s: not walking past %s (type %#x)\n",
+ entity->label, src->label, src->type);
+ break;
+ }
+ }
+
+ return 0;
+}
+
>> entities in the middle could change the cluster, such as CRUs,
>>> MPFUs, UDMPUs. Also possibly SUs to consider too, since they
>
> Thanks,
> Charles
next prev parent reply other threads:[~2026-07-27 12:42 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-22 23:42 [RFC PATCH 0/8] ASoC: SDCA: enable on DT platforms and add Qualcomm WCD9378 (Tambora) codec Srinivas Kandagatla
2026-07-22 23:42 ` [RFC PATCH 1/8] ASoC: SDCA: hw_params: program upstream Input Terminals for OT DAI Srinivas Kandagatla
2026-07-22 23:54 ` sashiko-bot
2026-07-24 13:14 ` Charles Keepax
2026-07-24 13:53 ` Charles Keepax
2026-07-24 16:35 ` Srinivas Kandagatla
2026-07-27 8:33 ` Charles Keepax
2026-07-27 12:42 ` Srinivas Kandagatla [this message]
2026-07-22 23:42 ` [RFC PATCH 2/8] ASoC: SDCA: allow building without ACPI Srinivas Kandagatla
2026-07-22 23:59 ` sashiko-bot
2026-07-22 23:42 ` [RFC PATCH 3/8] ASoC: SDCA: expose class helpers with hw_ops for non-DisCo platforms Srinivas Kandagatla
2026-07-22 23:58 ` sashiko-bot
2026-07-22 23:42 ` [RFC PATCH 4/8] ASoC: SDCA: add PDE pre/post-pmu hooks to hw_ops Srinivas Kandagatla
2026-07-22 23:56 ` sashiko-bot
2026-07-22 23:42 ` [RFC PATCH 5/8] ASoC: SDCA: class_function: xlate sound-dai cell by entity index Srinivas Kandagatla
2026-07-22 23:57 ` sashiko-bot
2026-07-22 23:42 ` [RFC PATCH 6/8] ASoC: SDCA: register SDCA_FUNCTION_TYPE_SIMPLE_JACK in class function driver Srinivas Kandagatla
2026-07-22 23:56 ` sashiko-bot
2026-07-23 10:55 ` Charles Keepax
2026-07-22 23:42 ` [RFC PATCH 7/8] dt-bindings: sound: qcom: add Tambora WCD9378 SDCA codec Srinivas Kandagatla
2026-07-22 23:51 ` sashiko-bot
2026-07-23 9:14 ` Konrad Dybcio
2026-07-23 13:28 ` Srinivas Kandagatla
2026-07-23 13:31 ` Konrad Dybcio
2026-07-29 11:40 ` Krzysztof Kozlowski
2026-07-29 12:17 ` Srinivas Kandagatla
2026-07-29 12:30 ` Krzysztof Kozlowski
2026-07-29 12:36 ` Srinivas Kandagatla
2026-07-29 12:43 ` Krzysztof Kozlowski
2026-07-29 13:02 ` Srinivas Kandagatla
2026-07-29 13:23 ` Krzysztof Kozlowski
2026-07-29 13:34 ` Srinivas Kandagatla
2026-07-22 23:42 ` [RFC PATCH 8/8] ASoC: codecs: add Qualcomm Tambora (WCD9378) " Srinivas Kandagatla
2026-07-23 0:03 ` sashiko-bot
2026-07-23 10:17 ` [RFC PATCH 0/8] ASoC: SDCA: enable on DT platforms and add Qualcomm WCD9378 (Tambora) codec Charles Keepax
2026-07-23 13:24 ` Srinivas Kandagatla
2026-07-24 12:36 ` Charles Keepax
2026-07-24 14:31 ` Srinivas Kandagatla
2026-07-24 15:40 ` Charles Keepax
2026-07-24 16:29 ` Srinivas Kandagatla
2026-07-29 11:14 ` Srinivas Kandagatla
2026-07-29 11:41 ` Krzysztof Kozlowski
2026-07-23 19:40 ` Jorijn van der Graaf
2026-07-24 12:17 ` Srinivas Kandagatla
2026-07-24 19:14 ` Jorijn van der Graaf
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=53bf0259-d7f3-48b7-bf6c-ae3d58856b49@oss.qualcomm.com \
--to=srinivas.kandagatla@oss.qualcomm.com \
--cc=broonie@kernel.org \
--cc=ckeepax@opensource.cirrus.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jorijnvdgraaf@catcrafts.net \
--cc=krzk+dt@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=mstrozek@opensource.cirrus.com \
--cc=patches@opensource.cirrus.com \
--cc=perex@perex.cz \
--cc=pierre-louis.bossart@linux.dev \
--cc=rf@opensource.cirrus.com \
--cc=robh@kernel.org \
--cc=srini@kernel.org \
--cc=tiwai@suse.com \
--cc=yung-chuan.liao@linux.intel.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