Skip to content

Commit 8a8a9ac

Browse files
krzkvinodkoul
authored andcommitted
soundwire: fix initializing sysfs for same devices on different buses
If same devices with same device IDs are present on different soundwire buses, the probe fails due to conflicting device names and sysfs entries: sysfs: cannot create duplicate filename '/bus/soundwire/devices/sdw:0:0217:0204:00:0' The link ID is 0 for both devices, so they should be differentiated by the controller ID. Add the controller ID so, the device names and sysfs entries look like: sdw:1:0:0217:0204:00:0 -> ../../../devices/platform/soc@0/6ab0000.soundwire-controller/sdw-master-1-0/sdw:1:0:0217:0204:00:0 sdw:3:0:0217:0204:00:0 -> ../../../devices/platform/soc@0/6b10000.soundwire-controller/sdw-master-3-0/sdw:3:0:0217:0204:00:0 [PLB changes: use bus->controller_id instead of bus->id] Fixes: 7c3cd18 ("soundwire: Add Master registration") Cc: [email protected] Reviewed-by: Bard Liao <[email protected]> Reviewed-by: Vijendar Mukunda <[email protected]> Co-developed-by: Pierre-Louis Bossart <[email protected]> Signed-off-by: Pierre-Louis Bossart <[email protected]> Signed-off-by: Krzysztof Kozlowski <[email protected]> Reviewed-by: Krzysztof Kozlowski <[email protected]> Tested-by: Krzysztof Kozlowski <[email protected]> Acked-by: Mark Brown <[email protected]> Tested-by: Srinivas Kandagatla <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 6543ac1 commit 8a8a9ac

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

drivers/soundwire/slave.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ int sdw_slave_add(struct sdw_bus *bus,
3939
slave->dev.fwnode = fwnode;
4040

4141
if (id->unique_id == SDW_IGNORED_UNIQUE_ID) {
42-
/* name shall be sdw:link:mfg:part:class */
43-
dev_set_name(&slave->dev, "sdw:%01x:%04x:%04x:%02x",
44-
bus->link_id, id->mfg_id, id->part_id,
42+
/* name shall be sdw:ctrl:link:mfg:part:class */
43+
dev_set_name(&slave->dev, "sdw:%01x:%01x:%04x:%04x:%02x",
44+
bus->controller_id, bus->link_id, id->mfg_id, id->part_id,
4545
id->class_id);
4646
} else {
47-
/* name shall be sdw:link:mfg:part:class:unique */
48-
dev_set_name(&slave->dev, "sdw:%01x:%04x:%04x:%02x:%01x",
49-
bus->link_id, id->mfg_id, id->part_id,
47+
/* name shall be sdw:ctrl:link:mfg:part:class:unique */
48+
dev_set_name(&slave->dev, "sdw:%01x:%01x:%04x:%04x:%02x:%01x",
49+
bus->controller_id, bus->link_id, id->mfg_id, id->part_id,
5050
id->class_id, id->unique_id);
5151
}
5252

sound/soc/intel/boards/sof_sdw.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,11 +1232,11 @@ static int fill_sdw_codec_dlc(struct device *dev,
12321232
else if (is_unique_device(adr_link, sdw_version, mfg_id, part_id,
12331233
class_id, adr_index))
12341234
codec->name = devm_kasprintf(dev, GFP_KERNEL,
1235-
"sdw:%01x:%04x:%04x:%02x", link_id,
1235+
"sdw:0:%01x:%04x:%04x:%02x", link_id,
12361236
mfg_id, part_id, class_id);
12371237
else
12381238
codec->name = devm_kasprintf(dev, GFP_KERNEL,
1239-
"sdw:%01x:%04x:%04x:%02x:%01x", link_id,
1239+
"sdw:0:%01x:%04x:%04x:%02x:%01x", link_id,
12401240
mfg_id, part_id, class_id, unique_id);
12411241

12421242
if (!codec->name)

0 commit comments

Comments
 (0)