Re: [PATCH v2 05/11] ASoC: SDCA: add populate_function hw_op for DT function data

From
Charles Keepax <ckeepax@opensource.cirrus.com>
Date
2026-09-08 16:25:47
Also in
linux-arm-msm, linux-sound, lkml
Reply to
Srinivas Kandagatla, 2026-09-07
On Mon, Sep 07, 2026 at 09:37:19AM +0100, Srinivas Kandagatla wrote:
quoted hunk ↗ jump to hunk
sdca_parse_function() walks a firmware node, but on DT there is no
DisCo node -- sdca_lookup_functions() is a no-op and the SDCA
function descriptors come with a NULL fwnode.

Add a populate_function hw_op that the class function driver falls
back to when @function->desc->node is NULL: it fills the caller-owned
sdca_function_data (entities, clusters, init_table, delays) from the
codec's static tables, matching by function type.  Leave
@function->desc alone -- the framework owns the per-instance
descriptor, so devices with more than one function of the same type
keep their per-instance SoundWire address.

Signed-off-by: Srinivas Kandagatla <redacted>
---
diff --git a/sound/soc/sdca/sdca_class_function.c b/sound/soc/sdca/sdca_class_function.c
index 10a2b031b572..8bca88865a4d 100644
--- a/sound/soc/sdca/sdca_class_function.c
+++ b/sound/soc/sdca/sdca_class_function.c
@@ -329,7 +329,14 @@ static int class_function_probe(struct auxiliary_device *auxdev,
 	drv->core = core;
 	drv->function = &sdev->function;
 
-	ret = sdca_parse_function(dev, drv->function);
+	if (drv->function->desc->node) {
+		ret = sdca_parse_function(dev, drv->function);
+	} else if (core->hw_ops && core->hw_ops->populate_function) {
+		ret = core->hw_ops->populate_function(core->sdw, drv->function);
+	} else {
+		dev_err(dev, "no firmware node and no populate_function hook\n");
+		return -ENOENT;
+	}
Is this the right logic here? I feel like if we have a
populate_function() callback we should call it regardless of if we
have a node. That would help with the use-case where this is
being used to work around bugs in the firmware, and
populate_function() can always call sdca_parse_function() if it
wants too.

Thanks,
Charles
Thread (50 messages) 50 messages, 8 authors, last reply 2026-09-09
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help