Commit 6543ac13 authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Vinod Koul
Browse files

soundwire: bus: introduce controller_id



The existing SoundWire support misses a clear Controller/Manager
hiearchical definition to deal with all variants across SOC vendors.

a) Intel platforms have one controller with 4 or more Managers.
b) AMD platforms have two controllers with one Manager each, but due
to BIOS issues use two different link_id values within the scope of a
single controller.
c) QCOM platforms have one or more controller with one Manager each.

This patch adds a 'controller_id' which can be set by higher
levels. If assigned to -1, the controller_id will be set to the
system-unique IDA-assigned bus->id.

The main change is that the bus->id is no longer used for any device
name, which makes the definition completely predictable and not
dependent on any enumeration order. The bus->id is only used to insert
the Managers in the stream rt context.

Reviewed-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: default avatarVijendar Mukunda <Vijendar.Mukunda@amd.com>
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Tested-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/stable/20231017160933.12624-2-pierre-louis.bossart%40linux.intel.com


Tested-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20231017160933.12624-2-pierre-louis.bossart@linux.intel.com


Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent 21f4c443
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -927,6 +927,14 @@ static int amd_sdw_manager_probe(struct platform_device *pdev)
	amd_manager->bus.clk_stop_timeout = 200;
	amd_manager->bus.link_id = amd_manager->instance;

	/*
	 * Due to BIOS compatibility, the two links are exposed within
	 * the scope of a single controller. If this changes, the
	 * controller_id will have to be updated with drv_data
	 * information.
	 */
	amd_manager->bus.controller_id = 0;

	switch (amd_manager->instance) {
	case ACP_SDW0:
		amd_manager->num_dout_ports = AMD_SDW0_MAX_TX_PORTS;
+4 −0
Original line number Diff line number Diff line
@@ -22,6 +22,10 @@ static int sdw_get_id(struct sdw_bus *bus)
		return rc;

	bus->id = rc;

	if (bus->controller_id == -1)
		bus->controller_id = rc;

	return 0;
}

+1 −1
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ void sdw_bus_debugfs_init(struct sdw_bus *bus)
		return;

	/* create the debugfs master-N */
	snprintf(name, sizeof(name), "master-%d-%d", bus->id, bus->link_id);
	snprintf(name, sizeof(name), "master-%d-%d", bus->controller_id, bus->link_id);
	bus->debugfs = debugfs_create_dir(name, sdw_debugfs_root);
}

+3 −0
Original line number Diff line number Diff line
@@ -234,6 +234,9 @@ static int intel_link_probe(struct auxiliary_device *auxdev,
	cdns->instance = sdw->instance;
	cdns->msg_count = 0;

	/* single controller for all SoundWire links */
	bus->controller_id = 0;

	bus->link_id = auxdev->id;
	bus->clk_stop_timeout = 1;

+1 −1
Original line number Diff line number Diff line
@@ -145,7 +145,7 @@ int sdw_master_device_add(struct sdw_bus *bus, struct device *parent,
	md->dev.fwnode = fwnode;
	md->dev.dma_mask = parent->dma_mask;

	dev_set_name(&md->dev, "sdw-master-%d", bus->id);
	dev_set_name(&md->dev, "sdw-master-%d-%d", bus->controller_id, bus->link_id);

	ret = device_register(&md->dev);
	if (ret) {
Loading