On 06/02/23 20:20, Pierre-Louis Bossart wrote:
>> In above case, two manager instances will be created. >> When manager under SWC1 scope tries to add peripheral >> device, In sdw_slave_add() API its failing because peripheral >> device descriptor uses link id followed by 48bit encoded address. >> In above scenarios, both the manager's link id is zero only.
So here you're reporting that the issue is that all devices use link0 ...
> what fails exactly? The device_register() ? > > If yes, what the issue. the device name? device_register() is failing because of duplication of device name. > I wonder if we need to use something like > > "name shall be sdw:bus_id:link:mfg:part:class" > > so as to uniquify the device name, if that was the problem. Yes correct.
can you check https://github.com/thesofproject/linux/pull/4165 and see if this works for you? I tested it on Intel platforms.
It's working fine on our platform. As mentioned earlier in this thread, we can't go with two ACPI companion device approach due to limitations on windows stack for current platform.
Thanks for testing.
So if you can't go with 2 ACPI companion devices, what does the 'Windows' DSDT look like and how would you identify that there are two controllers on the platform?
We are not populating two controller devices. Instead of it, we are populating single controller device with two independent manager instances under the same ACPI device scope. We have configuration register to identify sound wire manager instances on the platform. Below is the sample DSDT for Windows & Linux.
Scope (_SB.ACP) { Device (SDWC) { Name (_ADR, 0x05) // _ADR: Address Name(_DSD, Package() { ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), Package () { Package (2) {"mipi-sdw-sw-interface-revision", 0x00010000}, Package (2) {"mipi-sdw-manager-list", 2}, }, ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"), Package () { Package (2) {"mipi-sdw-link-0-subproperties", "SWM0"}, Package (2) {"mipi-sdw-link-1-subproperties", "SWM1"}, } }) // End _DSD Name(SWM0, Package() { ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), Package () { Package (2) {"mipi-sdw-sw-interface-revision", 0x00010000}, // ... place holder for SWM0 additional properties } }) // End SWM0.SWM Name(SWM1,Package(){ ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), Package () { Package (2) {"mipi-sdw-sw-interface-revision", 0x00010000}, // ... place holder for SWM1 additional properties } }) // End SWM1.SWM
Device (SLV0) { // SoundWire Slave 0 Name(_ADR, 0x000032025D131601) } // END SLV0
Device (SLV1) { // SoundWire Slave 1 Name(_ADR, 0x000130025D131601) } // END SLV1
... but here you have two different link numbers.
I interpret this as SLV0 on link0 and SLV1 on link1.
So what's the issue?
This solution works fine for us. We have shared sample DSDT for reference. By reading the ACP configuration register, controller count information is retrieved. Each Controller device scope has a single manager instance. To support this design, we need to create two ACPI companion devices. Under each controller device, one manager instance device is scoped. In this case, we will read "mipi-sdw-manager-list" as 1 for each controller. As per your review comment, we can't go with two ACPI companion devices approach due to Windows stack limitation. Windows DSDT implementation will refer to single ACPI companion device with two manager instances as mentioned in earlier reply. We are going to use the same for Linux.