Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SoundWire: introduce controller_id #4616

Merged

Conversation

plbossart
Copy link
Member

Alternate solution to @krzk suggested patches on alsa-devel.

@plbossart
Copy link
Member Author

@bardliao can you take a look if you have spare cycles. I don't have a local device with me so can't really smoke/stress test this change.

@bardliao
Copy link
Collaborator

bardliao commented Oct 5, 2023

@bardliao can you take a look if you have spare cycles. I don't have a local device with me so can't really smoke/stress test this change.

@plbossart I tested it on a TGL RVP and it works. rt711's device name is sdw:0:0:025d:0711:00 with this PR, and playback/capture works.

Copy link

@vijendarmukunda vijendarmukunda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change controller id assignment as amd_manager->bus.controller_id = 0;

plbossart and others added 2 commits October 5, 2023 11:17
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.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
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: <stable@vger.kernel.org>
Co-developed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
@vijendarmukunda
Copy link

verified changes and it's working fine on AMD platforms.

@plbossart plbossart marked this pull request as ready for review November 17, 2023 15:47
@plbossart plbossart merged commit 41edbee into thesofproject:topic/sof-dev Nov 17, 2023
11 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants