drivers/soundwire/slave.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-)
sdw_of_find_slaves() reads only the first "compatible" string on a
SoundWire slave DT node and rejects the node if that string does not
parse as sdwVMMMPPPPXX. This prevents the standard DT convention of
placing a vendor-variant compatible ahead of the SoundWire class-ID
compatible:
compatible = "vendor,partname", "sdwVMMMPPPPXX";
Iterate every string in the compatible property and accept the first
one that parses as a SoundWire class ID. The vendor-variant string
remains visible to driver probe callbacks via device_is_compatible()
for mode/variant disambiguation.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
---
drivers/soundwire/slave.c | 28 +++++++++++++++++++---------
1 file changed, 19 insertions(+), 9 deletions(-)
diff --git a/drivers/soundwire/slave.c b/drivers/soundwire/slave.c
index e0c49cbcb1ba..a7d2938b031d 100644
--- a/drivers/soundwire/slave.c
+++ b/drivers/soundwire/slave.c
@@ -243,17 +243,27 @@ int sdw_of_find_slaves(struct sdw_bus *bus)
const char *compat = NULL;
struct sdw_slave_id id;
const __be32 *addr;
+ struct property *prop;
+ bool matched = false;
- ret = of_property_read_string(node, "compatible", &compat);
- if (ret)
- continue;
-
- ret = sscanf(compat, "sdw%01x%04hx%04hx%02hhx", &sdw_version,
- &id.mfg_id, &id.part_id, &id.class_id);
+ /*
+ * Iterate the compatible list so DT nodes can carry a
+ * vendor-variant compatible ahead of the SoundWire class-ID
+ * compatible (e.g. "vendor,part", "sdwVMMMPPPPXX").
+ */
+ of_property_for_each_string(node, "compatible", prop, compat) {
+ ret = sscanf(compat, "sdw%01x%04hx%04hx%02hhx",
+ &sdw_version, &id.mfg_id, &id.part_id,
+ &id.class_id);
+ if (ret == 4) {
+ matched = true;
+ break;
+ }
+ }
- if (ret != 4) {
- dev_err(dev, "Invalid compatible string found %s\n",
- compat);
+ if (!matched) {
+ dev_err(dev, "%pOFn: no SoundWire class-ID compatible\n",
+ node);
continue;
}
--
2.53.0
On Mon, 07 Sep 2026 10:14:21 +0100, Srinivas Kandagatla wrote:
> sdw_of_find_slaves() reads only the first "compatible" string on a
> SoundWire slave DT node and rejects the node if that string does not
> parse as sdwVMMMPPPPXX. This prevents the standard DT convention of
> placing a vendor-variant compatible ahead of the SoundWire class-ID
> compatible:
>
> compatible = "vendor,partname", "sdwVMMMPPPPXX";
>
> [...]
Applied, thanks!
[1/1] soundwire: bus: iterate DT compatibles for class-ID match
commit: 659d6f148a88467817e9531a6c793ae022661bab
Best regards,
--
~Vinod
On Mon, Sep 07, 2026 at 10:14:21AM +0100, Srinivas Kandagatla wrote: > sdw_of_find_slaves() reads only the first "compatible" string on a > SoundWire slave DT node and rejects the node if that string does not > parse as sdwVMMMPPPPXX. This prevents the standard DT convention of > placing a vendor-variant compatible ahead of the SoundWire class-ID > compatible: > > compatible = "vendor,partname", "sdwVMMMPPPPXX"; > > Iterate every string in the compatible property and accept the first > one that parses as a SoundWire class ID. The vendor-variant string > remains visible to driver probe callbacks via device_is_compatible() > for mode/variant disambiguation. > > Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com> > --- Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com> Thanks, Charles
© 2016 - 2026 Red Hat, Inc.